Skip to content

Commit c42dffc

Browse files
chore : Resolve PR Comments
1 parent f0b3b95 commit c42dffc

File tree

6 files changed

+112
-58
lines changed

6 files changed

+112
-58
lines changed

crates/connector_configs/toml/development.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,14 @@ api_key="Key"
13531353
key1="Merchant ID"
13541354
api_secret="Shared Secret"
13551355

1356+
[deutschebank]
1357+
[[deutschebank.bank_debit]]
1358+
payment_method_type = "sepa"
1359+
[deutschebank.connector_auth.SignatureKey]
1360+
api_key="Client ID"
1361+
key1="Merchant ID"
1362+
api_secret="Client Key"
1363+
13561364
[dlocal]
13571365
[[dlocal.credit]]
13581366
payment_method_type = "Mastercard"

crates/connector_configs/toml/production.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,14 @@ placeholder="Enter Acquirer Country Code"
11251125
required=false
11261126
type="Text"
11271127

1128+
[deutschebank]
1129+
[[deutschebank.bank_debit]]
1130+
payment_method_type = "sepa"
1131+
[deutschebank.connector_auth.SignatureKey]
1132+
api_key="Client ID"
1133+
key1="Merchant ID"
1134+
api_secret="Client Key"
1135+
11281136
[dlocal]
11291137
[[dlocal.credit]]
11301138
payment_method_type = "Mastercard"

crates/connector_configs/toml/sandbox.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,14 @@ api_key="Key"
13521352
key1="Merchant ID"
13531353
api_secret="Shared Secret"
13541354

1355+
[deutschebank]
1356+
[[deutschebank.bank_debit]]
1357+
payment_method_type = "sepa"
1358+
[deutschebank.connector_auth.SignatureKey]
1359+
api_key="Client ID"
1360+
key1="Merchant ID"
1361+
api_secret="Client Key"
1362+
13551363
[dlocal]
13561364
[[dlocal.credit]]
13571365
payment_method_type = "Mastercard"

crates/hyperswitch_connectors/src/connectors/deutschebank.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for De
701701
) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
702702
let response: deutschebank::DeutschebankPaymentsResponse = res
703703
.response
704-
.parse_struct("Deutschebank PaymentsCaptureResponse")
704+
.parse_struct("Deutschebank PaymentsCancelResponse")
705705
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
706706
event_builder.map(|i| i.set_response_body(&response));
707707
router_env::logger::info!(connector_response=?response);

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

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -211,37 +211,40 @@ impl
211211
Some(date) => date.chars().take(10).collect(),
212212
None => time::OffsetDateTime::now_utc().date().to_string(),
213213
};
214-
Ok(Self {
215-
status: if item.response.rc == "0" {
216-
match item.response.state {
217-
Some(state) => common_enums::AttemptStatus::from(state),
218-
None => common_enums::AttemptStatus::Failure,
219-
}
220-
} else {
221-
common_enums::AttemptStatus::Failure
222-
},
223-
response: Ok(PaymentsResponseData::TransactionResponse {
224-
resource_id: ResponseId::NoResponseId,
225-
redirection_data: Some(RedirectForm::Form {
226-
endpoint: item.data.request.get_complete_authorize_url()?,
227-
method: common_utils::request::Method::Get,
228-
form_fields: HashMap::from([
229-
(
230-
"reference".to_string(),
231-
item.response.reference.unwrap_or("".to_string()),
232-
),
233-
("signed_on".to_string(), signed_on),
234-
]),
214+
match item.response.reference {
215+
Some(reference) => Ok(Self {
216+
status: if item.response.rc == "0" {
217+
match item.response.state {
218+
Some(state) => common_enums::AttemptStatus::from(state),
219+
None => common_enums::AttemptStatus::Failure,
220+
}
221+
} else {
222+
common_enums::AttemptStatus::Failure
223+
},
224+
response: Ok(PaymentsResponseData::TransactionResponse {
225+
resource_id: ResponseId::NoResponseId,
226+
redirection_data: Some(RedirectForm::Form {
227+
endpoint: item.data.request.get_complete_authorize_url()?,
228+
method: common_utils::request::Method::Get,
229+
form_fields: HashMap::from([
230+
("reference".to_string(), reference),
231+
("signed_on".to_string(), signed_on),
232+
]),
233+
}),
234+
mandate_reference: None,
235+
connector_metadata: None,
236+
network_txn_id: None,
237+
connector_response_reference_id: None,
238+
incremental_authorization_allowed: None,
239+
charge_id: None,
235240
}),
236-
mandate_reference: None,
237-
connector_metadata: None,
238-
network_txn_id: None,
239-
connector_response_reference_id: None,
240-
incremental_authorization_allowed: None,
241-
charge_id: None,
241+
..item.data
242242
}),
243-
..item.data
244-
})
243+
None => Ok(Self {
244+
status: common_enums::AttemptStatus::Failure,
245+
..item.data
246+
}),
247+
}
245248
}
246249
}
247250

@@ -399,7 +402,7 @@ pub struct DeutschebankPaymentsResponse {
399402
event_id: Option<String>,
400403
kind: Option<String>,
401404
tx_action: Option<DeutschebankTXAction>,
402-
tx_id: Option<String>,
405+
tx_id: String,
403406
amount_total: Option<DeutschebankAmount>,
404407
transaction_info: Option<DeutschebankTransactionInfo>,
405408
}
@@ -423,11 +426,6 @@ impl
423426
PaymentsResponseData,
424427
>,
425428
) -> Result<Self, Self::Error> {
426-
let resource_id = ResponseId::ConnectorTransactionId(
427-
item.response
428-
.tx_id
429-
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
430-
);
431429
Ok(Self {
432430
status: if item.response.rc == "0" {
433431
match item.data.request.is_auto_capture()? {
@@ -438,7 +436,7 @@ impl
438436
common_enums::AttemptStatus::Failure
439437
},
440438
response: Ok(PaymentsResponseData::TransactionResponse {
441-
resource_id,
439+
resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
442440
redirection_data: None,
443441
mandate_reference: None,
444442
connector_metadata: None,
@@ -452,10 +450,16 @@ impl
452450
}
453451
}
454452

453+
#[derive(Debug, Serialize, PartialEq)]
454+
#[serde(rename_all = "UPPERCASE")]
455+
pub enum DeutschebankTransactionKind {
456+
Directdebit,
457+
}
458+
455459
#[derive(Debug, Serialize, PartialEq)]
456460
pub struct DeutschebankCaptureRequest {
457461
changed_amount: MinorUnit,
458-
kind: String,
462+
kind: DeutschebankTransactionKind,
459463
}
460464

461465
impl TryFrom<&DeutschebankRouterData<&PaymentsCaptureRouterData>> for DeutschebankCaptureRequest {
@@ -465,7 +469,7 @@ impl TryFrom<&DeutschebankRouterData<&PaymentsCaptureRouterData>> for Deutscheba
465469
) -> Result<Self, Self::Error> {
466470
Ok(Self {
467471
changed_amount: item.amount,
468-
kind: "DIRECTDEBIT".to_string(),
472+
kind: DeutschebankTransactionKind::Directdebit,
469473
})
470474
}
471475
}
@@ -489,14 +493,9 @@ impl
489493
PaymentsResponseData,
490494
>,
491495
) -> Result<Self, Self::Error> {
492-
let resource_id = ResponseId::ConnectorTransactionId(
493-
item.response
494-
.tx_id
495-
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
496-
);
497496
Ok(Self {
498497
response: Ok(PaymentsResponseData::TransactionResponse {
499-
resource_id,
498+
resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
500499
redirection_data: None,
501500
mandate_reference: None,
502501
connector_metadata: None,
@@ -565,16 +564,16 @@ impl
565564
}
566565
}
567566

568-
#[derive(Default, Debug, Serialize)]
567+
#[derive(Debug, Serialize)]
569568
pub struct DeutschebankReversalRequest {
570-
kind: String,
569+
kind: DeutschebankTransactionKind,
571570
}
572571

573572
impl TryFrom<&PaymentsCancelRouterData> for DeutschebankReversalRequest {
574573
type Error = error_stack::Report<errors::ConnectorError>;
575574
fn try_from(_item: &PaymentsCancelRouterData) -> Result<Self, Self::Error> {
576575
Ok(Self {
577-
kind: "DIRECTDEBIT".to_string(),
576+
kind: DeutschebankTransactionKind::Directdebit,
578577
})
579578
}
580579
}
@@ -597,18 +596,18 @@ impl TryFrom<PaymentsCancelResponseRouterData<DeutschebankPaymentsResponse>>
597596
}
598597
}
599598

600-
#[derive(Default, Debug, Serialize)]
599+
#[derive(Debug, Serialize)]
601600
pub struct DeutschebankRefundRequest {
602601
changed_amount: MinorUnit,
603-
kind: String,
602+
kind: DeutschebankTransactionKind,
604603
}
605604

606605
impl<F> TryFrom<&DeutschebankRouterData<&RefundsRouterData<F>>> for DeutschebankRefundRequest {
607606
type Error = error_stack::Report<errors::ConnectorError>;
608607
fn try_from(item: &DeutschebankRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
609608
Ok(Self {
610609
changed_amount: item.amount.to_owned(),
611-
kind: "DIRECTDEBIT".to_string(),
610+
kind: DeutschebankTransactionKind::Directdebit,
612611
})
613612
}
614613
}
@@ -620,13 +619,9 @@ impl TryFrom<RefundsResponseRouterData<Execute, DeutschebankPaymentsResponse>>
620619
fn try_from(
621620
item: RefundsResponseRouterData<Execute, DeutschebankPaymentsResponse>,
622621
) -> Result<Self, Self::Error> {
623-
let connector_refund_id = item
624-
.response
625-
.tx_id
626-
.ok_or(errors::ConnectorError::MissingConnectorRefundID)?;
627622
Ok(Self {
628623
response: Ok(RefundsResponseData {
629-
connector_refund_id,
624+
connector_refund_id: item.response.tx_id,
630625
refund_status: if item.response.rc == "0" {
631626
enums::RefundStatus::Success
632627
} else {

crates/router/src/configs/defaults.rs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11209,8 +11209,43 @@ impl Default for super::settings::RequiredFields {
1120911209
}
1121011210
)
1121111211
]),
11212-
})
11213-
]),
11212+
}
11213+
),
11214+
(
11215+
enums::Connector::Deutschebank,
11216+
RequiredFieldFinal {
11217+
mandate: HashMap::new(),
11218+
non_mandate: HashMap::new(),
11219+
common: HashMap::from([ (
11220+
"billing.address.first_name".to_string(),
11221+
RequiredFieldInfo {
11222+
required_field: "payment_method_data.billing.address.first_name".to_string(),
11223+
display_name: "owner_name".to_string(),
11224+
field_type: enums::FieldType::UserBillingName,
11225+
value: None,
11226+
}),
11227+
(
11228+
"billing.address.last_name".to_string(),
11229+
RequiredFieldInfo {
11230+
required_field: "payment_method_data.billing.address.last_name".to_string(),
11231+
display_name: "owner_name".to_string(),
11232+
field_type: enums::FieldType::UserBillingName,
11233+
value: None,
11234+
}
11235+
),
11236+
(
11237+
"payment_method_data.bank_debit.sepa.iban".to_string(),
11238+
RequiredFieldInfo {
11239+
required_field: "payment_method_data.bank_debit.bacs.iban".to_string(),
11240+
display_name: "bank_account_number".to_string(),
11241+
field_type: enums::FieldType::Text,
11242+
value: None,
11243+
}
11244+
)
11245+
]),
11246+
}
11247+
)
11248+
]),
1121411249
},
1121511250
),
1121611251
(

0 commit comments

Comments
 (0)