Class: Nihaopay::Merchant

Inherits:
Object
  • Object
show all
Defined in:
lib/nihaopay/merchant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Merchant

Returns a new instance of Merchant.



5
6
7
# File 'lib/nihaopay/merchant.rb', line 5

def initialize(token)
  self.token = token
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/nihaopay/merchant.rb', line 3

def token
  @token
end

Instance Method Details

#ali_pay(amount, currency, options = {}) ⇒ Object



14
15
16
17
# File 'lib/nihaopay/merchant.rb', line 14

def ali_pay(amount, currency, options = {})
  options[:token] = token
  Nihaopay::SecurePay::AliPay.start(amount, currency, options)
end

#authorize(amount, credit_card, options = {}) ⇒ Object



24
25
26
27
# File 'lib/nihaopay/merchant.rb', line 24

def authorize(amount, credit_card, options = {})
  options[:token] = token
  Nihaopay::Transactions::Authorize.start(amount, credit_card, options)
end

#capture(transaction_id, amount, currency, options = {}) ⇒ Object



29
30
31
32
# File 'lib/nihaopay/merchant.rb', line 29

def capture(transaction_id, amount, currency, options = {})
  options[:token] = token
  Nihaopay::Transactions::Capture.start(transaction_id, amount, currency, options)
end

#purchase(amount, credit_card, options = {}) ⇒ Object



34
35
36
37
# File 'lib/nihaopay/merchant.rb', line 34

def purchase(amount, credit_card, options = {})
  options[:token] = token
  Nihaopay::Transactions::Purchase.start(amount, credit_card, options)
end

#refund(transaction_id, amount, currency, options = {}) ⇒ Object



44
45
46
47
# File 'lib/nihaopay/merchant.rb', line 44

def refund(transaction_id, amount, currency, options = {})
  options[:token] = token
  Nihaopay::Transactions::Refund.start(transaction_id, amount, currency, options)
end

#release(transaction_id, options = {}) ⇒ Object



39
40
41
42
# File 'lib/nihaopay/merchant.rb', line 39

def release(transaction_id, options = {})
  options[:token] = token
  Nihaopay::Transactions::Release.start(transaction_id, options)
end

#union_pay(amount, currency, options = {}) ⇒ Object



9
10
11
12
# File 'lib/nihaopay/merchant.rb', line 9

def union_pay(amount, currency, options = {})
  options[:token] = token
  Nihaopay::SecurePay::UnionPay.start(amount, currency, options)
end

#wechat_pay(amount, currency, options = {}) ⇒ Object



19
20
21
22
# File 'lib/nihaopay/merchant.rb', line 19

def wechat_pay(amount, currency, options = {})
  options[:token] = token
  Nihaopay::SecurePay::WeChatPay.start(amount, currency, options)
end