repo
stringclasses
4 values
file_path
stringlengths
6
193
extension
stringclasses
23 values
content
stringlengths
0
1.73M
token_count
int64
0
724k
__index_level_0__
int64
0
10.8k
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'status' matches 'pending'", function () { pm.expect(jsonData.status).to.eql("pending"); }, ); } // Response body should have value for "amount" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'", function () { pm.expect(jsonData.amount).to.eql(amount); }, ); }
356
3,706
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/response.json
.json
[]
1
3,707
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.prerequest.js
.js
0
3,708
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
.json
{ "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" }
155
3,709
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/event.test.js
.js
// Get the value of 'amount' from the environment const refund_amount = pm.environment.get("amount"); // Validate status 2xx pm.test("[GET]::/refunds/:id - Status code is 2xx", function () { pm.response.to.be.success; }); // Validate if response header has matching content-type pm.test("[GET]::/refunds/: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 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" if (jsonData?.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 "{{refund_amount}}" for "amount" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'", function () { pm.expect(jsonData.amount).to.eql(refund_amount); }, ); }
370
3,710
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/response.json
.json
[]
1
3,711
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
.json
{ "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" }
182
3,712
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
.js
// 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"); }, ); }
500
3,713
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/response.json
.json
[]
1
3,714
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "StripeCustomer", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "payment_method": "card", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe", "card_cvc": "123" } }, "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
699
3,715
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // 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 'processing'", function () { pm.expect(jsonData.status).to.eql("processing"); }, ); }
517
3,716
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/response.json
.json
[]
1
3,717
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(1000, 100000));
23
3,718
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Update/request.json
.json
{ "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": "{{another_random_number}}", "amount_to_capture": "{{another_random_number}}" } }, "url": { "raw": "{{baseUrl}}/payments/:id", "host": ["{{baseUrl}}"], "path": ["payments", ":id"], "variable": [ { "key": "id", "value": "{{payment_id}}" } ] }, "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created " }
220
3,719
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Update/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // Get the value of 'amount' from the environment const updated_amount = pm.environment.get("amount"); // Validate status 2xx pm.test("[POST]::/payments/:id - Status code is 2xx", function () { pm.response.to.be.success; }); // Validate if response header has matching content-type pm.test("[POST]::/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("[POST]::/payments/:id - Response has JSON Body", function () { pm.response.to.have.jsonBody(); }); // Parse the JSON response var jsonData = pm.response.json(); // Check if the 'amount' is equal to "updated_amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'", function () { pm.expect(jsonData.amount).to.eql(updated_amount); });
235
3,720
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Update/response.json
.json
[]
1
3,721
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Update/event.prerequest.js
.js
// Get the value of 'amount' from the environment pm.environment.set("another_random_number", _.random(100, 100000));
35
3,722
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Retrieve/request.json
.json
{ "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" }
182
3,723
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Retrieve/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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 - Content check if value for 'status' matches 'succeeded'", function() { pm.expect(jsonData.status).to.eql("succeeded"); })}; // Check if the 'amount' is equal to "amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' ", function () { pm.expect(jsonData.amount).to.eql(amount); }); //// Response body should have value "amount_received" for "amount" if (jsonData?.amount_received) { pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'", function() { pm.expect(jsonData.amount_received).to.eql(amount); })};
592
3,724
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Retrieve/response.json
.json
[]
1
3,725
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Retrieve/event.prerequest.js
.js
0
3,726
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": false, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "StripeCustomer", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
609
3,727
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Create/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // 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.'); }; // pm.collectionVariables - Set customer_id as variable for jsonData.customer_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.customer_id 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"); })};
562
3,728
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Create/response.json
.json
[]
1
3,729
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(1000, 100000));
23
3,730
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
.json
{ "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" }, { "key": "publishable_key", "value": "", "type": "text", "disabled": true } ], "body": { "mode": "raw", "options": { "raw": { "language": "json" } }, "raw_json_formatted": { "client_secret": "{{client_secret}}", "payment_method": "card", "payment_method_type": "debit", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "03", "card_exp_year": "69", "card_holder_name": "joseph Doe", "card_cvc": "737" } }, "setup_future_usage": "on_session", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "2022-09-10T10:11:12Z", "online": { "ip_address": "123.32.25.123", "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" } }, "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": "128.0.0.1" } } }, "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" }
816
3,731
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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"); }); // Set response object as internal variable let jsonData = {}; try {jsonData = pm.response.json();}catch(e){} // Validate if response has JSON Body pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { pm.response.to.have.jsonBody(); }); //// Response body should have value "processing" for "status" if (jsonData?.status) { pm.test("[POST]::/payments - Content check if value for 'status' matches 'processing'", function() { pm.expect(jsonData.status).to.eql("processing"); })}; // Check if the 'amount' is equal to "amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' ", function () { pm.expect(jsonData.amount).to.eql(amount); }); //// Response body should have value "amount_received" for "amount" if (jsonData?.amount_received) { pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'", function() { pm.expect(jsonData.amount_received).to.eql(amount); })};
343
3,732
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/response.json
.json
[]
1
3,733
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/event.prerequest.js
.js
0
3,734
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
.json
{ "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" }
182
3,735
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
.js
// 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"); }, ); }
499
3,736
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json
.json
[]
1
3,737
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": false, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "StripeCustomer", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my last payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "payment_method": "card", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe", "card_cvc": "123" } }, "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
699
3,738
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
.js
// 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" 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"); }, ); }
492
3,739
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json
.json
[]
1
3,740
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(1000, 100000));
23
3,741
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
.json
{ "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" }
349
3,742
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
.js
// 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 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/confirm - Content check if value for 'status' matches 'processing'", function () { pm.expect(jsonData.status).to.eql("processing"); }, ); }
511
3,743
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json
.json
[]
1
3,744
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Update/request.json
.json
{ "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": "{{another_random_number}}", "amount_to_capture": "{{another_random_number}}" } }, "url": { "raw": "{{baseUrl}}/payments/:id", "host": ["{{baseUrl}}"], "path": ["payments", ":id"], "variable": [ { "key": "id", "value": "{{payment_id}}" } ] }, "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created " }
220
3,745
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Update/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // Get the value of 'amount' from the environment const updated_amount = pm.environment.get("amount"); // Validate status 2xx pm.test("[POST]::/payments/:id - Status code is 2xx", function () { pm.response.to.be.success; }); // Validate if response header has matching content-type pm.test("[POST]::/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("[POST]::/payments/:id - Response has JSON Body", function () { pm.response.to.have.jsonBody(); }); // Parse the JSON response var jsonData = pm.response.json(); // Check if the 'amount' is equal to "updated_amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'", function () { pm.expect(jsonData.amount).to.eql(updated_amount); });
235
3,746
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Update/response.json
.json
[]
1
3,747
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Update/event.prerequest.js
.js
// Get the value of 'amount' from the environment pm.environment.set("another_random_number", _.random(100, 100000));
35
3,748
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve/request.json
.json
{ "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" }
182
3,749
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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 "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"); })}; // Check if the 'amount' is equal to "amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' ", function () { pm.expect(jsonData.amount).to.eql(amount); }); //// Response body should have value "amount_received" for "amount" if (jsonData?.amount_received) { pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'", function() { pm.expect(jsonData.amount_received).to.eql(amount); })};
592
3,750
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve/response.json
.json
[]
1
3,751
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve/event.prerequest.js
.js
0
3,752
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve Copy/request.json
.json
{ "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" }
182
3,753
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve Copy/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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 - Content check if value for 'status' matches 'succeeded'", function() { pm.expect(jsonData.status).to.eql("succeeded"); })}; // Check if the 'amount' is equal to "amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' ", function () { pm.expect(jsonData.amount).to.eql(amount); }); //// Response body should have value "amount_received" for "amount" if (jsonData?.amount_received) { pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'", function() { pm.expect(jsonData.amount_received).to.eql(amount); })};
592
3,754
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve Copy/response.json
.json
[]
1
3,755
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Retrieve Copy/event.prerequest.js
.js
0
3,756
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": false, "capture_method": "manual", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "StripeCustomer", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
609
3,757
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Create/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // 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.'); }; // pm.collectionVariables - Set customer_id as variable for jsonData.customer_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.customer_id 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"); })};
562
3,758
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Create/response.json
.json
[]
1
3,759
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(100, 100000));
22
3,760
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Capture/request.json
.json
{ "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": "{{amount}}", "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" }
231
3,761
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Capture/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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 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 "processing" for "status" if (jsonData?.status) { pm.test( "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'", function () { pm.expect(jsonData.status).to.eql("processing"); }, ); } // Validate the connector pm.test("[POST]::/payments - connector", function () { pm.expect(jsonData.connector).to.eql("nmi"); }); // Response body should have value "amount" for "amount_received" if (jsonData?.amount_received) { pm.test( "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'", function () { pm.expect(jsonData.amount_received).to.eql(amount); }, ); } // Response body should have value "0" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'", function () { pm.expect(jsonData.amount_capturable).to.eql(amount); }, ); }
719
3,762
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Capture/response.json
.json
[]
1
3,763
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Capture/event.prerequest.js
.js
0
3,764
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
.json
{ "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" }, { "key": "publishable_key", "value": "", "type": "text", "disabled": true } ], "body": { "mode": "raw", "options": { "raw": { "language": "json" } }, "raw_json_formatted": { "client_secret": "{{client_secret}}", "payment_method": "card", "payment_method_type": "debit", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "03", "card_exp_year": "69", "card_holder_name": "joseph Doe", "card_cvc": "737" } }, "setup_future_usage": "on_session", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "2022-09-10T10:11:12Z", "online": { "ip_address": "123.32.25.123", "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" } }, "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": "128.0.0.1" } } }, "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" }
816
3,765
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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"); }); // Set response object as internal variable let jsonData = {}; try {jsonData = pm.response.json();}catch(e){} // Validate if response has JSON Body pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () { pm.response.to.have.jsonBody(); }); //// 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"); })}; // Check if the 'amount' is equal to "amount" pm.test("[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' ", function () { pm.expect(jsonData.amount).to.eql(amount); }); //// Response body should have value "amount_received" for "amount" if (jsonData?.amount_received) { pm.test("[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'", function() { pm.expect(jsonData.amount_received).to.eql(amount); })};
346
3,766
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/response.json
.json
[]
1
3,767
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/event.prerequest.js
.js
0
3,768
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Retrieve/request.json
.json
{ "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" }
182
3,769
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Retrieve/event.test.js
.js
// 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 "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; }, );
557
3,770
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Retrieve/response.json
.json
[]
1
3,771
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": true, "business_country": "US", "business_label": "default", "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "bernard123", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "setup_future_usage": "on_session", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "2022-09-10T10:11:12Z", "online": { "ip_address": "123.32.25.123", "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" } }, "payment_method": "card", "payment_method_type": "debit", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "01", "card_exp_year": "69", "card_holder_name": "joseph Doe", "card_cvc": "123" } }, "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John", "last_name": "John" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "John", "last_name": "John" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
914
3,772
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/event.test.js
.js
// 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 "processing" for "status" if (jsonData?.status) { pm.test( "[POST]::/payments - Content check if value for 'status' matches 'processing'", function () { pm.expect(jsonData.status).to.eql("processing"); }, ); } // 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; }, );
546
3,773
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/response.json
.json
[]
1
3,774
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(100, 100000));
22
3,775
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Retrieve Copy/request.json
.json
{ "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" }
155
3,776
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Retrieve Copy/event.test.js
.js
// Validate status 2xx pm.test("[GET]::/refunds/:id - Status code is 2xx", function () { pm.response.to.be.success; }); // Validate if response header has matching content-type pm.test("[GET]::/refunds/: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 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" if (jsonData?.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 "10" for "amount" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'amount' matches '10'", function () { pm.expect(jsonData.amount).to.eql(10); }, ); }
347
3,777
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Retrieve Copy/response.json
.json
[]
1
3,778
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Retrieve Copy/event.prerequest.js
.js
0
3,779
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": false, "capture_method": "manual", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "{{customer_id}}", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "billing": { "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": "9123456789", "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": "9123456789", "country_code": "+91" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
696
3,780
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Create/event.test.js
.js
// Set the environment variable 'amount' with the value from the response pm.environment.set("amount", pm.response.json().amount); // 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"); }, ); } 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.'); };
554
3,781
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Create/response.json
.json
[]
1
3,782
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(100, 100000));
22
3,783
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/request.json
.json
{ "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": "7373" } }, "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" }
380
3,784
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.test.js
.js
// 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 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_capture" for "status" if (jsonData?.status) { pm.test( "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_capture'", function () { pm.expect(jsonData.status).to.eql("requires_capture"); }, ); } // Response body should have value "nmi" for "connector" if (jsonData?.connector) { pm.test( "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'", function () { pm.expect(jsonData.connector).to.eql("nmi"); }, ); }
585
3,785
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/response.json
.json
[]
1
3,786
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Save card payments - Confirm/event.prerequest.js
.js
0
3,787
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy-2/request.json
.json
{ "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" }
182
3,788
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy-2/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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"); }, ); } // Validate the connector pm.test("[POST]::/payments - connector", function () { pm.expect(jsonData.connector).to.eql("nmi"); }); // Response body should have value "amount" for "amount" if (jsonData?.amount) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'", function () { pm.expect(jsonData.amount).to.eql(amount); }, ); } // Response body should have value "amount" for "amount_received" if (jsonData?.amount_received) { pm.test( "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'", function () { pm.expect(jsonData.amount_received).to.eql(amount); }, ); } // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { pm.expect(jsonData.amount_capturable).to.eql(0); }, ); }
781
3,789
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy-2/response.json
.json
[]
1
3,790
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy-2/event.prerequest.js
.js
0
3,791
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve/request.json
.json
{ "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" }
182
3,792
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve/event.test.js
.js
// 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"); }, ); } // Validate the connector pm.test("[POST]::/payments - connector", function () { pm.expect(jsonData.connector).to.eql("nmi"); }); // Response body should have value "0" for "amount_capturable" if (jsonData?.amount) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'", function () { pm.expect(jsonData.amount_capturable).to.eql(0); }, ); }
614
3,793
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve/response.json
.json
[]
1
3,794
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve/event.prerequest.js
.js
0
3,795
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy/request.json
.json
{ "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" }
182
3,796
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
.js
// Get the value of 'amount' from the environment const amount = pm.environment.get("amount"); // 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 "requires_capture" for "status" if (jsonData?.status) { pm.test( "[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'", function () { pm.expect(jsonData.status).to.eql("requires_capture"); }, ); } // Validate the connector pm.test("[POST]::/payments - connector", function () { pm.expect(jsonData.connector).to.eql("nmi"); }); // Response body should have value "amount" for "amount" if (jsonData?.amount) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'", function () { pm.expect(jsonData.amount).to.eql(amount); }, ); } // Response body should have value "amount" for "amount_received" if (jsonData?.amount_received) { pm.test( "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'", function () { pm.expect(jsonData.amount_received).to.eql(amount); }, ); } // Response body should have value "amount" for "amount_capturable" if (jsonData?.amount) { pm.test( "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - {{amount}}'", function () { pm.expect(jsonData.amount_capturable).to.eql(amount); }, ); }
776
3,797
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy/response.json
.json
[]
1
3,798
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Retrieve-copy/event.prerequest.js
.js
0
3,799
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Create/request.json
.json
{ "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": "{{random_number}}", "currency": "USD", "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": "{{random_number}}", "customer_id": "nmisavecard_{{random_number}}", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "setup_future_usage": "on_session", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "2022-09-10T10:11:12Z", "online": { "ip_address": "123.32.25.123", "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" } }, "payment_method": "card", "payment_method_type": "credit", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "03", "card_exp_year": "69", "card_holder_name": "joseph Doe", "card_cvc": "7373" } }, "billing": { "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": "9123456789", "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": "9123456789", "country_code": "+91" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } } }, "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" }
973
3,800
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Create/event.test.js
.js
// 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.'); }; 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 "processing" for "status" if (jsonData?.status) { pm.test( "[POST]::/payments - Content check if value for 'status' matches 'processing'", function () { pm.expect(jsonData.status).to.eql("processing"); }, ); }
521
3,801
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Create/response.json
.json
[]
1
3,802
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Payments - Create/event.prerequest.js
.js
pm.environment.set("random_number", _.random(100, 100000));
22
3,803
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Create Copy/request.json
.json
{ "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": 10, "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" }
242
3,804
hyperswitch
postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture/Refunds - Create Copy/event.test.js
.js
// 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 "pending" for "status" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'status' matches 'pending'", function () { pm.expect(jsonData.status).to.eql("pending"); }, ); } // Response body should have value "10" for "amount" if (jsonData?.status) { pm.test( "[POST]::/refunds - Content check if value for 'amount' matches '10'", function () { pm.expect(jsonData.amount).to.eql(10); }, ); } // Validate the connector pm.test("[POST]::/payments - connector", function () { pm.expect(jsonData.connector).to.eql("nmi"); });
373
3,805