Class: Fondy::Client
- Inherits:
-
Object
- Object
- Fondy::Client
- Defined in:
- lib/fondy/client.rb
Instance Attribute Summary collapse
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
- #capture(order_id:, amount:, currency:) ⇒ Object
- #checkout(order_id:, order_desc:, amount:, currency:, **other_params) ⇒ Object
-
#initialize(merchant_id:, password:) ⇒ Client
constructor
A new instance of Client.
- #reverse(order_id:, amount:, currency:, comment: nil) ⇒ Object
- #status(order_id:) ⇒ Object
- #transaction_list(order_id:) ⇒ Object
Constructor Details
#initialize(merchant_id:, password:) ⇒ Client
Returns a new instance of Client.
6 7 8 9 |
# File 'lib/fondy/client.rb', line 6 def initialize(merchant_id:, password:) @merchant_id = merchant_id @password = password end |
Instance Attribute Details
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
4 5 6 |
# File 'lib/fondy/client.rb', line 4 def merchant_id @merchant_id end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/fondy/client.rb', line 4 def password @password end |
Instance Method Details
#capture(order_id:, amount:, currency:) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/fondy/client.rb', line 31 def capture(order_id:, amount:, currency:) params = { merchant_id: merchant_id, order_id: order_id, amount: amount, currency: currency, } send_request(:post, '/api/capture/order_id', params) end |
#checkout(order_id:, order_desc:, amount:, currency:, **other_params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fondy/client.rb', line 11 def checkout(order_id:, order_desc:, amount:, currency:, **other_params) params = { merchant_id: merchant_id, order_id: order_id, order_desc: order_desc, amount: amount, currency: currency, **other_params, } send_request(:post, '/api/checkout/url', params, verify_signature: false) end |
#reverse(order_id:, amount:, currency:, comment: nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fondy/client.rb', line 41 def reverse(order_id:, amount:, currency:, comment: nil) params = { merchant_id: merchant_id, order_id: order_id, amount: amount, currency: currency, } params[:comment] = comment if comment send_request(:post, '/api/reverse/order_id', params) end |
#status(order_id:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fondy/client.rb', line 23 def status(order_id:) params = { merchant_id: merchant_id, order_id: order_id, } send_request(:post, '/api/status/order_id', params) end |
#transaction_list(order_id:) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fondy/client.rb', line 52 def transaction_list(order_id:) send_request( :post, '/api/transaction_list', { merchant_id: merchant_id, order_id: order_id, }, verify_signature: false, response_class: TransactionListResponse, ) end |