Skip to content

Commit

Permalink
made some cypress changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayak Bhattacharya authored and Sayak Bhattacharya committed Nov 29, 2024
1 parent 7256ee7 commit 99e5223
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 44 deletions.
1 change: 0 additions & 1 deletion config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ max_feed_count = 200
[server]
# HTTP Request body limit. Defaults to 32kB
request_body_limit = 32768
port=8082

[secrets]
admin_api_key = "test_admin"
Expand Down
22 changes: 8 additions & 14 deletions crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ where
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
println!("Entered build headers of ConnectorCommonExt impl");
let mut headers = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
Expand All @@ -109,9 +108,6 @@ where
headers::MERCHANTID.to_string(),
req.merchant_id.get_string_repr().to_string().into_masked()
);
println!("Auth Header {:?}", auth_header);
println!("Request Id {:?}", request_id);
println!("Merchant Id {:?}", merchant_id);
headers.push(auth_header);
headers.push(request_id);
headers.push(merchant_id);
Expand Down Expand Up @@ -143,8 +139,7 @@ impl ConnectorCommon for Jpmorgan {
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
println!("Entering get_auth_header");
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
let auth = jpmorgan::JpmorganAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
Expand Down Expand Up @@ -251,7 +246,7 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
&self,
req: &RefreshTokenRouterData,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
let client_id = req.request.app_id.clone();

let client_secret = req.request.id.clone();
Expand Down Expand Up @@ -343,8 +338,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
println!("in get_headers of authorize {:?}", self.build_headers(req, connectors));
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down Expand Up @@ -435,7 +429,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down Expand Up @@ -526,7 +520,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Jpm
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down Expand Up @@ -597,7 +591,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Jp
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down Expand Up @@ -683,7 +677,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Jpmorga
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down Expand Up @@ -768,7 +762,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Jpmorgan
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use strum::Display;

use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::PaymentsAuthorizeRequestData,
utils::{PaymentsAuthorizeRequestData, RouterData as OtherRouterData},
};
pub struct JpmorganRouterData<T> {
pub amount: MinorUnit,
Expand Down Expand Up @@ -137,6 +137,13 @@ impl TryFrom<&JpmorganRouterData<&PaymentsAuthorizeRouterData>> for JpmorganPaym
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::Card(req_card) => {
if item.router_data.is_three_ds(){
return Err(errors::ConnectorError::NotSupported{
message : "Three_ds payments".to_string(),
connector : "Jpmorgan"
}
.into());
}
let capture_method = if let Some(method) = item.router_data.request.capture_method {
map_capture_method(method)
} else {
Expand Down
40 changes: 12 additions & 28 deletions cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
Response: {
status: 200,
trigger_skip: true,
status: 501,
body: {
// status: "requires_customer_action",
status: "succeeded"
// setup_future_usage: "on_session",
// payment_method_data: payment_method_data_3ds,
error: {
type: "invalid_request",
message: "Three_ds payments is not supported by Jpmorgan",
code: "IR_00",
},
},
},
},
Expand All @@ -54,13 +54,13 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
Response: {
status: 200,
trigger_skip: true,
status: 501,
body: {
//status: "requires_customer_action",
status: "succeeded"
// setup_future_usage: "on_session",
// payment_method_data: payment_method_data_3ds,
error: {
type: "invalid_request",
message: "Three_ds payments is not supported by Jpmorgan",
code: "IR_00",
},
},
},
},
Expand Down Expand Up @@ -156,7 +156,6 @@ export const connectorDetails = {
},
Response: {
status: 200,
//trigger_skip: true,
body: {
status: "succeeded",
},
Expand All @@ -172,35 +171,21 @@ export const connectorDetails = {
},
Response: {
status: 200,
//trigger_skip: true,
body: {
status: "succeeded",
},
},
// Response: {
// status: 400,
// //trigger_skip: true,
// body: {
// error: {
// type : "invalid_request",
// message : "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
// code : "IR_14",
// }
// },
// },
},
manualPaymentPartialRefund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
//currency: "USD",
customer_acceptance: null,
},
Response: {
status: 200,
//trigger_skip: true,
body: {
status: "succeeded",
},
Expand All @@ -216,7 +201,6 @@ export const connectorDetails = {
},
Response: {
status: 200,
//trigger_skip: true,
body: {
status: "succeeded",
},
Expand Down

0 comments on commit 99e5223

Please sign in to comment.