Skip to content

Commit 9b467a7

Browse files
committed
Update to v0.0.23
1 parent fe12dba commit 9b467a7

File tree

5 files changed

+77
-7
lines changed

5 files changed

+77
-7
lines changed

sample_code_runner.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ do
1616
printf '\n\n%s **** RUNNING - %s ****\n' "$SAMPLECOUNT" "$p" >> output.log
1717
python "$p" >> output.log
1818
printf '\n\n**** END RUNNING - %s ****\n' "$p" >> output.log
19-
FILECOUNT=$((FILECOUNT+1))
19+
SAMPLECOUNT=$((SAMPLECOUNT+1))
2020
fi
21+
22+
FILECOUNT=$((FILECOUNT+1))
2123

22-
SAMPLECOUNT=$((SAMPLECOUNT+1))
2324
done < list.txt
2425
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$SAMPLECOUNT"
2526
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$FILECOUNT" >> output.log

samples/Reporting/ConversionDetails/get-conversion-detail-transactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def del_none(d):
1616
return d
1717

1818
def get_conversion_detail_transactions():
19-
startTime = "2019-03-21T00:00:00Z"
20-
endTime = "2019-03-21T23:00:00Z"
19+
startTime = "2020-10-21T00:00:00Z"
20+
endTime = "2020-10-21T23:00:00Z"
2121
organizationId = "testrest"
2222

2323
try:

samples/Reporting/NotificationOfChanges/get-notification-of-changes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def del_none(d):
1616
return d
1717

1818
def get_notification_of_changes():
19-
startTime = "2020-03-01T12:00:00Z"
20-
endTime = "2020-03-10T12:00:00Z"
19+
startTime = "2020-10-01T12:00:00Z"
20+
endTime = "2020-10-10T12:00:00Z"
2121

2222
try:
2323
config_obj = configuration.Configuration()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
from CyberSource import *
2+
import os
3+
import json
4+
from importlib.machinery import SourceFileLoader
5+
6+
config_file = os.path.join(os.getcwd(), "data", "Configuration.py")
7+
configuration = SourceFileLoader("module.name", config_file).load_module()
8+
9+
# To delete None values in Input Request Json body
10+
def del_none(d):
11+
for key, value in list(d.items()):
12+
if value is None:
13+
del d[key]
14+
elif isinstance(value, dict):
15+
del_none(value)
16+
return d
17+
18+
def enroll_instrument_identifier_for_network_tokenization():
19+
profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"
20+
instrumentIdentifierTokenId = "7010000000016241111"
21+
22+
type = "enrollable card"
23+
cardExpirationMonth = "12"
24+
cardExpirationYear = "2031"
25+
cardSecurityCode = "123"
26+
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierCard(
27+
expiration_month = cardExpirationMonth,
28+
expiration_year = cardExpirationYear,
29+
security_code = cardSecurityCode
30+
)
31+
32+
billToAddress1 = "1 Market St"
33+
billToLocality = "San Francisco"
34+
billToAdministrativeArea = "CA"
35+
billToPostalCode = "94105"
36+
billToCountry = "US"
37+
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierBillTo(
38+
address1 = billToAddress1,
39+
locality = billToLocality,
40+
administrative_area = billToAdministrativeArea,
41+
postal_code = billToPostalCode,
42+
country = billToCountry
43+
)
44+
45+
requestObj = PostInstrumentIdentifierRequest(
46+
type = type,
47+
card = card.__dict__,
48+
bill_to = billTo.__dict__
49+
)
50+
51+
52+
requestObj = del_none(requestObj.__dict__)
53+
requestObj = json.dumps(requestObj)
54+
55+
try:
56+
config_obj = configuration.Configuration()
57+
client_config = config_obj.get_configuration()
58+
api_instance = InstrumentIdentifierApi(client_config)
59+
return_data, status, body = api_instance.post_instrument_identifier_enrollment(instrumentIdentifierTokenId, requestObj, profile_id=profileid)
60+
61+
print("\nAPI RESPONSE CODE : ", status)
62+
print("\nAPI RESPONSE BODY : ", body)
63+
64+
return return_data
65+
except Exception as e:
66+
print("\nException when calling InstrumentIdentifierApi->post_instrument_identifier_enrollment: %s\n" % e)
67+
68+
if __name__ == "__main__":
69+
enroll_instrument_identifier_for_network_tokenization()

samples/TransactionDetails/retrieve-transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def retrieve_transaction():
2323
api_payment_response = process_payment.simple_authorizationinternet(False)
2424
id = api_payment_response.id
2525

26-
time.sleep(10)
26+
time.sleep(15)
2727

2828
try:
2929
config_obj = configuration.Configuration()

0 commit comments

Comments
 (0)