| @@ 34-65 (lines=32) @@ | ||
| 31 | end |
|
| 32 | ||
| 33 | # Returns an Array of TransactionDetail objects built from the entities returned in the response. Returns nil if no transactions were returned. |
|
| 34 | def transactions |
|
| 35 | unless @transactions.nil? |
|
| 36 | transactions = [] |
|
| 37 | @transactions.element_children.each do |child| |
|
| 38 | next if child.nil? |
|
| 39 | transaction = build_entity(child, Fields::TRANSACTION_DETAILS_ENTITY_DESCRIPTION) |
|
| 40 | ||
| 41 | # handle some stuff thats too tricky for EntityDecription to handle |
|
| 42 | first_name = node_content_unless_nil(child.at_css('firstName')) |
|
| 43 | last_name = node_content_unless_nil(child.at_css('lastName')) |
|
| 44 | unless first_name.nil? && last_name.nil? |
|
| 45 | address = AuthorizeNet::Address.new(first_name: first_name, last_name: last_name) |
|
| 46 | transaction.customer = AuthorizeNet::Customer.new(address: address) |
|
| 47 | end |
|
| 48 | invoice_number = node_content_unless_nil(child.at_css('invoiceNumber')) |
|
| 49 | unless invoice_number.nil? |
|
| 50 | transaction.order = AuthorizeNet::Order.new(invoice_num: invoice_number) |
|
| 51 | end |
|
| 52 | subscription = child.at_css('subscription') |
|
| 53 | unless subscription.nil? |
|
| 54 | subscription_id = node_content_unless_nil(child.at_css('subscription').at_css('id')) |
|
| 55 | transaction.subscription_id = subscription_id unless subscription_id.nil? |
|
| 56 | ||
| 57 | pay_num = node_content_unless_nil(child.at_css('subscription').at_css('payNum')) |
|
| 58 | transaction.subscription_paynum = pay_num unless pay_num.nil? |
|
| 59 | end |
|
| 60 | ||
| 61 | transactions <<= transaction |
|
| 62 | end |
|
| 63 | return transactions unless transactions.empty? |
|
| 64 | end |
|
| 65 | end |
|
| 66 | ||
| 67 | # Builds and returns a TransactionDetail entity built from the response. If no transaction was found, returns nil. |
|
| 68 | def transaction |
|
| @@ 23-31 (lines=9) @@ | ||
| 20 | end |
|
| 21 | ||
| 22 | # Returns an Array of Batch objects built from the entities returned in the response. Returns nil if no batchList was returned. |
|
| 23 | def batch_list |
|
| 24 | unless @batch_list.nil? |
|
| 25 | batches = [] |
|
| 26 | @batch_list.element_children.each do |child| |
|
| 27 | batches <<= build_entity(child, Fields::BATCH_ENTITY_DESCRIPTION) unless child.nil? |
|
| 28 | end |
|
| 29 | return batches unless batches.empty? |
|
| 30 | end |
|
| 31 | end |
|
| 32 | ||
| 33 | # Returns an Array of TransactionDetail objects built from the entities returned in the response. Returns nil if no transactions were returned. |
|
| 34 | def transactions |
|
| @@ 23-34 (lines=12) @@ | ||
| 20 | attr_reader :total_num_in_resultset |
|
| 21 | ||
| 22 | # Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned. |
|
| 23 | def subscription_details |
|
| 24 | unless @subscription_details.nil? |
|
| 25 | subscription_details = [] |
|
| 26 | @subscription_details.element_children.each do |child| |
|
| 27 | next if child.nil? |
|
| 28 | subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION) |
|
| 29 | ||
| 30 | subscription_details <<= subscription_detail |
|
| 31 | end |
|
| 32 | return subscription_details unless subscription_details.empty? |
|
| 33 | end |
|
| 34 | end |
|
| 35 | end |
|
| 36 | end |
|
| 37 | ||
| @@ 77-85 (lines=9) @@ | ||
| 74 | ||
| 75 | # Returns a list of validation response as an AuthorizeNet::AIM::Response objects if a list of validation response was returned |
|
| 76 | # by the gateway. Returns nil otherwise. |
|
| 77 | def validation_responses |
|
| 78 | unless @validation_direct_response_list.nil? |
|
| 79 | responses = [] |
|
| 80 | @validation_direct_response_list.element_children.each do |child| |
|
| 81 | responses <<= AuthorizeNet::AIM::Response.new(child.dup, @transaction) unless child.nil? |
|
| 82 | end |
|
| 83 | return responses unless responses.empty? |
|
| 84 | end |
|
| 85 | end |
|
| 86 | ||
| 87 | # Returns the direct response as an AuthorizeNet::AIM::Response object if a direct response was returned |
|
| 88 | # by the gateway. Returns nil otherwise. |
|