From 916ec06afb25603a7c22063bc3b7e1bb9805252e Mon Sep 17 00:00:00 2001 From: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:25:14 +0530 Subject: [PATCH 1/4] fix error deserlization incase of authentication failure --- .../router/src/connector/authorizedotnet.rs | 45 ++++++++++++------- .../connector/authorizedotnet/transformers.rs | 29 +++++++++--- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs index 7ff2098344ee..9cfceaf225ae 100644 --- a/crates/router/src/connector/authorizedotnet.rs +++ b/crates/router/src/connector/authorizedotnet.rs @@ -884,29 +884,44 @@ fn get_error_response( match response.transaction_response { Some(transaction_response) => Ok({ - transaction_response - .errors - .and_then(|errors| { - errors.into_iter().next().map(|error| types::ErrorResponse { - code: error.error_code, - message: error.error_text, + match transaction_response { + authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponse( + payment_response, + ) => payment_response + .errors + .and_then(|errors| { + errors.into_iter().next().map(|error| types::ErrorResponse { + code: error.error_code, + message: error.error_text.to_owned(), + reason: Some(error.error_text), + status_code, + }) + }) + .unwrap_or_else(|| types::ErrorResponse { + code: consts::NO_ERROR_CODE.to_string(), // authorizedotnet sends 200 in case of bad request so , this are hard coded to NO_ERROR_CODE and NO_ERROR_MESSAGE + message: consts::NO_ERROR_MESSAGE.to_string(), reason: None, status_code, - }) - }) - .unwrap_or_else(|| types::ErrorResponse { - code: consts::NO_ERROR_CODE.to_string(), - message: consts::NO_ERROR_MESSAGE.to_string(), - reason: None, - status_code, - }) + }), + authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponseError( + _, + ) => { + let message = &response.messages.message[0].text; + types::ErrorResponse { + code: consts::NO_ERROR_CODE.to_string(), + message: message.to_string(), + reason: Some(message.to_string()), + status_code, + } + } + } }), None => { let message = &response.messages.message[0].text; Ok(types::ErrorResponse { code: consts::NO_ERROR_CODE.to_string(), message: message.to_string(), - reason: None, + reason: Some(message.to_string()), status_code, }) } diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index cd7e070b16fa..20d78729a1be 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -453,9 +453,22 @@ pub struct ErrorMessage { pub error_text: String, } +#[derive(Debug, Clone, Deserialize)] +#[serde(untagged)] +pub enum TransactionResponse { + AuthorizedotnetTransactionResponse(Box), + AuthorizedotnetTransactionResponseError(Box), +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct AuthorizedotnetTransactionResponseError { + _supplemental_data_qualification_indicator: i64, +} + #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TransactionResponse { +pub struct AuthorizedotnetTransactionResponse { response_code: AuthorizedotnetPaymentStatus, #[serde(rename = "transId")] transaction_id: String, @@ -550,7 +563,7 @@ impl >, ) -> Result { match &item.response.transaction_response { - Some(transaction_response) => { + Some(TransactionResponse::AuthorizedotnetTransactionResponse(transaction_response)) => { let status = enums::AttemptStatus::from(transaction_response.response_code.clone()); let error = transaction_response.errors.as_ref().and_then(|errors| { errors.iter().next().map(|error| types::ErrorResponse { @@ -598,11 +611,13 @@ impl ..item.data }) } - None => Ok(Self { - status: enums::AttemptStatus::Failure, - response: Err(get_err_response(item.http_code, item.response.messages)), - ..item.data - }), + Some(TransactionResponse::AuthorizedotnetTransactionResponseError(_)) | None => { + Ok(Self { + status: enums::AttemptStatus::Failure, + response: Err(get_err_response(item.http_code, item.response.messages)), + ..item.data + }) + } } } } From d97336eb4e947c940c0922742fd3423745b9a2d4 Mon Sep 17 00:00:00 2001 From: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:12:45 +0530 Subject: [PATCH 2/4] minor fixx --- .../router/src/connector/authorizedotnet.rs | 54 +++++++------------ 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs index 9cfceaf225ae..d25e62391b58 100644 --- a/crates/router/src/connector/authorizedotnet.rs +++ b/crates/router/src/connector/authorizedotnet.rs @@ -883,40 +883,26 @@ fn get_error_response( .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; match response.transaction_response { - Some(transaction_response) => Ok({ - match transaction_response { - authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponse( - payment_response, - ) => payment_response - .errors - .and_then(|errors| { - errors.into_iter().next().map(|error| types::ErrorResponse { - code: error.error_code, - message: error.error_text.to_owned(), - reason: Some(error.error_text), - status_code, - }) - }) - .unwrap_or_else(|| types::ErrorResponse { - code: consts::NO_ERROR_CODE.to_string(), // authorizedotnet sends 200 in case of bad request so , this are hard coded to NO_ERROR_CODE and NO_ERROR_MESSAGE - message: consts::NO_ERROR_MESSAGE.to_string(), - reason: None, - status_code, - }), - authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponseError( - _, - ) => { - let message = &response.messages.message[0].text; - types::ErrorResponse { - code: consts::NO_ERROR_CODE.to_string(), - message: message.to_string(), - reason: Some(message.to_string()), - status_code, - } - } - } - }), - None => { + Some(authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponse( + payment_response, + )) => Ok(payment_response + .errors + .and_then(|errors| { + errors.into_iter().next().map(|error| types::ErrorResponse { + code: error.error_code, + message: error.error_text.to_owned(), + reason: Some(error.error_text), + status_code, + }) + }) + .unwrap_or_else(|| types::ErrorResponse { + code: consts::NO_ERROR_CODE.to_string(), // authorizedotnet sends 200 in case of bad request so this are hard coded to NO_ERROR_CODE and NO_ERROR_MESSAGE + message: consts::NO_ERROR_MESSAGE.to_string(), + reason: None, + status_code, + })), + Some(authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponseError(_)) + | None => { let message = &response.messages.message[0].text; Ok(types::ErrorResponse { code: consts::NO_ERROR_CODE.to_string(), From 642576174a58822acc1ff93cac084184d1a6d1af Mon Sep 17 00:00:00 2001 From: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:31:15 +0530 Subject: [PATCH 3/4] add test cases in postman collection.dir --- .../.meta.json | 3 + .../Payments - Create/.event.meta.json | 3 + .../Payments - Create/event.prerequest.js | 1 + .../Payments - Create/event.test.js | 91 ++++++++++++ .../Payments - Create/request.json | 28 ++++ .../Payments - Create/response.json | 1 + .../Payments - Retrieve/.event.meta.json | 3 + .../Payments - Retrieve/event.test.js | 71 ++++++++++ .../Payments - Retrieve/request.json | 28 ++++ .../Payments - Retrieve/response.json | 1 + .../.meta.json | 8 ++ .../.event.meta.json | 3 + .../event.prerequest.js | 0 .../Payment Connector - Update/event.test.js | 39 ++++++ .../Payment Connector - Update/request.json | 129 ++++++++++++++++++ .../Payment Connector - Update/response.json | 1 + .../Payments - Create/.event.meta.json | 3 + .../Payments - Create/event.prerequest.js | 1 + .../Payments - Create/event.test.js | 92 +++++++++++++ .../Payments - Create/request.json | 28 ++++ .../Payments - Create/response.json | 1 + .../.event.meta.json | 3 + .../event.prerequest.js | 0 .../event.test.js | 39 ++++++ .../Payments - Update connector /request.json | 129 ++++++++++++++++++ .../response.json | 1 + 26 files changed, 707 insertions(+) create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/.event.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.prerequest.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.test.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/response.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/.event.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/event.test.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/request.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/response.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/.event.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.prerequest.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.test.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/response.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/.event.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.prerequest.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.test.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/response.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json create mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/.meta.json new file mode 100644 index 000000000000..69b505c6d863 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/.meta.json @@ -0,0 +1,3 @@ +{ + "childrenOrder": ["Payments - Create", "Payments - Retrieve"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/.event.meta.json new file mode 100644 index 000000000000..220b1a6723d5 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/.event.meta.json @@ -0,0 +1,3 @@ +{ + "eventOrder": ["event.test.js", "event.prerequest.js"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.prerequest.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.prerequest.js new file mode 100644 index 000000000000..27965bb9c016 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.prerequest.js @@ -0,0 +1 @@ +pm.environment.set("random_number", _.random(1000, 100000)); diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.test.js new file mode 100644 index 000000000000..414cbe9ae30d --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/event.test.js @@ -0,0 +1,91 @@ +// 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" or "failed" for "error_code" +if (jsonData?.error_code) { + pm.test( + "[POST]::/payments - Content check if value for 'error_code' matches '3' or '11' ", + function () { + pm.expect(jsonData.error_code).to.be.oneOf(["3", "11"]); + }, + ); +} + +// Response body should have value "processing" or "failed" for "status" +if (jsonData?.error_message) { + pm.test( + "[POST]::/payments - Content check if value for 'error_message' matches 'processing' or 'This transaction has been declined.' ", + function () { + pm.expect(jsonData.error_message).to.be.oneOf(["A duplicate transaction has been submitted.", "This transaction has been declined."]); + }, + ); +} + +// Response body should have value "processing" or "failed" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'processing' or 'failed' ", + function () { + pm.expect(jsonData.status).to.be.oneOf(["failed"]); + }, + ); +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json new file mode 100644 index 000000000000..17ef3acfa51c --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json @@ -0,0 +1,28 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"amount\": 7003,\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\":7003,\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"370000000000002\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"900\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": ["{{baseUrl}}"], + "path": ["payments"] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/response.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/.event.meta.json new file mode 100644 index 000000000000..0731450e6b25 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/.event.meta.json @@ -0,0 +1,3 @@ +{ + "eventOrder": ["event.test.js"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/event.test.js new file mode 100644 index 000000000000..611bb438bb84 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/event.test.js @@ -0,0 +1,71 @@ +// 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" or "failed" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'processing' or 'failed' ", + function () { + pm.expect(jsonData.status).to.be.oneOf(["processing", "failed"]); + }, + ); +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/request.json new file mode 100644 index 000000000000..6cd4b7d96c52 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/request.json @@ -0,0 +1,28 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": ["{{baseUrl}}"], + "path": ["payments", ":id"], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/response.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/.meta.json new file mode 100644 index 000000000000..0cc63949449b --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/.meta.json @@ -0,0 +1,8 @@ +{ + "childrenOrder": [ + "Payments Connector - Update", + "Payments - Create", + "Recurring Payments - Retrieve", + "Payments Connector - Update" + ] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/.event.meta.json new file mode 100644 index 000000000000..220b1a6723d5 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/.event.meta.json @@ -0,0 +1,3 @@ +{ + "eventOrder": ["event.test.js", "event.prerequest.js"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.prerequest.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.prerequest.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.test.js new file mode 100644 index 000000000000..88e92d8d84a2 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/event.test.js @@ -0,0 +1,39 @@ +// Validate status 2xx +pm.test( + "[POST]::/account/:account_id/connectors - Status code is 2xx", + function () { + pm.response.to.be.success; + }, +); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/account/:account_id/connectors - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id +if (jsonData?.merchant_connector_id) { + pm.collectionVariables.set( + "merchant_connector_id", + jsonData.merchant_connector_id, + ); + console.log( + "- use {{merchant_connector_id}} as collection variable for value", + jsonData.merchant_connector_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", + ); +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json new file mode 100644 index 000000000000..4f45aa9445c9 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json @@ -0,0 +1,129 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "connector_type": "fiz_operations", + "connector_name": "authorizedotnet", + "connector_account_details": { + "auth_type": "BodyKey", + "api_key": "{{connector_api_key}}", + "key1": "authorizedot" + }, + "test_mode": false, + "disabled": false, + "business_country": "US", + "business_label": "default", + "payment_methods_enabled": [ + { + "payment_method": "card", + "payment_method_types": [ + { + "payment_method_type": "credit", + "card_networks": ["Visa", "Mastercard"], + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "debit", + "card_networks": ["Visa", "Mastercard"], + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + }, + { + "payment_method": "pay_later", + "payment_method_types": [ + { + "payment_method_type": "klarna", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "affirm", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "afterpay_clearpay", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + } + ], + "metadata": { + "city": "NY", + "unit": "245" + } + } + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/connectors/:connector_id", + "host": ["{{baseUrl}}"], + "path": ["account", ":account_id", "connectors"], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}", + "description": "(Required) The unique identifier for the merchant account" + }, + { + "key": "connector_id", + "value": "{{merchant_connector_id}}", + "description": "(Required) The unique identifier for the merchant connector account" + } + + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/response.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/.event.meta.json new file mode 100644 index 000000000000..220b1a6723d5 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/.event.meta.json @@ -0,0 +1,3 @@ +{ + "eventOrder": ["event.test.js", "event.prerequest.js"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.prerequest.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.prerequest.js new file mode 100644 index 000000000000..27965bb9c016 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.prerequest.js @@ -0,0 +1 @@ +pm.environment.set("random_number", _.random(1000, 100000)); diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.test.js new file mode 100644 index 000000000000..d2d47ca994b0 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/event.test.js @@ -0,0 +1,92 @@ +// 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 "processing" or "failed" for "error_code" +if (jsonData?.error_code) { + pm.test( + "[POST]::/payments - Content check if value for 'error_code' matches 'E00007' or '11' ", + function () { + pm.expect(jsonData.error_code).to.be.oneOf(["E00007", "11"]); + }, + ); +} + +// Response body should have value "processing" or "failed" for "status" +if (jsonData?.error_message) { + pm.test( + "[POST]::/payments - Content check if value for 'error_message' matches 'processing' or 'This transaction has been declined.' ", + function () { + pm.expect(jsonData.error_message).to.be.oneOf(["A duplicate transaction has been submitted.", "User authentication failed due to invalid authentication values."]); + }, + ); +} + +// Response body should have value "processing" or "failed" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'processing' or 'failed' ", + function () { + pm.expect(jsonData.status).to.be.oneOf(["failed"]); + }, + ); +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json new file mode 100644 index 000000000000..17ef3acfa51c --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json @@ -0,0 +1,28 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"amount\": 7003,\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\":7003,\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"370000000000002\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"900\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": ["{{baseUrl}}"], + "path": ["payments"] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/response.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json new file mode 100644 index 000000000000..220b1a6723d5 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json @@ -0,0 +1,3 @@ +{ + "eventOrder": ["event.test.js", "event.prerequest.js"] +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js new file mode 100644 index 000000000000..88e92d8d84a2 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js @@ -0,0 +1,39 @@ +// Validate status 2xx +pm.test( + "[POST]::/account/:account_id/connectors - Status code is 2xx", + function () { + pm.response.to.be.success; + }, +); + +// Validate if response header has matching content-type +pm.test( + "[POST]::/account/:account_id/connectors - Content-Type is application/json", + function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); + }, +); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id +if (jsonData?.merchant_connector_id) { + pm.collectionVariables.set( + "merchant_connector_id", + jsonData.merchant_connector_id, + ); + console.log( + "- use {{merchant_connector_id}} as collection variable for value", + jsonData.merchant_connector_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", + ); +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json new file mode 100644 index 000000000000..e272cc4e3219 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json @@ -0,0 +1,129 @@ +{ + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{admin_api_key}}", + "type": "string" + }, + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "connector_type": "fiz_operations", + "connector_name": "authorizedotnet", + "connector_account_details": { + "auth_type": "BodyKey", + "api_key": "{{connector_api_key}}", + "key1": "{{connector_key1}}" + }, + "test_mode": false, + "disabled": false, + "business_country": "US", + "business_label": "default", + "payment_methods_enabled": [ + { + "payment_method": "card", + "payment_method_types": [ + { + "payment_method_type": "credit", + "card_networks": ["Visa", "Mastercard"], + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "debit", + "card_networks": ["Visa", "Mastercard"], + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + }, + { + "payment_method": "pay_later", + "payment_method_types": [ + { + "payment_method_type": "klarna", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "affirm", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_type": "afterpay_clearpay", + "payment_experience": "redirect_to_url", + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + } + ], + "metadata": { + "city": "NY", + "unit": "245" + } + } + }, + "url": { + "raw": "{{baseUrl}}/account/:account_id/connectors/:connector_id", + "host": ["{{baseUrl}}"], + "path": ["account", ":account_id", "connectors"], + "variable": [ + { + "key": "account_id", + "value": "{{merchant_id}}", + "description": "(Required) The unique identifier for the merchant account" + }, + { + "key": "connector_id", + "value": "{{merchant_connector_id}}", + "description": "(Required) The unique identifier for the merchant connector account" + } + + ] + }, + "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." +} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json @@ -0,0 +1 @@ +[] From e06bbaf1cf78a7c443bd2dcdebd975d126d6983d Mon Sep 17 00:00:00 2001 From: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:49:51 +0530 Subject: [PATCH 4/4] update postman collection for authorizedotnet --- .../Payments - Create/request.json | 61 ++++++++- .../Payment Connector - Update/request.json | 63 +-------- .../Payments - Create/request.json | 61 ++++++++- .../.event.meta.json | 3 - .../event.prerequest.js | 0 .../event.test.js | 39 ------ .../Payments - Update connector /request.json | 129 ------------------ .../response.json | 1 - 8 files changed, 121 insertions(+), 236 deletions(-) delete mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json delete mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js delete mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js delete mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json delete mode 100644 postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json index 17ef3acfa51c..b9bf4f2b66ea 100644 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json @@ -12,7 +12,66 @@ ], "body": { "mode": "raw", - "raw": "{\n \"amount\": 7003,\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\":7003,\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"370000000000002\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"900\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}", + "raw_json_formatted": { + "amount": 7003, + "currency": "USD", + "confirm": true, + "routing": { + "data": "authorizedotnet", + "type": "single" + }, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "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": "370000000000002", + "card_exp_month": "10", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "900" + } + }, + "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" + } + }, "options": { "raw": { "language": "json" diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json index 4f45aa9445c9..89e78ae13e1b 100644 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payment Connector - Update/request.json @@ -39,78 +39,17 @@ }, "raw_json_formatted": { "connector_type": "fiz_operations", - "connector_name": "authorizedotnet", "connector_account_details": { "auth_type": "BodyKey", "api_key": "{{connector_api_key}}", "key1": "authorizedot" - }, - "test_mode": false, - "disabled": false, - "business_country": "US", - "business_label": "default", - "payment_methods_enabled": [ - { - "payment_method": "card", - "payment_method_types": [ - { - "payment_method_type": "credit", - "card_networks": ["Visa", "Mastercard"], - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "debit", - "card_networks": ["Visa", "Mastercard"], - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - }, - { - "payment_method": "pay_later", - "payment_method_types": [ - { - "payment_method_type": "klarna", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "affirm", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "afterpay_clearpay", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - } - ], - "metadata": { - "city": "NY", - "unit": "245" } } }, "url": { "raw": "{{baseUrl}}/account/:account_id/connectors/:connector_id", "host": ["{{baseUrl}}"], - "path": ["account", ":account_id", "connectors"], + "path": ["account", ":account_id", "connectors",":connector_id"], "variable": [ { "key": "account_id", diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json index 17ef3acfa51c..b9bf4f2b66ea 100644 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json @@ -12,7 +12,66 @@ ], "body": { "mode": "raw", - "raw": "{\n \"amount\": 7003,\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\":7003,\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"370000000000002\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"900\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}", + "raw_json_formatted": { + "amount": 7003, + "currency": "USD", + "confirm": true, + "routing": { + "data": "authorizedotnet", + "type": "single" + }, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "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": "370000000000002", + "card_exp_month": "10", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "900" + } + }, + "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" + } + }, "options": { "raw": { "language": "json" diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json deleted file mode 100644 index 220b1a6723d5..000000000000 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /.event.meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eventOrder": ["event.test.js", "event.prerequest.js"] -} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.prerequest.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js deleted file mode 100644 index 88e92d8d84a2..000000000000 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /event.test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Validate status 2xx -pm.test( - "[POST]::/account/:account_id/connectors - Status code is 2xx", - function () { - pm.response.to.be.success; - }, -); - -// Validate if response header has matching content-type -pm.test( - "[POST]::/account/:account_id/connectors - Content-Type is application/json", - function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); - }, -); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - -// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id -if (jsonData?.merchant_connector_id) { - pm.collectionVariables.set( - "merchant_connector_id", - jsonData.merchant_connector_id, - ); - console.log( - "- use {{merchant_connector_id}} as collection variable for value", - jsonData.merchant_connector_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", - ); -} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json deleted file mode 100644 index e272cc4e3219..000000000000 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /request.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw_json_formatted": { - "connector_type": "fiz_operations", - "connector_name": "authorizedotnet", - "connector_account_details": { - "auth_type": "BodyKey", - "api_key": "{{connector_api_key}}", - "key1": "{{connector_key1}}" - }, - "test_mode": false, - "disabled": false, - "business_country": "US", - "business_label": "default", - "payment_methods_enabled": [ - { - "payment_method": "card", - "payment_method_types": [ - { - "payment_method_type": "credit", - "card_networks": ["Visa", "Mastercard"], - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "debit", - "card_networks": ["Visa", "Mastercard"], - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - }, - { - "payment_method": "pay_later", - "payment_method_types": [ - { - "payment_method_type": "klarna", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "affirm", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "afterpay_clearpay", - "payment_experience": "redirect_to_url", - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - } - ], - "metadata": { - "city": "NY", - "unit": "245" - } - } - }, - "url": { - "raw": "{{baseUrl}}/account/:account_id/connectors/:connector_id", - "host": ["{{baseUrl}}"], - "path": ["account", ":account_id", "connectors"], - "variable": [ - { - "key": "account_id", - "value": "{{merchant_id}}", - "description": "(Required) The unique identifier for the merchant account" - }, - { - "key": "connector_id", - "value": "{{merchant_connector_id}}", - "description": "(Required) The unique identifier for the merchant connector account" - } - - ] - }, - "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." -} diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json deleted file mode 100644 index fe51488c7066..000000000000 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Update connector /response.json +++ /dev/null @@ -1 +0,0 @@ -[]