Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(postman): Added address update test cases #2555

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions postman/collection-dir/stripe/.info.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"info": {
"_postman_id": "8690e6f5-b693-42f3-a9f5-a1492faecdd6",
"name": "stripe",
"_postman_id": "a553df38-fa33-4522-b029-1cd32821730e",
"name": "Stripe Postman 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: [[email protected]](mailto:[email protected])",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "25737662"
"_exporter_id": "24206034"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"Scenario18-Bank Redirect-giropay",
"Scenario19-Bank Transfer-ach",
"Scenario19-Bank Debit-ach",
"Scenario22-Wallet-Wechatpay"
"Scenario22-Wallet-Wechatpay",
"Scenario22- Update address and List Payment method",
"Scenario23- Update Amount"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"childrenOrder": [
"Payments - Create",
"List Payment Methods for a Merchant",
"Payments - Update",
"List Payment Methods for a Merchant-copy",
"Payments - Confirm",
"Payments - Retrieve"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eventOrder": [
"event.test.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Validate status 2xx
pm.test("[GET]::/payment_methods/:merchant_id - Status code is 2xx", function () {
pm.response.to.be.success;
});

// Validate if response header has matching content-type
pm.test("[GET]::/payment_methods/:merchant_id - Content-Type is application/json", function () {
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
});


// Parse the response body as JSON
var responseBody = pm.response.json();

// Check if "payment_methods" array contains a "payment_method" with the value "card"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "card";
});
});

// Check if "payment_methods" array contains a "payment_method" with the value "ideal"
pm.test("[GET]::/payment_methods/:merchant_id - Content Check if payment_method matches 'ideal'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "ideal";
});
});

// Check if "payment_methods" array contains a "payment_method" with the value "bank_redirect"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_redirect'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "bank_redirect";
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"auth": {
"type": "apikey",
"apikey": [
{
"key": "value",
"value": "{{publishable_key}}",
"type": "string"
},
{
"key": "key",
"value": "api-key",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "x-feature",
"value": "router-custom",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
"host": [
"{{baseUrl}}"
],
"path": [
"account",
"payment_methods"
],
"query": [
{
"key": "client_secret",
"value": "{{client_secret}}"
}
]
},
"description": "To filter and list the applicable payment methods for a particular merchant id."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eventOrder": [
"event.test.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Validate status 2xx
pm.test("[GET]::/payment_methods/:merchant_id - Status code is 2xx", function () {
pm.response.to.be.success;
});

// Validate if response header has matching content-type
pm.test("[GET]::/payment_methods/:merchant_id - Content-Type is application/json", function () {
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
});

// Parse the response body as JSON
var responseBody = pm.response.json();

// Check if "payment_methods" array contains a "payment_method" with the value "card"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "card";
});
});

// Check if "payment_methods" array contains a "payment_method" with the value "pay_later"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'pay_later'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "pay_later";
});
});
// Check if "payment_methods" array contains a "payment_method" with the value "wallet"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'wallet'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "wallet";
});
});

// Check if "payment_methods" array contains a "payment_method" with the value "bank_debit"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_debit'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "bank_debit";
});
});

// Check if "payment_methods" array contains a "payment_method" with the value "bank_transfer"
pm.test("[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_transfer'", function () {
var paymentMethods = responseBody.payment_methods;
var cardPaymentMethod = paymentMethods.find(function (method) {
return method.payment_method == "bank_transfer";
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"auth": {
"type": "apikey",
"apikey": [
{
"key": "value",
"value": "{{publishable_key}}",
"type": "string"
},
{
"key": "key",
"value": "api-key",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "x-feature",
"value": "router-custom",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
"host": [
"{{baseUrl}}"
],
"path": [
"account",
"payment_methods"
],
"query": [
{
"key": "client_secret",
"value": "{{client_secret}}"
}
]
},
"description": "To filter and list the applicable payment methods for a particular merchant id."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eventOrder": [
"event.test.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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_customer_action" for "status"
if (jsonData?.status) {
pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'", function() {
pm.expect(jsonData.status).to.eql("requires_customer_action");
})};

Loading
Loading