Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions samples/FlexMicroform/generate-capture-context-accept-card.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from CyberSource import *
from CyberSource.utilities.flex.CaptureContextParsingUtility import parse_capture_context_response
import os
import json
from importlib.machinery import SourceFileLoader
Expand Down Expand Up @@ -62,6 +63,18 @@ def generate_capture_context_accept_card():
print("\nAPI RESPONSE CODE : ", status)
print("\nAPI RESPONSE BODY : ", body)

# Parse the capture context response
try:

parsed_result = parse_capture_context_response(
jwt_value=return_data,
merchant_config=api_instance.api_client.mconfig
)

print("\nParsed Capture Context : ", json.dumps(parsed_result, indent=2))
except Exception as parse_error:
print("\nError in Capture Context Parsing : ", str(parse_error))

write_log_audit(status)

return return_data
Expand Down
13 changes: 13 additions & 0 deletions samples/FlexMicroform/generate-capture-context-accept-check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from CyberSource import *
from CyberSource.rest import ApiException
from CyberSource import GenerateCaptureContextRequest
from CyberSource.utilities.flex.CaptureContextParsingUtility import parse_capture_context_response
import os
import json
from importlib.machinery import SourceFileLoader
Expand Down Expand Up @@ -45,6 +46,18 @@ def generate_capture_context_accept_check():
print("\nAPI RESPONSE CODE : ", status)
print("\nAPI RESPONSE BODY : ", body)

# Parse the capture context response
try:

parsed_result = parse_capture_context_response(
jwt_value=return_data,
merchant_config=api_instance.api_client.mconfig
)

print("\nParsed Capture Context : ", json.dumps(parsed_result, indent=2))
except Exception as parse_error:
print("\nError in Capture Context Parsing : ", str(parse_error))

write_log_audit(status)

return return_data
Expand Down
6 changes: 3 additions & 3 deletions samples/TokenManagement/Customer/create-customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ def del_none(d):
def create_customer():
buyerInformationMerchantCustomerID = "Your customer identifier"
buyerInformationEmail = "[email protected]"
buyerInformation = Tmsv2customersBuyerInformation(
buyerInformation = Tmsv2tokenizeTokenInformationCustomerBuyerInformation(
merchant_customer_id = buyerInformationMerchantCustomerID,
email = buyerInformationEmail
)

clientReferenceInformationCode = "TC50171_3"
clientReferenceInformation = Tmsv2customersClientReferenceInformation(
clientReferenceInformation = Tmsv2tokenizeTokenInformationCustomerClientReferenceInformation(
code = clientReferenceInformationCode
)


merchantDefinedInformation = []
merchantDefinedInformation1 = Tmsv2customersMerchantDefinedInformation(
merchantDefinedInformation1 = Tmsv2tokenizeTokenInformationCustomerMerchantDefinedInformation(
name = "data1",
value = "Your customer data"
)
Expand Down
6 changes: 3 additions & 3 deletions samples/TokenManagement/Customer/update-customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ def update_customer():
customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"
buyerInformationMerchantCustomerID = "Your customer identifier"
buyerInformationEmail = "[email protected]"
buyerInformation = Tmsv2customersBuyerInformation(
buyerInformation = Tmsv2tokenizeTokenInformationCustomerBuyerInformation(
merchant_customer_id = buyerInformationMerchantCustomerID,
email = buyerInformationEmail
)

clientReferenceInformationCode = "TC50171_3"
clientReferenceInformation = Tmsv2customersClientReferenceInformation(
clientReferenceInformation = Tmsv2tokenizeTokenInformationCustomerClientReferenceInformation(
code = clientReferenceInformationCode
)


merchantDefinedInformation = []
merchantDefinedInformation1 = Tmsv2customersMerchantDefinedInformation(
merchantDefinedInformation1 = Tmsv2tokenizeTokenInformationCustomerMerchantDefinedInformation(
name = "data1",
value = "Your customer data"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def update_customers_default_payment_instrument():
customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"

defaultPaymentInstrumentId = "AB6A54B982A6FCB6E05341588E0A3935"
defaultPaymentInstrument = Tmsv2customersDefaultPaymentInstrument(
defaultPaymentInstrument = Tmsv2tokenizeTokenInformationCustomerDefaultPaymentInstrument(
id = defaultPaymentInstrumentId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def update_customers_default_shipping_address():
customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"

defaultShippingAddressId = "AB6A54B97C00FCB6E05341588E0A3935"
defaultShippingAddress = Tmsv2customersDefaultShippingAddress(
defaultShippingAddress = Tmsv2tokenizeTokenInformationCustomerDefaultShippingAddress(
id = defaultShippingAddressId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_customer_default_payment_instrument_card():
cardExpirationMonth = "12"
cardExpirationYear = "2031"
cardType = "001"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType
Expand All @@ -39,7 +39,7 @@ def create_customer_default_payment_instrument_card():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -53,7 +53,7 @@ def create_customer_default_payment_instrument_card():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_customer_nondefault_payment_instrument_card():
cardExpirationMonth = "12"
cardExpirationYear = "2031"
cardType = "001"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType
Expand All @@ -39,7 +39,7 @@ def create_customer_nondefault_payment_instrument_card():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -53,7 +53,7 @@ def create_customer_nondefault_payment_instrument_card():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def create_customer_payment_instrument_bank_account():
customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"

bankAccountType = "savings"
bankAccount = Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount(
bankAccount = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBankAccount(
type = bankAccountType
)

Expand All @@ -29,19 +29,19 @@ def create_customer_payment_instrument_bank_account():
buyerInformationDateOfBirth = "2000-12-13"

buyerInformationPersonalIdentification = []
buyerInformationPersonalIdentificationIssuedBy1 = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy(
buyerInformationPersonalIdentificationIssuedBy1 = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy(
administrative_area = "CA"
)

buyerInformationPersonalIdentification1 = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification(
buyerInformationPersonalIdentification1 = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification(
id = "57684432111321",
type = "driver license",
issued_by = buyerInformationPersonalIdentificationIssuedBy1.__dict__
)

buyerInformationPersonalIdentification.append(buyerInformationPersonalIdentification1.__dict__)

buyerInformation = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation(
buyerInformation = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformation(
company_tax_id = buyerInformationCompanyTaxID,
currency = buyerInformationCurrency,
date_of_birth = buyerInformationDateOfBirth,
Expand All @@ -58,7 +58,7 @@ def create_customer_payment_instrument_bank_account():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -81,7 +81,7 @@ def create_customer_payment_instrument_bank_account():
)

instrumentIdentifierId = "A7A91A2CA872B272E05340588D0A0699"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_customer_payment_instrument_pinless_debit():
cardStartMonth = "01"
cardStartYear = "2020"
cardUseAs = "pinless debit"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType,
Expand All @@ -46,7 +46,7 @@ def create_customer_payment_instrument_pinless_debit():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -60,7 +60,7 @@ def create_customer_payment_instrument_pinless_debit():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_customer_default_shipping_address():
shipToCountry = "US"
shipToEmail = "[email protected]"
shipToPhoneNumber = "4158880000"
shipTo = Tmsv2customersEmbeddedDefaultShippingAddressShipTo(
shipTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultShippingAddressShipTo(
first_name = shipToFirstName,
last_name = shipToLastName,
company = shipToCompany,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_customer_nondefault_shipping_address():
shipToCountry = "US"
shipToEmail = "[email protected]"
shipToPhoneNumber = "4158880000"
shipTo = Tmsv2customersEmbeddedDefaultShippingAddressShipTo(
shipTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultShippingAddressShipTo(
first_name = shipToFirstName,
last_name = shipToLastName,
company = shipToCompany,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def create_payment_instrument_bank_account():
profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"

bankAccountType = "savings"
bankAccount = Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount(
bankAccount = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBankAccount(
type = bankAccountType
)

Expand All @@ -29,19 +29,19 @@ def create_payment_instrument_bank_account():
buyerInformationDateOfBirth = "2000-12-13"

buyerInformationPersonalIdentification = []
buyerInformationPersonalIdentificationIssuedBy1 = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy(
buyerInformationPersonalIdentificationIssuedBy1 = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy(
administrative_area = "CA"
)

buyerInformationPersonalIdentification1 = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification(
buyerInformationPersonalIdentification1 = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification(
id = "57684432111321",
type = "driver license",
issued_by = buyerInformationPersonalIdentificationIssuedBy1.__dict__
)

buyerInformationPersonalIdentification.append(buyerInformationPersonalIdentification1.__dict__)

buyerInformation = Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation(
buyerInformation = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBuyerInformation(
company_tax_id = buyerInformationCompanyTaxID,
currency = buyerInformationCurrency,
date_of_birth = buyerInformationDateOfBirth,
Expand All @@ -58,7 +58,7 @@ def create_payment_instrument_bank_account():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -81,7 +81,7 @@ def create_payment_instrument_bank_account():
)

instrumentIdentifierId = "A7A91A2CA872B272E05340588D0A0699"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_payment_instrument_card():
cardExpirationMonth = "12"
cardExpirationYear = "2031"
cardType = "visa"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType
Expand All @@ -38,7 +38,7 @@ def create_payment_instrument_card():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -52,7 +52,7 @@ def create_payment_instrument_card():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_payment_instrument_pinless_debit():
cardStartMonth = "01"
cardStartYear = "2020"
cardUseAs = "pinless debit"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType,
Expand All @@ -47,7 +47,7 @@ def create_payment_instrument_pinless_debit():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158880000"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -61,7 +61,7 @@ def create_payment_instrument_pinless_debit():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def update_payment_instrument():
cardExpirationMonth = "12"
cardExpirationYear = "2031"
cardType = "visa"
card = Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
card = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentCard(
expiration_month = cardExpirationMonth,
expiration_year = cardExpirationYear,
type = cardType
Expand All @@ -39,7 +39,7 @@ def update_payment_instrument():
billToCountry = "US"
billToEmail = "[email protected]"
billToPhoneNumber = "4158888674"
billTo = Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
billTo = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentBillTo(
first_name = billToFirstName,
last_name = billToLastName,
company = billToCompany,
Expand All @@ -53,7 +53,7 @@ def update_payment_instrument():
)

instrumentIdentifierId = "7010000000016241111"
instrumentIdentifier = Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
instrumentIdentifier = Tmsv2tokenizeTokenInformationCustomerEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
id = instrumentIdentifierId
)

Expand Down
Loading