mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	ci(cypress): Add testcases for unified error code and message (#6796)
This commit is contained in:
		| @ -673,4 +673,52 @@ describe("Corner cases", () => { | |||||||
|       ); |       ); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
|  |   context("Card-NoThreeDS fail payment flow test", () => { | ||||||
|  |     let shouldContinue = true; // variable that will be used to skip tests if a previous test fails | ||||||
|  |  | ||||||
|  |     before("seed global state", () => { | ||||||
|  |       cy.task("getGlobalState").then((state) => { | ||||||
|  |         globalState = new State(state); | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     after("flush global state", () => { | ||||||
|  |       cy.task("setGlobalState", globalState.data); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     beforeEach(function () { | ||||||
|  |       if (!shouldContinue) { | ||||||
|  |         this.skip(); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     it("create-payment-call-test", () => { | ||||||
|  |       const data = getConnectorDetails(globalState.get("connectorId"))[ | ||||||
|  |         "card_pm" | ||||||
|  |       ]["PaymentIntent"]; | ||||||
|  |  | ||||||
|  |       cy.createPaymentIntentTest( | ||||||
|  |         fixtures.createPaymentBody, | ||||||
|  |         data, | ||||||
|  |         "no_three_ds", | ||||||
|  |         "automatic", | ||||||
|  |         globalState | ||||||
|  |       ); | ||||||
|  |  | ||||||
|  |       if (shouldContinue) shouldContinue = utils.should_continue_further(data); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     it("Confirm No 3DS", () => { | ||||||
|  |       const data = getConnectorDetails(globalState.get("connectorId"))[ | ||||||
|  |         "card_pm" | ||||||
|  |       ]["No3DSFailPayment"]; | ||||||
|  |  | ||||||
|  |       cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); | ||||||
|  |       if (shouldContinue) shouldContinue = utils.should_continue_further(data); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     it("retrieve-payment-call-test", () => { | ||||||
|  |       cy.retrievePaymentCallTest(globalState); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -16,6 +16,14 @@ const successfulThreeDSTestCardDetails = { | |||||||
|   card_cvc: "737", |   card_cvc: "737", | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | const failedNo3DSCardDetails = { | ||||||
|  |   card_number: "4242424242424242", | ||||||
|  |   card_exp_month: "01", | ||||||
|  |   card_exp_year: "25", | ||||||
|  |   card_holder_name: "joseph Doe", | ||||||
|  |   card_cvc: "123", | ||||||
|  | }; | ||||||
|  |  | ||||||
| const singleUseMandateData = { | const singleUseMandateData = { | ||||||
|   customer_acceptance: { |   customer_acceptance: { | ||||||
|     acceptance_type: "offline", |     acceptance_type: "offline", | ||||||
| @ -182,6 +190,26 @@ export const connectorDetails = { | |||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|     }, |     }, | ||||||
|  |     No3DSFailPayment: { | ||||||
|  |       Request: { | ||||||
|  |         payment_method: "card", | ||||||
|  |         payment_method_data: { | ||||||
|  |           card: failedNo3DSCardDetails, | ||||||
|  |         }, | ||||||
|  |         customer_acceptance: null, | ||||||
|  |         setup_future_usage: "on_session", | ||||||
|  |       }, | ||||||
|  |       Response: { | ||||||
|  |         status: 200, | ||||||
|  |         body: { | ||||||
|  |           status: "failed", | ||||||
|  |           error_code: "2", | ||||||
|  |           error_message: "Refused", | ||||||
|  |           unified_code: "UE_9000", | ||||||
|  |           unified_message: "Something went wrong", | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|     Capture: { |     Capture: { | ||||||
|       Request: { |       Request: { | ||||||
|         payment_method: "card", |         payment_method: "card", | ||||||
|  | |||||||
| @ -708,6 +708,20 @@ export const connectorDetails = { | |||||||
|         setup_future_usage: "on_session", |         setup_future_usage: "on_session", | ||||||
|       }, |       }, | ||||||
|     }), |     }), | ||||||
|  |     No3DSFailPayment: getCustomExchange({ | ||||||
|  |       Request: { | ||||||
|  |         payment_method: "card", | ||||||
|  |         payment_method_data: { | ||||||
|  |           card: successfulNo3DSCardDetails, | ||||||
|  |         }, | ||||||
|  |         customer_acceptance: null, | ||||||
|  |         setup_future_usage: "on_session", | ||||||
|  |       }, | ||||||
|  |       Response: { | ||||||
|  |         status: 200, | ||||||
|  |         body: {}, | ||||||
|  |       }, | ||||||
|  |     }), | ||||||
|     Capture: getCustomExchange({ |     Capture: getCustomExchange({ | ||||||
|       Request: { |       Request: { | ||||||
|         payment_method: "card", |         payment_method: "card", | ||||||
|  | |||||||
| @ -16,6 +16,14 @@ const successfulThreeDSTestCardDetails = { | |||||||
|   card_cvc: "737", |   card_cvc: "737", | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | const failedNo3DSCardDetails = { | ||||||
|  |   card_number: "4000000000000002", | ||||||
|  |   card_exp_month: "01", | ||||||
|  |   card_exp_year: "25", | ||||||
|  |   card_holder_name: "joseph Doe", | ||||||
|  |   card_cvc: "123", | ||||||
|  | }; | ||||||
|  |  | ||||||
| const singleUseMandateData = { | const singleUseMandateData = { | ||||||
|   customer_acceptance: { |   customer_acceptance: { | ||||||
|     acceptance_type: "offline", |     acceptance_type: "offline", | ||||||
| @ -254,6 +262,27 @@ export const connectorDetails = { | |||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|     }, |     }, | ||||||
|  |     No3DSFailPayment: { | ||||||
|  |       Request: { | ||||||
|  |         payment_method: "card", | ||||||
|  |         payment_method_data: { | ||||||
|  |           card: failedNo3DSCardDetails, | ||||||
|  |         }, | ||||||
|  |         customer_acceptance: null, | ||||||
|  |         setup_future_usage: "on_session", | ||||||
|  |       }, | ||||||
|  |       Response: { | ||||||
|  |         status: 200, | ||||||
|  |         body: { | ||||||
|  |           status: "failed", | ||||||
|  |           error_code: "card_declined", | ||||||
|  |           error_message: | ||||||
|  |             "message - Your card was declined., decline_code - generic_decline", | ||||||
|  |           unified_code: "UE_9000", | ||||||
|  |           unified_message: "Something went wrong", | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|     Capture: { |     Capture: { | ||||||
|       Request: { |       Request: { | ||||||
|         payment_method: "card", |         payment_method: "card", | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Gnanasundari24
					Gnanasundari24