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): Add Cybersource Collection #3657

Merged
merged 5 commits into from
Feb 15, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions postman/collection-dir/cybersource/.auth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"auth": {
"type": "apikey",
"apikey": [
{
"key": "value",
"value": "{{api_key}}",
"type": "string"
},
{
"key": "key",
"value": "api-key",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
}
}
6 changes: 6 additions & 0 deletions postman/collection-dir/cybersource/.event.meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"eventOrder": [
"event.prerequest.js",
"event.test.js"
]
}
9 changes: 9 additions & 0 deletions postman/collection-dir/cybersource/.info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info": {
"_postman_id": "def65b5c-dc11-4917-a1bb-508988011eff",
"name": "cybersource",
"description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "24206034"
}
}
6 changes: 6 additions & 0 deletions postman/collection-dir/cybersource/.meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"childrenOrder": [
"Health check",
"Flow Testcases"
]
}
96 changes: 96 additions & 0 deletions postman/collection-dir/cybersource/.variable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"variable": [
{
"key": "baseUrl",
"value": "",
"type": "string"
},
{
"key": "admin_api_key",
"value": "",
"type": "string"
},
{
"key": "api_key",
"value": "",
"type": "string"
},
{
"key": "merchant_id",
"value": ""
},
{
"key": "payment_id",
"value": ""
},
{
"key": "customer_id",
"value": "cybersourcecustomer"
},
{
"key": "mandate_id",
"value": ""
},
{
"key": "payment_method_id",
"value": ""
},
{
"key": "refund_id",
"value": ""
},
{
"key": "merchant_connector_id",
"value": ""
},
{
"key": "client_secret",
"value": "",
"type": "string"
},
{
"key": "connector_api_key",
"value": "",
"type": "string"
},
{
"key": "publishable_key",
"value": "",
"type": "string"
},
{
"key": "api_key_id",
"value": "",
"type": "string"
},
{
"key": "payment_token",
"value": ""
},
{
"key": "gateway_merchant_id",
"value": "",
"type": "string"
},
{
"key": "certificate",
"value": "",
"type": "string"
},
{
"key": "certificate_keys",
"value": "",
"type": "string"
},
{
"key": "connector_key1",
"value": "",
"type": "string"
},
{
"key": "connector_api_secret",
"value": "",
"type": "string"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"childrenOrder": [
"QuickStart",
"Happy Cases",
"Variation Cases"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"childrenOrder": [
"Scenario1-Create payment with confirm true",
"Scenario2-Create payment with confirm false",
"Scenario2a-Create payment with confirm false card holder name null",
"Scenario2b-Create payment with confirm false card holder name empty",
"Scenario3-Create payment without PMD",
"Scenario4-Create payment with Manual capture",
"Scenario4a-Create payment with partial capture",
"Scenario5-Void the payment",
"Scenario6-Refund full payment",
"Scenario6a-Partial refund",
"Scenario7-Create a mandate and recurring payment",
"Scenario7a-Manual capture for recurring payments",
"Scenario8-Refund recurring payment",
"Scenario9-Add card flow",
"Scenario10-Don't Pass CVV for save card flow and verifysuccess payment",
"Scenario11-Save card payment with manual capture",
"Scenario12-Zero auth mandates",
"Scenario13-Incremental auth",
"Scenario14-Incremental auth for mandates",
"Scenario15-Incremental auth with partial capture",
"Scenario16-Verify PML for mandate",
"Scenario17-Revoke mandates",
"Scenario18-Update mandate card details",
"Scenario19-Create 3ds payment",
"Scenario20-Create 3ds mandate",
"Scenario21-Create a mandate without customer acceptance"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"childrenOrder": [
"Payments - Create",
"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,67 @@
// Validate status 2xx
pm.test("[POST]::/payments - Status code is 2xx", function () {
pm.response.to.be.success;
});

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

// Validate if response has JSON Body
pm.test("[POST]::/payments - Response has JSON Body", function () {
pm.response.to.have.jsonBody();
});

// Set response object as internal variable
let jsonData = {};
try {
jsonData = pm.response.json();
} catch (e) {}

// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
if (jsonData?.payment_id) {
pm.collectionVariables.set("payment_id", jsonData.payment_id);
console.log(
"- use {{payment_id}} as collection variable for value",
jsonData.payment_id,
);
} else {
console.log(
"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
);
}

// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
if (jsonData?.client_secret) {
pm.collectionVariables.set("client_secret", jsonData.client_secret);
console.log(
"- use {{client_secret}} as collection variable for value",
jsonData.client_secret,
);
} else {
console.log(
"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
);
}

// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
"[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
function () {
pm.expect(jsonData.status).to.eql("succeeded");
},
);
}

// Response body should have "connector_transaction_id"
pm.test(
"[POST]::/payments - Content check if 'connector_transaction_id' exists",
function () {
pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
.true;
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"key": "x-feature",
"value": "router-custom",
"type": "text"
}
],
"body": {
"mode": "raw",
"options": {
"raw": {
"language": "json"
}
},
"raw_json_formatted": {
"amount": 6540,
"currency": "USD",
"confirm": true,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
"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",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "01",
"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": "sundari",
"last_name": "sundari"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "sundari",
"last_name": "sundari"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"count_tickets": 1,
"transaction_number": "5590045"
}
}
},
"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"
}
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"
]
}
Loading
Loading