class Fondy::Client
Attributes
merchant_id[R]
password[R]
Public Class Methods
new(merchant_id:, password:)
click to toggle source
# File lib/fondy/client.rb, line 6 def initialize(merchant_id:, password:) @merchant_id = merchant_id @password = password end
Public Instance Methods
capture(order_id:, amount:, currency:)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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:)
click to toggle source
# 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:)
click to toggle source
# 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
Private Instance Methods
send_request(method, url, params, verify_signature: true, response_class: Response)
click to toggle source
# File lib/fondy/client.rb, line 67 def send_request(method, url, params, verify_signature: true, response_class: Response) params[:signature] = Signature.build(params: params, password: password) http_response = Request.call(method, url, params) response = response_class.new(http_response) if verify_signature && response.success? Signature.verify(params: response.to_h, password: password) end response end