Skip to content

Commit 6f01d8d

Browse files
author
brianmc
committed
updated Fraud Management samples
1 parent bde25ab commit 6f01d8d

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

PaymentTransactions/update-held-transaction.py renamed to FraudManagement/approve-or-decline-held-transaction.py

Lines changed: 1 addition & 1 deletion
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 update_held_transaction(transactionId):
9+
def approve_or_decline_held_transaction(transactionId):
1010
merchantAuth = apicontractsv1.merchantAuthenticationType()
1111
merchantAuth.name = constants.apiLoginId
1212
merchantAuth.transactionKey = constants.transactionKey
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os, sys
2+
import imp
3+
4+
from authorizenet import apicontractsv1
5+
from authorizenet.apicontrollers import *
6+
constants = imp.load_source('modulename', 'constants.py')
7+
from decimal import *
8+
9+
def get_unsettled_transaction_list():
10+
merchantAuth = apicontractsv1.merchantAuthenticationType()
11+
merchantAuth.name = constants.apiLoginId
12+
merchantAuth.transactionKey = constants.transactionKey
13+
14+
unsettledTransactionListRequest = apicontractsv1.getUnsettledTransactionListRequest()
15+
unsettledTransactionListRequest.merchantAuthentication = merchantAuth
16+
17+
unsettledTransactionListController = getUnsettledTransactionListController(unsettledTransactionListRequest)
18+
19+
unsettledTransactionListController.execute()
20+
21+
unsettledTransactionListResponse = unsettledTransactionListController.getresponse()
22+
23+
if unsettledTransactionListResponse is not None:
24+
if unsettledTransactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok:
25+
print('Successfully got unsettled transaction list!')
26+
27+
for transaction in unsettledTransactionListResponse.transactions.transaction:
28+
print('Transaction Id : %s' % transaction.transId)
29+
print('Transaction Status : %s' % transaction.transactionStatus)
30+
print('Amount Type : %s' % transaction.accountType)
31+
print('Settle Amount : %s' % transaction.settleAmount)
32+
33+
if unsettledTransactionListResponse.messages:
34+
print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0]['code'].text)
35+
print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0]['text'].text)
36+
else:
37+
if unsettledTransactionListResponse.messages:
38+
print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % (unsettledTransactionListResponse.messages.message[0]['code'].text,unsettledTransactionListResponse.messages.message[0]['text'].text))
39+
40+
return unsettledTransactionListResponse
41+
42+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
43+
get_unsettled_transaction_list()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy