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

Main module

Defined Under Namespace

Classes: CardManager, Configuration, PaymentManager, Responder, Wrapper

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

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



7
8
9
# File 'lib/mandarin_api.rb', line 7

def self.assign_card(user)
  MandarinApi::CardManager.new.assign_card user
end

.configure {|config| ... } ⇒ Object

Yields:



54
55
56
# File 'lib/mandarin_api.rb', line 54

def self.configure
  yield(config)
end

.oneway_assign_card(user, card) ⇒ Object



11
12
13
# File 'lib/mandarin_api.rb', line 11

def self.oneway_assign_card(user, card)
  MandarinApi::CardManager.new.one_side_assign_card user, card
end

.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