diff --git a/config/config.example.toml b/config/config.example.toml index a9df57cb7b..4cfe6a61e3 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -183,6 +183,7 @@ adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -324,6 +325,7 @@ rewards = ["cashtocode", "zen"] cards = [ "adyen", "adyenplatform", + "archipel", "authorizedotnet", "coinbase", "coingate", @@ -475,8 +477,8 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch [zero_mandates.supported_payment_methods] -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,archipel" wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later bank_debit.ach = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit @@ -491,8 +493,8 @@ wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet" } bank_redirect.giropay = { connector_list = "globalpay" } [mandates.supported_payment_methods] -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" wallet.paypal = { connector_list = "adyen,novalnet" } # Mandate supported payment method type and connector for wallets pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later bank_debit.ach = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit @@ -1030,7 +1032,7 @@ check_token_status_url= "" # base url to check token status from token servic connector_list = "cybersource" # Supported connectors for network tokenization [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" # Supported connectors for network transaction id +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" # Supported connectors for network transaction id [grpc_client.dynamic_routing_client] # Dynamic Routing Client Configuration host = "localhost" # Client Host diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml index 11d2e4a050..554e41b502 100644 --- a/config/deployments/integration_test.toml +++ b/config/deployments/integration_test.toml @@ -27,6 +27,7 @@ adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -178,8 +179,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless,adyen" } bank_debit.bacs = { connector_list = "gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" pay_later.klarna.connector_list = "adyen" wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet" wallet.samsung_pay.connector_list = "cybersource" @@ -202,8 +203,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } bank_debit.bacs = { connector_list = "stripe,gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" pay_later.klarna.connector_list = "adyen,aci" wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo" wallet.samsung_pay.connector_list = "cybersource" @@ -230,7 +231,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" [payouts] diff --git a/config/deployments/production.toml b/config/deployments/production.toml index 8ec7d3b5db..d93add9620 100644 --- a/config/deployments/production.toml +++ b/config/deployments/production.toml @@ -31,6 +31,7 @@ adyenplatform.base_url = "https://balanceplatform-api-live.adyen.com/" airwallex.base_url = "https://api.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://api.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://www.bambora.co.nz/interface/api/dts.asmx" @@ -178,8 +179,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless,adyen" } bank_debit.bacs = { connector_list = "gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" pay_later.klarna.connector_list = "adyen" wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet" wallet.samsung_pay.connector_list = "cybersource" @@ -202,8 +203,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } bank_debit.bacs = { connector_list = "stripe,gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" pay_later.klarna.connector_list = "adyen,aci" wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo" wallet.samsung_pay.connector_list = "cybersource" @@ -230,7 +231,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card [network_transaction_id_supported_connectors] -connector_list = "adyen,stripe" +connector_list = "adyen,archipel,stripe" [payouts] payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml index 656c47bc5e..b5d3cb69cb 100644 --- a/config/deployments/sandbox.toml +++ b/config/deployments/sandbox.toml @@ -31,6 +31,7 @@ adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -178,8 +179,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless,adyen" } bank_debit.bacs = { connector_list = "gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" pay_later.klarna.connector_list = "adyen" wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet" wallet.samsung_pay.connector_list = "cybersource" @@ -202,8 +203,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } bank_debit.bacs = { connector_list = "stripe,gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" pay_later.klarna.connector_list = "adyen,aci" wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo" wallet.samsung_pay.connector_list = "cybersource" @@ -230,7 +231,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" [payouts] diff --git a/config/development.toml b/config/development.toml index a550bc0408..ccf5649951 100644 --- a/config/development.toml +++ b/config/development.toml @@ -118,6 +118,7 @@ cards = [ "adyenplatform", "airwallex", "amazonpay", + "archipel", "authorizedotnet", "bambora", "bamboraapac", @@ -231,6 +232,7 @@ adyen.dispute_base_url = "https://ca-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -903,8 +905,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless,adyen" } bank_debit.bacs = { connector_list = "gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" pay_later.klarna.connector_list = "adyen" wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet" wallet.samsung_pay.connector_list = "cybersource" @@ -928,8 +930,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } bank_debit.bacs = { connector_list = "stripe,gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel" pay_later.klarna.connector_list = "adyen,aci" wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo" wallet.samsung_pay.connector_list = "cybersource" @@ -956,7 +958,7 @@ card.credit = { connector_list = "cybersource" } card.debit = { connector_list = "cybersource" } [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" [connector_request_reference_id_config] merchant_ids_send_payment_id_as_connector_request_id = [] diff --git a/config/docker_compose.toml b/config/docker_compose.toml index 4258a9e7f3..9ac4bb7f35 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -114,6 +114,7 @@ adyen.dispute_base_url = "https://ca-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -237,6 +238,7 @@ cards = [ "adyenplatform", "airwallex", "amazonpay", + "archipel", "authorizedotnet", "bambora", "bamboraapac", @@ -809,8 +811,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless,adyen" } bank_debit.bacs = { connector_list = "gocardless" } bank_debit.sepa = { connector_list = "gocardless,adyen" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal" +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,worldpay,nmi,bankofamerica,wellsfargo,bamboraapac,nexixpay,novalnet,paypal,archipel" pay_later.klarna.connector_list = "adyen" wallet.apple_pay.connector_list = "adyen,cybersource,bankofamerica,novalnet,authorizedotnet" wallet.samsung_pay.connector_list = "cybersource" @@ -834,9 +836,8 @@ wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotn wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" } wallet.samsung_pay = { connector_list = "cybersource" } wallet.paypal = { connector_list = "adyen,novalnet,authorizedotnet" } -card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,wellsfargo" } -card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,wellsfargo" } - +card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo" } +card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo" } bank_debit.ach = { connector_list = "gocardless,adyen" } bank_debit.becs = { connector_list = "gocardless" } bank_debit.bacs = { connector_list = "adyen" } @@ -850,7 +851,7 @@ card.credit = { connector_list = "cybersource" } card.debit = { connector_list = "cybersource" } [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" [connector_customer] connector_list = "gocardless,stax,stripe,facilitapay" diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs index de8d6fe436..a0ef01f4f1 100644 --- a/crates/common_enums/src/connector_enums.rs +++ b/crates/common_enums/src/connector_enums.rs @@ -62,6 +62,7 @@ pub enum RoutableConnectors { Adyen, Airwallex, // Amazonpay, + Archipel, Authorizedotnet, Bankofamerica, Billwerk, @@ -211,6 +212,7 @@ pub enum Connector { Adyen, Airwallex, // Amazonpay, + Archipel, Authorizedotnet, Bambora, Bamboraapac, @@ -473,7 +475,7 @@ impl Connector { | Self::Noon | Self::Stripe | Self::Datatrans => false, - Self::Checkout | Self::Nmi |Self::Cybersource => true, + Self::Checkout | Self::Nmi |Self::Cybersource | Self::Archipel => true, } } @@ -535,6 +537,7 @@ impl From for Connector { RoutableConnectors::Aci => Self::Aci, RoutableConnectors::Adyen => Self::Adyen, RoutableConnectors::Airwallex => Self::Airwallex, + RoutableConnectors::Archipel => Self::Archipel, RoutableConnectors::Authorizedotnet => Self::Authorizedotnet, RoutableConnectors::Bankofamerica => Self::Bankofamerica, RoutableConnectors::Billwerk => Self::Billwerk, @@ -646,6 +649,7 @@ impl TryFrom for RoutableConnectors { Connector::Aci => Ok(Self::Aci), Connector::Adyen => Ok(Self::Adyen), Connector::Airwallex => Ok(Self::Airwallex), + Connector::Archipel => Ok(Self::Archipel), Connector::Authorizedotnet => Ok(Self::Authorizedotnet), Connector::Bankofamerica => Ok(Self::Bankofamerica), Connector::Billwerk => Ok(Self::Billwerk), diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs index 0b16aa4d03..78f85c8257 100644 --- a/crates/connector_configs/src/common_config.rs +++ b/crates/connector_configs/src/common_config.rs @@ -108,6 +108,8 @@ pub struct ApiModelMetaData { pub card_brands: Option>, pub merchant_category_code: Option, pub merchant_configuration_id: Option, + pub tenant_id: Option, + pub platform_url: Option, } #[serde_with::skip_serializing_none] diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index 2ec4dd140d..61c9e1ca69 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -122,6 +122,8 @@ pub struct ConfigMetadata { pub currency_id: Option, pub platform_id: Option, pub ledger_account_id: Option, + pub tenant_id: Option, + pub platform_url: Option, } #[serde_with::skip_serializing_none] @@ -168,6 +170,7 @@ pub struct ConnectorConfig { #[cfg(feature = "payouts")] pub adyenplatform_payout: Option, pub airwallex: Option, + pub archipel: Option, pub authorizedotnet: Option, pub bamboraapac: Option, pub bankofamerica: Option, @@ -349,6 +352,7 @@ impl ConnectorConfig { Connector::Adyen => Ok(connector_data.adyen), Connector::Adyenplatform => Err("Use get_payout_connector_config".to_string()), Connector::Airwallex => Ok(connector_data.airwallex), + Connector::Archipel => Ok(connector_data.archipel), Connector::Authorizedotnet => Ok(connector_data.authorizedotnet), Connector::Bamboraapac => Ok(connector_data.bamboraapac), Connector::Bankofamerica => Ok(connector_data.bankofamerica), diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml index bbfcd7f9af..a4403923fd 100644 --- a/crates/connector_configs/toml/development.toml +++ b/crates/connector_configs/toml/development.toml @@ -5826,3 +5826,107 @@ api_secret="Secret Key" [facilitapay.connector_auth.BodyKey] api_key="Password" key1="Username" + +[archipel] +[[archipel.credit]] +payment_method_type = "Mastercard" +[[archipel.credit]] +payment_method_type = "Visa" +[[archipel.credit]] +payment_method_type = "AmericanExpress" +[[archipel.credit]] +payment_method_type = "DinersClub" +[[archipel.credit]] +payment_method_type = "Discover" +[[archipel.credit]] +payment_method_type = "CartesBancaires" +[[archipel.debit]] +payment_method_type = "Mastercard" +[[archipel.debit]] +payment_method_type = "Visa" +[[archipel.debit]] +payment_method_type = "AmericanExpress" +[[archipel.debit]] +payment_method_type = "DinersClub" +[[archipel.debit]] +payment_method_type = "Discover" +[[archipel.debit]] +payment_method_type = "CartesBancaires" +[[archipel.wallet]] +payment_method_type = "apple_pay" +[archipel.metadata.tenant_id] +name = "tenant_id" +label = "Tenant ID" +placeholder = "Enter Archipel tenantID" +required = true +type = "Text" +[archipel.metadata.platform_url] +name = "platform_url" +label = "Platform Endpoint Prefix" +placeholder = "E.g. 192.0.0.1:8080" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "certificate" +label = "Merchant Certificate (Base64 Encoded)" +placeholder = "Enter Merchant Certificate (Base64 Encoded)" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "certificate_keys" +label = "Merchant PrivateKey (Base64 Encoded)" +placeholder = "Enter Merchant PrivateKey (Base64 Encoded)" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "merchant_identifier" +label = "Apple Merchant Identifier" +placeholder = "Enter Apple Merchant Identifier" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "display_name" +label = "Display Name" +placeholder = "Enter Display Name" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "initiative" +label = "Domain" +placeholder = "Enter Domain" +required = true +type = "Select" +options = ["web", "ios"] +[[archipel.metadata.apple_pay]] +name = "initiative_context" +label = "Domain Name" +placeholder = "Enter Domain Name" +required = true +type = "Text" +[[archipel.metadata.apple_pay]] +name = "merchant_business_country" +label = "Merchant Business Country" +placeholder = "Enter Merchant Business Country" +required = true +type = "Select" +options = [] +[[archipel.metadata.apple_pay]] +name = "payment_processing_details_at" +label = "Payment Processing Details At" +placeholder = "Enter Payment Processing Details At" +required = true +type = "Radio" +options = ["Hyperswitch"] + +[archipel.metadata.acquirer_bin] +name = "acquirer_bin" +label = "Acquirer Bin" +placeholder = "Enter Acquirer Bin" +required = false +type = "Text" +[archipel.metadata.acquirer_merchant_id] +name = "acquirer_merchant_id" +label = "Acquirer Merchant ID" +placeholder = "Enter Acquirer Merchant ID" +required = false +type = "Text" diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml index e794813e3d..9900edbba8 100644 --- a/crates/connector_configs/toml/production.toml +++ b/crates/connector_configs/toml/production.toml @@ -4412,3 +4412,107 @@ type="Text" [facilitapay.connector_auth.BodyKey] api_key="Password" key1="Username" + +[archipel] +[[archipel.credit]] +payment_method_type = "Mastercard" +[[archipel.credit]] +payment_method_type = "Visa" +[[archipel.credit]] +payment_method_type = "AmericanExpress" +[[archipel.credit]] +payment_method_type = "DinersClub" +[[archipel.credit]] +payment_method_type = "Discover" +[[archipel.credit]] +payment_method_type = "CartesBancaires" +[[archipel.debit]] +payment_method_type = "Mastercard" +[[archipel.debit]] +payment_method_type = "Visa" +[[archipel.debit]] +payment_method_type = "AmericanExpress" +[[archipel.debit]] +payment_method_type = "DinersClub" +[[archipel.debit]] +payment_method_type = "Discover" +[[archipel.debit]] +payment_method_type = "CartesBancaires" +[[archipel.wallet]] +payment_method_type = "apple_pay" +[archipel.metadata.tenant_id] +name="tenant_id" +label="Tenant ID" +placeholder="Enter Archipel tenantID" +required=true +type="Text" +[archipel.metadata.platform_url] +name="platform_url" +label="Platform Endpoint Prefix" +placeholder="E.g. 192.0.0.1:8080" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="certificate" +label="Merchant Certificate (Base64 Encoded)" +placeholder="Enter Merchant Certificate (Base64 Encoded)" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="certificate_keys" +label="Merchant PrivateKey (Base64 Encoded)" +placeholder="Enter Merchant PrivateKey (Base64 Encoded)" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="merchant_identifier" +label="Apple Merchant Identifier" +placeholder="Enter Apple Merchant Identifier" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="display_name" +label="Display Name" +placeholder="Enter Display Name" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="initiative" +label="Domain" +placeholder="Enter Domain" +required=true +type="Select" +options=["web","ios"] +[[archipel.metadata.apple_pay]] +name="initiative_context" +label="Domain Name" +placeholder="Enter Domain Name" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="merchant_business_country" +label="Merchant Business Country" +placeholder="Enter Merchant Business Country" +required=true +type="Select" +options=[] +[[archipel.metadata.apple_pay]] +name="payment_processing_details_at" +label="Payment Processing Details At" +placeholder="Enter Payment Processing Details At" +required=true +type="Radio" +options=["Hyperswitch"] + +[archipel.metadata.acquirer_bin] +name = "acquirer_bin" +label = "Acquirer Bin" +placeholder = "Enter Acquirer Bin" +required = false +type = "Text" +[archipel.metadata.acquirer_merchant_id] +name = "acquirer_merchant_id" +label = "Acquirer Merchant ID" +placeholder = "Enter Acquirer Merchant ID" +required = false +type = "Text" diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index 428e90fb8e..d9dea35440 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -5801,3 +5801,107 @@ api_secret = "Secret Key" [facilitapay.connector_auth.BodyKey] api_key="Password" key1="Username" + +[archipel] +[[archipel.credit]] +payment_method_type = "Mastercard" +[[archipel.credit]] +payment_method_type = "Visa" +[[archipel.credit]] +payment_method_type = "AmericanExpress" +[[archipel.credit]] +payment_method_type = "DinersClub" +[[archipel.credit]] +payment_method_type = "Discover" +[[archipel.credit]] +payment_method_type = "CartesBancaires" +[[archipel.debit]] +payment_method_type = "Mastercard" +[[archipel.debit]] +payment_method_type = "Visa" +[[archipel.debit]] +payment_method_type = "AmericanExpress" +[[archipel.debit]] +payment_method_type = "DinersClub" +[[archipel.debit]] +payment_method_type = "Discover" +[[archipel.debit]] +payment_method_type = "CartesBancaires" +[[archipel.wallet]] +payment_method_type = "apple_pay" +[archipel.metadata.tenant_id] +name="tenant_id" +label="Tenant ID" +placeholder="Enter Archipel tenantID" +required=true +type="Text" +[archipel.metadata.platform_url] +name="platform_url" +label="Platform Endpoint Prefix" +placeholder="E.g. 192.0.0.1:8080" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="certificate" +label="Merchant Certificate (Base64 Encoded)" +placeholder="Enter Merchant Certificate (Base64 Encoded)" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="certificate_keys" +label="Merchant PrivateKey (Base64 Encoded)" +placeholder="Enter Merchant PrivateKey (Base64 Encoded)" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="merchant_identifier" +label="Apple Merchant Identifier" +placeholder="Enter Apple Merchant Identifier" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="display_name" +label="Display Name" +placeholder="Enter Display Name" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="initiative" +label="Domain" +placeholder="Enter Domain" +required=true +type="Select" +options=["web","ios"] +[[archipel.metadata.apple_pay]] +name="initiative_context" +label="Domain Name" +placeholder="Enter Domain Name" +required=true +type="Text" +[[archipel.metadata.apple_pay]] +name="merchant_business_country" +label="Merchant Business Country" +placeholder="Enter Merchant Business Country" +required=true +type="Select" +options=[] +[[archipel.metadata.apple_pay]] +name="payment_processing_details_at" +label="Payment Processing Details At" +placeholder="Enter Payment Processing Details At" +required=true +type="Radio" +options=["Hyperswitch"] + +[archipel.metadata.acquirer_bin] +name = "acquirer_bin" +label = "Acquirer Bin" +placeholder = "Enter Acquirer Bin" +required = false +type = "Text" +[archipel.metadata.acquirer_merchant_id] +name = "acquirer_merchant_id" +label = "Acquirer Merchant ID" +placeholder = "Enter Acquirer Merchant ID" +required = false +type = "Text" diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs index 009bec8c92..0dcd327c13 100644 --- a/crates/hyperswitch_connectors/src/connectors.rs +++ b/crates/hyperswitch_connectors/src/connectors.rs @@ -3,6 +3,7 @@ pub mod adyen; pub mod adyenplatform; pub mod airwallex; pub mod amazonpay; +pub mod archipel; pub mod authorizedotnet; pub mod bambora; pub mod bamboraapac; @@ -98,7 +99,7 @@ pub mod zen; pub mod zsl; pub use self::{ aci::Aci, adyen::Adyen, adyenplatform::Adyenplatform, airwallex::Airwallex, - amazonpay::Amazonpay, authorizedotnet::Authorizedotnet, bambora::Bambora, + amazonpay::Amazonpay, archipel::Archipel, authorizedotnet::Authorizedotnet, bambora::Bambora, bamboraapac::Bamboraapac, bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, boku::Boku, braintree::Braintree, cashtocode::Cashtocode, chargebee::Chargebee, checkout::Checkout, coinbase::Coinbase, coingate::Coingate, diff --git a/crates/hyperswitch_connectors/src/connectors/archipel.rs b/crates/hyperswitch_connectors/src/connectors/archipel.rs new file mode 100644 index 0000000000..3f7a7224c4 --- /dev/null +++ b/crates/hyperswitch_connectors/src/connectors/archipel.rs @@ -0,0 +1,1071 @@ +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; +use common_enums::enums; +use common_utils::{ + errors::CustomResult, + ext_traits::{ByteSliceExt, ValueExt}, + request::{Method, Request, RequestBuilder, RequestContent}, + types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, +}; +use error_stack::{report, ResultExt}; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, + IncrementalAuthorization, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsIncrementalAuthorizationData, + PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsIncrementalAuthorizationRouterData, PaymentsSyncRouterData, RefundSyncRouterData, + RefundsRouterData, SetupMandateRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + consts::NO_ERROR_MESSAGE, + errors, + events::connector_api_logs::ConnectorEvent, + types::Response, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::Maskable; +use router_env::{error, info}; +use transformers::{ + self as archipel, ArchipelCardAuthorizationRequest, ArchipelIncrementalAuthorizationRequest, + ArchipelPaymentsCancelRequest, ArchipelRefundRequest, ArchipelWalletAuthorizationRequest, +}; + +use crate::{ + capture_method_not_supported, + constants::headers, + types::ResponseRouterData, + utils::{is_mandate_supported, PaymentMethodDataType, PaymentsAuthorizeRequestData}, +}; + +pub mod transformers; + +#[derive(Clone)] +pub struct Archipel { + amount_converter: &'static (dyn AmountConvertor + Sync), +} + +impl Archipel { + pub const fn new() -> &'static Self { + &Self { + amount_converter: &MinorUnitForConnector, + } + } +} + +impl api::PaymentAuthorize for Archipel {} +impl api::PaymentSync for Archipel {} +impl api::PaymentVoid for Archipel {} +impl api::PaymentCapture for Archipel {} +impl api::MandateSetup for Archipel {} +impl api::ConnectorAccessToken for Archipel {} +impl api::PaymentToken for Archipel {} +impl api::PaymentSession for Archipel {} +impl api::Refund for Archipel {} +impl api::RefundExecute for Archipel {} +impl api::RefundSync for Archipel {} +impl api::Payment for Archipel {} +impl api::PaymentIncrementalAuthorization for Archipel {} +impl api::ConnectorSpecifications for Archipel {} + +fn build_env_specific_endpoint( + base_url: &str, + connector_metadata: &Option, +) -> CustomResult { + let archipel_connector_metadata_object = + transformers::ArchipelConfigData::try_from(connector_metadata)?; + let endpoint_prefix = archipel_connector_metadata_object.platform_url; + Ok(base_url.replace("{{merchant_endpoint_prefix}}", &endpoint_prefix)) +} + +impl ConnectorCommonExt for Archipel +where + Self: ConnectorIntegration, +{ + fn build_headers( + &self, + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + let mut header = vec![( + headers::CONTENT_TYPE.to_string(), + self.get_content_type().to_string().into(), + )]; + let mut api_key = self.get_auth_header(&req.connector_auth_type)?; + header.append(&mut api_key); + Ok(header) + } +} + +impl ConnectorCommon for Archipel { + fn id(&self) -> &'static str { + "archipel" + } + + fn get_currency_unit(&self) -> api::CurrencyUnit { + api::CurrencyUnit::Minor + } + + fn get_auth_header( + &self, + _auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { + Ok(vec![]) + } + + fn common_get_content_type(&self) -> &'static str { + "application/json" + } + + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { + connectors.archipel.base_url.as_ref() + } + + fn build_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + let archipel_error: CustomResult< + archipel::ArchipelErrorMessage, + common_utils::errors::ParsingError, + > = res.response.parse_struct("ArchipelErrorMessage"); + + match archipel_error { + Ok(err) => { + event_builder.map(|i| i.set_error_response_body(&err)); + info!(connector_response=?err); + + Ok(ErrorResponse { + status_code: res.status_code, + code: err.code, + attempt_status: None, + connector_transaction_id: None, + message: err + .description + .clone() + .unwrap_or(NO_ERROR_MESSAGE.to_string()), + reason: err.description, + network_decline_code: None, + network_advice_code: None, + network_error_message: None, + }) + } + Err(error) => { + event_builder.map(|event| { + event.set_error(serde_json::json!({ + "error": res.response.escape_ascii().to_string(), + "status_code": res.status_code + })) + }); + error!(deserialization_error=?error); + crate::utils::handle_json_response_deserialization_failure(res, "archipel") + } + } + } +} + +impl ConnectorValidation for Archipel { + fn validate_connector_against_payment_request( + &self, + capture_method: Option, + _payment_method: common_enums::PaymentMethod, + pmt: Option, + ) -> CustomResult<(), errors::ConnectorError> { + let capture_method = capture_method.unwrap_or_default(); + + match capture_method { + enums::CaptureMethod::Automatic + | enums::CaptureMethod::SequentialAutomatic + | enums::CaptureMethod::Manual => Ok(()), + enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => { + let connector = self.id(); + match pmt { + Some(payment_method_type) => { + capture_method_not_supported!( + connector, + capture_method, + payment_method_type + ) + } + None => capture_method_not_supported!(connector, capture_method), + } + } + } + } + + fn validate_mandate_payment( + &self, + pm_type: Option, + pm_data: PaymentMethodData, + ) -> CustomResult<(), errors::ConnectorError> { + let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]); + + is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) + } +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult { + let capture_method = req + .request + .capture_method + .ok_or(errors::ConnectorError::CaptureMethodNotSupported)?; + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + match capture_method { + enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => { + Ok(format!("{}{}", base_url, "/pay")) + } + enums::CaptureMethod::Manual => Ok(format!("{}{}", base_url, "/authorize")), + enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => { + Err(report!(errors::ConnectorError::CaptureMethodNotSupported)) + } + } + } + + fn get_request_body( + &self, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let amount = crate::utils::convert_amount( + self.amount_converter, + req.request.minor_amount, + req.request.currency, + )?; + let router_data: archipel::ArchipelRouterData<_> = + (amount, config_data.tenant_id, req).into(); + + if req.request.is_wallet() { + let request: ArchipelWalletAuthorizationRequest = router_data.try_into()?; + Ok(RequestContent::Json(Box::new(request))) + } else { + let request: ArchipelCardAuthorizationRequest = router_data.try_into()?; + Ok(RequestContent::Json(Box::new(request))) + } + } + + fn build_request( + &self, + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsAuthorizeRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for Authorize flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl + ConnectorIntegration< + IncrementalAuthorization, + PaymentsIncrementalAuthorizationData, + PaymentsResponseData, + > for Archipel +{ + fn get_headers( + &self, + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + let connector_payment_id = req.request.connector_transaction_id.clone(); + + Ok(format!( + "{}{}{}", + base_url, "/incrementAuthorization/", connector_payment_id + )) + } + + fn get_request_body( + &self, + req: &PaymentsIncrementalAuthorizationRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let router_data: archipel::ArchipelRouterData<_> = ( + MinorUnit::new(req.request.additional_amount), + config_data.tenant_id, + req, + ) + .into(); + let request: ArchipelIncrementalAuthorizationRequest = router_data.into(); + + Ok(RequestContent::Json(Box::new(request))) + } + + fn build_request( + &self, + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsIncrementalAuthorizationRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for IncrementalAuthorization flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + let metadata: archipel::ArchipelTransactionMetadata = req + .request + .connector_meta + .clone() + .and_then(|value| value.parse_value("ArchipelTransactionMetadata").ok()) + .ok_or_else(|| errors::ConnectorError::MissingConnectorTransactionID)?; + + Ok(format!( + "{}{}{}", + base_url, "/transactions/", metadata.transaction_id + )) + } + + fn build_request( + &self, + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Get) + .url(url) + .attach_default_headers() + .headers(headers) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsSyncRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for PSync flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + + Ok(format!( + "{}{}{}", + base_url, "/capture/", req.request.connector_transaction_id + )) + } + + fn get_request_body( + &self, + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let amount_to_capture = crate::utils::convert_amount( + self.amount_converter, + req.request.minor_amount_to_capture, + req.request.currency, + )?; + let router_data: archipel::ArchipelRouterData<_> = + (amount_to_capture, config_data.tenant_id, req).into(); + let request: archipel::ArchipelCaptureRequest = router_data.into(); + + Ok(RequestContent::Json(Box::new(request))) + } + + fn build_request( + &self, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsCaptureRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for Capture flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration + for Archipel +{ + fn get_headers( + &self, + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + + Ok(format!("{}{}", base_url, "/verify")) + } + + fn get_request_body( + &self, + req: &SetupMandateRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let router_data: archipel::ArchipelRouterData<_> = + (MinorUnit::zero(), config_data.tenant_id, req).into(); + let request: ArchipelCardAuthorizationRequest = router_data.try_into()?; + + Ok(RequestContent::Json(Box::new(request))) + } + + fn build_request( + &self, + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &SetupMandateRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for SetupMandate flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + + Ok(format!( + "{}{}{}", + base_url, "/refund/", req.request.connector_transaction_id + )) + } + + fn get_request_body( + &self, + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let refund_amount = crate::utils::convert_amount( + self.amount_converter, + req.request.minor_refund_amount, + req.request.currency, + )?; + let router_data: archipel::ArchipelRouterData<_> = + (refund_amount, config_data.tenant_id, req).into(); + let request: ArchipelRefundRequest = router_data.into(); + + Ok(RequestContent::Json(Box::new(request))) + } + + fn build_request( + &self, + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &RefundsRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult, errors::ConnectorError> { + let response: archipel::ArchipelRefundResponse = res + .response + .parse_struct("ArchipelRefundResponse for Execute flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &RefundSyncRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let platform_url = &config_data.platform_url; + let metadata: archipel::ArchipelTransactionMetadata = req + .request + .connector_metadata + .clone() + .and_then(|value| value.parse_value("ArchipelTransactionMetadata").ok()) + .ok_or_else(|| errors::ConnectorError::MissingConnectorTransactionID)?; + + Ok(format!( + "{platform_url}{}{}", + "Transaction/v1/transactions/", metadata.transaction_id + )) + } + + fn build_request( + &self, + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Get) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &RefundSyncRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelRefundResponse = res + .response + .parse_struct("ArchipelRefundResponse for RSync flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration + for Archipel +{ + // Not Implemented (R) +} + +impl ConnectorIntegration for Archipel { + // Not Implemented (R) +} + +impl ConnectorIntegration for Archipel { + // Not Implemented (R) +} + +impl ConnectorIntegration for Archipel { + fn get_headers( + &self, + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult { + let base_url = + build_env_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?; + + Ok(format!( + "{}{}{}", + base_url, "/cancel/", req.request.connector_transaction_id + )) + } + + fn get_request_body( + &self, + req: &PaymentsCancelRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let config_data: archipel::ArchipelConfigData = (&req.connector_meta_data).try_into()?; + let router_data: archipel::ArchipelRouterData<_> = ( + req.request + .minor_amount + .ok_or(errors::ConnectorError::MissingRequiredField { + field_name: "Amount", + })?, + config_data.tenant_id, + req, + ) + .into(); + let request: ArchipelPaymentsCancelRequest = router_data.into(); + + Ok(RequestContent::Json(Box::new(request))) + } + + fn build_request( + &self, + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let url = &self.get_url(req, connectors)?; + let headers = self.get_headers(req, connectors)?; + let body = self.get_request_body(req, connectors)?; + + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(url) + .attach_default_headers() + .headers(headers) + .set_body(body) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsCancelRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: archipel::ArchipelPaymentsResponse = res + .response + .parse_struct("ArchipelPaymentsResponse for Void flow") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|event| event.set_response_body(&response)); + info!(connector_response=?response); + + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } + + fn get_5xx_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +#[async_trait::async_trait] +impl IncomingWebhook for Archipel { + fn get_webhook_object_reference_id( + &self, + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } + + fn get_webhook_event_type( + &self, + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } + + fn get_webhook_resource_object( + &self, + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult, errors::ConnectorError> { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } +} diff --git a/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs b/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs new file mode 100644 index 0000000000..7cfee92d33 --- /dev/null +++ b/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs @@ -0,0 +1,1394 @@ +use bytes::Bytes; +use common_enums::{ + self, AttemptStatus, AuthorizationStatus, CaptureMethod, Currency, FutureUsage, + PaymentMethodStatus, RefundStatus, +}; +use common_utils::{ext_traits::Encode, pii, types::MinorUnit}; +use error_stack::ResultExt; +use hyperswitch_domain_models::{ + address::AddressDetails, + payment_method_data::{Card, PaymentMethodData, WalletData}, + router_data::{ConnectorAuthType, ErrorResponse, PaymentMethodToken, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::{ + AuthenticationData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, + PaymentsIncrementalAuthorizationData, PaymentsSyncData, ResponseId, + SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsIncrementalAuthorizationRouterData, RefundsRouterData, SetupMandateRouterData, + }, +}; +use hyperswitch_interfaces::{consts, errors}; +use masking::Secret; +use serde::{Deserialize, Serialize}; + +use crate::{ + types::{RefundsResponseRouterData, ResponseRouterData}, + unimplemented_payment_method, + utils::{ + self, AddressData, AddressDetailsData, ApplePayDecrypt, CardData, CardIssuer, + PaymentsAuthorizeRequestData, RouterData as _, + }, +}; + +const THREE_DS_MAX_SUPPORTED_VERSION: &str = "2.2.0"; + +#[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone)] +#[serde(transparent)] +pub struct ArchipelTenantId(pub String); + +impl From for ArchipelTenantId { + fn from(value: String) -> Self { + Self(value) + } +} + +pub struct ArchipelRouterData { + pub amount: MinorUnit, + pub tenant_id: ArchipelTenantId, + pub router_data: T, +} + +impl From<(MinorUnit, ArchipelTenantId, T)> for ArchipelRouterData { + fn from((amount, tenant_id, router_data): (MinorUnit, ArchipelTenantId, T)) -> Self { + Self { + amount, + tenant_id, + router_data, + } + } +} + +pub struct ArchipelAuthType {} + +impl TryFrom<&ConnectorAuthType> for ArchipelAuthType { + type Error = error_stack::Report; + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { + ConnectorAuthType::NoKey => Ok(Self {}), + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + } +} + +#[derive(Debug, Deserialize, Serialize, Eq, PartialEq)] +pub struct ArchipelConfigData { + pub tenant_id: ArchipelTenantId, + pub platform_url: String, +} + +impl TryFrom<&Option> for ArchipelConfigData { + type Error = error_stack::Report; + fn try_from(connector_metadata: &Option) -> Result { + let config_data = utils::to_connector_meta_from_secret::(connector_metadata.clone()) + .change_context(errors::ConnectorError::InvalidConnectorConfig { + config: "metadata. Required fields: tenant_id, platform_url", + })?; + Ok(config_data) + } +} + +#[derive(Debug, Default, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "UPPERCASE")] +pub enum ArchipelPaymentInitiator { + #[default] + Customer, + Merchant, +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ArchipelWalletProvider { + ApplePay, + GooglePay, + SamsungPay, +} + +#[derive(Debug, Default, Serialize, Eq, PartialEq)] +#[serde(rename_all = "UPPERCASE")] +pub enum ArchipelPaymentCertainty { + #[default] + Final, + Estimated, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelOrderRequest { + amount: MinorUnit, + currency: String, + certainty: ArchipelPaymentCertainty, + initiator: ArchipelPaymentInitiator, +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +pub struct CardExpiryDate { + month: Secret, + year: Secret, +} + +#[derive(Debug, Serialize, Default, Eq, PartialEq, Clone)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ApplicationSelectionIndicator { + #[default] + ByDefault, + CustomerChoice, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct Archipel3DS { + #[serde(rename = "acsTransID")] + acs_trans_id: Option>, + #[serde(rename = "dsTransID")] + ds_trans_id: Option>, + #[serde(rename = "3DSRequestorName")] + three_ds_requestor_name: Option>, + #[serde(rename = "3DSAuthDate")] + three_ds_auth_date: Option, + #[serde(rename = "3DSAuthAmt")] + three_ds_auth_amt: Option, + #[serde(rename = "3DSAuthStatus")] + three_ds_auth_status: Option, + #[serde(rename = "3DSMaxSupportedVersion")] + three_ds_max_supported_version: String, + #[serde(rename = "3DSVersion")] + three_ds_version: Option, + authentication_value: Secret, + authentication_method: Option>, + eci: Option>, +} + +impl From for Archipel3DS { + fn from(three_ds_data: AuthenticationData) -> Self { + Self { + acs_trans_id: None, + ds_trans_id: three_ds_data.ds_trans_id.map(Secret::new), + three_ds_requestor_name: None, + three_ds_auth_date: None, + three_ds_auth_amt: None, + three_ds_auth_status: None, + three_ds_max_supported_version: THREE_DS_MAX_SUPPORTED_VERSION.into(), + three_ds_version: three_ds_data.message_version, + authentication_value: Secret::new(three_ds_data.cavv), + authentication_method: None, + eci: three_ds_data.eci.map(Secret::new), + } + } +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelCardHolder { + billing_address: Option, +} + +impl TryFrom> for ArchipelCardHolder { + type Error = (); + fn try_from(value: Option) -> Result { + Ok(Self { + billing_address: value, + }) + } +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelBillingAddress { + address: Secret, + postal_code: Secret, +} + +impl TryFrom<&AddressDetails> for ArchipelBillingAddress { + type Error = error_stack::Report; + fn try_from(address_details: &AddressDetails) -> Result { + Ok(Self { + address: address_details.get_combined_address_line()?, + postal_code: address_details.get_zip()?.clone(), + }) + } +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "UPPERCASE")] +pub enum ArchipelCredentialIndicatorStatus { + Initial, + Subsequent, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelCredentialIndicator { + status: ArchipelCredentialIndicatorStatus, + recurring: Option, + transaction_id: Option, +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct TokenizedCardData { + card_data: ArchipelTokenizedCard, + wallet_information: ArchipelWalletInformation, +} + +impl TryFrom<(&WalletData, &Option)> for TokenizedCardData { + type Error = error_stack::Report; + fn try_from( + (wallet_data, pm_token): (&WalletData, &Option), + ) -> Result { + let WalletData::ApplePay(apple_pay_data) = wallet_data else { + return Err(error_stack::Report::from( + errors::ConnectorError::NotSupported { + message: "Wallet type used".to_string(), + connector: "Archipel", + }, + )); + }; + + let Some(PaymentMethodToken::ApplePayDecrypt(apple_pay_decrypt_data)) = pm_token else { + return Err(error_stack::Report::from(unimplemented_payment_method!( + "Apple Pay", + "Manual", + "Archipel" + ))); + }; + + let card_number = apple_pay_decrypt_data + .application_primary_account_number + .clone(); + + let expiry_year_2_digit = apple_pay_decrypt_data.get_two_digit_expiry_year()?; + let expiry_month = apple_pay_decrypt_data.get_expiry_month()?; + + Ok(Self { + card_data: ArchipelTokenizedCard { + expiry: CardExpiryDate { + year: expiry_year_2_digit, + month: expiry_month, + }, + number: card_number, + scheme: ArchipelCardScheme::from(apple_pay_data.payment_method.network.as_str()), + }, + wallet_information: { + ArchipelWalletInformation { + wallet_provider: ArchipelWalletProvider::ApplePay, + wallet_indicator: apple_pay_decrypt_data.payment_data.eci_indicator.clone(), + wallet_cryptogram: apple_pay_decrypt_data + .payment_data + .online_payment_cryptogram + .clone(), + } + }, + }) + } +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelTokenizedCard { + number: Secret, + expiry: CardExpiryDate, + scheme: ArchipelCardScheme, +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelCard { + number: cards::CardNumber, + expiry: CardExpiryDate, + security_code: Option>, + card_holder_name: Option>, + application_selection_indicator: ApplicationSelectionIndicator, + scheme: ArchipelCardScheme, +} + +impl TryFrom<(Option>, &Card)> for ArchipelCard { + type Error = error_stack::Report; + fn try_from( + (card_holder_name, ccard): (Option>, &Card), + ) -> Result { + let scheme: ArchipelCardScheme = ccard.get_card_issuer().ok().into(); + Ok(Self { + number: ccard.card_number.clone(), + expiry: CardExpiryDate { + month: ccard.card_exp_month.clone(), + year: ccard.get_card_expiry_year_2_digit()?, + }, + security_code: Some(ccard.card_cvc.clone()), + application_selection_indicator: ApplicationSelectionIndicator::ByDefault, + card_holder_name: ccard.card_holder_name.clone().or(card_holder_name), + scheme, + }) + } +} + +impl + TryFrom<( + Option>, + &hyperswitch_domain_models::payment_method_data::CardDetailsForNetworkTransactionId, + )> for ArchipelCard +{ + type Error = error_stack::Report; + fn try_from( + (card_holder_name, card_details): ( + Option>, + &hyperswitch_domain_models::payment_method_data::CardDetailsForNetworkTransactionId, + ), + ) -> Result { + let scheme: ArchipelCardScheme = card_details.get_card_issuer().ok().into(); + Ok(Self { + number: card_details.card_number.clone(), + expiry: CardExpiryDate { + month: card_details.card_exp_month.clone(), + year: card_details.get_card_expiry_year_2_digit()?, + }, + security_code: None, + application_selection_indicator: ApplicationSelectionIndicator::ByDefault, + card_holder_name: card_details.card_holder_name.clone().or(card_holder_name), + scheme, + }) + } +} + +#[derive(Debug, Serialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelWalletInformation { + wallet_indicator: Option, + wallet_provider: ArchipelWalletProvider, + wallet_cryptogram: Secret, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelPaymentInformation { + order: ArchipelOrderRequest, + cardholder: Option, + card_holder_name: Option>, + credential_indicator: Option, + stored_on_file: bool, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelWalletAuthorizationRequest { + order: ArchipelOrderRequest, + card: ArchipelTokenizedCard, + cardholder: Option, + wallet: ArchipelWalletInformation, + #[serde(rename = "3DS")] + three_ds: Option, + credential_indicator: Option, + stored_on_file: bool, + tenant_id: ArchipelTenantId, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelCardAuthorizationRequest { + order: ArchipelOrderRequest, + card: ArchipelCard, + cardholder: Option, + #[serde(rename = "3DS")] + three_ds: Option, + credential_indicator: Option, + stored_on_file: bool, + tenant_id: ArchipelTenantId, +} + +// PaymentsResponse + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "UPPERCASE")] +pub enum ArchipelCardScheme { + Amex, + Mastercard, + Visa, + Discover, + Diners, + Unknown, +} + +impl From<&str> for ArchipelCardScheme { + fn from(input: &str) -> Self { + match input { + "Visa" => Self::Visa, + "Amex" => Self::Amex, + "Diners" => Self::Diners, + "Mastercard" => Self::Mastercard, + "Discover" => Self::Discover, + _ => Self::Unknown, + } + } +} + +impl From> for ArchipelCardScheme { + fn from(card_issuer: Option) -> Self { + match card_issuer { + Some(CardIssuer::Visa) => Self::Visa, + Some(CardIssuer::Master | CardIssuer::Maestro) => Self::Mastercard, + Some(CardIssuer::AmericanExpress) => Self::Amex, + Some(CardIssuer::Discover) => Self::Discover, + Some(CardIssuer::DinersClub) => Self::Diners, + _ => Self::Unknown, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +#[serde(rename_all = "lowercase")] +pub enum ArchipelPaymentStatus { + #[default] + Succeeded, + Failed, +} + +impl TryFrom<(AttemptStatus, CaptureMethod)> for ArchipelPaymentFlow { + type Error = errors::ConnectorError; + + fn try_from( + (status, capture_method): (AttemptStatus, CaptureMethod), + ) -> Result { + let is_auto_capture = matches!(capture_method, CaptureMethod::Automatic); + + match status { + AttemptStatus::AuthenticationFailed => Ok(Self::Verify), + AttemptStatus::Authorizing + | AttemptStatus::Authorized + | AttemptStatus::AuthorizationFailed => Ok(Self::Authorize), + AttemptStatus::Voided | AttemptStatus::VoidInitiated | AttemptStatus::VoidFailed => { + Ok(Self::Cancel) + } + AttemptStatus::CaptureInitiated | AttemptStatus::CaptureFailed => { + if is_auto_capture { + Ok(Self::Pay) + } else { + Ok(Self::Capture) + } + } + AttemptStatus::PaymentMethodAwaited | AttemptStatus::ConfirmationAwaited => { + if is_auto_capture { + Ok(Self::Pay) + } else { + Ok(Self::Authorize) + } + } + _ => Err(errors::ConnectorError::ProcessingStepFailed(Some( + Bytes::from_static( + "Impossible to determine Archipel flow from AttemptStatus".as_bytes(), + ), + ))), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum ArchipelPaymentFlow { + Verify, + Authorize, + Pay, + Capture, + Cancel, +} + +struct ArchipelFlowStatus { + status: ArchipelPaymentStatus, + flow: ArchipelPaymentFlow, +} +impl ArchipelFlowStatus { + fn new(status: ArchipelPaymentStatus, flow: ArchipelPaymentFlow) -> Self { + Self { status, flow } + } +} + +impl From for AttemptStatus { + fn from(ArchipelFlowStatus { status, flow }: ArchipelFlowStatus) -> Self { + match status { + ArchipelPaymentStatus::Succeeded => match flow { + ArchipelPaymentFlow::Authorize => Self::Authorized, + ArchipelPaymentFlow::Pay + | ArchipelPaymentFlow::Verify + | ArchipelPaymentFlow::Capture => Self::Charged, + ArchipelPaymentFlow::Cancel => Self::Voided, + }, + ArchipelPaymentStatus::Failed => match flow { + ArchipelPaymentFlow::Authorize | ArchipelPaymentFlow::Pay => { + Self::AuthorizationFailed + } + ArchipelPaymentFlow::Verify => Self::AuthenticationFailed, + ArchipelPaymentFlow::Capture => Self::CaptureFailed, + ArchipelPaymentFlow::Cancel => Self::VoidFailed, + }, + } + } +} + +#[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelOrderResponse { + id: String, + amount: Option, + currency: Option, + captured_amount: Option, + authorized_amount: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct ArchipelErrorMessage { + pub code: String, + pub description: Option, +} + +impl Default for ArchipelErrorMessage { + fn default() -> Self { + Self { + code: consts::NO_ERROR_CODE.to_string(), + description: Some(consts::NO_ERROR_MESSAGE.to_string()), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +struct ArchipelErrorMessageWithHttpCode { + error_message: ArchipelErrorMessage, + http_code: u16, +} +impl ArchipelErrorMessageWithHttpCode { + fn new(error_message: ArchipelErrorMessage, http_code: u16) -> Self { + Self { + error_message, + http_code, + } + } +} + +#[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Default)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelTransactionMetadata { + pub transaction_id: String, + pub transaction_date: String, + pub financial_network_code: Option, + pub issuer_transaction_id: Option, + pub response_code: Option, + pub authorization_code: Option, + pub payment_account_reference: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelPaymentsResponse { + order: ArchipelOrderResponse, + transaction_id: String, + transaction_date: String, + transaction_result: ArchipelPaymentStatus, + error: Option, + financial_network_code: Option, + issuer_transaction_id: Option, + response_code: Option, + authorization_code: Option, + payment_account_reference: Option>, +} + +impl From<&ArchipelPaymentsResponse> for ArchipelTransactionMetadata { + fn from(payment_response: &ArchipelPaymentsResponse) -> Self { + Self { + transaction_id: payment_response.transaction_id.clone(), + transaction_date: payment_response.transaction_date.clone(), + financial_network_code: payment_response.financial_network_code.clone(), + issuer_transaction_id: payment_response.issuer_transaction_id.clone(), + response_code: payment_response.response_code.clone(), + authorization_code: payment_response.authorization_code.clone(), + payment_account_reference: payment_response.payment_account_reference.clone(), + } + } +} + +// AUTHORIZATION FLOW +impl TryFrom<(MinorUnit, &PaymentsAuthorizeRouterData)> for ArchipelPaymentInformation { + type Error = error_stack::Report; + + fn try_from( + (amount, router_data): (MinorUnit, &PaymentsAuthorizeRouterData), + ) -> Result { + let is_recurring_payment = router_data + .request + .mandate_id + .as_ref() + .and_then(|mandate_ids| mandate_ids.mandate_id.as_ref()) + .is_some(); + + let is_subsequent_trx = router_data + .request + .mandate_id + .as_ref() + .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) + .is_some(); + + let is_saved_card_payment = (router_data.request.is_mandate_payment()) + | (router_data.request.setup_future_usage == Some(FutureUsage::OnSession)) + | (router_data.payment_method_status == Some(PaymentMethodStatus::Active)); + + let certainty = if router_data.request.request_incremental_authorization { + if is_recurring_payment { + ArchipelPaymentCertainty::Final + } else { + ArchipelPaymentCertainty::Estimated + } + } else { + ArchipelPaymentCertainty::Final + }; + + let transaction_initiator = if is_recurring_payment { + ArchipelPaymentInitiator::Merchant + } else { + ArchipelPaymentInitiator::Customer + }; + + let order = ArchipelOrderRequest { + amount, + currency: router_data.request.currency.to_string(), + certainty, + initiator: transaction_initiator.clone(), + }; + + let card_holder_name = router_data.get_billing()?.get_optional_full_name(); + let cardholder = Some(ArchipelCardHolder { + billing_address: Some( + router_data + .get_billing_address() + .and_then(ArchipelBillingAddress::try_from)?, + ), + }); + + let indicator_status = if is_subsequent_trx { + ArchipelCredentialIndicatorStatus::Subsequent + } else { + ArchipelCredentialIndicatorStatus::Initial + }; + + let stored_on_file = + is_saved_card_payment | router_data.request.is_customer_initiated_mandate_payment(); + + let credential_indicator = stored_on_file.then(|| ArchipelCredentialIndicator { + status: indicator_status.clone(), + recurring: Some(is_recurring_payment), + transaction_id: match indicator_status { + ArchipelCredentialIndicatorStatus::Initial => None, + ArchipelCredentialIndicatorStatus::Subsequent => { + router_data.request.get_optional_network_transaction_id() + } + }, + }); + + Ok(Self { + order, + cardholder, + card_holder_name, + credential_indicator, + stored_on_file, + }) + } +} + +impl TryFrom> + for ArchipelCardAuthorizationRequest +{ + type Error = error_stack::Report; + + fn try_from( + item: ArchipelRouterData<&PaymentsAuthorizeRouterData>, + ) -> Result { + let ArchipelRouterData { + amount, + tenant_id, + router_data, + } = item; + + let payment_information = ArchipelPaymentInformation::try_from((amount, router_data))?; + let payment_method_data = match &item.router_data.request.payment_method_data { + PaymentMethodData::Card(ccard) => { + ArchipelCard::try_from((payment_information.card_holder_name, ccard))? + } + PaymentMethodData::CardDetailsForNetworkTransactionId(card_details) => { + ArchipelCard::try_from((payment_information.card_holder_name, card_details))? + } + PaymentMethodData::CardRedirect(..) + | PaymentMethodData::Wallet(..) + | PaymentMethodData::PayLater(..) + | PaymentMethodData::BankRedirect(..) + | PaymentMethodData::BankDebit(..) + | PaymentMethodData::BankTransfer(..) + | PaymentMethodData::Crypto(..) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(..) + | PaymentMethodData::Upi(..) + | PaymentMethodData::Voucher(..) + | PaymentMethodData::GiftCard(..) + | PaymentMethodData::CardToken(..) + | PaymentMethodData::OpenBanking(..) + | PaymentMethodData::NetworkToken(..) + | PaymentMethodData::MobilePayment(..) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Archipel"), + ))?, + }; + + let three_ds: Option = if item.router_data.is_three_ds() { + let auth_data = item + .router_data + .request + .get_authentication_data() + .change_context(errors::ConnectorError::NotSupported { + message: "Selected 3DS authentication method".to_string(), + connector: "archipel", + })?; + Some(Archipel3DS::from(auth_data)) + } else { + None + }; + + Ok(Self { + order: payment_information.order, + cardholder: payment_information.cardholder, + card: payment_method_data, + three_ds, + credential_indicator: payment_information.credential_indicator, + stored_on_file: payment_information.stored_on_file, + tenant_id, + }) + } +} + +impl TryFrom> + for ArchipelWalletAuthorizationRequest +{ + type Error = error_stack::Report; + + fn try_from( + item: ArchipelRouterData<&PaymentsAuthorizeRouterData>, + ) -> Result { + let ArchipelRouterData { + amount, + tenant_id, + router_data, + } = item; + + let payment_information = ArchipelPaymentInformation::try_from((amount, router_data))?; + let payment_method_data = match &item.router_data.request.payment_method_data { + PaymentMethodData::Wallet(wallet_data) => { + TokenizedCardData::try_from((wallet_data, &item.router_data.payment_method_token))? + } + PaymentMethodData::Card(..) + | PaymentMethodData::CardDetailsForNetworkTransactionId(..) + | PaymentMethodData::CardRedirect(..) + | PaymentMethodData::PayLater(..) + | PaymentMethodData::BankRedirect(..) + | PaymentMethodData::BankDebit(..) + | PaymentMethodData::BankTransfer(..) + | PaymentMethodData::Crypto(..) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(..) + | PaymentMethodData::Upi(..) + | PaymentMethodData::Voucher(..) + | PaymentMethodData::GiftCard(..) + | PaymentMethodData::CardToken(..) + | PaymentMethodData::OpenBanking(..) + | PaymentMethodData::NetworkToken(..) + | PaymentMethodData::MobilePayment(..) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Archipel"), + ))?, + }; + + Ok(Self { + order: payment_information.order, + cardholder: payment_information.cardholder, + card: payment_method_data.card_data.clone(), + wallet: payment_method_data.wallet_information.clone(), + three_ds: None, + credential_indicator: payment_information.credential_indicator, + stored_on_file: payment_information.stored_on_file, + tenant_id, + }) + } +} + +// Responses for AUTHORIZATION FLOW +impl + TryFrom< + ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsAuthorizeData, + PaymentsResponseData, + >, + > for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsAuthorizeData, + PaymentsResponseData, + >, + ) -> Result { + if let Some(error) = item.response.error { + return Ok(Self { + response: Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + ..item.data + }); + }; + + let capture_method = item + .data + .request + .capture_method + .ok_or_else(|| errors::ConnectorError::CaptureMethodNotSupported)?; + + let (archipel_flow, is_incremental_allowed) = match capture_method { + CaptureMethod::Automatic => (ArchipelPaymentFlow::Pay, false), + _ => ( + ArchipelPaymentFlow::Authorize, + item.data.request.request_incremental_authorization, + ), + }; + + let connector_metadata: Option = + ArchipelTransactionMetadata::from(&item.response) + .encode_to_value() + .ok(); + + let status: AttemptStatus = + ArchipelFlowStatus::new(item.response.transaction_result, archipel_flow).into(); + + Ok(Self { + status, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order.id), + charges: None, + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + // Save archipel initial transaction uuid for network transaction mit/cit + network_txn_id: item + .data + .request + .is_customer_initiated_mandate_payment() + .then_some(item.response.transaction_id), + connector_response_reference_id: None, + incremental_authorization_allowed: Some(is_incremental_allowed), + }), + ..item.data + }) + } +} + +// PSYNC FLOW +impl + TryFrom> + for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsSyncData, + PaymentsResponseData, + >, + ) -> Result { + if let Some(error) = item.response.error { + return Ok(Self { + response: Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + ..item.data + }); + }; + + let connector_metadata: Option = + ArchipelTransactionMetadata::from(&item.response) + .encode_to_value() + .ok(); + + let capture_method = item + .data + .request + .capture_method + .ok_or_else(|| errors::ConnectorError::CaptureMethodNotSupported)?; + + let archipel_flow: ArchipelPaymentFlow = (item.data.status, capture_method).try_into()?; + + let status: AttemptStatus = + ArchipelFlowStatus::new(item.response.transaction_result, archipel_flow).into(); + + Ok(Self { + status, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order.id), + charges: None, + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + }), + ..item.data + }) + } +} + +/* CAPTURE FLOW */ + +#[derive(Debug, Serialize, Eq, PartialEq)] +pub struct ArchipelCaptureRequest { + order: ArchipelCaptureOrderRequest, +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +pub struct ArchipelCaptureOrderRequest { + amount: MinorUnit, +} + +impl From> for ArchipelCaptureRequest { + fn from(item: ArchipelRouterData<&PaymentsCaptureRouterData>) -> Self { + Self { + order: ArchipelCaptureOrderRequest { + amount: item.amount, + }, + } + } +} + +impl + TryFrom< + ResponseRouterData, + > for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsCaptureData, + PaymentsResponseData, + >, + ) -> Result { + if let Some(error) = item.response.error { + return Ok(Self { + response: Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + ..item.data + }); + }; + + let connector_metadata: Option = + ArchipelTransactionMetadata::from(&item.response) + .encode_to_value() + .ok(); + + let status: AttemptStatus = ArchipelFlowStatus::new( + item.response.transaction_result, + ArchipelPaymentFlow::Capture, + ) + .into(); + + Ok(Self { + status, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order.id), + charges: None, + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + }), + ..item.data + }) + } +} + +// Setup Mandate FLow +impl TryFrom> for ArchipelCardAuthorizationRequest { + type Error = error_stack::Report; + fn try_from(item: ArchipelRouterData<&SetupMandateRouterData>) -> Result { + let order = ArchipelOrderRequest { + amount: item.amount, + currency: item.router_data.request.currency.to_string(), + certainty: ArchipelPaymentCertainty::Final, + initiator: ArchipelPaymentInitiator::Customer, + }; + + let card_holder_name = item.router_data.get_billing()?.get_optional_full_name(); + + let cardholder = Some(ArchipelCardHolder { + billing_address: Some( + item.router_data + .get_billing_address() + .and_then(ArchipelBillingAddress::try_from)?, + ), + }); + + let stored_on_file = true; + + let credential_indicator = Some(ArchipelCredentialIndicator { + status: ArchipelCredentialIndicatorStatus::Initial, + recurring: Some(false), + transaction_id: None, + }); + + let payment_information = ArchipelPaymentInformation { + order, + cardholder, + card_holder_name, + stored_on_file, + credential_indicator, + }; + + let card_data = match &item.router_data.request.payment_method_data { + PaymentMethodData::Card(ccard) => { + ArchipelCard::try_from((payment_information.card_holder_name, ccard))? + } + _ => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Archipel"), + ))?, + }; + + Ok(Self { + order: payment_information.order, + cardholder: payment_information.cardholder, + card: card_data, + three_ds: None, + credential_indicator: payment_information.credential_indicator, + stored_on_file: payment_information.stored_on_file, + tenant_id: item.tenant_id, + }) + } +} + +impl + TryFrom< + ResponseRouterData< + F, + ArchipelPaymentsResponse, + SetupMandateRequestData, + PaymentsResponseData, + >, + > for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + SetupMandateRequestData, + PaymentsResponseData, + >, + ) -> Result { + if let Some(error) = item.response.error { + return Ok(Self { + response: Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + ..item.data + }); + }; + + let connector_metadata: Option = + ArchipelTransactionMetadata::from(&item.response) + .encode_to_value() + .ok(); + + let status: AttemptStatus = ArchipelFlowStatus::new( + item.response.transaction_result, + ArchipelPaymentFlow::Verify, + ) + .into(); + + Ok(Self { + status, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order.id), + charges: None, + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + network_txn_id: Some(item.response.transaction_id.clone()), + connector_response_reference_id: Some(item.response.transaction_id), + incremental_authorization_allowed: Some(false), + }), + ..item.data + }) + } +} + +// Void Flow => /cancel/{order_id} +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelPaymentsCancelRequest { + tenant_id: ArchipelTenantId, +} + +impl From> for ArchipelPaymentsCancelRequest { + fn from(item: ArchipelRouterData<&PaymentsCancelRouterData>) -> Self { + Self { + tenant_id: item.tenant_id, + } + } +} + +impl + TryFrom< + ResponseRouterData, + > for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsCancelData, + PaymentsResponseData, + >, + ) -> Result { + if let Some(error) = item.response.error { + return Ok(Self { + response: Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + ..item.data + }); + }; + + let connector_metadata: Option = + ArchipelTransactionMetadata::from(&item.response) + .encode_to_value() + .ok(); + + let status: AttemptStatus = ArchipelFlowStatus::new( + item.response.transaction_result, + ArchipelPaymentFlow::Cancel, + ) + .into(); + + Ok(Self { + status, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order.id), + charges: None, + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + }), + ..item.data + }) + } +} + +#[derive(Debug, Serialize, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelIncrementalAuthorizationRequest { + order: ArchipelOrderRequest, + tenant_id: ArchipelTenantId, +} + +// Incremental Authorization status mapping +impl From for AuthorizationStatus { + fn from(status: ArchipelPaymentStatus) -> Self { + match status { + ArchipelPaymentStatus::Succeeded => Self::Success, + ArchipelPaymentStatus::Failed => Self::Failure, + } + } +} + +impl From> + for ArchipelIncrementalAuthorizationRequest +{ + fn from(item: ArchipelRouterData<&PaymentsIncrementalAuthorizationRouterData>) -> Self { + Self { + order: ArchipelOrderRequest { + amount: item.amount, + currency: item.router_data.request.currency.to_string(), + certainty: ArchipelPaymentCertainty::Estimated, + initiator: ArchipelPaymentInitiator::Customer, + }, + tenant_id: item.tenant_id, + } + } +} + +impl + TryFrom< + ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsIncrementalAuthorizationData, + PaymentsResponseData, + >, + > for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData< + F, + ArchipelPaymentsResponse, + PaymentsIncrementalAuthorizationData, + PaymentsResponseData, + >, + ) -> Result { + let status = AuthorizationStatus::from(item.response.transaction_result); + + let (error_code, error_message) = match (&status, item.response.error) { + (AuthorizationStatus::Success, _) | (_, None) => (None, None), + (_, Some(err)) => (Some(err.code), err.description), + }; + + Ok(Self { + response: Ok(PaymentsResponseData::IncrementalAuthorizationResponse { + status, + error_code, + error_message, + connector_authorization_id: None, + }), + ..item.data + }) + } +} + +/* REFUND FLOW */ +#[derive(Debug, Serialize)] +pub struct ArchipelRefundOrder { + pub amount: MinorUnit, + pub currency: Currency, +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelRefundRequest { + pub order: ArchipelRefundOrder, + pub tenant_id: ArchipelTenantId, +} + +impl From>> for ArchipelRefundRequest { + fn from(item: ArchipelRouterData<&RefundsRouterData>) -> Self { + Self { + order: ArchipelRefundOrder { + amount: item.amount, + currency: item.router_data.request.currency, + }, + tenant_id: item.tenant_id, + } + } +} + +// Type definition for Refund Response +#[derive(Debug, Serialize, Default, Deserialize, Clone)] +#[serde(rename_all = "UPPERCASE")] +pub enum ArchipelRefundStatus { + Accepted, + Failed, + #[default] + Pending, +} + +impl From for RefundStatus { + fn from(item: ArchipelPaymentStatus) -> Self { + match item { + ArchipelPaymentStatus::Succeeded => Self::Success, + ArchipelPaymentStatus::Failed => Self::Failure, + } + } +} + +#[derive(Default, Debug, Clone, Serialize, Deserialize)] +pub struct ArchipelRefundOrderResponse { + id: String, +} + +#[derive(Default, Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ArchipelRefundResponse { + order: ArchipelRefundOrderResponse, + status: ArchipelRefundStatus, + transaction_result: ArchipelPaymentStatus, + transaction_id: Option, + transaction_date: Option, + error: Option, +} + +impl TryFrom for RefundsResponseData { + type Error = error_stack::Report; + fn try_from(resp: ArchipelRefundResponse) -> Result { + Ok(Self { + connector_refund_id: resp + .transaction_id + .ok_or_else(|| errors::ConnectorError::ParsingFailed)?, + refund_status: RefundStatus::from(resp.transaction_result), + }) + } +} + +impl TryFrom> + for RefundsRouterData +{ + type Error = error_stack::Report; + fn try_from( + item: RefundsResponseRouterData, + ) -> Result { + let response = match item.response.error { + None => Ok(RefundsResponseData::try_from(item.response)?), + Some(error) => Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + }; + + Ok(Self { + response, + ..item.data + }) + } +} + +impl TryFrom> + for RefundsRouterData +{ + type Error = error_stack::Report; + fn try_from( + item: RefundsResponseRouterData, + ) -> Result { + let response = match item.response.error { + None => Ok(RefundsResponseData::try_from(item.response)?), + Some(error) => Err(ArchipelErrorMessageWithHttpCode::new(error, item.http_code).into()), + }; + + Ok(Self { + response, + ..item.data + }) + } +} + +impl From for ErrorResponse { + fn from( + ArchipelErrorMessageWithHttpCode { + error_message, + http_code, + }: ArchipelErrorMessageWithHttpCode, + ) -> Self { + Self { + status_code: http_code, + code: error_message.code, + attempt_status: None, + connector_transaction_id: None, + message: error_message + .description + .clone() + .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + reason: error_message.description, + network_decline_code: None, + network_advice_code: None, + network_error_message: None, + } + } +} diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index 3708e02cdc..cbca2a9808 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -122,6 +122,7 @@ default_imp_for_authorize_session_token!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -235,6 +236,7 @@ default_imp_for_calculate_tax!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -349,6 +351,7 @@ default_imp_for_session_update!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -463,6 +466,7 @@ default_imp_for_post_session_tokens!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -576,6 +580,7 @@ default_imp_for_update_metadata!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -693,6 +698,7 @@ default_imp_for_complete_authorize!( connectors::Adyen, connectors::Adyenplatform, connectors::Amazonpay, + connectors::Archipel, connectors::Bamboraapac, connectors::Bankofamerica, connectors::Billwerk, @@ -903,6 +909,7 @@ default_imp_for_create_customer!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1017,6 +1024,7 @@ default_imp_for_connector_redirect_response!( connectors::Adyen, connectors::Adyenplatform, connectors::Amazonpay, + connectors::Archipel, connectors::Billwerk, connectors::Bitpay, connectors::Bamboraapac, @@ -1111,6 +1119,7 @@ default_imp_for_pre_processing_steps!( connectors::Aci, connectors::Adyenplatform, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1216,6 +1225,7 @@ default_imp_for_post_processing_steps!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1331,6 +1341,7 @@ default_imp_for_approve!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1447,6 +1458,7 @@ default_imp_for_reject!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1563,6 +1575,7 @@ default_imp_for_webhook_source_verification!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1678,6 +1691,7 @@ default_imp_for_accept_dispute!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1792,6 +1806,7 @@ default_imp_for_submit_evidence!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -1906,6 +1921,7 @@ default_imp_for_defend_dispute!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2029,6 +2045,7 @@ default_imp_for_file_upload!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2135,6 +2152,7 @@ default_imp_for_payouts!( connectors::Aci, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2245,6 +2263,7 @@ default_imp_for_payouts_create!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2359,6 +2378,7 @@ default_imp_for_payouts_retrieve!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2474,6 +2494,7 @@ default_imp_for_payouts_eligibility!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2587,6 +2608,7 @@ default_imp_for_payouts_fulfill!( connectors::Aci, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2698,6 +2720,7 @@ default_imp_for_payouts_cancel!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2813,6 +2836,7 @@ default_imp_for_payouts_quote!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -2928,6 +2952,7 @@ default_imp_for_payouts_recipient!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3043,6 +3068,7 @@ default_imp_for_payouts_recipient_account!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3160,6 +3186,7 @@ default_imp_for_frm_sale!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3276,6 +3303,7 @@ default_imp_for_frm_checkout!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3392,6 +3420,7 @@ default_imp_for_frm_transaction!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3508,6 +3537,7 @@ default_imp_for_frm_fulfillment!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3624,6 +3654,7 @@ default_imp_for_frm_record_return!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3737,6 +3768,7 @@ default_imp_for_revoking_mandates!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3848,6 +3880,7 @@ default_imp_for_uas_pre_authentication!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -3961,6 +3994,7 @@ default_imp_for_uas_post_authentication!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4075,6 +4109,7 @@ default_imp_for_uas_authentication_confirmation!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4180,6 +4215,7 @@ default_imp_for_connector_request_id!( connectors::Adyen, connectors::Adyenplatform, connectors::Airwallex, + connectors::Archipel, connectors::Authorizedotnet, connectors::Amazonpay, connectors::Bambora, @@ -4289,6 +4325,7 @@ default_imp_for_fraud_check!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4427,6 +4464,7 @@ default_imp_for_connector_authentication!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4538,6 +4576,7 @@ default_imp_for_uas_authentication!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4644,6 +4683,7 @@ default_imp_for_revenue_recovery! { connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4761,6 +4801,7 @@ default_imp_for_billing_connector_payment_sync!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4877,6 +4918,7 @@ default_imp_for_revenue_recovery_record_back!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, @@ -4991,6 +5033,7 @@ default_imp_for_billing_connector_invoice_sync!( connectors::Adyenplatform, connectors::Airwallex, connectors::Amazonpay, + connectors::Archipel, connectors::Authorizedotnet, connectors::Bambora, connectors::Bamboraapac, diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 835833feed..fc9c45f539 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -1002,10 +1002,20 @@ impl AccessTokenRequestInfo for RefreshTokenRouterData { } pub trait ApplePayDecrypt { fn get_expiry_month(&self) -> Result, Error>; + fn get_two_digit_expiry_year(&self) -> Result, Error>; fn get_four_digit_expiry_year(&self) -> Result, Error>; } impl ApplePayDecrypt for Box { + fn get_two_digit_expiry_year(&self) -> Result, Error> { + Ok(Secret::new( + self.application_expiration_date + .get(0..2) + .ok_or(errors::ConnectorError::RequestEncodingFailed)? + .to_string(), + )) + } + fn get_four_digit_expiry_year(&self) -> Result, Error> { Ok(Secret::new(format!( "20{}", diff --git a/crates/hyperswitch_domain_models/src/configs.rs b/crates/hyperswitch_domain_models/src/configs.rs index afbf9dc16a..d5d7f22515 100644 --- a/crates/hyperswitch_domain_models/src/configs.rs +++ b/crates/hyperswitch_domain_models/src/configs.rs @@ -17,6 +17,7 @@ pub struct Connectors { pub airwallex: ConnectorParams, pub amazonpay: ConnectorParams, pub applepay: ConnectorParams, + pub archipel: ConnectorParams, pub authorizedotnet: ConnectorParams, pub bambora: ConnectorParams, pub bamboraapac: ConnectorParams, diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index 51482cb09a..26332d3f43 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -5,8 +5,8 @@ pub mod utils; pub use hyperswitch_connectors::connectors::{ aci, aci::Aci, adyen, adyen::Adyen, adyenplatform, adyenplatform::Adyenplatform, airwallex, - airwallex::Airwallex, amazonpay, amazonpay::Amazonpay, authorizedotnet, - authorizedotnet::Authorizedotnet, bambora, bambora::Bambora, bamboraapac, + airwallex::Airwallex, amazonpay, amazonpay::Amazonpay, archipel, archipel::Archipel, + authorizedotnet, authorizedotnet::Authorizedotnet, bambora, bambora::Bambora, bamboraapac, bamboraapac::Bamboraapac, bankofamerica, bankofamerica::Bankofamerica, billwerk, billwerk::Billwerk, bitpay, bitpay::Bitpay, bluesnap, bluesnap::Bluesnap, boku, boku::Boku, braintree, braintree::Braintree, cashtocode, cashtocode::Cashtocode, chargebee, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index f12dc48924..b359248f90 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1327,6 +1327,11 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> { airwallex::transformers::AirwallexAuthType::try_from(self.auth_type)?; Ok(()) } + api_enums::Connector::Archipel => { + archipel::transformers::ArchipelAuthType::try_from(self.auth_type)?; + archipel::transformers::ArchipelConfigData::try_from(self.connector_meta_data)?; + Ok(()) + } api_enums::Connector::Authorizedotnet => { authorizedotnet::transformers::AuthorizedotnetAuthType::try_from(self.auth_type)?; Ok(()) diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index eebff72722..9291bdb3bf 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -303,6 +303,9 @@ impl ConnectorData { // enums::Connector::Amazonpay => { // Ok(ConnectorEnum::Old(Box::new(connector::Amazonpay))) // } + enums::Connector::Archipel => { + Ok(ConnectorEnum::Old(Box::new(connector::Archipel::new()))) + } enums::Connector::Authorizedotnet => { Ok(ConnectorEnum::Old(Box::new(&connector::Authorizedotnet))) } diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 9af28d4adc..ebdb0bfe1c 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -214,6 +214,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Adyenplatform => Self::Adyenplatform, api_enums::Connector::Airwallex => Self::Airwallex, // api_enums::Connector::Amazonpay => Self::Amazonpay, + api_enums::Connector::Archipel => Self::Archipel, api_enums::Connector::Authorizedotnet => Self::Authorizedotnet, api_enums::Connector::Bambora => Self::Bambora, api_enums::Connector::Bamboraapac => Self::Bamboraapac, diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml index 2675c33702..05a6060e8c 100644 --- a/crates/router/tests/connectors/sample_auth.toml +++ b/crates/router/tests/connectors/sample_auth.toml @@ -13,6 +13,8 @@ api_secret = "Secondary key" [amazonpay] api_key="API Key" +[archipel] + [authorizedotnet] api_key = "MyMerchantName" key1 = "MyTransactionKey" diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs index da93a4720c..9b0a393fd8 100644 --- a/crates/test_utils/src/connector_auth.rs +++ b/crates/test_utils/src/connector_auth.rs @@ -18,6 +18,7 @@ pub struct ConnectorAuthentication { pub adyen_uk: Option, pub airwallex: Option, pub amazonpay: Option, + pub archipel: Option, pub authorizedotnet: Option, pub bambora: Option, pub bamboraapac: Option, @@ -324,6 +325,9 @@ impl From for ConnectorAuthType { } } +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct NoKey {} + #[derive(Debug, Serialize, Deserialize, Clone)] pub struct AutomationConfigs { pub hs_base_url: Option, diff --git a/cypress-tests/cypress/e2e/configs/Payment/Archipel.js b/cypress-tests/cypress/e2e/configs/Payment/Archipel.js new file mode 100644 index 0000000000..1137302772 --- /dev/null +++ b/cypress-tests/cypress/e2e/configs/Payment/Archipel.js @@ -0,0 +1,383 @@ +import { customerAcceptance } from "./Commons.js"; + +const successfulNo3DSCardDetails = { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "50", + card_holder_name: "joseph Doe", + card_cvc: "123", +}; + +const singleUseMandateData = { + customer_acceptance: customerAcceptance, + mandate_type: { + single_use: { + amount: 8000, + currency: "USD", + }, + }, +}; + +export const connectorDetails = { + card_pm: { + PaymentIntent: { + Request: { + amount: 6000, + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + setup_future_usage: "on_session", + }, + }, + }, + PaymentIntentOffSession: { + Request: { + currency: "USD", + billing: { + address: { + line1: "1467", + line2: "CA", + line3: "CA", + city: "Florence", + state: "Tuscany", + zip: "12345", + first_name: "Max", + last_name: "Mustermann", + }, + email: "mauro.morandi@nexi.it", + phone: { + number: "9123456789", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + }, + }, + }, + No3DSManualCapture: { + Request: { + amount: 6000, + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + No3DSAutoCapture: { + Request: { + amount: 6000, + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + Capture: { + Request: { + amount_to_capture: 6000, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + PartialCapture: { + Request: { + amount_to_capture: 3000, + }, + Response: { + status: 200, + body: { + status: "partially_captured", + amount: 6000, + amount_capturable: 0, + amount_received: 3000, + }, + }, + }, + Void: { + Request: {}, + Response: { + status: 200, + body: { + status: "cancelled", + }, + }, + }, + Refund: { + Request: { + amount: 6000, + }, + Response: { + status: 200, + body: { + status: "failed", + }, + }, + }, + manualPaymentRefund: { + Request: { + amount: 6000, + }, + Response: { + status: 200, + body: { + status: "failed", + }, + }, + }, + manualPaymentPartialRefund: { + Request: { + amount: 2000, + }, + Response: { + status: 200, + body: { + status: "failed", + }, + }, + }, + PartialRefund: { + Request: { + amount: 2000, + }, + Response: { + status: 200, + body: { + status: "failed", + }, + }, + }, + SyncRefund: { + Response: { + status: 200, + body: { + status: "failed", + }, + }, + }, + IncrementalAuth: { + Request: { + amount: 7000, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + amount: 7000, + amount_capturable: 7000, + amount_received: null, + }, + }, + }, + ZeroAuthMandate: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + ZeroAuthPaymentIntent: { + Request: { + amount: 0, + setup_future_usage: "off_session", + currency: "USD", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + setup_future_usage: "off_session", + }, + }, + }, + ZeroAuthConfirmPayment: { + Request: { + payment_type: "setup_mandate", + payment_method: "card", + payment_method_type: "credit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + }, + Response: { + status: 200, + body: { + status: "succeeded", + setup_future_usage: "off_session", + }, + }, + }, + SaveCardUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_type: "debit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + setup_future_usage: "on_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + SaveCardConfirmAutoCaptureOffSession: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + SaveCardUseNo3DSAutoCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + SaveCardUseNo3DSManualCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + SaveCardConfirmAutoCaptureOffSessionWithoutBilling: { + Request: { + setup_future_usage: "off_session", + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: + "No eligible connector was found for the current payment method configuration", + code: "IR_39", + }, + }, + }, + }, + SaveCardUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + setup_future_usage: "on_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + PaymentIntentWithShippingCost: { + Request: { + currency: "USD", + amount: 6500, + shipping_cost: 50, + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + shipping_cost: 50, + amount: 6500, + net_amount: 6550, + amount_capturable: 6550, + }, + }, + }, + PaymentConfirmWithShippingCost: { + Request: { + amount: 6500, + shipping_cost: 50, + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "succeeded", + shipping_cost: 50, + amount_received: 6550, + amount: 6500, + net_amount: 6550, + }, + }, + }, + }, +}; diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js index 2aeae65000..33285c8258 100644 --- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js +++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js @@ -1,5 +1,6 @@ // This file is the default. To override, add to connector.js import { getCustomExchange } from "./Modifiers"; +import State from "../../../utils/State.js"; export const customerAcceptance = { acceptance_type: "offline", @@ -10,6 +11,47 @@ export const customerAcceptance = { }, }; +const globalState = new State({ + connectorId: Cypress.env("CONNECTOR"), + baseUrl: Cypress.env("BASEURL"), + adminApiKey: Cypress.env("ADMINAPIKEY"), + connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"), +}); + +const connectorName = normalize(globalState.get("connectorId")); + +function normalize(input) { + const exceptions = { + bankofamerica: "Bank of America", + cybersource: "Cybersource", + paybox: "Paybox", + paypal: "Paypal", + wellsfargo: "Wellsfargo", + fiuu: "Fiuu", + noon: "Noon", + archipel: "Archipel", + // Add more known exceptions here + }; + + if (typeof input !== "string") { + const specName = Cypress.spec.name; + + if (specName.includes("-")) { + const parts = specName.split("-"); + + if (parts.length > 1 && parts[1].includes(".")) { + return parts[1].split(".")[0]; + } + } + + // Fallback + return `${specName}`; + } + + const lowerCaseInput = input.toLowerCase(); + return exceptions[lowerCaseInput] || input; +} + const successfulNo3DSCardDetails = { card_number: "4111111111111111", card_exp_month: "08", diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js index bd3cf5eeeb..d6cacc3f93 100644 --- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js +++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js @@ -18,6 +18,7 @@ function normalize(input) { paypal: "Paypal", wellsfargo: "Wellsfargo", noon: "Noon", + archipel: "Archipel", // Add more known exceptions here }; diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js index 0ccf8e3a79..6b73b67d1a 100644 --- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js +++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js @@ -33,6 +33,7 @@ import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js"; import { connectorDetails as wellsfargoConnectorDetails } from "./WellsFargo.js"; import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js"; import { connectorDetails as xenditConnectorDetails } from "./Xendit.js"; +import { connectorDetails as archipelConnectorDetails } from "./Archipel.js"; const connectorDetails = { adyen: adyenConnectorDetails, @@ -66,6 +67,7 @@ const connectorDetails = { wellsfargo: wellsfargoConnectorDetails, worldpay: worldpayConnectorDetails, xendit: xenditConnectorDetails, + archipel: archipelConnectorDetails, }; export default function getConnectorDetails(connectorId) { diff --git a/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js index cde959ad8e..9a68e119b0 100644 --- a/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js @@ -47,4 +47,4 @@ describe("Connector Account Create flow test", () => { }); } ); -}); +}); \ No newline at end of file diff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.json index 22b1b894f1..0eb4f53c19 100644 --- a/cypress-tests/cypress/fixtures/confirm-body.json +++ b/cypress-tests/cypress/fixtures/confirm-body.json @@ -18,9 +18,9 @@ "first_name": "john", "last_name": "doe", "zip": "10001", - "line1": "123 Main Street Apt 4B", - "line2": "123 Main Street Apt 4B", - "line3": "123 Main Street Apt 4B" + "line1": "123", + "line2": "Main Street", + "line3": "Apt 4B" } }, diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 09c8facb38..8a517dfc52 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -824,29 +824,44 @@ Cypress.Commands.add( updateConnectorBody.connector_type = connectorType; updateConnectorBody.connector_label = connectorLabel; - cy.request({ - method: "POST", - url: url, - headers: { - Accept: "application/json", - "Content-Type": "application/json", - "api-key": api_key, - "x-merchant-id": merchant_id, - }, - body: updateConnectorBody, - failOnStatusCode: false, - }).then((response) => { - logRequestId(response.headers["x-request-id"]); - - cy.wrap(response).then(() => { - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.connector_name).to.equal(connector_id); - expect(response.body.merchant_connector_id).to.equal( - merchant_connector_id + cy.readFile(globalState.get("connectorAuthFilePath")).then( + (jsonContent) => { + const { authDetails } = getValueByKey( + JSON.stringify(jsonContent), + connector_id ); - expect(response.body.connector_label).to.equal(connectorLabel); - }); - }); + if (authDetails && authDetails.metadata) { + updateConnectorBody.metadata = { + ...updateConnectorBody.metadata, // Preserve existing metadata + ...authDetails.metadata, + }; + } + cy.request({ + method: "POST", + url: url, + headers: { + Accept: "application/json", + "Content-Type": "application/json", + "api-key": api_key, + "x-merchant-id": merchant_id, + }, + body: updateConnectorBody, + failOnStatusCode: false, + }).then((response) => { + logRequestId(response.headers["x-request-id"]); + cy.wrap(response).then(() => { + expect(response.headers["content-type"]).to.include( + "application/json" + ); + expect(response.body.connector_name).to.equal(connector_id); + expect(response.body.merchant_connector_id).to.equal( + merchant_connector_id + ); + expect(response.body.connector_label).to.equal(connectorLabel); + }); + }); + } + ); } ); @@ -1104,12 +1119,12 @@ Cypress.Commands.add( const responsePaymentMethods = response.body["payment_methods"]; const responseRequiredFields = responsePaymentMethods[0]["payment_method_types"][0][ - "required_fields" + "required_fields" ]; const expectedRequiredFields = data["payment_methods"][0]["payment_method_types"][0][ - "required_fields" + "required_fields" ]; Object.keys(expectedRequiredFields).forEach((key) => { @@ -2421,13 +2436,13 @@ Cypress.Commands.add( for (const key in response.body.attempts) { if ( response.body.attempts[key].attempt_id === - `${payment_id}_${attempt}` && + `${payment_id}_${attempt}` && response.body.status === "succeeded" ) { expect(response.body.attempts[key].status).to.equal("charged"); } else if ( response.body.attempts[key].attempt_id === - `${payment_id}_${attempt}` && + `${payment_id}_${attempt}` && response.body.status === "requires_customer_action" ) { expect(response.body.attempts[key].status).to.equal( @@ -2611,6 +2626,7 @@ Cypress.Commands.add( } } else if (response.body.authentication_type === "no_three_ds") { for (const key in resData.body) { + expect(resData.body[key], [key]).to.deep.equal( response.body[key] ); diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml index 57abde7cc4..f4f1eeb2fa 100644 --- a/loadtest/config/development.toml +++ b/loadtest/config/development.toml @@ -81,6 +81,7 @@ adyen.dispute_base_url = "https://ca-test.adyen.com/" airwallex.base_url = "https://api-demo.airwallex.com/" amazonpay.base_url = "https://pay-api.amazon.com/v2" applepay.base_url = "https://apple-pay-gateway.apple.com/" +archipel.base_url = "https://{{merchant_endpoint_prefix}}/ArchiPEL/Transaction/v1" authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api" @@ -203,6 +204,7 @@ cards = [ "adyenplatform", "airwallex", "amazonpay", + "archipel", "authorizedotnet", "bambora", "bamboraapac", @@ -600,7 +602,7 @@ card.credit = { connector_list = "cybersource" } card.debit = { connector_list = "cybersource" } [network_transaction_id_supported_connectors] -connector_list = "adyen,cybersource,novalnet,stripe,worldpay" +connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" [analytics] source = "sqlx" diff --git a/postman/collection-dir/archipel/.auth.json b/postman/collection-dir/archipel/.auth.json new file mode 100644 index 0000000000..915a283579 --- /dev/null +++ b/postman/collection-dir/archipel/.auth.json @@ -0,0 +1,22 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + } +} diff --git a/postman/collection-dir/archipel/.event.meta.json b/postman/collection-dir/archipel/.event.meta.json new file mode 100644 index 0000000000..2df9d47d93 --- /dev/null +++ b/postman/collection-dir/archipel/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.prerequest.js", + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/.info.json b/postman/collection-dir/archipel/.info.json new file mode 100644 index 0000000000..e01e10f8bb --- /dev/null +++ b/postman/collection-dir/archipel/.info.json @@ -0,0 +1,9 @@ +{ + "info": { + "_postman_id": "c505d595-99e0-4cd0-b384-f47fbbd0c560", + "name": "archipel", + "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "37912341" + } +} diff --git a/postman/collection-dir/archipel/.meta.json b/postman/collection-dir/archipel/.meta.json new file mode 100644 index 0000000000..91b6a65c5b --- /dev/null +++ b/postman/collection-dir/archipel/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Health check", + "Flow Testcases" + ] +} diff --git a/postman/collection-dir/archipel/.variable.json b/postman/collection-dir/archipel/.variable.json new file mode 100644 index 0000000000..ab4ff9928f --- /dev/null +++ b/postman/collection-dir/archipel/.variable.json @@ -0,0 +1,88 @@ +{ + "variable": [ + { + "key": "baseUrl", + "value": "", + "type": "string" + }, + { + "key": "admin_api_key", + "value": "", + "type": "string" + }, + { + "key": "organization_id", + "value": "" + }, + { + "key": "merchant_id", + "value": "" + }, + { + "key": "profile_id", + "value": "" + }, + { + "key": "api_key", + "value": "", + "type": "string" + }, + { + "key": "api_key_id", + "value": "", + "type": "string" + }, + { + "key": "publishable_key", + "value": "", + "type": "string" + }, + { + "key": "client_secret", + "value": "", + "type": "string" + }, + { + "key": "archipel_tenant_id", + "value": "", + "type": "string" + }, + { + "key": "archipel_platform_url", + "value": "", + "type": "string" + }, + { + "key": "merchant_connector_id", + "value": "" + }, + { + "key": "payment_id", + "value": "" + }, + { + "key": "customer_id", + "value": "" + }, + { + "key": "mandate_id", + "value": "" + }, + { + "key": "refund_id", + "value": "" + }, + { + "key": "payment_token", + "value": "" + }, + { + "key": "connector_transaction_id", + "value": "" + }, + { + "key": "archipel_transaction_uuid", + "value": "" + } + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/.meta.json b/postman/collection-dir/archipel/Flow Testcases/.meta.json new file mode 100644 index 0000000000..0fb70a8439 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "QuickStart", + "Happy Cases", + "Negative Cases" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/.meta.json new file mode 100644 index 0000000000..1baf077be5 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/.meta.json @@ -0,0 +1,18 @@ +{ + "childrenOrder": [ + "Scenario1-Create payment with confirm true", + "Scenario2-Create payment with confirm false", + "Scenario3a-Create payment with Manual capture", + "Scenario3b-Create payment with partial capture", + "Scenario3c-Create payment with confirm false and manual capture", + "Scenario4-Zero auth mandates", + "Scenario5-Create a mandate and recurring payment", + "Scenario6-Saved card flow", + "Scenario8a-Incremental authorization", + "Scenario8b-Incremental authorization with partial capture", + "Scenario9a-Refund full payment", + "Scenario9b-Refund partial payment", + "Scenario9c-Refund full incremented payment", + "Scenario10-Create 3DS payment" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json new file mode 100644 index 0000000000..96c3568d6a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Retrieve", + "Payments - Retrieve payment attempt" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js new file mode 100644 index 0000000000..2b503f23b1 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js @@ -0,0 +1,66 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/event.test.js new file mode 100644 index 0000000000..6a7cc430ce --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/event.test.js @@ -0,0 +1,85 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'charged' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("charged"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + +pm.test( + "[POST]::/payments - Archiepl response 'transactionId' is updated and not null", + function () { + pm.expect(payment_attempt.connector_metadata.transactionId).not.null + pm.expect(payment_attempt.connector_metadata.transactionId).to.not.equal( + pm.collectionVariables.get("archipel_transaction_uuid") + ) + pm.collectionVariables.set("archipel_transaction_uuid", payment_attempt.connector_metadata.transactionId) + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/request.json new file mode 100644 index 0000000000..c357901bbf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve payment attempt/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..4965dde1b2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js @@ -0,0 +1,69 @@ + +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/.meta.json new file mode 100644 index 0000000000..4ad2095438 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/.meta.json @@ -0,0 +1,9 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Confirm", + "Payments - External 3ds authentication", + "Payments - Authorize request intent", + "Payments - Retrieve after confirm" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/event.test.js new file mode 100644 index 0000000000..5a76256cd9 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/event.test.js @@ -0,0 +1,4 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/request.json new file mode 100644 index 0000000000..4c4a9dc5af --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/request.json @@ -0,0 +1,23 @@ +{ + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/{{merchant_id}}/authorize/archipel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "{{merchant_id}}", + "authorize", + "archipel" + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Authorize request intent/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/event.test.js new file mode 100644 index 0000000000..ee1ac3796b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/event.test.js @@ -0,0 +1,49 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "requires_customer_action" for "status" +pm.test( +"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'", + function () { + pm.expect(jsonData.status).to.eql("requires_customer_action"); + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/request.json new file mode 100644 index 0000000000..610128b63d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/request.json @@ -0,0 +1,86 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "4242424242424242" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..905cc47900 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/request.json new file mode 100644 index 0000000000..49feac4989 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/request.json @@ -0,0 +1,78 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "USD", + "confirm": false, + "capture_method": "automatic", + "authentication_type": "three_ds", + "request_external_three_ds_authentication": true, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "FRA", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/event.test.js new file mode 100644 index 0000000000..ef774a4df8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/event.test.js @@ -0,0 +1,4 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/request.json new file mode 100644 index 0000000000..4326c6a2f2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/request.json @@ -0,0 +1,66 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "device_channel": "BRW", + "threeds_method_comp_ind": "Y" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/3ds/authentication", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "3ds", + "authentication" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - External 3ds authentication/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/event.test.js new file mode 100644 index 0000000000..344e0a0ac8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario10-Create 3DS payment/Payments - Retrieve after confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json new file mode 100644 index 0000000000..22a5b0d7b2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json @@ -0,0 +1,10 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Retrieve with client secret", + "Payments - Retrieve", + "Payments - Confirm", + "Payments - Retrieve after confirm", + "Payments - Retrieve with connector sync" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js new file mode 100644 index 0000000000..20315afd2d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js @@ -0,0 +1,49 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "succeeded" for "status" +pm.test( +"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json new file mode 100644 index 0000000000..9d4d008431 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json @@ -0,0 +1,86 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js new file mode 100644 index 0000000000..905cc47900 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json new file mode 100644 index 0000000000..3220d8af0e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json @@ -0,0 +1,79 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": false, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/event.test.js new file mode 100644 index 0000000000..344e0a0ac8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve after confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/event.test.js new file mode 100644 index 0000000000..3b138fd1f8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/event.test.js @@ -0,0 +1,45 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, +); + +pm.test( + "[POST]::/payments - Content check if no 'connector' is affected to the payment intent", + function () { + pm.expect(jsonData.connector).to.be.null; + }, +); + +// Response body should not have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' is null", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.null; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/request.json new file mode 100644 index 0000000000..a19aea89f4 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/request.json @@ -0,0 +1,53 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?client_secret={{client_secret}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "client_secret", + "value": "{{client_secret}}" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with client secret/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/event.test.js new file mode 100644 index 0000000000..6a7cc430ce --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/event.test.js @@ -0,0 +1,85 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'charged' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("charged"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + +pm.test( + "[POST]::/payments - Archiepl response 'transactionId' is updated and not null", + function () { + pm.expect(payment_attempt.connector_metadata.transactionId).not.null + pm.expect(payment_attempt.connector_metadata.transactionId).to.not.equal( + pm.collectionVariables.get("archipel_transaction_uuid") + ) + pm.collectionVariables.set("archipel_transaction_uuid", payment_attempt.connector_metadata.transactionId) + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/request.json new file mode 100644 index 0000000000..c357901bbf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve with connector sync/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..3b138fd1f8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js @@ -0,0 +1,45 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, +); + +pm.test( + "[POST]::/payments - Content check if no 'connector' is affected to the payment intent", + function () { + pm.expect(jsonData.connector).to.be.null; + }, +); + +// Response body should not have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' is null", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.null; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json new file mode 100644 index 0000000000..c71774083b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/.meta.json new file mode 100644 index 0000000000..ee4276a23f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Capture", + "Payments - Sync payment", + "Payments - Check payment attempt" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/event.test.js new file mode 100644 index 0000000000..616804d6b6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/event.test.js @@ -0,0 +1,108 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test( +"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}, +); + +// Response body should have value "500" for "amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +// Response body should have value "500" for "net_amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +// Response body should have value "500" for "amount_capturable" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( +"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/request.json new file mode 100644 index 0000000000..88957428e8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/request.json @@ -0,0 +1,44 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 500, + "statement_descriptor_name": "John", + "statement_descriptor_suffix": "JD" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/event.test.js new file mode 100644 index 0000000000..adafc346a1 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'charged' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("charged"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/request.json new file mode 100644 index 0000000000..c357901bbf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Check payment attempt/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/event.test.js new file mode 100644 index 0000000000..0059369fd2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/event.test.js @@ -0,0 +1,66 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_capture" for "status" +pm.test( +"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", +function () { + pm.expect(jsonData.status).to.eql("requires_capture"); +}, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/request.json new file mode 100644 index 0000000000..fb4c86242d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/event.test.js new file mode 100644 index 0000000000..becb5cfa9b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3a-Create payment with Manual capture/Payments - Sync payment/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/.meta.json new file mode 100644 index 0000000000..ee4276a23f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Capture", + "Payments - Sync payment", + "Payments - Check payment attempt" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/event.test.js new file mode 100644 index 0000000000..61e9ea7b21 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/event.test.js @@ -0,0 +1,107 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "partially_captured" for "status" +pm.test( +"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'", +function () { + pm.expect(jsonData.status).to.eql("partially_captured"); +}, +); + +// Response body should have value "500" for "amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +// Response body should have value "500" for "net_amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +// Response body should have value "500" for "amount_capturable" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( +"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 200", + function () { + pm.expect(jsonData.amount_received).to.eql(200); + }, +); + + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/request.json new file mode 100644 index 0000000000..262c5e9352 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/request.json @@ -0,0 +1,44 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 200, + "statement_descriptor_name": "John", + "statement_descriptor_suffix": "JD" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/event.test.js new file mode 100644 index 0000000000..d648be137e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'partial_charged' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("partial_charged"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/request.json new file mode 100644 index 0000000000..c357901bbf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Check payment attempt/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/event.test.js new file mode 100644 index 0000000000..f40da5511f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_capture" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, + ); +} + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/request.json new file mode 100644 index 0000000000..fb4c86242d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/event.test.js new file mode 100644 index 0000000000..4c3fc81edf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/event.test.js @@ -0,0 +1,69 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "partially_captured" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'", + function () { + pm.expect(jsonData.status).to.eql("partially_captured"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(200); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3b-Create payment with partial capture/Payments - Sync payment/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/.meta.json new file mode 100644 index 0000000000..0d0d1ee05e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Confirm", + "Payments - Capture", + "Payments - Check payment attempt" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/event.test.js new file mode 100644 index 0000000000..616804d6b6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/event.test.js @@ -0,0 +1,108 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test( +"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}, +); + +// Response body should have value "500" for "amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +// Response body should have value "500" for "net_amount" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +// Response body should have value "500" for "amount_capturable" +pm.test( +"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( +"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/request.json new file mode 100644 index 0000000000..88957428e8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/request.json @@ -0,0 +1,44 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 500, + "statement_descriptor_name": "John", + "statement_descriptor_suffix": "JD" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/event.test.js new file mode 100644 index 0000000000..adafc346a1 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'charged' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("charged"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(jsonData.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/request.json new file mode 100644 index 0000000000..d574a2a025 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/request.json @@ -0,0 +1,37 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + }, + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Check payment attempt/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/event.test.js new file mode 100644 index 0000000000..f451172456 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/event.test.js @@ -0,0 +1,49 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// Response body should have value "requires_capture" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/request.json new file mode 100644 index 0000000000..9d4d008431 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/request.json @@ -0,0 +1,86 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/event.test.js new file mode 100644 index 0000000000..16d65258f4 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/event.test.js @@ -0,0 +1,66 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_confirmation" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'", + function () { + pm.expect(jsonData.status).to.eql("requires_confirmation"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/request.json new file mode 100644 index 0000000000..ffa77bd7ee --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": false, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario3c-Create payment with confirm false and manual capture/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/.meta.json new file mode 100644 index 0000000000..34e1413308 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create mandate", + "Payments - Confirm mandate", + "Payments - Create recurring", + "Payments - Retrieve recurring" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/event.test.js new file mode 100644 index 0000000000..2b8a0318d3 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/event.test.js @@ -0,0 +1,59 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id); +} else { + console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { +pm.test("[POST]::/payments - Content check if value for 'status' matches 'succeeded'", function() { + pm.expect(jsonData.status).to.eql("succeeded"); +})}; + +// Response body should have "mandate_id" +pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() { + pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true; +}); + +// Response body should have "mandate_data" +pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() { + pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/request.json new file mode 100644 index 0000000000..838f3aab5f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/request.json @@ -0,0 +1,103 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "publishable_key", + "value": "pk_snd_8798c6a9114646f8b970b93ad5765ddf", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "customer_id": "{{customer_id}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102", + "card_network": "Mastercard" + } + }, + "setup_future_usage": "off_session", + "payment_type": "setup_mandate", + "mandate_data": { + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "{{$isoTimestamp}}", + "online": { + "ip_address": "125.0.0.1", + "user_agent": "amet irure esse" + } + }, + "mandate_type": { + "multi_use": { + "amount": 799, + "currency": "EUR", + "start_date": "{{$isoTimestamp}}", + "end_date": "2099-01-01T00:00:00Z", + "metadata": { + "frequency": "13" + } + } + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Confirm mandate/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/event.test.js new file mode 100644 index 0000000000..17c0ca2950 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/event.test.js @@ -0,0 +1,51 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { +pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", function() { + pm.expect(jsonData.status).to.eql("requires_payment_method"); +})}; + +// Response body should have "mandate_id" +pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() { + pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true; +}); + +// Response body should have "mandate_data" +pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() { + pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/request.json new file mode 100644 index 0000000000..7a5ac3b460 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/request.json @@ -0,0 +1,94 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 0, + "currency": "EUR", + "confirm": false, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "description": "[Archipel Connector][Scenario4] - Create Zero auth mandate", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create mandate/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/event.test.js new file mode 100644 index 0000000000..0868d67db0 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/event.test.js @@ -0,0 +1,65 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id); +} else { + console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { +pm.test("[POST]::/payments - Content check if value for 'status' matches 'succeeded'", function() { + pm.expect(jsonData.status).to.eql("succeeded"); +})}; + +// Response body should have "mandate_id" +pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() { + pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true; +}); + +// Response body should have "mandate_data" +pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() { + pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true; +}); + +// Response body should have "payment_method_data" +pm.test("[POST]::/payments - Content check if 'payment_method_data' exists", function() { + pm.expect((typeof jsonData.payment_method_data !== "undefined")).to.be.true; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/request.json new file mode 100644 index 0000000000..aac94668f6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/request.json @@ -0,0 +1,116 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 799, + "currency": "EUR", + "confirm": true, + "profile_id": "{{profile_id}}", + "capture_method": "automatic", + "capture_on": "{{$isoTimestamp}}", + "customer_id": "{{customer_id}}", + "description": "[Archipel Connector][Scenario4] - Create recurring payment", + "authentication_type": "no_three_ds", + "mandate_id": "{{mandate_id}}", + "off_session": true, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + }, + "order_details": [ + { + "product_name": "VOD subscription", + "quantity": 1, + "amount": 799, + "account_name": "transaction_processing" + } + ] + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Create recurring/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/event.test.js new file mode 100644 index 0000000000..115e821b7e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/event.test.js @@ -0,0 +1,82 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists is correct ", + function () { + pm.expect(jsonData.mandate_id).to.eql(pm.collectionVariables.get("mandate_id")); + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario4-Zero auth mandates/Payments - Retrieve recurring/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/.meta.json new file mode 100644 index 0000000000..857ad43fd5 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/.meta.json @@ -0,0 +1,10 @@ +{ + "childrenOrder": [ + "Payments - Create mandate", + "Payments - Confirm mandate", + "Payments - Retrieve mandate", + "List payment methods for a Customer", + "Payments - Create recurring", + "Payments - Retrieve recurring" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js new file mode 100644 index 0000000000..8f940e049a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js @@ -0,0 +1,28 @@ +// Validate status 2xx +pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payment_methods/:customer_id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +if (jsonData?.customer_payment_methods[0]?.payment_token) { + pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token); + console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token); +} else { + console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.'); +} + +// Response body should have at least one card payment mehod" +pm.test( +"[GET]::/payment_methods/:customer_id - Content check body has at least one customer_payment_methods", +function () { + pm.expect(jsonData.customer_payment_methods.length).greaterThan(0); + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/request.json new file mode 100644 index 0000000000..cff6d6d715 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/request.json @@ -0,0 +1,28 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/customers/:customer_id/payment_methods", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers", + ":customer_id", + "payment_methods" + ], + "variable": [ + { + "key": "customer_id", + "value": "{{customer_id}}", + "description": "//Pass the customer id" + } + ] + }, + "description": "To filter and list the applicable payment methods for a particular Customer ID" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/List payment methods for a Customer/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/event.test.js new file mode 100644 index 0000000000..148440eff5 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/event.test.js @@ -0,0 +1,80 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body must not have value "failed" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'status' not matches 'failed'", + function () { + pm.expect(jsonData.status).to.not.eql("failed"); + }, + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id); +} else { + console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/request.json new file mode 100644 index 0000000000..151c35e652 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/request.json @@ -0,0 +1,103 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "customer_id": "{{customer_id}}", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102", + "card_network": "Visa" + } + }, + "setup_future_usage": "off_session", + "mandate_data": { + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "{{$isoTimestamp}}", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + "mandate_type": { + "single_use": { + "amount": 1000, + "currency": "EUR" + } + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Confirm mandate/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/event.test.js new file mode 100644 index 0000000000..8b198f9f6f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/event.test.js @@ -0,0 +1,87 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/request.json new file mode 100644 index 0000000000..f1215dc2b0 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/request.json @@ -0,0 +1,73 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "currency": "EUR", + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "description": "[Archipel Connector][Scenario5] - Create mandate with payment", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create mandate/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/event.test.js new file mode 100644 index 0000000000..e2ddde7136 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/event.test.js @@ -0,0 +1,95 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); + +// Response body should have "payment_method_data" +pm.test( + "[POST]::/payments - Content check if 'payment_method_data' exists", + function () { + pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/request.json new file mode 100644 index 0000000000..7b7ea0f185 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/request.json @@ -0,0 +1,76 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 900, + "currency": "EUR", + "confirm": true, + "profile_id": "{{profile_id}}", + "capture_method": "automatic", + "capture_on": "{{$isoTimestamp}}", + "customer_id": "{{customer_id}}", + "description": "[Archipel Connector][Scenario5] - Create recurring payment", + "authentication_type": "no_three_ds", + "mandate_id": "{{mandate_id}}", + "off_session": true, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Create recurring/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/event.test.js new file mode 100644 index 0000000000..033167061b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/event.test.js @@ -0,0 +1,86 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments/:id - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments/:id - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve mandate/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/event.test.js new file mode 100644 index 0000000000..fe8fa706b9 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/event.test.js @@ -0,0 +1,75 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario5-Create a mandate and recurring payment/Payments - Retrieve recurring/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/.meta.json new file mode 100644 index 0000000000..6f5f51da5e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/.meta.json @@ -0,0 +1,10 @@ +{ + "childrenOrder": [ + "Payments - Create first", + "Payments - Confirm first and save card", + "Payment methods - List and get token", + "Payments - Create second", + "Payments - Confirm secod and use saved card", + "Payments - Retrieve" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/event.test.js new file mode 100644 index 0000000000..52c82b9201 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/event.test.js @@ -0,0 +1,28 @@ +// Validate status 2xx +pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payment_methods/:customer_id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// Response body should have at least one card payment mehod" +pm.test( +"[GET]::/payment_methods/:customer_id - Content check body has at least one customer_payment_methods", +function () { + pm.expect(jsonData.customer_payment_methods.length).greaterThan(0); + }, +); + +if (jsonData?.customer_payment_methods[0]?.payment_token) { + pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token); + console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token); +} else { + console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.'); +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/request.json new file mode 100644 index 0000000000..cff6d6d715 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/request.json @@ -0,0 +1,28 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/customers/:customer_id/payment_methods", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers", + ":customer_id", + "payment_methods" + ], + "variable": [ + { + "key": "customer_id", + "value": "{{customer_id}}", + "description": "//Pass the customer id" + } + ] + }, + "description": "To filter and list the applicable payment methods for a particular Customer ID" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payment methods - List and get token/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/event.test.js new file mode 100644 index 0000000000..061689b073 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/event.test.js @@ -0,0 +1,61 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test( +"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/request.json new file mode 100644 index 0000000000..f1a7642455 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/request.json @@ -0,0 +1,96 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102", + "card_network": "Visa" + } + }, + "setup_future_usage": "off_session", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "{{$isoTimestamp}}", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "125.0.0.1" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm first and save card/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/event.test.js new file mode 100644 index 0000000000..c42829b354 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/event.test.js @@ -0,0 +1,72 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + + +// Response body should have value "cybersource" for "connector" +if (jsonData?.connector) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'archipel'", + function () { + pm.expect(jsonData.connector).to.eql("archipel"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/request.json new file mode 100644 index 0000000000..1bc98ba4a2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/request.json @@ -0,0 +1,66 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}", + "payment_method": "card", + "payment_token": "{{payment_token}}", + "card_cvc": "123" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Confirm secod and use saved card/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/event.test.js new file mode 100644 index 0000000000..24c0c554d7 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + +if (jsonData?.customer_id) { + pm.collectionVariables.set("customer_id", jsonData.customer_id); + console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id); +} else { + console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.'); +}; + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { + pm.test("[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_payment_method'", function() { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + })}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/request.json new file mode 100644 index 0000000000..c2a7c3b22d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/request.json @@ -0,0 +1,74 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "currency": "EUR", + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "customer_id": "{{customer_id}}", + "description": "[Archipel Connector][Scenario6] - Create payment and save card", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create first/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/event.test.js new file mode 100644 index 0000000000..31c6af0dfb --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/event.test.js @@ -0,0 +1,41 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + +if (jsonData?.customer_id) { + pm.collectionVariables.set("customer_id", jsonData.customer_id); + console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id); +} else { + console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/request.json new file mode 100644 index 0000000000..d9143d2288 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/request.json @@ -0,0 +1,74 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "currency": "EUR", + "capture_on": "{{$isoTimestamp}}", + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "customer_id": "{{customer_id}}", + "setup_future_usage": "off_session", + "description": "[Archipel Connector][Scenario6] - Create payment with already saved card", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Create second/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..4ae08a2606 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/event.test.js @@ -0,0 +1,49 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario6-Saved card flow/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/.meta.json new file mode 100644 index 0000000000..afba25ab6d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Cancel" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/event.test.js new file mode 100644 index 0000000000..dcf3f19164 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/event.test.js @@ -0,0 +1,61 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/cancel - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/cancel - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/cancel - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "cancelled" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'", + function () { + pm.expect(jsonData.status).to.eql("cancelled"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/request.json new file mode 100644 index 0000000000..f64e37a125 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/request.json @@ -0,0 +1,43 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "cancellation_reason": "requested_by_customer" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/cancel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "cancel" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Cancel/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..0059369fd2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/event.test.js @@ -0,0 +1,66 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_capture" for "status" +pm.test( +"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", +function () { + pm.expect(jsonData.status).to.eql("requires_capture"); +}, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/request.json new file mode 100644 index 0000000000..db982ee59b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/request.json @@ -0,0 +1,68 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "phone_country_code": "+91", + "description": "[Archipel][Connector][Scenario7] - Create payment and cancel it", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario7-Void the payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/.meta.json new file mode 100644 index 0000000000..5949de1a33 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Incremental Authorization", + "Payments - Capture" + ], + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/event.test.js new file mode 100644 index 0000000000..bfbe32d242 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/event.test.js @@ -0,0 +1,80 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" + +pm.test( + "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + + +// Response body should have value "1001" for "amount" + +pm.test( + "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'", + function () { + pm.expect(jsonData.amount).to.eql(1001); + }, +); + +// Response body should have value "1001" for "amount_received" + +pm.test( + "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'", + function () { + pm.expect(jsonData.amount_received).to.eql(1001); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/request.json new file mode 100644 index 0000000000..9c93d2e288 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/request.json @@ -0,0 +1,33 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 1001 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "To capture the funds for an uncaptured payment" + } + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/event.test.js new file mode 100644 index 0000000000..01031b32cc --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/event.test.js @@ -0,0 +1,43 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// Response body should have value "requires_capture" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, +); + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/request.json new file mode 100644 index 0000000000..39ad0fbb08 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/request.json @@ -0,0 +1,58 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "phone_country_code": "+91", + "description": "[Archipel][Connector][Scenario8a] - Create payment with incremental authorization", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/event.test.js new file mode 100644 index 0000000000..d78d4999b2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/event.test.js @@ -0,0 +1,44 @@ + +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +var jsonData = pm.response.json(); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations ", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations.length).greaterThan(0); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () { + // Parse the response JSON + var jsonData = pm.response.json(); + + // Check if the 'status' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success"); +}); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/request.json new file mode 100644 index 0000000000..7370c98307 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/request.json @@ -0,0 +1,26 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 1001 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8a-Incremental authorization/Payments - Incremental Authorization/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/.meta.json new file mode 100644 index 0000000000..9ce06ce0af --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Incremental Authorization", + "Payments - Capture" + ], + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/event.test.js new file mode 100644 index 0000000000..a7af9e467a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/event.test.js @@ -0,0 +1,81 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "partially_captured" for "status" +if (jsonData?.status) { + pm.test( + "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'", + function () { + pm.expect(jsonData.status).to.eql("partially_captured"); + }, + ); +} + +// Response body should have value "1001" for "amount" +if (jsonData?.amount) { + pm.test( + "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'", + function () { + pm.expect(jsonData.amount).to.eql(1001); + }, + ); +} + +// Response body should have value "600" for "amount_received" +if (jsonData?.amount_received) { + pm.test( + "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '600'", + function () { + pm.expect(jsonData.amount_received).to.eql(600); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/request.json new file mode 100644 index 0000000000..639d22aa83 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/request.json @@ -0,0 +1,33 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 600 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + } +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/event.test.js new file mode 100644 index 0000000000..01031b32cc --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/event.test.js @@ -0,0 +1,43 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// Response body should have value "requires_capture" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, +); + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/request.json new file mode 100644 index 0000000000..cceff575c4 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/request.json @@ -0,0 +1,58 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "phone_country_code": "+91", + "description": "[Archipel][Connector][Scenario8b] - Create payment with incremental authorization and partial capture", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/event.test.js new file mode 100644 index 0000000000..d78d4999b2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/event.test.js @@ -0,0 +1,44 @@ + +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +var jsonData = pm.response.json(); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations ", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations.length).greaterThan(0); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () { + // Parse the response JSON + var jsonData = pm.response.json(); + + // Check if the 'status' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success"); +}); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/request.json new file mode 100644 index 0000000000..7370c98307 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/request.json @@ -0,0 +1,26 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 1001 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario8b-Incremental authorization with partial capture/Payments - Incremental Authorization/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/.meta.json new file mode 100644 index 0000000000..879784aca9 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Refunds - Create", + "Refunds - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..3229b53a6d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/event.test.js @@ -0,0 +1,70 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have value "500" for "amount" +pm.test("[POST]::/payments - Content check if value for 'amount' matches '500'", +function () { + pm.expect(jsonData.amount).to.eql(500); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/payments - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/event.test.js new file mode 100644 index 0000000000..8c56e30984 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/refunds - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test("[POST]::/refunds - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}); + +// Response body should have value "500" for "amount" +pm.test("[POST]::/refunds - Content check if value for 'amount' matches '500'", +function () { + pm.expect(jsonData.amount).to.eql(500); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/refunds - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/request.json new file mode 100644 index 0000000000..241a13121e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/request.json @@ -0,0 +1,42 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "payment_id": "{{payment_id}}", + "amount": 500, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } + } + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/event.test.js new file mode 100644 index 0000000000..8c56e30984 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/refunds - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test("[POST]::/refunds - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}); + +// Response body should have value "500" for "amount" +pm.test("[POST]::/refunds - Content check if value for 'amount' matches '500'", +function () { + pm.expect(jsonData.amount).to.eql(500); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/refunds - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/request.json new file mode 100644 index 0000000000..6c28619e85 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/refunds/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{refund_id}}", + "description": "(Required) unique refund id" + } + ] + }, + "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9a-Refund full payment/Refunds - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/.meta.json new file mode 100644 index 0000000000..879784aca9 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Refunds - Create", + "Refunds - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..3229b53a6d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/event.test.js @@ -0,0 +1,70 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have value "500" for "amount" +pm.test("[POST]::/payments - Content check if value for 'amount' matches '500'", +function () { + pm.expect(jsonData.amount).to.eql(500); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/payments - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/event.test.js new file mode 100644 index 0000000000..6c9824d340 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/refunds - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test("[POST]::/refunds - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}); + +// Response body should have value "200" for "amount" +pm.test("[POST]::/refunds - Content check if value for 'amount' matches '200'", +function () { + pm.expect(jsonData.amount).to.eql(200); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/refunds - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/request.json new file mode 100644 index 0000000000..aa09538e1c --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/request.json @@ -0,0 +1,42 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "payment_id": "{{payment_id}}", + "amount": 200, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } + } + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/event.test.js new file mode 100644 index 0000000000..6c9824d340 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/refunds - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test("[POST]::/refunds - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}); + +// Response body should have value "200" for "amount" +pm.test("[POST]::/refunds - Content check if value for 'amount' matches '200'", +function () { + pm.expect(jsonData.amount).to.eql(200); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/refunds - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/request.json new file mode 100644 index 0000000000..6c28619e85 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/refunds/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{refund_id}}", + "description": "(Required) unique refund id" + } + ] + }, + "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9b-Refund partial payment/Refunds - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/.meta.json new file mode 100644 index 0000000000..fd6b46372c --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Incremental Authorization", + "Payments - Capture", + "Refunds - Create" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/event.test.js new file mode 100644 index 0000000000..bfbe32d242 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/event.test.js @@ -0,0 +1,80 @@ +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) { } + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" + +pm.test( + "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + + +// Response body should have value "1001" for "amount" + +pm.test( + "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'", + function () { + pm.expect(jsonData.amount).to.eql(1001); + }, +); + +// Response body should have value "1001" for "amount_received" + +pm.test( + "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'", + function () { + pm.expect(jsonData.amount_received).to.eql(1001); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/request.json new file mode 100644 index 0000000000..9c93d2e288 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/request.json @@ -0,0 +1,33 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 1001 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "To capture the funds for an uncaptured payment" + } + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..01031b32cc --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/event.test.js @@ -0,0 +1,43 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// Response body should have value "requires_capture" for "status" +pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, +); + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/request.json new file mode 100644 index 0000000000..39ad0fbb08 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/request.json @@ -0,0 +1,58 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "phone_country_code": "+91", + "description": "[Archipel][Connector][Scenario8a] - Create payment with incremental authorization", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/event.test.js new file mode 100644 index 0000000000..d78d4999b2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/event.test.js @@ -0,0 +1,44 @@ + +// Validate status 2xx +pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +var jsonData = pm.response.json(); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations ", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations.length).greaterThan(0); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'", function () { + // Check if the 'amount' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500); +}); + +pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () { + // Parse the response JSON + var jsonData = pm.response.json(); + + // Check if the 'status' in the response matches the expected value + pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success"); +}); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/request.json new file mode 100644 index 0000000000..7370c98307 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/request.json @@ -0,0 +1,26 @@ +{ + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 1001 + } + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Payments - Incremental Authorization/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/event.test.js new file mode 100644 index 0000000000..804d3e4a58 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/event.test.js @@ -0,0 +1,48 @@ +// Validate status 2xx +pm.test("[POST]::/refunds - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test("[POST]::/refunds - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}); + +// Response body should have value "1001" for "amount" +pm.test("[POST]::/refunds - Content check if value for 'amount' matches '1001'", +function () { + pm.expect(jsonData.amount).to.eql(1001); +}); + +// Response body should have "EUR" for "currency" +pm.test("[POST]::/refunds - Content check if value for 'currency' matches 'EUR'", +function () { + pm.expect(jsonData.currency).to.eql("EUR"); +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/request.json new file mode 100644 index 0000000000..d48ee5a25b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/request.json @@ -0,0 +1,42 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "payment_id": "{{payment_id}}", + "amount": 1001, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } + } + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Happy Cases/Scenario9c-Refund full incremented payment/Refunds - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/.meta.json new file mode 100644 index 0000000000..9ac15a2c1e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/.meta.json @@ -0,0 +1,14 @@ +{ + "childrenOrder": [ + "Scenario1-Create payment with Invalid card details", + "Scenario2-Confirming without payment method", + "Scenario3-Create payment with Manual capture but wrong pan", + "Scenario4-Capture greater amount", + "Scenario5-Capture the succeeded payment", + "Scenario6-Create a recurring payment with greater mandate amount", + "Scenario7-Create a card payment without card scheme", + "Scenario8-Void succeeded payment", + "Scenario9-Refund exceeds amount", + "Scenario10-Refund for unsuccessful payment" + ] +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/.meta.json new file mode 100644 index 0000000000..6604e8a748 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create(Invalid card number)", + "Payments - Create(Invalid Exp month)", + "Payments - Create(Invalid Exp Year)", + "Payments - Create(invalid CVV)" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js new file mode 100644 index 0000000000..c4b29d78d2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js @@ -0,0 +1,73 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "next_action.redirect_to_url" +pm.test("[POST]::/payments - Content check if 'error' exists", function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; +}); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} + +// Response body should have value "connector error" for "error message" +if (jsonData?.error?.message) { + pm.test( + "[POST]::/payments - Content check if value for 'error.message' matches 'Invalid Expiry Year'", + function () { + pm.expect(jsonData.error.message).to.eql("Invalid Expiry Year"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json new file mode 100644 index 0000000000..f489c223bf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "1970", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js new file mode 100644 index 0000000000..ee90c62b81 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js @@ -0,0 +1,63 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "next_action.redirect_to_url" +pm.test("[POST]::/payments - Content check if 'error' exists", function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; +}); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json new file mode 100644 index 0000000000..09aeb8d28f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "24", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js new file mode 100644 index 0000000000..a58e23401e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js @@ -0,0 +1,63 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test("[POST]::/payments - Content check if 'error' exists", function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; +}); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'", + function () { + pm.expect(jsonData.error.type).to.eql("connector_error"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json new file mode 100644 index 0000000000..4b1dda42d0 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js new file mode 100644 index 0000000000..2e6eccc81b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js @@ -0,0 +1,63 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test("[POST]::/payments - Content check if 'error' exists", function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; +}); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json new file mode 100644 index 0000000000..22553a15b1 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "00000", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/.meta.json new file mode 100644 index 0000000000..5ded1b913f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Refunds - Create" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..1961240af6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_confirmation" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'", + function () { + pm.expect(jsonData.status).to.eql("requires_confirmation"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/request.json new file mode 100644 index 0000000000..89e21331cd --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": false, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/event.test.js new file mode 100644 index 0000000000..d3c4451760 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/event.test.js @@ -0,0 +1,48 @@ +// Validate status 4xx +pm.test("[POST]::/refunds - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "invalid_request" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/request.json new file mode 100644 index 0000000000..d18aaf8bef --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/request.json @@ -0,0 +1,42 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "payment_id": "{{payment_id}}", + "amount": 540, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } + } + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario10-Refund for unsuccessful payment/Refunds - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/.meta.json new file mode 100644 index 0000000000..90b19864ee --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Confirm" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/event.test.js new file mode 100644 index 0000000000..839f2246ae --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/event.test.js @@ -0,0 +1,69 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/confirm - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/request.json new file mode 100644 index 0000000000..16f6e13983 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/request.json @@ -0,0 +1,63 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "client_secret": "{{client_secret}}" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/event.test.js new file mode 100644 index 0000000000..905cc47900 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_payment_method" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", + function () { + pm.expect(jsonData.status).to.eql("requires_payment_method"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/request.json new file mode 100644 index 0000000000..3220d8af0e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/request.json @@ -0,0 +1,79 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": false, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario2-Confirming without payment method/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/.meta.json new file mode 100644 index 0000000000..60051ecca2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..4ac527d834 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/.event.meta.json @@ -0,0 +1,6 @@ +{ + "eventOrder": [ + "event.test.js", + "event.prerequest.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/event.prerequest.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/event.test.js new file mode 100644 index 0000000000..6293ba1938 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/event.test.js @@ -0,0 +1,75 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "failed" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'failed'", + function () { + pm.expect(jsonData.status).to.eql("failed"); + }, + ); +} + +pm.test( + "[POST]::/payments - Content check if 'connector' is archipel", + function () { + pm.expect(jsonData.connector).to.be.equal("archipel"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/request.json new file mode 100644 index 0000000000..926ed7990e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "0000000000000" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..83c414a41f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/event.test.js @@ -0,0 +1,81 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "failed" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'", + function () { + pm.expect(jsonData.status).to.eql("failed"); + }, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); + +let payment_attempt = {} + +pm.test( + "[POST]::/payments - Payment has one 'Payment Attempt'", + function () { + pm.expect(jsonData.attempts.length).to.be.equal(1); + payment_attempt = jsonData.attempts[0] + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has 'authorization_failed' status", + function () { + pm.expect(payment_attempt.status).to.be.equal("authorization_failed"); + }, +); + + +pm.test( + "[POST]::/payments - Payment Attempt has 'connector_transaction_id'", + function () { + pm.expect(payment_attempt.connector_transaction_id).to.be.equal( + pm.collectionVariables.get("connector_transaction_id") + ); + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has archiepl response 'transactionId' in connector_metadata", + function () { + pm.expect(payment_attempt.connector_metadata.transactionId).to.be.not.null; + pm.collectionVariables.set("archipel_transaction_uuid", payment_attempt.connector_metadata.transactionId) + }, +); + +pm.test( + "[POST]::/payments - Payment Attempt has no error", + function () { + pm.expect(payment_attempt.error_message).to.be.null; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/request.json new file mode 100644 index 0000000000..c357901bbf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario3-Create payment with Manual capture but wrong pan/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/.meta.json new file mode 100644 index 0000000000..e4ef30e39e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Capture", + "Payments - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/event.test.js new file mode 100644 index 0000000000..5148496731 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/event.test.js @@ -0,0 +1,69 @@ +// Validate status 4xx +pm.test("[POST]::/payments/:id/capture - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/request.json new file mode 100644 index 0000000000..766a8330d6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/request.json @@ -0,0 +1,45 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 7000, + "statement_descriptor_name": "Joseph", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To capture the funds for an uncaptured payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/event.test.js new file mode 100644 index 0000000000..0059369fd2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/event.test.js @@ -0,0 +1,66 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_capture" for "status" +pm.test( +"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", +function () { + pm.expect(jsonData.status).to.eql("requires_capture"); +}, +); + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/request.json new file mode 100644 index 0000000000..fb4c86242d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "manual", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..5bbd978e9c --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_capture" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", + function () { + pm.expect(jsonData.status).to.eql("requires_capture"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario4-Capture greater amount/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/.meta.json new file mode 100644 index 0000000000..3074abbae2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/.meta.json @@ -0,0 +1,7 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Sync payment", + "Payments - Capture" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/event.test.js new file mode 100644 index 0000000000..5148496731 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/event.test.js @@ -0,0 +1,69 @@ +// Validate status 4xx +pm.test("[POST]::/payments/:id/capture - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/capture - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/request.json new file mode 100644 index 0000000000..766a8330d6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/request.json @@ -0,0 +1,45 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount_to_capture": 7000, + "statement_descriptor_name": "Joseph", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To capture the funds for an uncaptured payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Capture/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..e6950cb91a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + pm.collectionVariables.set("connector_transaction_id", jsonData.connector_transaction_id) + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/event.test.js new file mode 100644 index 0000000000..becb5cfa9b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/event.test.js @@ -0,0 +1,68 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Response body should have value "Succeeded" for "status" +pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount' equal 500", + function () { + pm.expect(jsonData.amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'net_amount' equal 500", + function () { + pm.expect(jsonData.net_amount).to.eql(500); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0", + function () { + pm.expect(jsonData.amount_capturable).to.eql(0); + }, +); + +pm.test( + "[POST]::/payments/:id - Content check if value for 'amount_received' equal 500", + function () { + pm.expect(jsonData.amount_received).to.eql(500); + }, +); + + +// Response body should have "connector_transaction_id" +pm.test( + "[POST]::/payments - Content check if 'connector_transaction_id' exists", + function () { + pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be + .true; + }, +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario5-Capture the succeeded payment/Payments - Sync payment/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/.meta.json new file mode 100644 index 0000000000..ad88bfd417 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Confirm", + "Payments - Retrieve", + "Recurring Payments - Create" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/event.test.js new file mode 100644 index 0000000000..2b8a0318d3 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/event.test.js @@ -0,0 +1,59 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id); +} else { + console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.'); +}; + + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id); +} else { + console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.'); +}; + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret); +} else { + console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.'); +}; + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { +pm.test("[POST]::/payments - Content check if value for 'status' matches 'succeeded'", function() { + pm.expect(jsonData.status).to.eql("succeeded"); +})}; + +// Response body should have "mandate_id" +pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() { + pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true; +}); + +// Response body should have "mandate_data" +pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() { + pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true; +}); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/request.json new file mode 100644 index 0000000000..838f3aab5f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/request.json @@ -0,0 +1,103 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "publishable_key", + "value": "pk_snd_8798c6a9114646f8b970b93ad5765ddf", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "customer_id": "{{customer_id}}", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102", + "card_network": "Mastercard" + } + }, + "setup_future_usage": "off_session", + "payment_type": "setup_mandate", + "mandate_data": { + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "{{$isoTimestamp}}", + "online": { + "ip_address": "125.0.0.1", + "user_agent": "amet irure esse" + } + }, + "mandate_type": { + "multi_use": { + "amount": 799, + "currency": "EUR", + "start_date": "{{$isoTimestamp}}", + "end_date": "2099-01-01T00:00:00Z", + "metadata": { + "frequency": "13" + } + } + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Confirm/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js new file mode 100644 index 0000000000..24534fc903 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js @@ -0,0 +1,85 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "requires_confirmation" for "status" +pm.test( +"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'", +function () { + pm.expect(jsonData.status).to.eql("requires_confirmation"); +}, +); + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/request.json new file mode 100644 index 0000000000..1a9750f36a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/request.json @@ -0,0 +1,108 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 0, + "currency": "EUR", + "confirm": false, + "capture_method": "automatic", + "customer_id": "{{customer_id}}", + "profile_id": "{{profile_id}}", + "description": "[Archipel Connector][Variation Cases][Scenario6] - Create mandate", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102", + "card_network": "Visa" + } + }, + "setup_future_usage": "off_session", + "mandate_data": { + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + "mandate_type": { + "single_use": { + "amount": 1000, + "currency": "EUR" + } + } + }, + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..58d2dfe66d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js @@ -0,0 +1,74 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js new file mode 100644 index 0000000000..e862404c2b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js @@ -0,0 +1,79 @@ +// Validate status 4xx +pm.test("[POST]::/payments - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "invalid_request" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json new file mode 100644 index 0000000000..a7da97361d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json @@ -0,0 +1,76 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 9000, + "currency": "EUR", + "confirm": true, + "profile_id": "{{profile_id}}", + "capture_method": "automatic", + "capture_on": "{{$isoTimestamp}}", + "customer_id": "{{customer_id}}", + "description": "[Archipel Connector][Variation Cases][Scenario6] - Create recurring payment greather than mandate amount", + "authentication_type": "no_three_ds", + "mandate_id": "{{mandate_id}}", + "off_session": true, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario6-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/.meta.json new file mode 100644 index 0000000000..60051ecca2 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/event.test.js new file mode 100644 index 0000000000..31d2934290 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/event.test.js @@ -0,0 +1,85 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +pm.test( +"[POST]::/payments - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}, +); + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/request.json new file mode 100644 index 0000000000..1527fe6979 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/request.json @@ -0,0 +1,67 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "[Archipel Connector][Variation Cases][Scenario7] - Create card payment without passing card scheme", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..fc0c30e948 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/event.test.js @@ -0,0 +1,57 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +pm.test( +"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", +function () { + pm.expect(jsonData.status).to.eql("succeeded"); +}, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/request.json new file mode 100644 index 0000000000..b9ebc1be4a --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario7-Create a card payment without card scheme/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/.meta.json new file mode 100644 index 0000000000..afba25ab6d --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Cancel" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/event.test.js new file mode 100644 index 0000000000..0f869a6dfb --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/event.test.js @@ -0,0 +1,69 @@ +// Validate status 4xx +pm.test("[POST]::/payments/:id/cancel - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/payments/:id/cancel - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Validate if response has JSON Body +pm.test("[POST]::/payments/:id/cancel - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/request.json new file mode 100644 index 0000000000..f64e37a125 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/request.json @@ -0,0 +1,43 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "cancellation_reason": "requested_by_customer" + } + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/cancel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "cancel" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Cancel/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/event.test.js new file mode 100644 index 0000000000..9885d5f5e7 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/request.json new file mode 100644 index 0000000000..5668781260 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/request.json @@ -0,0 +1,68 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "profile_id": "{{profile_id}}", + "phone_country_code": "+91", + "description": "[Archipel][Connector][VariationCases][Scenario8] - Try to cancel success payment", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario8-Void succeeded payment/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/.meta.json new file mode 100644 index 0000000000..5ded1b913f --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/.meta.json @@ -0,0 +1,6 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Refunds - Create" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/event.test.js new file mode 100644 index 0000000000..9885d5f5e7 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/event.test.js @@ -0,0 +1,58 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/event.test.js new file mode 100644 index 0000000000..776dbd7071 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/event.test.js @@ -0,0 +1,48 @@ +// Validate status 4xx +pm.test("[POST]::/refunds - Status code is 4xx", function () { + pm.response.to.be.error; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/refunds - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id +if (jsonData?.refund_id) { + pm.collectionVariables.set("refund_id", jsonData.refund_id); + console.log( + "- use {{refund_id}} as collection variable for value", + jsonData.refund_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.", + ); +} + +// Response body should have "error" +pm.test( + "[POST]::/payments/:id/confirm - Content check if 'error' exists", + function () { + pm.expect(typeof jsonData.error !== "undefined").to.be.true; + }, +); + +// Response body should have value "connector error" for "error type" +if (jsonData?.error?.type) { + pm.test( + "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", + function () { + pm.expect(jsonData.error.type).to.eql("invalid_request"); + }, + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/request.json new file mode 100644 index 0000000000..326319e8fd --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/request.json @@ -0,0 +1,42 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "payment_id": "{{payment_id}}", + "amount": 7000, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } + } + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/Negative Cases/Scenario9-Refund exceeds amount/Refunds - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/.meta.json new file mode 100644 index 0000000000..883fe751ef --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/.meta.json @@ -0,0 +1,12 @@ +{ + "childrenOrder": [ + "Organization - Create", + "Merchant Account - Create", + "API Key - Create", + "Business Profile - Create", + "Payment Connector - Create", + "Customer - Create", + "Payments - Create", + "Payments - Retrieve" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/event.test.js new file mode 100644 index 0000000000..e40171e957 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/event.test.js @@ -0,0 +1,55 @@ +// Validate status 2xx +pm.test("[POST]::/api_keys/:merchant_id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/api_keys/:merchant_id - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id +if (jsonData?.key_id) { + pm.collectionVariables.set("api_key_id", jsonData.key_id); + console.log( + "- use {{api_key_id}} as collection variable for value", + jsonData.key_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.", + ); +} + +// pm.collectionVariables - Set api_key as variable for jsonData.api_key +if (jsonData?.api_key) { + pm.collectionVariables.set("api_key", jsonData.api_key); + console.log( + "- use {{api_key}} as collection variable for value", + jsonData.api_key, + ); +} else { + console.log( + "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.", + ); +} + +pm.test( + "[POST]::/api_keys/:merchant_id - Validate merchant_id", + function () { + pm.expect(jsonData.merchant_id).to.equal( + pm.collectionVariables.get("merchant_id"), + ); + }, +); diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/request.json new file mode 100644 index 0000000000..2176551fb8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/request.json @@ -0,0 +1,52 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw_json_formatted": { + "name": "archipel_connector_dev_key", + "description": "Api key used to test payments with archipel connector", + "expiration": "2099-09-23T01:02:03.000Z" + } + }, + "url": { + "raw": "{{baseUrl}}/api_keys/:merchant_id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api_keys", + ":merchant_id" + ], + "variable": [ + { + "key": "merchant_id", + "value": "{{merchant_id}}" + } + ] + } +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/API Key - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/event.test.js new file mode 100644 index 0000000000..402887cade --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/event.test.js @@ -0,0 +1,49 @@ +// Validate status 2xx +pm.test( + "[POST]::/account/:account_id/business_profile - Status code is 2xx", + function () { + pm.response.to.be.success; + }, +); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/account/:account_id/business_profile - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set profile_id as variable for jsonData.profile_id +if (jsonData?.profile_id) { + pm.collectionVariables.set( + "profile_id", + jsonData.profile_id, + ); + console.log( + "- use {{profile_id}} as collection variable for value", + jsonData.profile_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{profile_id}}, as jsonData.profile_id is undefined.", + ); +} + +// Validate if response has correct merchant_id +pm.test( + "[POST]::/account/:account_id/business_profile - Validate merchant_id", + function () { + pm.expect(jsonData.merchant_id).to.eql( + pm.collectionVariables.get("merchant_id") + ); + } +); \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/request.json new file mode 100644 index 0000000000..d3d479c363 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/request.json @@ -0,0 +1,64 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "profile_name": "eisop_cnp", + "is_connector_agnostic_mit_enabled": true, + "collect_billing_details_from_wallet_connector": true + } + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/business_profile", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "account", + ":account_id", + "business_profile" + ], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}" + } + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Business Profile - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/event.test.js new file mode 100644 index 0000000000..8d97e350aa --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/event.test.js @@ -0,0 +1,26 @@ +// Validate status 2xx +pm.test("[POST]::/customers - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/customers - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json"); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/customers - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try {jsonData = pm.response.json();}catch(e){} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.customer_id) { + pm.collectionVariables.set("customer_id", jsonData.customer_id); + console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id); +} else { + console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.payment_id is undefined.'); +}; \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/request.json new file mode 100644 index 0000000000..87e7127354 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/request.json @@ -0,0 +1,70 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "name": "User Test", + "email": "user@test.com", + "phone": "381545600", + "phone_country_code": "+33", + "description": "Archipel connector test user", + "address": { + "line1": "Parc La Fayette", + "line2": "6 Rue Isaac Newton", + "line3": "", + "zip": "25000", + "city": "Besancon", + "state": "FRANCE", + "country": "FR", + "first_name": "User", + "last_name": "Test" + }, + "metadata": {} + } + }, + "url": { + "raw": "{{baseUrl}}/customers", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Customer - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js new file mode 100644 index 0000000000..7de0d5beb3 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js @@ -0,0 +1,56 @@ +// Validate status 2xx +pm.test("[POST]::/accounts - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/accounts - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id +if (jsonData?.merchant_id) { + pm.collectionVariables.set("merchant_id", jsonData.merchant_id); + console.log( + "- use {{merchant_id}} as collection variable for value", + jsonData.merchant_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.", + ); +} + +// pm.collectionVariables - Set api_key as variable for jsonData.api_key +if (jsonData?.api_key) { + pm.collectionVariables.set("api_key", jsonData.api_key); + console.log( + "- use {{api_key}} as collection variable for value", + jsonData.api_key, + ); +} else { + console.log( + "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.", + ); +} + +// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key +if (jsonData?.publishable_key) { + pm.collectionVariables.set("publishable_key", jsonData.publishable_key); + console.log( + "- use {{publishable_key}} as collection variable for value", + jsonData.publishable_key, + ); +} else { + console.log( + "INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.", + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/request.json new file mode 100644 index 0000000000..fb84d55caf --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/request.json @@ -0,0 +1,79 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "merchant_id": "flowbird", + "organization_id": "{{organization_id}}", + "merchant_name": "Flowbird", + "merchant_details": { + "primary_contact_person": "Primary Contact Person", + "primary_email": "primary_email@flowbird.group", + "primary_phone": "Primary Phone Number", + "secondary_contact_person": "Flowbird contact", + "secondary_email": "contact@flowbird.group", + "secondary_phone": "+33 (0) 1 58 09 81 10", + "website": "https://www.flowbird.com/", + "about_business": "Effortless Parking, Charging, Payments and Movement, From City to City", + "address": { + "line1": "2 ter rue du château", + "line2": "", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + } + }, + "sub_merchants_enabled": false, + "metadata": { + "compatible_connector": "archipel" + } + } + }, + "url": { + "raw": "{{baseUrl}}/accounts", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "accounts" + ] + }, + "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Merchant Account - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/event.test.js new file mode 100644 index 0000000000..f2008fe8f0 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/event.test.js @@ -0,0 +1,30 @@ +// Validate status 2xx +pm.test("[POST]::/organization - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/organization - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id +if (jsonData?.organization_id) { + pm.collectionVariables.set("organization_id", jsonData.organization_id); + console.log( + "- use {{organization_id}} as collection variable for value", + jsonData.organization_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{organization_id}}, as jsonData.organization_id is undefined.", + ); +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/request.json new file mode 100644 index 0000000000..a9a7ecbfb8 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/request.json @@ -0,0 +1,56 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "organization_details": null, + "metadata": null, + "organization_name": "Flowbird" + } + }, + "url": { + "raw": "{{baseUrl}}/organization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "organization" + ] + }, + "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Organization - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js new file mode 100644 index 0000000000..17583e8bcc --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js @@ -0,0 +1,103 @@ +// Validate status 2xx +pm.test( + "[POST]::/account/:account_id/connectors - Status code is 2xx", + function () { + pm.response.to.have.status(200); + }, +); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/account/:account_id/connectors - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Set response object as internal variable +let jsonData = pm.response.json(); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate connector_type", + function () { + pm.expect(jsonData.connector_type).to.equal( + "payment_processor", + ); + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate connector_name", + function () { + pm.expect(jsonData.connector_name).to.equal( + "archipel", + ); + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate merchant_connector_id", + function () { + // pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id + if (jsonData?.merchant_connector_id) { + pm.collectionVariables.set( + "merchant_connector_id", + jsonData.merchant_connector_id, + ); + console.log( + "- use {{merchant_connector_id}} as collection variable for value", + jsonData.merchant_connector_id, + ); + } else { + console.log( + "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", + ); + } + pm.expect(jsonData.merchant_connector_id).to.equal( + pm.collectionVariables.get("merchant_connector_id") + ); + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate auth_type is NoKey", + function () { + pm.expect(jsonData.connector_account_details.auth_type).to.equal( + "NoKey" + ); + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate metadata contains tenant_id", + function () { + pm.expect(jsonData.metadata.tenant_id).to.not.be.null; + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate is not test_mode", + function () { + pm.expect(jsonData.test_mode).to.be.false; + }, +); + + +pm.test( + "[POST]::/account/:account_id/connectors - Validate is not disabled", + function () { + pm.expect(jsonData.test_mode).to.be.false; + }, +); + +pm.test( + "[POST]::/account/:account_id/connectors - Validate have active status", + function () { + pm.expect(jsonData.status).to.equal( + "active" + ); + }, +); + diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/request.json new file mode 100644 index 0000000000..dcd7ffde08 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/request.json @@ -0,0 +1,177 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "connector_type": "payment_processor", + "connector_name": "archipel", + "connector_account_details": { + "auth_type": "NoKey" + }, + "metadata": { + "tenant_id": "{{archipel_tenant_id}}", + "platform_url": "{{archipel_platform_url}}", + "apple_pay_combined": { + "manual": { + "session_token_data": { + "initiative": "web", + "certificate": "", + "display_name": "Flowbird", + "certificate_keys": "", + "initiative_context": "", + "merchant_identifier": "", + "merchant_business_country": "", + "payment_processing_details_at": "Hyperswitch", + "payment_processing_certificate": "", + "payment_processing_certificate_key": "" + }, + "payment_request_data": { + "label": "Flowbird", + "supported_networks": [ + "visa", + "masterCard", + "amex", + "discover" + ], + "merchant_capabilities": [ + "supports3DS" + ] + } + } + } + }, + "profile_id": "{{profile_id}}", + "test_mode": false, + "disabled": false, + "payment_methods_enabled": [ + { + "payment_method": "card", + "payment_method_types": [ + { + "payment_method_type": "credit", + "payment_experience": null, + "card_networks": [ + "AmericanExpress", + "Discover", + "Interac", + "JCB", + "Mastercard", + "Visa", + "DinersClub", + "UnionPay", + "RuPay" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "debit", + "payment_experience": null, + "card_networks": [ + "AmericanExpress", + "Discover", + "Interac", + "JCB", + "Mastercard", + "Visa", + "DinersClub", + "UnionPay", + "RuPay" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + }, + { + "payment_method": "wallet", + "payment_method_types": [ + { + "payment_method_type": "apple_pay", + "payment_experience": null, + "card_networks": [ + "AmericanExpress", + "Discover", + "Interac", + "JCB", + "Mastercard", + "Visa", + "DinersClub", + "UnionPay", + "RuPay" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": false, + "installment_payment_enabled": true + } + ] + } + ] + } + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/connectors", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "account", + ":account_id", + "connectors" + ], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}", + "description": "(Required) The unique identifier for the merchant account" + } + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." +} \ No newline at end of file diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payment Connector - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/event.test.js new file mode 100644 index 0000000000..a6947db94c --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/event.test.js @@ -0,0 +1,61 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/request.json new file mode 100644 index 0000000000..1b3903eba6 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/request.json @@ -0,0 +1,90 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 500, + "amount_to_capture": 500, + "currency": "EUR", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "01", + "card_exp_year": "50", + "card_holder_name": "John Doe", + "card_number": "5185570141917102" + } + }, + "profile_id": "{{profile_id}}", + "email": "john_doe@gmail.com", + "name": "John Doe", + "phone": "8056594427", + "phone_country_code": "+91", + "description": "{{$randomLoremSentence}}", + "billing": { + "address": { + "line1": "2 ter", + "line2": "rue du château", + "line3": "", + "city": "Neuilly-sur-Seine", + "state": "France", + "zip": "92200", + "country": "FR" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "Joseph Doe", + "statement_descriptor_suffix": "JS" + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js new file mode 100644 index 0000000000..d0a02af743 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js @@ -0,0 +1,61 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/request.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/request.json new file mode 100644 index 0000000000..c71774083b --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/response.json b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Flow Testcases/QuickStart/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/Health check/.meta.json b/postman/collection-dir/archipel/Health check/.meta.json new file mode 100644 index 0000000000..a2453d22a1 --- /dev/null +++ b/postman/collection-dir/archipel/Health check/.meta.json @@ -0,0 +1,5 @@ +{ + "childrenOrder": [ + "Healthcheck" + ] +} diff --git a/postman/collection-dir/archipel/Health check/Healthcheck/.event.meta.json b/postman/collection-dir/archipel/Health check/Healthcheck/.event.meta.json new file mode 100644 index 0000000000..688c85746e --- /dev/null +++ b/postman/collection-dir/archipel/Health check/Healthcheck/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/archipel/Health check/Healthcheck/event.test.js b/postman/collection-dir/archipel/Health check/Healthcheck/event.test.js new file mode 100644 index 0000000000..b490b8be09 --- /dev/null +++ b/postman/collection-dir/archipel/Health check/Healthcheck/event.test.js @@ -0,0 +1,4 @@ +// Validate status 2xx +pm.test("[POST]::/accounts - Status code is 2xx", function () { + pm.response.to.be.success; +}); diff --git a/postman/collection-dir/archipel/Health check/Healthcheck/request.json b/postman/collection-dir/archipel/Health check/Healthcheck/request.json new file mode 100644 index 0000000000..4e1e0a0d9e --- /dev/null +++ b/postman/collection-dir/archipel/Health check/Healthcheck/request.json @@ -0,0 +1,13 @@ +{ + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/health", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "health" + ] + } +} diff --git a/postman/collection-dir/archipel/Health check/Healthcheck/response.json b/postman/collection-dir/archipel/Health check/Healthcheck/response.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/postman/collection-dir/archipel/Health check/Healthcheck/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/archipel/event.prerequest.js b/postman/collection-dir/archipel/event.prerequest.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/postman/collection-dir/archipel/event.test.js b/postman/collection-dir/archipel/event.test.js new file mode 100644 index 0000000000..fb52caec30 --- /dev/null +++ b/postman/collection-dir/archipel/event.test.js @@ -0,0 +1,13 @@ +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log("[LOG]::payment_id - " + jsonData.payment_id); +} + +console.log("[LOG]::x-request-id - " + pm.response.headers.get("x-request-id")); diff --git a/postman/collection-json/archipel.postman_collection.json b/postman/collection-json/archipel.postman_collection.json new file mode 100644 index 0000000000..8d89998804 --- /dev/null +++ b/postman/collection-json/archipel.postman_collection.json @@ -0,0 +1,11177 @@ +{ + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);", + "}", + "", + "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));", + "" + ], + "type": "text/javascript" + } + } + ], + "item": [ + { + "name": "Health check", + "item": [ + { + "name": "Healthcheck", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/health", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "health" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Flow Testcases", + "item": [ + { + "name": "QuickStart", + "item": [ + { + "name": "Organization - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/organization - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/organization - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id", + "if (jsonData?.organization_id) {", + " pm.collectionVariables.set(\"organization_id\", jsonData.organization_id);", + " console.log(", + " \"- use {{organization_id}} as collection variable for value\",", + " jsonData.organization_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{organization_id}}, as jsonData.organization_id is undefined.\",", + " );", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"organization_details\":null,\"metadata\":null,\"organization_name\":\"Flowbird\"}" + }, + "url": { + "raw": "{{baseUrl}}/organization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "organization" + ] + }, + "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." + }, + "response": [] + }, + { + "name": "Merchant Account - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id", + "if (jsonData?.merchant_id) {", + " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);", + " console.log(", + " \"- use {{merchant_id}} as collection variable for value\",", + " jsonData.merchant_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set api_key as variable for jsonData.api_key", + "if (jsonData?.api_key) {", + " pm.collectionVariables.set(\"api_key\", jsonData.api_key);", + " console.log(", + " \"- use {{api_key}} as collection variable for value\",", + " jsonData.api_key,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key", + "if (jsonData?.publishable_key) {", + " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);", + " console.log(", + " \"- use {{publishable_key}} as collection variable for value\",", + " jsonData.publishable_key,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"merchant_id\":\"flowbird\",\"organization_id\":\"{{organization_id}}\",\"merchant_name\":\"Flowbird\",\"merchant_details\":{\"primary_contact_person\":\"Primary Contact Person\",\"primary_email\":\"primary_email@flowbird.group\",\"primary_phone\":\"Primary Phone Number\",\"secondary_contact_person\":\"Flowbird contact\",\"secondary_email\":\"contact@flowbird.group\",\"secondary_phone\":\"+33 (0) 1 58 09 81 10\",\"website\":\"https://www.flowbird.com/\",\"about_business\":\"Effortless Parking, Charging, Payments and Movement, From City to City\",\"address\":{\"line1\":\"2 ter rue du château\",\"line2\":\"\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"}},\"sub_merchants_enabled\":false,\"metadata\":{\"compatible_connector\":\"archipel\"}}" + }, + "url": { + "raw": "{{baseUrl}}/accounts", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "accounts" + ] + }, + "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." + }, + "response": [] + }, + { + "name": "API Key - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id", + "if (jsonData?.key_id) {", + " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);", + " console.log(", + " \"- use {{api_key_id}} as collection variable for value\",", + " jsonData.key_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set api_key as variable for jsonData.api_key", + "if (jsonData?.api_key) {", + " pm.collectionVariables.set(\"api_key\", jsonData.api_key);", + " console.log(", + " \"- use {{api_key}} as collection variable for value\",", + " jsonData.api_key,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",", + " );", + "}", + "", + "pm.test(", + " \"[POST]::/api_keys/:merchant_id - Validate merchant_id\",", + " function () {", + " pm.expect(jsonData.merchant_id).to.equal(", + " pm.collectionVariables.get(\"merchant_id\"),", + " );", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"name\":\"archipel_connector_dev_key\",\"description\":\"Api key used to test payments with archipel connector\",\"expiration\":\"2099-09-23T01:02:03.000Z\"}" + }, + "url": { + "raw": "{{baseUrl}}/api_keys/:merchant_id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api_keys", + ":merchant_id" + ], + "variable": [ + { + "key": "merchant_id", + "value": "{{merchant_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Business Profile - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(", + " \"[POST]::/account/:account_id/business_profile - Status code is 2xx\",", + " function () {", + " pm.response.to.be.success;", + " },", + ");", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/account/:account_id/business_profile - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set profile_id as variable for jsonData.profile_id", + "if (jsonData?.profile_id) {", + " pm.collectionVariables.set(", + " \"profile_id\",", + " jsonData.profile_id,", + " );", + " console.log(", + " \"- use {{profile_id}} as collection variable for value\",", + " jsonData.profile_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{profile_id}}, as jsonData.profile_id is undefined.\",", + " );", + "}", + "", + "// Validate if response has correct merchant_id", + "pm.test(", + " \"[POST]::/account/:account_id/business_profile - Validate merchant_id\",", + " function () {", + " pm.expect(jsonData.merchant_id).to.eql(", + " pm.collectionVariables.get(\"merchant_id\")", + " );", + " }", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"profile_name\":\"eisop_cnp\",\"is_connector_agnostic_mit_enabled\":true,\"collect_billing_details_from_wallet_connector\":true}" + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/business_profile", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "account", + ":account_id", + "business_profile" + ], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}" + } + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." + }, + "response": [] + }, + { + "name": "Payment Connector - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",", + " function () {", + " pm.response.to.have.status(200);", + " },", + ");", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Set response object as internal variable", + "let jsonData = pm.response.json();", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate connector_type\",", + " function () {", + " pm.expect(jsonData.connector_type).to.equal(", + " \"payment_processor\",", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate connector_name\",", + " function () {", + " pm.expect(jsonData.connector_name).to.equal(", + " \"archipel\",", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate merchant_connector_id\",", + " function () {", + " // pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id", + " if (jsonData?.merchant_connector_id) {", + " pm.collectionVariables.set(", + " \"merchant_connector_id\",", + " jsonData.merchant_connector_id,", + " );", + " console.log(", + " \"- use {{merchant_connector_id}} as collection variable for value\",", + " jsonData.merchant_connector_id,", + " );", + " } else {", + " console.log(", + " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",", + " );", + " }", + " pm.expect(jsonData.merchant_connector_id).to.equal(", + " pm.collectionVariables.get(\"merchant_connector_id\")", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate auth_type is NoKey\",", + " function () {", + " pm.expect(jsonData.connector_account_details.auth_type).to.equal(", + " \"NoKey\"", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate metadata contains tenant_id\",", + " function () {", + " pm.expect(jsonData.metadata.tenant_id).to.not.be.null;", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate is not test_mode\",", + " function () {", + " pm.expect(jsonData.test_mode).to.be.false;", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate is not disabled\",", + " function () {", + " pm.expect(jsonData.test_mode).to.be.false;", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/account/:account_id/connectors - Validate have active status\",", + " function () {", + " pm.expect(jsonData.status).to.equal(", + " \"active\"", + " );", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"connector_type\":\"payment_processor\",\"connector_name\":\"archipel\",\"connector_account_details\":{\"auth_type\":\"NoKey\"},\"metadata\":{\"tenant_id\":\"{{archipel_tenant_id}}\",\"platform_url\":\"{{archipel_platform_url}}\",\"apple_pay_combined\":{\"manual\":{\"session_token_data\":{\"initiative\":\"web\",\"certificate\":\"\",\"display_name\":\"Flowbird\",\"certificate_keys\":\"\",\"initiative_context\":\"\",\"merchant_identifier\":\"\",\"merchant_business_country\":\"\",\"payment_processing_details_at\":\"Hyperswitch\",\"payment_processing_certificate\":\"\",\"payment_processing_certificate_key\":\"\"},\"payment_request_data\":{\"label\":\"Flowbird\",\"supported_networks\":[\"visa\",\"masterCard\",\"amex\",\"discover\"],\"merchant_capabilities\":[\"supports3DS\"]}}}},\"profile_id\":\"{{profile_id}}\",\"test_mode\":false,\"disabled\":false,\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"payment_experience\":null,\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"debit\",\"payment_experience\":null,\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"apple_pay\",\"payment_experience\":null,\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":false,\"installment_payment_enabled\":true}]}]}" + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/connectors", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "account", + ":account_id", + "connectors" + ], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}", + "description": "(Required) The unique identifier for the merchant account" + } + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." + }, + "response": [] + }, + { + "name": "Customer - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/customers - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/customers - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/customers - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.customer_id) {", + " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);", + " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.payment_id is undefined.');", + "};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"name\":\"User Test\",\"email\":\"user@test.com\",\"phone\":\"381545600\",\"phone_country_code\":\"+33\",\"description\":\"Archipel connector test user\",\"address\":{\"line1\":\"Parc La Fayette\",\"line2\":\"6 Rue Isaac Newton\",\"line3\":\"\",\"zip\":\"25000\",\"city\":\"Besancon\",\"state\":\"FRANCE\",\"country\":\"FR\",\"first_name\":\"User\",\"last_name\":\"Test\"},\"metadata\":{}}" + }, + "url": { + "raw": "{{baseUrl}}/customers", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Happy Cases", + "item": [ + { + "name": "Scenario7-Void the payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + "\"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + "},", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel][Connector][Scenario7] - Create payment and cancel it\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Cancel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"cancelled\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"cancelled\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"cancellation_reason\":\"requested_by_customer\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/cancel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "cancel" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action" + }, + "response": [] + } + ] + }, + { + "name": "Scenario1-Create payment with confirm true", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Retrieve payment attempt", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'charged' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"charged\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Archiepl response 'transactionId' is updated and not null\",", + " function () {", + " pm.expect(payment_attempt.connector_metadata.transactionId).not.null", + " pm.expect(payment_attempt.connector_metadata.transactionId).to.not.equal(", + " pm.collectionVariables.get(\"archipel_transaction_uuid\")", + " )", + " pm.collectionVariables.set(\"archipel_transaction_uuid\", payment_attempt.connector_metadata.transactionId)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario2-Create payment with confirm false", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve with client secret", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if no 'connector' is affected to the payment intent\",", + " function () {", + " pm.expect(jsonData.connector).to.be.null;", + " },", + ");", + "", + "// Response body should not have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' is null\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.null;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?client_secret={{client_secret}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "client_secret", + "value": "{{client_secret}}" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if no 'connector' is affected to the payment intent\",", + " function () {", + " pm.expect(jsonData.connector).to.be.null;", + " },", + ");", + "", + "// Response body should not have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' is null\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.null;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Retrieve after confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Retrieve with connector sync", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'charged' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"charged\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Archiepl response 'transactionId' is updated and not null\",", + " function () {", + " pm.expect(payment_attempt.connector_metadata.transactionId).not.null", + " pm.expect(payment_attempt.connector_metadata.transactionId).to.not.equal(", + " pm.collectionVariables.get(\"archipel_transaction_uuid\")", + " )", + " pm.collectionVariables.set(\"archipel_transaction_uuid\", payment_attempt.connector_metadata.transactionId)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario3a-Create payment with Manual capture", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + "\"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + "},", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + "\"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "},", + ");", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"net_amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"amount_capturable\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + "\"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":500,\"statement_descriptor_name\":\"John\",\"statement_descriptor_suffix\":\"JD\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Sync payment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Check payment attempt", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'charged' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"charged\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario3b-Create payment with partial capture", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + " );", + "}", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"partially_captured\" for \"status\"", + "pm.test(", + "\"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"partially_captured\");", + "},", + ");", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"net_amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"amount_capturable\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + "\"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 200\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(200);", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":200,\"statement_descriptor_name\":\"John\",\"statement_descriptor_suffix\":\"JD\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Sync payment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"partially_captured\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"partially_captured\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(200);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Check payment attempt", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'partial_charged' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"partial_charged\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario3c-Create payment with confirm false and manual capture", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_confirmation\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + "\"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "},", + ");", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"net_amount\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'net_amount' matches '500'\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "// Response body should have value \"500\" for \"amount_capturable\"", + "pm.test(", + "\"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches '0'\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + "\"[POST]::/payments:id/capture - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":500,\"statement_descriptor_name\":\"John\",\"statement_descriptor_suffix\":\"JD\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Check payment attempt", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'charged' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"charged\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(jsonData.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + }, + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario4-Zero auth mandates", + "item": [ + { + "name": "Payments - Create mandate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + "})};", + "", + "// Response body should have \"mandate_id\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_id' exists\", function() {", + " pm.expect((typeof jsonData.mandate_id !== \"undefined\")).to.be.true;", + "});", + "", + "// Response body should have \"mandate_data\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_data' exists\", function() {", + " pm.expect((typeof jsonData.mandate_data !== \"undefined\")).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":0,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"description\":\"[Archipel Connector][Scenario4] - Create Zero auth mandate\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm mandate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "})};", + "", + "// Response body should have \"mandate_id\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_id' exists\", function() {", + " pm.expect((typeof jsonData.mandate_id !== \"undefined\")).to.be.true;", + "});", + "", + "// Response body should have \"mandate_data\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_data' exists\", function() {", + " pm.expect((typeof jsonData.mandate_data !== \"undefined\")).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "publishable_key", + "value": "pk_snd_8798c6a9114646f8b970b93ad5765ddf", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"customer_id\":\"{{customer_id}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\",\"card_network\":\"Mastercard\"}},\"setup_future_usage\":\"off_session\",\"payment_type\":\"setup_mandate\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"{{$isoTimestamp}}\",\"online\":{\"ip_address\":\"125.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":799,\"currency\":\"EUR\",\"start_date\":\"{{$isoTimestamp}}\",\"end_date\":\"2099-01-01T00:00:00Z\",\"metadata\":{\"frequency\":\"13\"}}}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Create recurring", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "})};", + "", + "// Response body should have \"mandate_id\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_id' exists\", function() {", + " pm.expect((typeof jsonData.mandate_id !== \"undefined\")).to.be.true;", + "});", + "", + "// Response body should have \"mandate_data\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_data' exists\", function() {", + " pm.expect((typeof jsonData.mandate_data !== \"undefined\")).to.be.true;", + "});", + "", + "// Response body should have \"payment_method_data\"", + "pm.test(\"[POST]::/payments - Content check if 'payment_method_data' exists\", function() {", + " pm.expect((typeof jsonData.payment_method_data !== \"undefined\")).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":799,\"currency\":\"EUR\",\"confirm\":true,\"profile_id\":\"{{profile_id}}\",\"capture_method\":\"automatic\",\"capture_on\":\"{{$isoTimestamp}}\",\"customer_id\":\"{{customer_id}}\",\"description\":\"[Archipel Connector][Scenario4] - Create recurring payment\",\"authentication_type\":\"no_three_ds\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"},\"order_details\":[{\"product_name\":\"VOD subscription\",\"quantity\":1,\"amount\":799,\"account_name\":\"transaction_processing\"}]}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve recurring", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists is correct \",", + " function () {", + " pm.expect(jsonData.mandate_id).to.eql(pm.collectionVariables.get(\"mandate_id\"));", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario5-Create a mandate and recurring payment", + "item": [ + { + "name": "Payments - Create mandate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"currency\":\"EUR\",\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"description\":\"[Archipel Connector][Scenario5] - Create mandate with payment\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm mandate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body must not have value \"failed\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'status' not matches 'failed'\",", + " function () {", + " pm.expect(jsonData.status).to.not.eql(\"failed\");", + " },", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');", + "};" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"customer_id\":\"{{customer_id}}\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\",\"card_network\":\"Visa\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"{{$isoTimestamp}}\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":1000,\"currency\":\"EUR\"}}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Retrieve mandate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "List payment methods for a Customer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "if (jsonData?.customer_payment_methods[0]?.payment_token) {", + " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);", + " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');", + "}", + "", + "// Response body should have at least one card payment mehod\"", + "pm.test(", + "\"[GET]::/payment_methods/:customer_id - Content check body has at least one customer_payment_methods\",", + "function () {", + " pm.expect(jsonData.customer_payment_methods.length).greaterThan(0);", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/customers/:customer_id/payment_methods", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers", + ":customer_id", + "payment_methods" + ], + "variable": [ + { + "key": "customer_id", + "value": "{{customer_id}}", + "description": "//Pass the customer id" + } + ] + }, + "description": "To filter and list the applicable payment methods for a particular Customer ID" + }, + "response": [] + }, + { + "name": "Payments - Create recurring", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"payment_method_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'payment_method_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":900,\"currency\":\"EUR\",\"confirm\":true,\"profile_id\":\"{{profile_id}}\",\"capture_method\":\"automatic\",\"capture_on\":\"{{$isoTimestamp}}\",\"customer_id\":\"{{customer_id}}\",\"description\":\"[Archipel Connector][Scenario5] - Create recurring payment\",\"authentication_type\":\"no_three_ds\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve recurring", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario6-Saved card flow", + "item": [ + { + "name": "Payments - Create first", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "if (jsonData?.customer_id) {", + " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);", + " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');", + "};", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_payment_method'\", function() {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " })};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"currency\":\"EUR\",\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"customer_id\":\"{{customer_id}}\",\"description\":\"[Archipel Connector][Scenario6] - Create payment and save card\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm first and save card", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\",\"card_network\":\"Visa\"}},\"setup_future_usage\":\"off_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"{{$isoTimestamp}}\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payment methods - List and get token", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// Response body should have at least one card payment mehod\"", + "pm.test(", + "\"[GET]::/payment_methods/:customer_id - Content check body has at least one customer_payment_methods\",", + "function () {", + " pm.expect(jsonData.customer_payment_methods.length).greaterThan(0);", + " },", + ");", + "", + "if (jsonData?.customer_payment_methods[0]?.payment_token) {", + " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);", + " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/customers/:customer_id/payment_methods", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "customers", + ":customer_id", + "payment_methods" + ], + "variable": [ + { + "key": "customer_id", + "value": "{{customer_id}}", + "description": "//Pass the customer id" + } + ] + }, + "description": "To filter and list the applicable payment methods for a particular Customer ID" + }, + "response": [] + }, + { + "name": "Payments - Create second", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "if (jsonData?.customer_id) {", + " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);", + " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');", + "};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"currency\":\"EUR\",\"capture_on\":\"{{$isoTimestamp}}\",\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"customer_id\":\"{{customer_id}}\",\"setup_future_usage\":\"off_session\",\"description\":\"[Archipel Connector][Scenario6] - Create payment with already saved card\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm secod and use saved card", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "", + "// Response body should have value \"cybersource\" for \"connector\"", + "if (jsonData?.connector) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'archipel'\",", + " function () {", + " pm.expect(jsonData.connector).to.eql(\"archipel\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"123\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario8a-Incremental authorization", + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + ");", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel][Connector][Scenario8a] - Create payment with incremental authorization\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Incremental Authorization", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations \", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations.length).greaterThan(0);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'\", function () {", + " // Parse the response JSON", + " var jsonData = pm.response.json();", + "", + " // Check if the 'status' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].status).to.eql(\"success\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":1001}" + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "", + "pm.test(", + " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "", + "// Response body should have value \"1001\" for \"amount\"", + "", + "pm.test(", + " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(1001);", + " },", + ");", + "", + "// Response body should have value \"1001\" for \"amount_received\"", + "", + "pm.test(", + " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(1001);", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":1001}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "To capture the funds for an uncaptured payment" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Scenario8b-Incremental authorization with partial capture", + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + ");", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel][Connector][Scenario8b] - Create payment with incremental authorization and partial capture\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Incremental Authorization", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations \", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations.length).greaterThan(0);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'\", function () {", + " // Parse the response JSON", + " var jsonData = pm.response.json();", + "", + " // Check if the 'status' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].status).to.eql(\"success\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":1001}" + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"partially_captured\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"partially_captured\");", + " },", + " );", + "}", + "", + "// Response body should have value \"1001\" for \"amount\"", + "if (jsonData?.amount) {", + " pm.test(", + " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(1001);", + " },", + " );", + "}", + "", + "// Response body should have value \"600\" for \"amount_received\"", + "if (jsonData?.amount_received) {", + " pm.test(", + " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '600'\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(600);", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":600}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Scenario9a-Refund full payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(\"[POST]::/payments - Content check if value for 'amount' matches '500'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(500);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/payments - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Refunds - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\", ", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "});", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'amount' matches '500'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(500);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":500,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" + }, + "response": [] + }, + { + "name": "Refunds - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\", ", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "});", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'amount' matches '500'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(500);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/refunds/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{refund_id}}", + "description": "(Required) unique refund id" + } + ] + }, + "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario9b-Refund partial payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have value \"500\" for \"amount\"", + "pm.test(\"[POST]::/payments - Content check if value for 'amount' matches '500'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(500);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/payments - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Refunds - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\", ", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "});", + "", + "// Response body should have value \"200\" for \"amount\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'amount' matches '200'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(200);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":200,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" + }, + "response": [] + }, + { + "name": "Refunds - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\", ", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "});", + "", + "// Response body should have value \"200\" for \"amount\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'amount' matches '200'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(200);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/refunds/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{refund_id}}", + "description": "(Required) unique refund id" + } + ] + }, + "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario9c-Refund full incremented payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + ");", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel][Connector][Scenario8a] - Create payment with incremental authorization\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Incremental Authorization", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check have at least one incremental_authorizations \", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations.length).greaterThan(0);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'previously_authorized_amount' matches '500'\", function () {", + " // Check if the 'amount' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].previously_authorized_amount).to.eql(500);", + "});", + "", + "pm.test(\"[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'\", function () {", + " // Parse the response JSON", + " var jsonData = pm.response.json();", + "", + " // Check if the 'status' in the response matches the expected value", + " pm.expect(jsonData.incremental_authorizations[0].status).to.eql(\"success\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":1001}" + }, + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "incremental_authorization" + ] + } + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) { }", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "", + "pm.test(", + " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "", + "// Response body should have value \"1001\" for \"amount\"", + "", + "pm.test(", + " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(1001);", + " },", + ");", + "", + "// Response body should have value \"1001\" for \"amount_received\"", + "", + "pm.test(", + " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(1001);", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":1001}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "To capture the funds for an uncaptured payment" + } + ] + } + }, + "response": [] + }, + { + "name": "Refunds - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\", ", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "});", + "", + "// Response body should have value \"1001\" for \"amount\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'amount' matches '1001'\",", + "function () {", + " pm.expect(jsonData.amount).to.eql(1001);", + "});", + "", + "// Response body should have \"EUR\" for \"currency\"", + "pm.test(\"[POST]::/refunds - Content check if value for 'currency' matches 'EUR'\",", + "function () {", + " pm.expect(jsonData.currency).to.eql(\"EUR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":1001,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario10-Create 3DS payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"authentication_type\":\"three_ds\",\"request_external_three_ds_authentication\":true,\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"FRA\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"requires_customer_action\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"4242424242424242\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - External 3ds authentication", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\",\"device_channel\":\"BRW\",\"threeds_method_comp_ind\":\"Y\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/3ds/authentication", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "3ds", + "authentication" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Authorize request intent", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/{{payment_id}}/{{merchant_id}}/authorize/archipel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + "{{payment_id}}", + "{{merchant_id}}", + "authorize", + "archipel" + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Retrieve after confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "Negative Cases", + "item": [ + { + "name": "Scenario1-Create payment with Invalid card details", + "item": [ + { + "name": "Payments - Create(Invalid card number)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + "});", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"connector_error\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Create(Invalid Exp month)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"next_action.redirect_to_url\"", + "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + "});", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"24\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Create(Invalid Exp Year)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"next_action.redirect_to_url\"", + "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + "});", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "", + "// Response body should have value \"connector error\" for \"error message\"", + "if (jsonData?.error?.message) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'error.message' matches 'Invalid Expiry Year'\",", + " function () {", + " pm.expect(jsonData.error.message).to.eql(\"Invalid Expiry Year\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"1970\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Create(invalid CVV)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + "});", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"00000\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + } + ] + }, + { + "name": "Scenario2-Confirming without payment method", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_payment_method\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{publishable_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"client_secret\":\"{{client_secret}}\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + } + ] + }, + { + "name": "Scenario3-Create payment with Manual capture but wrong pan", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"failed\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'failed'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"failed\");", + " },", + " );", + "}", + "", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector' is archipel\",", + " function () {", + " pm.expect(jsonData.connector).to.be.equal(\"archipel\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"0000000000000\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"failed\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"failed\");", + " },", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");", + "", + "let payment_attempt = {}", + "", + "pm.test(", + " \"[POST]::/payments - Payment has one 'Payment Attempt'\",", + " function () {", + " pm.expect(jsonData.attempts.length).to.be.equal(1);", + " payment_attempt = jsonData.attempts[0]", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'authorization_failed' status\",", + " function () {", + " pm.expect(payment_attempt.status).to.be.equal(\"authorization_failed\");", + " },", + ");", + "", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has 'connector_transaction_id'\",", + " function () {", + " pm.expect(payment_attempt.connector_transaction_id).to.be.equal(", + " pm.collectionVariables.get(\"connector_transaction_id\")", + " );", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has archiepl response 'transactionId' in connector_metadata\",", + " function () {", + " pm.expect(payment_attempt.connector_metadata.transactionId).to.be.not.null;", + " pm.collectionVariables.set(\"archipel_transaction_uuid\", payment_attempt.connector_metadata.transactionId)", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments - Payment Attempt has no error\",", + " function () {", + " pm.expect(payment_attempt.error_message).to.be.null;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?expand_attempts=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "expand_attempts", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario4-Capture greater amount", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "pm.test(", + "\"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + "},", + ");", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To capture the funds for an uncaptured payment" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_capture\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_capture\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario5-Capture the succeeded payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " pm.collectionVariables.set(\"connector_transaction_id\", jsonData.connector_transaction_id)", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Sync payment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount' equal 500\",", + " function () {", + " pm.expect(jsonData.amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'net_amount' equal 500\",", + " function () {", + " pm.expect(jsonData.net_amount).to.eql(500);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_capturable' equal 0\",", + " function () {", + " pm.expect(jsonData.amount_capturable).to.eql(0);", + " },", + ");", + "", + "pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'amount_received' equal 500\",", + " function () {", + " pm.expect(jsonData.amount_received).to.eql(500);", + " },", + ");", + "", + "", + "// Response body should have \"connector_transaction_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be", + " .true;", + " },", + ");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Payments - Capture", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/capture - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/capture", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "capture" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To capture the funds for an uncaptured payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario6-Create a recurring payment with greater mandate amount", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_confirmation\" for \"status\"", + "pm.test(", + "\"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");", + "},", + ");", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":0,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"customer_id\":\"{{customer_id}}\",\"profile_id\":\"{{profile_id}}\",\"description\":\"[Archipel Connector][Variation Cases][Scenario6] - Create mandate\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\",\"card_network\":\"Visa\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":1000,\"currency\":\"EUR\"}}},\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Confirm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx ", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");", + "});", + "", + "// Validate if response has JSON Body ", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {jsonData = pm.response.json();}catch(e){}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');", + "};", + "", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);", + "} else {", + " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');", + "};", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);", + "} else {", + " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');", + "};", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "})};", + "", + "// Response body should have \"mandate_id\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_id' exists\", function() {", + " pm.expect((typeof jsonData.mandate_id !== \"undefined\")).to.be.true;", + "});", + "", + "// Response body should have \"mandate_data\"", + "pm.test(\"[POST]::/payments - Content check if 'mandate_data' exists\", function() {", + " pm.expect((typeof jsonData.mandate_data !== \"undefined\")).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "publishable_key", + "value": "pk_snd_8798c6a9114646f8b970b93ad5765ddf", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"customer_id\":\"{{customer_id}}\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\",\"card_network\":\"Mastercard\"}},\"setup_future_usage\":\"off_session\",\"payment_type\":\"setup_mandate\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"{{$isoTimestamp}}\",\"online\":{\"ip_address\":\"125.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":799,\"currency\":\"EUR\",\"start_date\":\"{{$isoTimestamp}}\",\"end_date\":\"2099-01-01T00:00:00Z\",\"metadata\":{\"frequency\":\"13\"}}}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/confirm", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "confirm" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}" + } + ] + }, + "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "Recurring Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"invalid_request\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":9000,\"currency\":\"EUR\",\"confirm\":true,\"profile_id\":\"{{profile_id}}\",\"capture_method\":\"automatic\",\"capture_on\":\"{{$isoTimestamp}}\",\"customer_id\":\"{{customer_id}}\",\"description\":\"[Archipel Connector][Variation Cases][Scenario6] - Create recurring payment greather than mandate amount\",\"authentication_type\":\"no_three_ds\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + } + ] + }, + { + "name": "Scenario7-Create a card payment without card scheme", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "},", + ");", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel Connector][Variation Cases][Scenario7] - Create card payment without passing card scheme\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "pm.test(", + "\"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + "function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + "},", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario8-Void succeeded payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"profile_id\":\"{{profile_id}}\",\"phone_country_code\":\"+91\",\"description\":\"[Archipel][Connector][VariationCases][Scenario8] - Try to cancel success payment\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Cancel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/payments/:id/cancel - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(", + " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",", + " function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + " },", + ");", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"cancellation_reason\":\"requested_by_customer\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments/:id/cancel", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id", + "cancel" + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action" + }, + "response": [] + } + ] + }, + { + "name": "Scenario9-Refund exceeds amount", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Refunds - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"connector error\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":7000,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario10-Refund for unsuccessful payment", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"requires_confirmation\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":500,\"amount_to_capture\":500,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"manual\",\"authentication_type\":\"no_three_ds\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_cvc\":\"123\",\"card_exp_month\":\"01\",\"card_exp_year\":\"50\",\"card_holder_name\":\"John Doe\",\"card_number\":\"5185570141917102\"}},\"profile_id\":\"{{profile_id}}\",\"email\":\"john_doe@gmail.com\",\"name\":\"John Doe\",\"phone\":\"8056594427\",\"phone_country_code\":\"+91\",\"description\":\"{{$randomLoremSentence}}\",\"billing\":{\"address\":{\"line1\":\"2 ter\",\"line2\":\"rue du château\",\"line3\":\"\",\"city\":\"Neuilly-sur-Seine\",\"state\":\"France\",\"zip\":\"92200\",\"country\":\"FR\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"Joseph Doe\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Refunds - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 4xx", + "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {", + " pm.response.to.be.error;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id", + "if (jsonData?.refund_id) {", + " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);", + " console.log(", + " \"- use {{refund_id}} as collection variable for value\",", + " jsonData.refund_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",", + " );", + "}", + "", + "// Response body should have \"error\"", + "pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",", + " function () {", + " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have value \"invalid_request\" for \"error type\"", + "if (jsonData?.error?.type) {", + " pm.test(", + " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",", + " function () {", + " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");", + " },", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + }, + "url": { + "raw": "{{baseUrl}}/refunds", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "refunds" + ] + }, + "description": "To create a refund against an already processed payment" + }, + "response": [] + } + ] + } + ] + } + ] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "info": { + "_postman_id": "c505d595-99e0-4cd0-b384-f47fbbd0c560", + "name": "archipel", + "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "37912341" + }, + "variable": [ + { + "key": "baseUrl", + "value": "", + "type": "string" + }, + { + "key": "admin_api_key", + "value": "", + "type": "string" + }, + { + "key": "organization_id", + "value": "" + }, + { + "key": "merchant_id", + "value": "" + }, + { + "key": "profile_id", + "value": "" + }, + { + "key": "api_key", + "value": "", + "type": "string" + }, + { + "key": "api_key_id", + "value": "", + "type": "string" + }, + { + "key": "publishable_key", + "value": "", + "type": "string" + }, + { + "key": "client_secret", + "value": "", + "type": "string" + }, + { + "key": "archipel_tenant_id", + "value": "", + "type": "string" + }, + { + "key": "archipel_platform_url", + "value": "", + "type": "string" + }, + { + "key": "merchant_connector_id", + "value": "" + }, + { + "key": "payment_id", + "value": "" + }, + { + "key": "customer_id", + "value": "" + }, + { + "key": "mandate_id", + "value": "" + }, + { + "key": "refund_id", + "value": "" + }, + { + "key": "payment_token", + "value": "" + }, + { + "key": "connector_transaction_id", + "value": "" + }, + { + "key": "archipel_transaction_uuid", + "value": "" + } + ] +} diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh index 72a0f3543f..3023c2e541 100755 --- a/scripts/add_connector.sh +++ b/scripts/add_connector.sh @@ -6,7 +6,7 @@ function find_prev_connector() { git checkout $self cp $self $self.tmp # Add new connector to existing list and sort it - connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay ctp_visa cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayxml xendit zsl "$1") + connectors=(aci adyen adyenplatform airwallex amazonpay applepay archipel authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay ctp_visa cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayxml xendit zsl "$1") IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS res="$(echo ${sorted[@]})" sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp