Class: CmbPay::SingleOrderMessage
- Inherits:
-
Object
- Object
- CmbPay::SingleOrderMessage
- Defined in:
- lib/cmb_pay/message/single_order_message.rb
Instance Attribute Summary collapse
-
#accept_date ⇒ Object
readonly
Returns the value of attribute accept_date.
-
#accept_time ⇒ Object
readonly
Returns the value of attribute accept_time.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#bank_seq_no ⇒ Object
readonly
Returns the value of attribute bank_seq_no.
-
#bill_amount ⇒ Object
readonly
Returns the value of attribute bill_amount.
-
#bill_no ⇒ Object
readonly
Returns the value of attribute bill_no.
-
#card_no ⇒ Object
readonly
Returns the value of attribute card_no.
-
#card_type ⇒ Object
readonly
Returns the value of attribute card_type.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
-
#merchant_para ⇒ Object
readonly
Returns the value of attribute merchant_para.
-
#raw_http_response ⇒ Object
readonly
Returns the value of attribute raw_http_response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(http_response) ⇒ SingleOrderMessage
constructor
A new instance of SingleOrderMessage.
- #succeed? ⇒ Boolean
Constructor Details
#initialize(http_response) ⇒ SingleOrderMessage
Returns a new instance of SingleOrderMessage.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 17 def initialize(http_response) @raw_http_response = http_response return unless http_response.code == 200 document_root = REXML::Document.new(http_response.body.to_s).root head = document_root.elements['Head'] @code = head.elements['Code'].text = head.elements['ErrMsg'].text return unless succeed? body = document_root.elements['Body'] @bill_no = body.elements['BillNo'].text @amount = body.elements['Amount'].text @accept_date = body.elements['AcceptDate'].text @accept_time = body.elements['AcceptTime'].text @bill_amount = body.elements['BillAmount'].text @status = body.elements['Status'].text @card_type = body.elements['CardType'].text @fee = body.elements['Fee'].text @merchant_para = body.elements['MerchantPara'].text @card_no = body.elements['CardNo'].text @bank_seq_no = body.elements['BankSeqNo'].text end |
Instance Attribute Details
#accept_date ⇒ Object (readonly)
Returns the value of attribute accept_date.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def accept_date @accept_date end |
#accept_time ⇒ Object (readonly)
Returns the value of attribute accept_time.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def accept_time @accept_time end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def amount @amount end |
#bank_seq_no ⇒ Object (readonly)
Returns the value of attribute bank_seq_no.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def bank_seq_no @bank_seq_no end |
#bill_amount ⇒ Object (readonly)
Returns the value of attribute bill_amount.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def bill_amount @bill_amount end |
#bill_no ⇒ Object (readonly)
Returns the value of attribute bill_no.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def bill_no @bill_no end |
#card_no ⇒ Object (readonly)
Returns the value of attribute card_no.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def card_no @card_no end |
#card_type ⇒ Object (readonly)
Returns the value of attribute card_type.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def card_type @card_type end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def code @code end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def fee @fee end |
#merchant_para ⇒ Object (readonly)
Returns the value of attribute merchant_para.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def merchant_para @merchant_para end |
#raw_http_response ⇒ Object (readonly)
Returns the value of attribute raw_http_response.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def raw_http_response @raw_http_response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 5 def status @status end |
Instance Method Details
#succeed? ⇒ Boolean
41 42 43 |
# File 'lib/cmb_pay/message/single_order_message.rb', line 41 def succeed? code.nil? && .nil? end |