module MandarinApi

Main module

Attributes

config[RW]

Public Class Methods

assign_card(user, urls = {}) click to toggle source
# File lib/mandarin_api.rb, line 8
def self.assign_card(user, urls = {})
  MandarinApi::CardManager.new.assign_card user, urls
end
charge(order_id, amount, user, extra = {}) click to toggle source
# File lib/mandarin_api.rb, line 16
def self.charge(order_id, amount, user, extra = {})
  params = {
    order_id: order_id, amount: amount, email: user.email, phone: user.phone,
    urls: extra[:urls], custom_values: extra[:custom_values]
  }
  MandarinApi::PaymentManager.new.perform_charge params
end
configure() { |config| ... } click to toggle source
# File lib/mandarin_api.rb, line 60
def self.configure
  yield(config)
end
oneway_assign_card(user, card) click to toggle source
# File lib/mandarin_api.rb, line 12
def self.oneway_assign_card(user, card)
  MandarinApi::CardManager.new.one_side_assign_card user, card
end
pay(order_id, amount, assigned_card_uuid, custom_values = []) click to toggle source
# File lib/mandarin_api.rb, line 24
def self.pay(order_id, amount, assigned_card_uuid, custom_values = [])
  params = {
    order_id: order_id, amount: amount, custom_values: custom_values,
    assigned_card_uuid: assigned_card_uuid
  }
  MandarinApi::PaymentManager.new.perform_payment params
end
payout(order_id, amount, assigned_card_uuid, custom_values = []) click to toggle source
# File lib/mandarin_api.rb, line 32
def self.payout(order_id, amount, assigned_card_uuid, custom_values = [])
  params = {
    order_id: order_id, amount: amount, assigned_card_uuid: assigned_card_uuid,
    custom_values: custom_values
  }
  MandarinApi::PaymentManager.new.perform_payout params
end
process_callback(request_params, response_handler) click to toggle source
# File lib/mandarin_api.rb, line 50
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) click to toggle source
# File lib/mandarin_api.rb, line 45
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, amount) click to toggle source
# File lib/mandarin_api.rb, line 40
def self.refund(order_id, transaction_uuid, amount)
  params = { order_id: order_id, transaction_uuid: transaction_uuid, amount: amount }
  MandarinApi::PaymentManager.new.perform_refund params
end