Closed gnongsie closed 4 years ago
@jfreres : Hi, thank you for your interest in this code change. I have merged and released this to PyPi. Please find the release notes here.
This is fantastic. I begin some additional testing. Thanks for getting this release out so fast!
@jfreres Hi, thank you for your interest in this code change. I have merged and released this to PyPi. Please find the release notes herehttps://github.com/CyberSource/cybersource-rest-client-python/releases/tag/0.0.19.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/CyberSource/cybersource-rest-client-python/pull/50#issuecomment-669769734, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJWRKE5IJSOQWRB36BQPNQTR7JN7JANCNFSM4PVF3VDA.
@gnongsie Thanks. The action_list and action_token_types are in available now.
But still not getting a token back when using payment_with_flex_transient_token? Should this not return a token and capture payment at the same time?
def payment_with_flex_transient_token(flag, reference, cc_expiry, jwt):
clientReferenceInformationCode = str(reference.name + '-{}').format(len(reference.transaction_ids.ids))
clientReferenceInformation = Ptsv2paymentsClientReferenceInformation(
code = clientReferenceInformationCode
)
orderInformationAmountDetailsTotalAmount = str(reference.amount_total)
orderInformationAmountDetailsCurrency = str(reference.currency_id.name)
orderInformationAmountDetails = Ptsv2paymentsOrderInformationAmountDetails(
total_amount = orderInformationAmountDetailsTotalAmount,
currency = orderInformationAmountDetailsCurrency
)
processingInformationCapture = False
if flag:
processingInformationCapture = True
processingInformationActionList = []
processingInformationActionList.append("TOKEN_CREATE")
# Valid values: - customer - paymentInstrument - instrumentIdentifier - shippingAddress
processingInformationActionTokenTypes = []
processingInformationActionTokenTypes.append("customer")
processingInformationActionTokenTypes.append("paymentInstrument")
processingInformationActionTokenTypes.append("instrumentIdentifier")
#processingInformationActionTokenTypes.append("shippingAddress")
processingInformationCommerceIndicator = "internet"
processingInformation = Ptsv2paymentsProcessingInformation(
action_list = processingInformationActionList,
action_token_types = processingInformationActionTokenTypes,
capture = processingInformationCapture,
commerce_indicator = processingInformationCommerceIndicator
)
paymentInformationCardExpirationMonth = str(cc_expiry)[:2]
paymentInformationCardExpirationYear = str(cc_expiry)[-2:]
paymentInformationCard = Ptsv2paymentsPaymentInformationCard(
expiration_month = paymentInformationCardExpirationMonth,
expiration_year = paymentInformationCardExpirationYear,
)
paymentInformation = Ptsv2paymentsPaymentInformation(
card = paymentInformationCard.__dict__
)
orderInformationBillToFirstName = str(reference.partner_invoice_id.display_name)
orderInformationBillToLastName = str(reference.partner_invoice_id.display_name)
orderInformationBillToAddress1 = str(reference.partner_invoice_id.street)
orderInformationBillToLocality = str(reference.partner_invoice_id.city)
orderInformationBillToAdministrativeArea = str(reference.partner_shipping_id.state_id.code)
orderInformationBillToPostalCode = str(reference.partner_shipping_id.zip)
orderInformationBillToCountry = str(reference.partner_shipping_id.country_id.code)
orderInformationBillToDistrict = str(reference.partner_invoice_id.city)
orderInformationBillToBuildingNumber = "123"
orderInformationBillToEmail = str(reference.partner_invoice_id.email)
orderInformationBillToPhoneNumber = str(reference.partner_invoice_id.phone)
orderInformationBillTo = Ptsv2paymentsOrderInformationBillTo(
first_name = orderInformationBillToFirstName,
last_name = orderInformationBillToLastName,
address1 = orderInformationBillToAddress1,
locality = orderInformationBillToLocality,
administrative_area = orderInformationBillToAdministrativeArea,
postal_code = orderInformationBillToPostalCode,
country = orderInformationBillToCountry,
district = orderInformationBillToDistrict,
building_number = orderInformationBillToBuildingNumber,
email = orderInformationBillToEmail,
phone_number = orderInformationBillToPhoneNumber
)
orderInformation = Ptsv2paymentsOrderInformation(
amount_details = orderInformationAmountDetails.__dict__,
bill_to = orderInformationBillTo.__dict__
)
tokenInformationTransientTokenJwt = jwt
tokenInformation = Ptsv2paymentsTokenInformation(
transient_token_jwt = tokenInformationTransientTokenJwt
)
requestObj = CreatePaymentRequest(
client_reference_information = clientReferenceInformation.__dict__,
processing_information = processingInformation.__dict__,
payment_information = paymentInformation.__dict__,
order_information = orderInformation.__dict__,
token_information = tokenInformation.__dict__
)
requestObj = flex_functions.FlexFunctions.del_none(requestObj.__dict__)
requestObj = json.dumps(requestObj)
try:
config_obj = flex_configuration.FlexConfiguration()
client_config = config_obj.get_configuration()
api_instance = PaymentsApi(client_config)
return_data, status, body = api_instance.create_payment(requestObj)
print("\nAPI RESPONSE CODE : ", status)
print("\nAPI RESPONSE BODY : ", body)
print("\nAPI RETURN DATA : ", return_data)
return return_data
except Exception as e:
print("\nException when calling PaymentsApi->create_payment: %s\n" % e)
Hi @jfreres,
I tried out your code, with obvious substitutions for some of the lines. And I am able to get the token information at the end of the response.
Can you provide some information about what response you are seeing? Also, please confirm that you are using the correct value for the Flex Transient Token.
Hi @gnongsie ,
Sure. This is a test transaction returning as shown above I get no token information. API RESPONSE CODE : 201
API RESPONSE BODY : {"_links":{"void":{"method":"POST","href":"/pts/v2/payments/5967988486726499304001/voids"},"self":{"method":"GET","href":"/pts/v2/payments/5967988486726499304001"}},"clientReferenceInformation":{"code":"SO530202008070613-0"},"id":"5967988486726499304001","orderInformation":{"amountDetails":{"totalAmount":"46.14","authorizedAmount":"46.14","currency":"USD"}},"paymentAccountInformation":{"card":{"type":"001"}},"paymentInformation":{"tokenizedCard":{"type":"001"}},"pointOfSaleInformation":{"terminalId":"111111"},"processorInformation":{"approvalCode":"888888","cardVerification":{"resultCode":""},"networkTransactionId":"123456789619999","transactionId":"123456789619999","responseCode":"100","avs":{"code":"X","codeRaw":"I1"}},"reconciliationId":"794749474DAXFTGB","status":"AUTHORIZED","submitTimeUtc":"2020-08-07T11:14:08Z"}
API RETURN DATA : {'client_reference_information': {'code': 'SO530202008070613-0', 'owner_merchant_id': None, 'submit_local_date_time': None}, 'consumer_authentication_information': None, 'error_information': None, 'id': '5967988486726499304001', 'installment_information': None, 'issuer_information': None, 'links': {'_self': {'href': '/pts/v2/payments/5967988486726499304001', 'method': 'GET'}, 'capture': None, 'customer': None, 'instrument_identifier': None, 'payment_instrument': None, 'reversal': None, 'shipping_address': None}, 'order_information': {'amount_details': {'authorized_amount': '46.14', 'currency': 'USD', 'total_amount': '46.14'}, 'invoice_details': None}, 'payment_information': {'account_features': None, 'bank': None, 'card': None, 'customer': None, 'instrument_identifier': None, 'payment_instrument': None, 'shipping_address': None, 'tokenized_card': {'assurance_level': None, 'expiration_month': None, 'expiration_year': None, 'prefix': None, 'requestor_id': None, 'suffix': None, 'type': '001'}}, 'point_of_sale_information': {'amex_capn_data': None, 'emv': None, 'terminal_id': '111111'}, 'processing_information': None, 'processor_information': {'ach_verification': None, 'amex_verbal_auth_reference_number': None, 'approval_code': '888888', 'auth_indicator': None, 'avs': {'code': 'X', 'code_raw': 'I1'}, 'card_verification': {'result_code': '', 'result_code_raw': None}, 'consumer_authentication_response': None, 'customer': None, 'electronic_verification_results': None, 'forwarded_acquirer_code': None, 'master_card_authentication_type': None, 'master_card_service_code': None, 'master_card_service_reply_code': None, 'merchant_advice': None, 'merchant_number': None, 'name': None, 'network_transaction_id': '123456789619999', 'payment_account_reference_number': None, 'provider_transaction_id': None, 'response_category_code': None, 'response_code': '100', 'response_code_source': None, 'response_details': None, 'routing': None, 'system_trace_audit_number': None, 'transaction_id': '123456789619999', 'transaction_integrity_code': None}, 'reconciliation_id': '794749474DAXFTGB', 'risk_information': None, 'status': 'AUTHORIZED', 'submit_time_utc': '2020-08-07T11:14:08Z', 'token_information': None}
Hi @jfreres
Thank you for this information. I have been instructed to inform you that Token Management Service needs to be enabled for a merchant to use it in the Sandbox environment.
May I request you to contact your account manager (from Visa/CyberSource) to check if your merchant account is configured properly for this flow to work?
@gnongsie I will verify. I have been using secure acceptance, soap, and both return subscription id tokens if passing create_payment_token?
Is the release going to be merged to master and released to pip installer today>