Class: CcbConnectClient::PaymentDetailsQueryResponse
- Inherits:
-
BaseResponse
- Object
- BaseResponse
- CcbConnectClient::PaymentDetailsQueryResponse
- Defined in:
- lib/ccb_connect_client/models/payment_details_query_response.rb
Instance Attribute Summary collapse
-
#cur_page ⇒ Object
Returns the value of attribute cur_page.
-
#cust_id ⇒ Object
Returns the value of attribute cust_id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#list ⇒ Object
Returns the value of attribute list.
-
#notice ⇒ Object
Returns the value of attribute notice.
-
#page_count ⇒ Object
Returns the value of attribute page_count.
-
#tx_code ⇒ Object
Returns the value of attribute tx_code.
Attributes inherited from BaseResponse
#request_sn, #return_code, #return_msg, #successful
Instance Method Summary collapse
- #from_xml(xml) ⇒ Object
-
#initialize ⇒ PaymentDetailsQueryResponse
constructor
A new instance of PaymentDetailsQueryResponse.
Methods inherited from BaseResponse
Constructor Details
#initialize ⇒ PaymentDetailsQueryResponse
Returns a new instance of PaymentDetailsQueryResponse.
10 11 12 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 10 def initialize super end |
Instance Attribute Details
#cur_page ⇒ Object
Returns the value of attribute cur_page.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def cur_page @cur_page end |
#cust_id ⇒ Object
Returns the value of attribute cust_id.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def cust_id @cust_id end |
#language ⇒ Object
Returns the value of attribute language.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def language @language end |
#list ⇒ Object
Returns the value of attribute list.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def list @list end |
#notice ⇒ Object
Returns the value of attribute notice.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def notice @notice end |
#page_count ⇒ Object
Returns the value of attribute page_count.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def page_count @page_count end |
#tx_code ⇒ Object
Returns the value of attribute tx_code.
8 9 10 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 8 def tx_code @tx_code end |
Instance Method Details
#from_xml(xml) ⇒ Object
14 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ccb_connect_client/models/payment_details_query_response.rb', line 14 def from_xml xml response = PaymentDetailsQueryResponse.new doc = Document.new(xml) # logger = Logger.new('foo.log', 'monthly') # logger.datetime_format = '%Y-%m-%d %H:%M:%S' if CcbConnectClient.debug_mode # logger.info("PaymentDetailsQueryResponse response xml: #{doc}") puts "PaymentDetailsQueryResponse response xml: #{doc}" end response.request_sn = doc.elements["TX/REQUEST_SN"].text response.cust_id = doc.elements["TX/CUST_ID"].text response.tx_code = doc.elements["TX/TX_CODE"].text response.return_code = doc.elements["TX/RETURN_CODE"].text response.return_msg = doc.elements["TX/RETURN_MSG"].text response.language = doc.elements["TX/LANGUAGE"].text # INFO response.cur_page = doc.elements["TX/TX_INFO/CUR_PAGE"].text response.page_count = doc.elements["TX/TX_INFO/PAGE_COUNT"].text response.list = Array.new # LIST doc.elements.each("TX/TX_INFO/LIST") { |e| response_element = PaymentDetailsQueryResponseElement.new response_element.tran_date = e.elements["TRAN_DATE"].text response_element.acc_date = e.elements["ACC_DATE"].text response_element.order = e.elements["ORDER"].text response_element.account = e.elements["ACCOUNT"].text response_element.acc_name = e.elements["ACC_NAME"].text response_element.payment_money = e.elements["PAYMENT_MONEY"].text response_element.refund_money = e.elements["REFUND_MONEY"].text response_element.pos_id = e.elements["POS_ID"].text response_element.rem1 = e.elements["REM1"].text response_element.rem2 = e.elements["REM2"].text order_status = OrderStatus.new order_status.status = e.elements["ORDER_STATUS"].text case order_status.status when '0' order_status.status_name = "失败" when '1' order_status.status_name = "成功" when '2' order_status.status_name = "待银行确认" when '3' order_status.status_name = "已部分退款" when '4' order_status.status_name = "已全额退款" when '5' order_status.status_name = "待银行确认" end response_element.order_status = order_status response.list.push(response_element) } if CcbConnectClient.debug_mode # logger.info("PaymentDetailsQueryResponse response xml: #{doc}") puts "PaymentDetailsQueryResponse response object: #{response.inspect}" end response end |