mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	 150094fd92
			
		
	
	150094fd92
	
	
	
		
			
			Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
		
			
				
	
	
		
			674 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			674 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const successfulNo3DSCardDetails = {
 | |
|   card_number: "4111111111111111",
 | |
|   card_exp_month: "03",
 | |
|   card_exp_year: "30",
 | |
|   card_holder_name: "John Doe",
 | |
|   card_cvc: "737",
 | |
| };
 | |
| 
 | |
| const successfulThreeDSTestCardDetails = {
 | |
|   card_number: "4917610000000000",
 | |
|   card_exp_month: "03",
 | |
|   card_exp_year: "30",
 | |
|   card_holder_name: "Joseph Doe",
 | |
|   card_cvc: "737",
 | |
| };
 | |
| 
 | |
| 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: {
 | |
|       Request: {
 | |
|         currency: "EUR",
 | |
|         amount: 900,
 | |
|         customer_acceptance: null,
 | |
|         setup_future_usage: "on_session",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_payment_method",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     "3DSManualCapture": {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_data: {
 | |
|           card: successfulThreeDSTestCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         customer_acceptance: null,
 | |
|         setup_future_usage: "on_session",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "processing",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     "3DSAutoCapture": {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_data: {
 | |
|           card: successfulThreeDSTestCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         customer_acceptance: null,
 | |
|         setup_future_usage: "on_session",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     No3DSManualCapture: {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_data: {
 | |
|           card: successfulNo3DSCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         customer_acceptance: null,
 | |
|         setup_future_usage: "on_session",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_capture",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     No3DSAutoCapture: {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_type: "credit",
 | |
|         payment_method_data: {
 | |
|           card: successfulNo3DSCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         amount: 900,
 | |
|         customer_acceptance: null,
 | |
|         setup_future_usage: "on_session",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "succeeded",
 | |
|           connector: "adyen",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     Capture: {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_data: {
 | |
|           card: successfulNo3DSCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         customer_acceptance: null,
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "processing",
 | |
|           amount: 6500,
 | |
|           amount_capturable: 6500,
 | |
|           amount_received: 0,
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     PartialCapture: {
 | |
|       Request: {},
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "processing",
 | |
|           amount: 6500,
 | |
|           amount_capturable: 6500,
 | |
|           amount_received: 0,
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     Void: {
 | |
|       Request: {},
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "processing",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     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",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     ZeroAuthMandate: {
 | |
|       Request: {
 | |
|         payment_method: "card",
 | |
|         payment_method_data: {
 | |
|           card: successfulNo3DSCardDetails,
 | |
|         },
 | |
|         currency: "USD",
 | |
|         mandate_data: singleUseMandateData,
 | |
|       },
 | |
|       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",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|   },
 | |
|   bank_transfer_pm: {
 | |
|     PaymentIntent: {
 | |
|       Request: {
 | |
|         currency: "BRL",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_payment_method",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     Pix: {
 | |
|       Request: {
 | |
|         payment_method: "bank_transfer",
 | |
|         payment_method_type: "pix",
 | |
|         payment_method_data: {
 | |
|           bank_transfer: {
 | |
|             pix: {},
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "BR",
 | |
|             first_name: "joseph",
 | |
|             last_name: "Doe",
 | |
|           },
 | |
|           phone: {
 | |
|             number: "9123456789",
 | |
|             country_code: "+91",
 | |
|           },
 | |
|         },
 | |
|         currency: "BRL",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|   },
 | |
|   bank_redirect_pm: {
 | |
|     PaymentIntent: {
 | |
|       Request: {
 | |
|         currency: "EUR",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_payment_method",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     ideal: {
 | |
|       Request: {
 | |
|         payment_method: "bank_redirect",
 | |
|         payment_method_type: "ideal",
 | |
|         payment_method_data: {
 | |
|           bank_redirect: {
 | |
|             ideal: {
 | |
|               bank_name: "ing",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "NL",
 | |
|             first_name: "joseph",
 | |
|             last_name: "Doe",
 | |
|           },
 | |
|           phone: {
 | |
|             number: "9123456789",
 | |
|             country_code: "+91",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|           connector: "adyen",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     giropay: {
 | |
|       Request: {
 | |
|         payment_method: "bank_redirect",
 | |
|         payment_method_type: "giropay",
 | |
|         payment_method_data: {
 | |
|           bank_redirect: {
 | |
|             giropay: {
 | |
|               bank_name: "",
 | |
|               bank_account_bic: "",
 | |
|               bank_account_iban: "",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "DE",
 | |
|             first_name: "joseph",
 | |
|             last_name: "Doe",
 | |
|           },
 | |
|           phone: {
 | |
|             number: "9123456789",
 | |
|             country_code: "+91",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     sofort: {
 | |
|       Request: {
 | |
|         payment_method: "bank_redirect",
 | |
|         payment_method_type: "sofort",
 | |
|         payment_method_data: {
 | |
|           bank_redirect: {
 | |
|             sofort: {
 | |
|               preferred_language: "en",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "DE",
 | |
|             first_name: "joseph",
 | |
|             last_name: "Doe",
 | |
|           },
 | |
|           phone: {
 | |
|             number: "9123456789",
 | |
|             country_code: "+91",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     eps: {
 | |
|       Request: {
 | |
|         payment_method: "bank_redirect",
 | |
|         payment_method_type: "eps",
 | |
|         payment_method_data: {
 | |
|           bank_redirect: {
 | |
|             eps: {
 | |
|               bank_name: "ing",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "AT",
 | |
|             first_name: "joseph",
 | |
|             last_name: "Doe",
 | |
|           },
 | |
|           phone: {
 | |
|             number: "9123456789",
 | |
|             country_code: "+91",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_customer_action",
 | |
|           connector: "adyen",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     blik: {
 | |
|       Request: {
 | |
|         payment_method: "bank_redirect",
 | |
|         payment_method_type: "blik",
 | |
|         payment_method_data: {
 | |
|           bank_redirect: {
 | |
|             blik: {
 | |
|               name: "John Doe",
 | |
|               email: "example@email.com",
 | |
|               blik_code: "777987",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|         billing: {
 | |
|           address: {
 | |
|             line1: "1467",
 | |
|             line2: "Harrison Street",
 | |
|             line3: "Harrison Street",
 | |
|             city: "San Fransico",
 | |
|             state: "California",
 | |
|             zip: "94122",
 | |
|             country: "PL",
 | |
|             first_name: "john",
 | |
|             last_name: "doe",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "processing",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|   },
 | |
|   upi_pm: {
 | |
|     PaymentIntent: {
 | |
|       Request: {
 | |
|         currency: "INR",
 | |
|       },
 | |
|       Response: {
 | |
|         status: 200,
 | |
|         body: {
 | |
|           status: "requires_payment_method",
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     UpiCollect: {
 | |
|       Request: {
 | |
|         payment_method: "upi",
 | |
|         payment_method_type: "upi_collect",
 | |
|         payment_method_data: {
 | |
|           upi: {
 | |
|             upi_collect: {
 | |
|               vpa_id: "successtest@iata",
 | |
|             },
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 400,
 | |
|         body: {
 | |
|           error: {
 | |
|             type: "invalid_request",
 | |
|             message: "Payment method type not supported",
 | |
|             code: "HE_03",
 | |
|             reason: "automatic for upi_collect is not supported by adyen",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|     UpiIntent: {
 | |
|       Request: {
 | |
|         payment_method: "upi",
 | |
|         payment_method_type: "upi_intent",
 | |
|         payment_method_data: {
 | |
|           upi: {
 | |
|             upi_intent: {},
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|       Response: {
 | |
|         status: 400,
 | |
|         body: {
 | |
|           error: {
 | |
|             type: "invalid_request",
 | |
|             message: "Payment method type not supported",
 | |
|             code: "HE_03",
 | |
|             reason: "automatic for upi_intent is not supported by adyen",
 | |
|           },
 | |
|         },
 | |
|       },
 | |
|     },
 | |
|   },
 | |
| };
 |