mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(connector): [Fiuu] Add support for cards recurring payments (#6361)
Co-authored-by: Chikke Srujan <chikke.srujan@Chikke-Srujan-N7WRTY72X7.local> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -13,6 +13,40 @@ const successfulThreeDSTestCardDetails = {
|
||||
card_holder_name: "joseph Doe",
|
||||
card_cvc: "123",
|
||||
};
|
||||
|
||||
const singleUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
single_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const multiUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
multi_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
@ -184,5 +218,346 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandateNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: null,
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
setup_future_usage: "on_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
setup_future_usage: "on_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSAutoCaptureOffSession: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
setup_future_usage: "off_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSManualCaptureOffSession: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
setup_future_usage: "off_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardConfirmAutoCaptureOffSession: {
|
||||
Request: {
|
||||
setup_future_usage: "off_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardConfirmManualCaptureOffSession: {
|
||||
Request: {
|
||||
setup_future_usage: "off_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandateNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: null,
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandate3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: null,
|
||||
authentication_type: "three_ds",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandate3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
mandate_data: null,
|
||||
authentication_type: "three_ds",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -1843,7 +1843,11 @@ Cypress.Commands.add(
|
||||
const nextActionUrl = response.body.next_action.redirect_to_url;
|
||||
cy.log(nextActionUrl);
|
||||
} else if (response.body.authentication_type === "no_three_ds") {
|
||||
expect(response.body.status).to.equal("succeeded");
|
||||
if (response.body.connector === "fiuu") {
|
||||
expect(response.body.status).to.equal("failed");
|
||||
} else {
|
||||
expect(response.body.status).to.equal("succeeded");
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Invalid authentication type ${response.body.authentication_type}`
|
||||
@ -2446,51 +2450,55 @@ Cypress.Commands.add(
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add("updateConfig", (configType, configData, globalState, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const merchant_id = globalState.get("merchantId");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
Cypress.Commands.add(
|
||||
"updateConfig",
|
||||
(configType, configData, globalState, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const merchant_id = globalState.get("merchantId");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
|
||||
let key;
|
||||
let url;
|
||||
let body;
|
||||
|
||||
switch (configType) {
|
||||
case 'autoRetry':
|
||||
key = `should_call_gsm_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
case 'maxRetries':
|
||||
key = `max_auto_retries_enabled_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
case 'stepUp':
|
||||
key = `step_up_enabled_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Invalid config type passed into the configs: "${api_key}: ${value}"`);
|
||||
}
|
||||
let key;
|
||||
let url;
|
||||
let body;
|
||||
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: url,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
body: body,
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
if (response.status === 200) {
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
switch (configType) {
|
||||
case "autoRetry":
|
||||
key = `should_call_gsm_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
case "maxRetries":
|
||||
key = `max_auto_retries_enabled_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
case "stepUp":
|
||||
key = `step_up_enabled_${merchant_id}`;
|
||||
url = `${base_url}/configs/${key}`;
|
||||
body = { key: key, value: value };
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Invalid config type passed into the configs: "${api_key}: ${value}"`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: url,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
body: body,
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
if (response.status === 200) {
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user