class CcbConnectClient::PaymentDetailsQueryResponse

Attributes

cur_page[RW]
cust_id[RW]
language[RW]
list[RW]
notice[RW]
page_count[RW]
tx_code[RW]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/ccb_connect_client/models/payment_details_query_response.rb, line 10
def initialize
  super
end

Public Instance Methods

from_xml(xml) click to toggle source
# File lib/ccb_connect_client/models/payment_details_query_response.rb, line 14
def from_xml xml
  response = PaymentDetailsQueryResponse.new
  doc = Document.new(xml)

  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 && CcbConnectClient.logger
    CcbConnectClient.logger.debug("PaymentDetailsQueryResponse response object : #{response.inspect}")
  end
  response
end