Class: Wajub::PaymentsResource
Instance Attribute Summary
Attributes inherited from BaseClient
#api_key, #base_url, #idempotency_key_prefix, #last_request, #transport
Instance Method Summary
collapse
Methods inherited from BaseClient
#delete, #get, #initialize, #post, #put, #request
Instance Method Details
#cancel(id, options = nil) ⇒ Object
57
58
59
60
|
# File 'lib/wajub/resources.rb', line 57
def cancel(id, options = nil)
res = delete("/payments/#{URI.encode_www_form_component(id)}", options)
to_payment_object('transaction' => HttpUtils.pick_resource(res, 'transaction'))
end
|
#create(params, options = nil) ⇒ Object
40
41
42
|
# File 'lib/wajub/resources.rb', line 40
def create(params, options = nil)
to_payment_object(post('/payments', params, options))
end
|
#initialize_payment(params, options = nil) ⇒ Object
44
45
46
|
# File 'lib/wajub/resources.rb', line 44
def initialize_payment(params, options = nil)
create(params, options)
end
|
#list(params = nil) ⇒ Object
53
54
55
|
# File 'lib/wajub/resources.rb', line 53
def list(params = nil)
PagedResult.create(self, '/payments', 'transactions', params)
end
|
#list_refunds(id, params = nil) ⇒ Object
72
73
74
75
|
# File 'lib/wajub/resources.rb', line 72
def list_refunds(id, params = nil)
list = HttpUtils.pick_list(get("/payments/#{URI.encode_www_form_component(id)}/refunds", params), 'refunds')
[list[:data], list[:meta]]
end
|
#process(id, params, options = nil) ⇒ Object
62
63
64
65
|
# File 'lib/wajub/resources.rb', line 62
def process(id, params, options = nil)
res = post("/payments/#{URI.encode_www_form_component(id)}", params, options)
to_payment_object('transaction' => HttpUtils.pick_resource(res, 'transaction'))
end
|
#process_split(id, params, options = nil) ⇒ Object
67
68
69
70
|
# File 'lib/wajub/resources.rb', line 67
def process_split(id, params, options = nil)
res = post("/payments/#{URI.encode_www_form_component(id)}/splits", params, options)
to_payment_object('transaction' => HttpUtils.pick_resource(res, 'transaction'))
end
|
#retrieve(id) ⇒ Object
48
49
50
51
|
# File 'lib/wajub/resources.rb', line 48
def retrieve(id)
res = get("/payments/#{URI.encode_www_form_component(id)}")
to_payment_object('transaction' => HttpUtils.pick_resource(res, 'transaction'))
end
|