Skip to content

Commit 60a143e

Browse files
authored
Merge pull request AuthorizeNet#29 from akankaria/master
Fixing capture_previously_authorized_amount sample code
2 parents a88e5cd + 69508de commit 60a143e

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

PaymentTransactions/capture-previously-authorized-amount.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
constants = imp.load_source('modulename', 'constants.py')
77
from decimal import *
88

9-
def capture_previously_authorized_amount():
9+
def capture_previously_authorized_amount(transactionId):
1010
merchantAuth = apicontractsv1.merchantAuthenticationType()
1111
merchantAuth.name = constants.apiLoginId
1212
merchantAuth.transactionKey = constants.transactionKey
@@ -15,9 +15,7 @@ def capture_previously_authorized_amount():
1515
transactionrequest = apicontractsv1.transactionRequestType()
1616
transactionrequest.transactionType = "priorAuthCaptureTransaction"
1717
transactionrequest.amount = Decimal ('2.55')
18-
transactionrequest.refTransId = "2245440574"
19-
20-
18+
transactionrequest.refTransId = transactionId
2119

2220
createtransactionrequest = apicontractsv1.createTransactionRequest()
2321
createtransactionrequest.merchantAuthentication = merchantAuth
@@ -55,4 +53,4 @@ def capture_previously_authorized_amount():
5553
return response
5654

5755
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
58-
capture_previously_authorized_amount()
56+
capture_previously_authorized_amount('12345678')

list_of_sample_codes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ charge_tokenized_credit_card 1 0
2323
credit_bank_account 1 0
2424
debit_bank_account 1 1
2525
refund_transaction 1 0
26-
update_split_tender_group 1 1
26+
update_split_tender_group 1 0
2727
void_transaction 1 0
2828
authorization_and_capture_continue 1 1
2929
authorization_and_capture 1 1

test-runner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,12 @@ def capture_funds_authorized_through_another_channel(self):
320320

321321
def capture_previously_authorized_amount(self):
322322
print("capture_previously_authorized_amount")
323+
324+
modl = imp.load_source('modulename', 'PaymentTransactions/authorize-credit-card.py')
325+
response = modl.authorize_credit_card()
326+
323327
modl = imp.load_source('modulename', 'PaymentTransactions/capture-previously-authorized-amount.py')
324-
return modl.capture_previously_authorized_amount()
328+
return modl.capture_previously_authorized_amount(response.transactionResponse.transId)
325329

326330
def charge_credit_card(self):
327331
print("charge_credit_card")

0 commit comments

Comments
 (0)