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