Class: MostOts::Service
- Inherits:
-
Object
- Object
- MostOts::Service
- Includes:
- Logging
- Defined in:
- lib/most_ots/service.rb
Overview
Most Money HTTP Service Wrapper
Constant Summary collapse
- ENCRYPTED_FIELDS =
Fields that needs to be encrypted
i[traceNo qrAccountNumber qrCode srcMsisdn tan].freeze
- PROTOCOL_VERSION =
Current Protocol Version
'05'.freeze
Instance Attribute Summary collapse
-
#api_host ⇒ String
Most API Endpoint.
-
#base_params ⇒ Hash
Base Parameters.
-
#certificate ⇒ File
Most Provided Public Key.
-
#cipher_iv ⇒ Array
Cipher IV binary.
-
#cipher_key ⇒ String
16byte key string.
Instance Method Summary collapse
-
#check_qr_payment(params) ⇒ JSON
Response.
-
#check_qr_payment_batch(params) ⇒ JSON
Response.
-
#initialize(options = {}) ⇒ Service
constructor
A new instance of Service.
-
#purchase_qr(params) ⇒ JSON
Response.
-
#purchase_tan(params) ⇒ JSON
Response.
-
#transfer_qr(params) ⇒ JSON
Response.
-
#wait_payment_response(params) ⇒ JSON
Response.
Methods included from Logging
Constructor Details
#initialize(options = {}) ⇒ Service
Returns a new instance of Service.
35 36 37 38 39 40 41 42 |
# File 'lib/most_ots/service.rb', line 35 def initialize( = {}) logger.debug('MostOts Service API Initializing') setup_base_params() self.certificate = .fetch(:most_cert_file) self.api_host = .fetch(:host) { 'http://202.131.242.165:9089' } self.cipher_key = [:cipher_key] self.cipher_iv = .fetch(:cipher_iv) end |
Instance Attribute Details
#api_host ⇒ String
Most API Endpoint
32 33 34 |
# File 'lib/most_ots/service.rb', line 32 def api_host @api_host end |
#base_params ⇒ Hash
Base Parameters
24 25 26 |
# File 'lib/most_ots/service.rb', line 24 def base_params @base_params end |
#certificate ⇒ File
Most Provided Public Key
28 29 30 |
# File 'lib/most_ots/service.rb', line 28 def certificate @certificate end |
#cipher_iv ⇒ Array
Returns cipher IV binary.
20 21 22 |
# File 'lib/most_ots/service.rb', line 20 def cipher_iv @cipher_iv end |
#cipher_key ⇒ String
Returns 16byte key string.
17 18 19 |
# File 'lib/most_ots/service.rb', line 17 def cipher_key @cipher_key end |
Instance Method Details
#check_qr_payment(params) ⇒ JSON
Returns response.
79 80 81 82 83 84 85 86 |
# File 'lib/most_ots/service.rb', line 79 def check_qr_payment(params) logger.debug('MostOts Service Check QR Payment Called') # Mandatory Fields mf = i[srcInstId channel lang traceNo qrCode payeeId posNo billId isCheckQr] # Optional Fields of = i[deviceIP deviceMac deviceName] api_request('/api/mapi/TT3065', configure_params(params, mf, of)) end |
#check_qr_payment_batch(params) ⇒ JSON
Returns response.
90 91 92 93 94 95 96 97 |
# File 'lib/most_ots/service.rb', line 90 def check_qr_payment_batch(params) logger.debug('MostOts Service Check QR Payment Called') # Mandatory Fields mf = i[srcInstId channel lang traceNo qrCode payeeId posNo isCheckQr] # Optional Fields of = i[deviceIP deviceMac deviceName] api_request('/api/mapi/TT3066', configure_params(params, mf, of)) end |
#purchase_qr(params) ⇒ JSON
Returns response.
46 47 48 49 50 51 52 53 |
# File 'lib/most_ots/service.rb', line 46 def purchase_qr(params) logger.debug('MostOts Service Purchase QR Called') # Mandatory Fields mf = i[srcInstId channel lang traceNo payeeId posNo tranAmount tranCur tranDesc qrPaidLimit] # Optional Fields of = i[billId deviceIP deviceMac deviceName] api_request('/api/mapi/TT3051', configure_params(params, mf, of)) end |
#purchase_tan(params) ⇒ JSON
Returns response.
101 102 103 104 105 106 107 108 |
# File 'lib/most_ots/service.rb', line 101 def purchase_tan(params) logger.debug('MostOts Service Purchase Tan Called') # Mandatory Fields mf = i[srcInstId channel lang traceNo payeeId posNo srcMsisdn tan tranAmount tranCur] # Optional Fields of = i[billId tranDesc deviceIP deviceMac deviceName] api_request('/api/mapi/TT1608', configure_params(params, mf, of)) end |
#transfer_qr(params) ⇒ JSON
Returns response.
57 58 59 60 61 62 63 64 |
# File 'lib/most_ots/service.rb', line 57 def transfer_qr(params) logger.debug('MostOts Service Transfer QR Called') # Mandatory Fields mf = i[srcInstId channel lang traceNo qrBankCode qrAccountName qrAccountNumber tranAmount tranCur] # Optional Fields of = i[tranDesc] api_request('/api/mapi/TT3061', configure_params(params, mf, of)) end |
#wait_payment_response(params) ⇒ JSON
Returns response.
68 69 70 71 72 73 74 75 |
# File 'lib/most_ots/service.rb', line 68 def wait_payment_response(params) logger.debug('MostOts Service Waiting Payment Response') # Mandatory Fields mf = i[srcInstId channel lang qrBankCode qrAccountName qrAccountNumber tranAmount tranCur] # Optional Fields of = i[tranDesc] api_request('/api/mapi/TT3064', configure_params(params, mf, of)) end |