Skip to content

Commit

Permalink
Get transaction list
Browse files Browse the repository at this point in the history
Adds API call to retrieve transaction list corresponding to a batch id.
Also adds a unit test to test the feature.

Signed-off-by: Srijan Misra <[email protected]>
  • Loading branch information
srmisra committed Dec 7, 2015
1 parent 248cc52 commit 22773ad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/authorize_net/api/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,13 @@ def get_customer_payment_profile_list(request)
def arb_get_subscription_request(request)
make_request(request,ARBGetSubscriptionResponse,Type::API_ARB_GET_SUBSCRIPTION_REQUEST)
end

# This request enables you to get transaction list
#
# See spec/api_spec.rb for usage examples
def get_transaction_list(request)
make_request(request,GetTransactionListResponse,Type::API_GET_TRANSACTION_LIST)
end

end
end
19 changes: 19 additions & 0 deletions spec/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,25 @@
expect(response.paymentProfiles.paymentProfile[0].payment.creditCard.cardNumber).not_to eq(nil)

end

it "should be able to get transaction List Request" do
transaction = AuthorizeNet::API::Transaction.new(@api_login, @api_key, :gateway => @gateway)

batchId = "4551107"

@getTransactionListRequest = GetTransactionListRequest.new
@getTransactionListRequest.batchId = batchId

transaction.should respond_to(:get_transaction_list)
response = transaction.get_transaction_list(@getTransactionListRequest)

expect(response).not_to eq(nil)
expect(response.messages).not_to eq(nil)
expect(response.messages.resultCode).not_to eq(nil)
expect(response.messages.resultCode).to eq(MessageTypeEnum::Ok)
expect(response.transactions).not_to eq (nil)

end

def get_actual(expected, className, topElement)
xmlText = @transaction.serialize(expected,topElement)
Expand Down

0 comments on commit 22773ad

Please sign in to comment.