Class: Focas::Payment
- Inherits:
-
Object
- Object
- Focas::Payment
- Defined in:
- lib/focas/payment.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#trade_info ⇒ Object
Returns the value of attribute trade_info.
Instance Method Summary collapse
-
#initialize(lidm: nil, purch_amt: nil, currency_note: '訂單金額說明', auth_res_url: nil) ⇒ Payment
constructor
A new instance of Payment.
- #success? ⇒ Boolean
Constructor Details
#initialize(lidm: nil, purch_amt: nil, currency_note: '訂單金額說明', auth_res_url: nil) ⇒ Payment
Returns a new instance of Payment.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/focas/payment.rb', line 15 def initialize( # 必填參數 lidm: nil, purch_amt: nil, # 參數 currency_note: '訂單金額說明', # 客製回傳網址(同一個站有不同接收的 route 時使用) auth_res_url: nil ) unless lidm && purch_amt raise Focas::PaymentArgumentError, '請確認以下參數皆有填寫: - lidm 訂單編號 - purch_amt 金額 ' end @lidm = lidm @purch_amt = purch_amt @currency_note = currency_note # 回傳網址 @auth_res_url = auth_res_url set_trade_info end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
13 14 15 |
# File 'lib/focas/payment.rb', line 13 def response @response end |
#trade_info ⇒ Object
Returns the value of attribute trade_info.
12 13 14 |
# File 'lib/focas/payment.rb', line 12 def trade_info @trade_info end |
Instance Method Details
#success? ⇒ Boolean
44 45 46 47 |
# File 'lib/focas/payment.rb', line 44 def success? return if @response.nil? @response['Status'] == 'SUCCESS' end |