Skip to content
Merged
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
14 changes: 14 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,19 @@ 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,
verify_jwt_signature=True
)

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
14 changes: 14 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,19 @@ 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,
verify_jwt_signature=True
)

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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from CyberSource import *
from CyberSource.rest import ApiException
from CyberSource.models import Upv1capturecontextsCaptureMandate, Upv1capturecontextsOrderInformationAmountDetails, Upv1capturecontextsOrderInformation, GenerateUnifiedCheckoutCaptureContextRequest, Upv1capturecontextsCompleteMandate
from CyberSource.utilities.flex.CaptureContextParsingUtility import parse_capture_context_response
from pathlib import Path
import os
import json
Expand Down Expand Up @@ -105,6 +106,19 @@ def generate_unified_checkout_capture_context():
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,
verify_jwt_signature=True
)

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
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from CyberSource import *
from CyberSource.rest import ApiException
from CyberSource.utilities.flex.CaptureContextParsingUtility import parse_capture_context_response
from CyberSource.models import Upv1capturecontextsCaptureMandate, Upv1capturecontextsOrderInformationAmountDetails, Upv1capturecontextsOrderInformation, GenerateUnifiedCheckoutCaptureContextRequest, Upv1capturecontextsCompleteMandate, Upv1capturecontextsDataOrderInformationBillTo, Upv1capturecontextsDataOrderInformationBillToCompany, Upv1capturecontextsDataOrderInformationShipTo
from pathlib import Path
import os
import json
Expand Down Expand Up @@ -96,7 +98,7 @@ def generate_unified_checkout_capture_context():
orderInformationBillToCompanyDistrict = "district"
orderInformationBillToCompanyLocality = "Foster City"
orderInformationBillToCompanyPostalCode = "94404"
orderInformationBillToCompany = Upv1capturecontextsOrderInformationBillToCompany(
orderInformationBillToCompany = Upv1capturecontextsDataOrderInformationBillToCompany(
name = orderInformationBillToCompanyName,
address1 = orderInformationBillToCompanyAddress1,
address2 = orderInformationBillToCompanyAddress2,
Expand All @@ -118,7 +120,7 @@ def generate_unified_checkout_capture_context():
orderInformationBillToTitle = "Mr"
orderInformationBillToPhoneNumber = "1234567890"
orderInformationBillToPhoneType = "phoneType"
orderInformationBillTo = Upv1capturecontextsOrderInformationBillTo(
orderInformationBillTo = Upv1capturecontextsDataOrderInformationBillTo(
address1 = orderInformationBillToAddress1,
address2 = orderInformationBillToAddress2,
address3 = orderInformationBillToAddress3,
Expand Down Expand Up @@ -152,7 +154,7 @@ def generate_unified_checkout_capture_context():
orderInformationShipToPostalCode = "BT1 4LS"
orderInformationShipToFirstName = "Joe"
orderInformationShipToLastName = "Soap"
orderInformationShipTo = Upv1capturecontextsOrderInformationShipTo(
orderInformationShipTo = Upv1capturecontextsDataOrderInformationShipTo(
address1 = orderInformationShipToAddress1,
address2 = orderInformationShipToAddress2,
address3 = orderInformationShipToAddress3,
Expand Down Expand Up @@ -204,6 +206,18 @@ def generate_unified_checkout_capture_context():
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,
verify_jwt_signature=True
)

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
except Exception as e:
Expand Down
13 changes: 13 additions & 0 deletions samples/UnifiedCheckout/generate-unified-checkout.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
from pathlib import Path
import os
import json
Expand Down Expand Up @@ -109,6 +110,18 @@ def generate_unified_checkout_capture_context():
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,
verify_jwt_signature=True
)

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
except Exception as e:
Expand Down