Skip to content

Commit 17d3b31

Browse files
Sayak BhattacharyaSayak Bhattacharya
authored andcommitted
made some requested changes
1 parent fa28b59 commit 17d3b31

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

config/deployments/integration_test.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ debit.currency = "USD"
287287
ali_pay.currency = "GBP,CNY"
288288
we_chat_pay.currency = "GBP,CNY"
289289

290+
[pm.filters.jpmorgan]
291+
debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
292+
credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
293+
290294
[pm_filters.klarna]
291295
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
292296

config/deployments/production.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ ali_pay.currency = "GBP,CNY"
322322
we_chat_pay.currency = "GBP,CNY"
323323

324324
[pm.filters.jpmorgan]
325-
debit = { country = "CA, EU, UK, US", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, ISK, JMD, JPY, KES, KHR, KMF, KRW, KYD, KZT, LAK, LBP, LKR, LRD, LSL, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SLL, SOS, SRD, STN, SZL, THB, TJS, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW" }
326-
credit = { country = "CA, EU, UK, US", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, ISK, JMD, JPY, KES, KHR, KMF, KRW, KYD, KZT, LAK, LBP, LKR, LRD, LSL, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SLL, SOS, SRD, STN, SZL, THB, TJS, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW" }
325+
debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
326+
credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
327327

328328
[pm_filters.klarna]
329329
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }

config/deployments/sandbox.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ debit.currency = "USD"
322322
ali_pay.currency = "GBP,CNY"
323323
we_chat_pay.currency = "GBP,CNY"
324324

325+
[pm.filters.jpmorgan]
326+
debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
327+
credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
328+
325329
[pm_filters.klarna]
326330
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
327331

config/development.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,N
490490
credit = { currency = "USD" }
491491
debit = { currency = "USD" }
492492

493+
[pm.filters.jpmorgan]
494+
debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
495+
credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
496+
493497
[pm_filters.klarna]
494498
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,EUR,EUR,CAD,CZK,DKK,EUR,EUR,EUR,EUR,EUR,EUR,EUR,NZD,NOK,PLN,EUR,EUR,SEK,CHF,GBP,USD" }
495499

crates/hyperswitch_connectors/src/connectors/jpmorgan.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use hyperswitch_interfaces::{
3434
types::{self, RefreshTokenType, Response},
3535
webhooks,
3636
};
37-
use masking::{Mask, PeekInterface};
37+
use masking::{Mask, Maskable, PeekInterface};
3838
use transformers::{self as jpmorgan, JpmorganErrorResponse};
3939

4040
use crate::{
@@ -75,8 +75,6 @@ impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, Pay
7575
// Not Implemented (R)
7676
}
7777

78-
use masking::Maskable;
79-
8078
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Jpmorgan
8179
where
8280
Self: ConnectorIntegration<Flow, Request, Response>,

crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, JpmorganAuthUpdateResponse, T, AccessTo
8383
pub struct JpmorganPaymentsRequest {
8484
capture_method: CapMethod,
8585
amount: MinorUnit,
86-
currency: String,
86+
currency: common_enums::Currency,
8787
merchant: JpmorganMerchant,
8888
payment_method_type: JpmorganPaymentMethodType,
8989
}
@@ -148,7 +148,7 @@ impl TryFrom<&JpmorganRouterData<&PaymentsAuthorizeRouterData>> for JpmorganPaym
148148
let capture_method =
149149
map_capture_method(item.router_data.request.capture_method.unwrap_or_default());
150150

151-
let currency = item.router_data.request.currency.to_string();
151+
let currency = item.router_data.request.currency;
152152

153153
let merchant_software = JpmorganMerchantSoftware {
154154
company_name: String::from("JPMC"),
@@ -206,19 +206,17 @@ impl TryFrom<&JpmorganRouterData<&PaymentsAuthorizeRouterData>> for JpmorganPaym
206206
}
207207
#[derive(Debug)]
208208
pub struct JpmorganAuthType {
209-
#[allow(dead_code)]
210-
pub(super) api_key: Secret<String>,
211-
#[allow(dead_code)]
212-
pub(super) key1: Secret<String>,
209+
pub(super) _api_key: Secret<String>,
210+
pub(super) _key1: Secret<String>,
213211
}
214212

215213
impl TryFrom<&ConnectorAuthType> for JpmorganAuthType {
216214
type Error = error_stack::Report<errors::ConnectorError>;
217215
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
218216
match auth_type {
219217
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
220-
api_key: api_key.to_owned(),
221-
key1: key1.to_owned(),
218+
_api_key: api_key.to_owned(),
219+
_key1: key1.to_owned(),
222220
}),
223221
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
224222
}
@@ -263,7 +261,7 @@ pub struct JpmorganPaymentsResponse {
263261
approval_code: Option<String>,
264262
host_message: Option<String>,
265263
amount: Option<i64>,
266-
currency: Option<String>,
264+
currency: Option<common_enums::Currency>,
267265
remaining_refundable_amount: Option<i64>,
268266
remaining_auth_amount: Option<i64>,
269267
host_reference_id: Option<String>,
@@ -422,7 +420,7 @@ pub struct JpmorganCaptureRequest {
422420
original_transaction_id: Option<String>,
423421
is_amount_final: Option<bool>,
424422
amount: MinorUnit,
425-
currency: Option<String>,
423+
currency: Option<common_enums::Currency>,
426424
merchant_order_number: Option<String>,
427425
risk: Option<RiskCapReq>,
428426
retail_addenda: Option<RetailAddendaCapReq>,
@@ -483,7 +481,7 @@ pub struct BusinessInformation {
483481
#[serde(rename_all = "camelCase")]
484482
pub struct PartnerService {
485483
pub external_vendor_product_name: Option<String>,
486-
pub currency: Option<String>,
484+
pub currency: Option<common_enums::Currency>,
487485
pub external_monthly_service_fee_amount: Option<i64>,
488486
}
489487

@@ -510,7 +508,7 @@ pub struct MerchantReportedRevenue {
510508
pub amount: Option<i64>,
511509
pub start_date: Option<String>,
512510
pub end_date: Option<String>,
513-
pub currency: Option<String>,
511+
pub currency: Option<common_enums::Currency>,
514512
pub amount_type: Option<String>,
515513
}
516514

@@ -846,7 +844,7 @@ impl TryFrom<&JpmorganRouterData<&PaymentsCaptureRouterData>> for JpmorganCaptur
846844
.as_ref()
847845
.map(|cm| cm.to_string());
848846

849-
let currency = Some(item.router_data.request.currency.to_string());
847+
let currency = Some(item.router_data.request.currency);
850848
let amount = item.amount;
851849
Ok(Self {
852850
capture_method,
@@ -874,7 +872,6 @@ impl TryFrom<&JpmorganRouterData<&PaymentsCaptureRouterData>> for JpmorganCaptur
874872
}
875873
}
876874

877-
//made changes here in JpmorganTransactionState
878875
#[derive(Debug, Serialize, Deserialize)]
879876
#[serde(rename_all = "camelCase")]
880877
pub struct JpmorganCaptureResponse {
@@ -1053,7 +1050,7 @@ pub struct JpmorganRefundResponse {
10531050
pub request_id: String,
10541051
pub transaction_state: JpmorganTransactionState,
10551052
pub amount: MinorUnit,
1056-
pub currency: String,
1053+
pub currency: common_enums::Currency,
10571054
pub response_status: JpmorganResponseStatus,
10581055
pub response_code: String,
10591056
pub response_message: String,
@@ -1134,7 +1131,7 @@ pub struct JpmorganRefundSyncResponse {
11341131
request_id: String,
11351132
transaction_state: JpmorganTransactionState,
11361133
amount: MinorUnit,
1137-
currency: String,
1134+
currency: common_enums::Currency,
11381135
response_status: JpmorganResponseStatus,
11391136
response_code: String,
11401137
}

0 commit comments

Comments
 (0)