Module: MandarinApi
- Defined in:
- lib/mandarin_api.rb,
lib/mandarin_api/wrapper.rb,
lib/mandarin_api/responder.rb,
lib/mandarin_api/card_manager.rb,
lib/mandarin_api/configuration.rb,
lib/mandarin_api/payment_manager.rb
Overview
Defined Under Namespace
Classes: CardManager, Configuration, PaymentManager, Responder, Wrapper
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
5
6
7
|
# File 'lib/mandarin_api.rb', line 5
def config
@config
end
|
Class Method Details
.assign_card(user) ⇒ Object
54
55
56
|
# File 'lib/mandarin_api.rb', line 54
def self.configure
yield(config)
end
|
.oneway_assign_card(user, card) ⇒ Object
.pay(order_id, amount, assigned_card_uuid) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/mandarin_api.rb', line 15
def self.pay(order_id, amount, assigned_card_uuid)
params = {
order_id: order_id, amount: amount,
assigned_card_uuid: assigned_card_uuid
}
MandarinApi::PaymentManager.new.perform_payment params
end
|
.payout(order_id, amount, assigned_card_uuid) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/mandarin_api.rb', line 23
def self.payout(order_id, amount, assigned_card_uuid)
params = {
order_id: order_id, amount: amount,
assigned_card_uuid: assigned_card_uuid
}
MandarinApi::PaymentManager.new.perform_payout params
end
|
.process_callback(request_params, response_handler) ⇒ Object
44
45
46
47
48
|
# File 'lib/mandarin_api.rb', line 44
def self.process_callback(request_params, response_handler)
response = MandarinApi::Responder.new(request_params)
response_handler.success(response.data) if response.success
response_handler.failure(response.data) if response.failure
end
|
.rebill(order_id, amount, transaction_uuid) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/mandarin_api.rb', line 36
def self.rebill(order_id, amount, transaction_uuid)
params = {
order_id: order_id, amount: amount,
transaction_uuid: transaction_uuid
}
MandarinApi::PaymentManager.new.perform_rebill params
end
|
.refund(order_id, transaction_uuid) ⇒ Object
31
32
33
34
|
# File 'lib/mandarin_api.rb', line 31
def self.refund(order_id, transaction_uuid)
params = { order_id: order_id, transaction_uuid: transaction_uuid }
MandarinApi::PaymentManager.new.perform_refund params
end
|