mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
ci(postman): Update Checkout Collection to support multiple captures (#2086)
This commit is contained in:
33
postman/collection-dir/checkout/.event.json
Normal file
33
postman/collection-dir/checkout/.event.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"event": [
|
||||
{
|
||||
"listen": "prerequest",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
""
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"// Set response object as internal variable",
|
||||
"let jsonData = {};",
|
||||
"try {jsonData = pm.response.json();}catch(e){}",
|
||||
"",
|
||||
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
|
||||
"if (jsonData?.payment_id) {",
|
||||
" pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
|
||||
" console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);",
|
||||
"}",
|
||||
"",
|
||||
"console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get('x-request-id'));",
|
||||
""
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.prerequest.js",
|
||||
"event.test.js"
|
||||
]
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
{
|
||||
"info": {
|
||||
"_postman_id": "3ed89b0d-4c28-4178-9630-ffc58fd694be",
|
||||
"name": "checkout",
|
||||
"_postman_id": "0da8c3be-4466-413e-9e72-81b21533423e",
|
||||
"name": "Checkout Collection",
|
||||
"description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
||||
"_exporter_id": "25737662"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
"Scenario2-Create payment with confirm false",
|
||||
"Scenario3-Create payment without PMD",
|
||||
"Scenario4-Create payment with Manual capture with confirm false",
|
||||
"Scenario4-Create payment with Manual capture",
|
||||
"Scenario11-Create Partial Capture payment",
|
||||
"Scenario5-Void the payment",
|
||||
"Scenario9-Refund full payment",
|
||||
"Scenario10-Partial refund"
|
||||
"Scenario5-Create payment with Manual capture",
|
||||
"Scenario6-Create Partial Capture payment",
|
||||
"Scenario7-Void the payment",
|
||||
"Scenario8-Refund full payment",
|
||||
"Scenario9-Partial refund",
|
||||
"Scenario10-Multiple Captures"
|
||||
]
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Successful Partial Capture and Refund",
|
||||
"Retrieve After Partial Capture",
|
||||
"Cancel After Partial Capture",
|
||||
"Refund After Partial Capture",
|
||||
"3DS Payment"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Payments - Create",
|
||||
"Payments - Retrieve"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[POST]::/payments - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[POST]::/payments - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[POST]::/payments - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
|
||||
// pm.collectionVariables - Set 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 "connector error" for "error type"
|
||||
if (jsonData?.status) {
|
||||
pm.test("[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'requires_customer_action'", function() {
|
||||
pm.expect(jsonData.status).to.eql("requires_customer_action");
|
||||
})};
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": 6000,
|
||||
"currency": "USD",
|
||||
"confirm": true,
|
||||
"capture_method": "manual_multiple",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"customer_id": "StripeCustomer",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
"phone": "999999999",
|
||||
"phone_country_code": "+1",
|
||||
"description": "Its my first payment request",
|
||||
"authentication_type": "three_ds",
|
||||
"return_url": "https://duck.com",
|
||||
"payment_method": "card",
|
||||
"payment_method_data": {
|
||||
"card": {
|
||||
"card_number": "4242424242424242",
|
||||
"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": "PiX"
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"address": {
|
||||
"line1": "1467",
|
||||
"line2": "Harrison Street",
|
||||
"line3": "Harrison Street",
|
||||
"city": "San Fransico",
|
||||
"state": "California",
|
||||
"zip": "94122",
|
||||
"country": "US",
|
||||
"first_name": "PiX"
|
||||
}
|
||||
},
|
||||
"statement_descriptor_name": "joseph",
|
||||
"statement_descriptor_suffix": "JS",
|
||||
"metadata": {
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"routing": {
|
||||
"type": "single",
|
||||
"data": "checkout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
|
||||
// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
|
||||
if (jsonData?.mandate_id) {
|
||||
pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
|
||||
console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
|
||||
};
|
||||
|
||||
// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
|
||||
if (jsonData?.client_secret) {
|
||||
pm.collectionVariables.set("client_secret", jsonData.client_secret);
|
||||
console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
|
||||
};
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Payments - Create",
|
||||
"Payments - Retrieve",
|
||||
"Payments - Capture",
|
||||
"Payments - Cancel"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
// Validate status 4xx
|
||||
pm.test("[POST]::/payments/:id/cancel - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[POST]::/payments/:id/cancel - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[POST]::/payments/:id/cancel - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
|
||||
if (jsonData?.client_secret) {
|
||||
pm.collectionVariables.set("client_secret", jsonData.client_secret);
|
||||
console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
|
||||
};
|
||||
|
||||
// Response body should have value "connector error" for "error type"
|
||||
if (jsonData?.status) {
|
||||
pm.test("[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'cancelled'", function() {
|
||||
pm.expect(jsonData.status).to.eql("cancelled");
|
||||
})};
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// 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.');
|
||||
};
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": 6000,
|
||||
"currency": "USD",
|
||||
"confirm": true,
|
||||
"capture_method": "manual_multiple",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"customer_id": "StripeCustomer",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
"phone": "999999999",
|
||||
"phone_country_code": "+1",
|
||||
"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": "4242424242424242",
|
||||
"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": "PiX"
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"address": {
|
||||
"line1": "1467",
|
||||
"line2": "Harrison Street",
|
||||
"line3": "Harrison Street",
|
||||
"city": "San Fransico",
|
||||
"state": "California",
|
||||
"zip": "94122",
|
||||
"country": "US",
|
||||
"first_name": "PiX"
|
||||
}
|
||||
},
|
||||
"statement_descriptor_name": "joseph",
|
||||
"statement_descriptor_suffix": "JS",
|
||||
"metadata": {
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"routing": {
|
||||
"type": "single",
|
||||
"data": "checkout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
|
||||
// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
|
||||
if (jsonData?.mandate_id) {
|
||||
pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
|
||||
console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
|
||||
};
|
||||
|
||||
// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
|
||||
if (jsonData?.client_secret) {
|
||||
pm.collectionVariables.set("client_secret", jsonData.client_secret);
|
||||
console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Payments - Create",
|
||||
"Payments - Capture",
|
||||
"Refunds - Create"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// 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.');
|
||||
};
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": 6000,
|
||||
"currency": "USD",
|
||||
"confirm": true,
|
||||
"capture_method": "manual_multiple",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"customer_id": "StripeCustomer",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
"phone": "999999999",
|
||||
"phone_country_code": "+1",
|
||||
"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": "4242424242424242",
|
||||
"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": "PiX"
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"address": {
|
||||
"line1": "1467",
|
||||
"line2": "Harrison Street",
|
||||
"line3": "Harrison Street",
|
||||
"city": "San Fransico",
|
||||
"state": "California",
|
||||
"zip": "94122",
|
||||
"country": "US",
|
||||
"first_name": "PiX"
|
||||
}
|
||||
},
|
||||
"statement_descriptor_name": "joseph",
|
||||
"statement_descriptor_suffix": "JS",
|
||||
"metadata": {
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"routing": {
|
||||
"type": "single",
|
||||
"data": "checkout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
// Validate status 4xx
|
||||
pm.test("[POST]::/refunds - Status code is 4xx", function () {
|
||||
pm.response.to.be.error;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[POST]::/refunds - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// Response body should have value "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"payment_id": "{{payment_id}}",
|
||||
"amount": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Payments - Create",
|
||||
"Payments - Retrieve",
|
||||
"Payments - Capture",
|
||||
"Payments - Retrieve-copy"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// 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.');
|
||||
};
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": 6000,
|
||||
"currency": "USD",
|
||||
"confirm": true,
|
||||
"capture_method": "manual_multiple",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"customer_id": "StripeCustomer",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
"phone": "999999999",
|
||||
"phone_country_code": "+1",
|
||||
"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": "4242424242424242",
|
||||
"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": "PiX"
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"address": {
|
||||
"line1": "1467",
|
||||
"line2": "Harrison Street",
|
||||
"line3": "Harrison Street",
|
||||
"city": "San Fransico",
|
||||
"state": "California",
|
||||
"zip": "94122",
|
||||
"country": "US",
|
||||
"first_name": "PiX"
|
||||
}
|
||||
},
|
||||
"statement_descriptor_name": "joseph",
|
||||
"statement_descriptor_suffix": "JS",
|
||||
"metadata": {
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"routing": {
|
||||
"type": "single",
|
||||
"data": "checkout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try { jsonData = pm.response.json(); } catch (e) { }
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value", jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
@ -0,0 +1,37 @@
|
||||
{
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{baseUrl}}/payments/:id?force_sync=true&expand_captures=true",
|
||||
"host": [
|
||||
"{{baseUrl}}"
|
||||
],
|
||||
"path": [
|
||||
"payments",
|
||||
":id"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "force_sync",
|
||||
"value": "true"
|
||||
},
|
||||
{
|
||||
"key": "expand_captures",
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
|
||||
// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
|
||||
if (jsonData?.mandate_id) {
|
||||
pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
|
||||
console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
|
||||
};
|
||||
|
||||
// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
|
||||
if (jsonData?.client_secret) {
|
||||
pm.collectionVariables.set("client_secret", jsonData.client_secret);
|
||||
console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"childrenOrder": [
|
||||
"Payments - Create",
|
||||
"Payments - Capture - 1",
|
||||
"Payments - Capture - 2",
|
||||
"Payments - Capture - 3",
|
||||
"Payments - Retrieve",
|
||||
"Refunds - Create",
|
||||
"Refunds - Retrieve"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// 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 "connector error" for "error type"
|
||||
if (jsonData?.error?.type) {
|
||||
pm.test("[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'", function() {
|
||||
pm.expect(jsonData.error.type).to.eql("invalid_request");
|
||||
})};
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"options": {
|
||||
"raw": {
|
||||
"language": "json"
|
||||
}
|
||||
},
|
||||
"raw_json_formatted": {
|
||||
"amount_to_capture": 2000,
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// 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.');
|
||||
};
|
||||
@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": 6000,
|
||||
"currency": "USD",
|
||||
"confirm": true,
|
||||
"capture_method": "manual_multiple",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"customer_id": "StripeCustomer",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
"phone": "999999999",
|
||||
"phone_country_code": "+1",
|
||||
"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": "4242424242424242",
|
||||
"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": "PiX"
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"address": {
|
||||
"line1": "1467",
|
||||
"line2": "Harrison Street",
|
||||
"line3": "Harrison Street",
|
||||
"city": "San Fransico",
|
||||
"state": "California",
|
||||
"zip": "94122",
|
||||
"country": "US",
|
||||
"first_name": "PiX"
|
||||
}
|
||||
},
|
||||
"statement_descriptor_name": "joseph",
|
||||
"statement_descriptor_suffix": "JS",
|
||||
"metadata": {
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"routing": {
|
||||
"type": "single",
|
||||
"data": "checkout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eventOrder": [
|
||||
"event.test.js",
|
||||
"event.prerequest.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
// Validate status 2xx
|
||||
pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
|
||||
pm.response.to.be.success;
|
||||
});
|
||||
|
||||
// Validate if response header has matching content-type
|
||||
pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
|
||||
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
|
||||
});
|
||||
|
||||
// Set response object as internal variable
|
||||
let jsonData = {};
|
||||
try {jsonData = pm.response.json();}catch(e){}
|
||||
|
||||
// Validate if response has JSON Body
|
||||
pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
|
||||
pm.response.to.have.jsonBody();
|
||||
});
|
||||
|
||||
|
||||
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
|
||||
if (jsonData?.payment_id) {
|
||||
pm.collectionVariables.set("payment_id", jsonData.payment_id);
|
||||
console.log("- use {{payment_id}} as collection variable for value",jsonData.payment_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');
|
||||
};
|
||||
|
||||
|
||||
// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
|
||||
if (jsonData?.mandate_id) {
|
||||
pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
|
||||
console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
|
||||
};
|
||||
|
||||
// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
|
||||
if (jsonData?.client_secret) {
|
||||
pm.collectionVariables.set("client_secret", jsonData.client_secret);
|
||||
console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
|
||||
} else {
|
||||
console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
|
||||
};
|
||||
@ -0,0 +1,37 @@
|
||||
{
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Accept",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{baseUrl}}/payments/:id?force_sync=true&expand_captures=true",
|
||||
"host": [
|
||||
"{{baseUrl}}"
|
||||
],
|
||||
"path": [
|
||||
"payments",
|
||||
":id"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "force_sync",
|
||||
"value": "true"
|
||||
},
|
||||
{
|
||||
"key": "expand_captures",
|
||||
"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"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user