Skip to content

Commit a0c2a6b

Browse files
bsayak03Sayak Bhattacharya
andauthored
fix(connector): [FORTE] Deserialization Error in PSync Response (#8775)
Co-authored-by: Sayak Bhattacharya <[email protected]>
1 parent 8bb8b20 commit a0c2a6b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn get_status(response_code: ForteResponseCode, action: ForteAction) -> enums::A
212212
ForteResponseCode::A01 => match action {
213213
ForteAction::Authorize => enums::AttemptStatus::Authorized,
214214
ForteAction::Sale => enums::AttemptStatus::Pending,
215-
ForteAction::Verify => enums::AttemptStatus::Charged,
215+
ForteAction::Verify | ForteAction::Capture => enums::AttemptStatus::Charged,
216216
},
217217
ForteResponseCode::A05 | ForteResponseCode::A06 => enums::AttemptStatus::Authorizing,
218218
_ => enums::AttemptStatus::Failure,
@@ -221,10 +221,10 @@ fn get_status(response_code: ForteResponseCode, action: ForteAction) -> enums::A
221221

222222
#[derive(Debug, Deserialize, Serialize)]
223223
pub struct CardResponse {
224-
pub name_on_card: Secret<String>,
224+
pub name_on_card: Option<Secret<String>>,
225225
pub last_4_account_number: String,
226226
pub masked_account_number: String,
227-
pub card_type: String,
227+
pub card_type: Option<String>,
228228
}
229229

230230
#[derive(Debug, Deserialize, Serialize)]
@@ -266,6 +266,7 @@ pub enum ForteAction {
266266
Sale,
267267
Authorize,
268268
Verify,
269+
Capture,
269270
}
270271

271272
#[derive(Debug, Deserialize, Serialize)]
@@ -316,19 +317,33 @@ impl<F, T> TryFrom<ResponseRouterData<F, FortePaymentsResponse, T, PaymentsRespo
316317
}
317318

318319
//PsyncResponse
319-
320320
#[derive(Debug, Deserialize, Serialize)]
321321
pub struct FortePaymentsSyncResponse {
322322
pub transaction_id: String,
323+
pub organization_id: Secret<String>,
323324
pub location_id: Secret<String>,
325+
pub original_transaction_id: Option<String>,
324326
pub status: FortePaymentStatus,
325327
pub action: ForteAction,
326-
pub authorization_amount: Option<FloatMajorUnit>,
327328
pub authorization_code: String,
328-
pub entered_by: String,
329+
pub authorization_amount: Option<FloatMajorUnit>,
329330
pub billing_address: Option<BillingAddress>,
331+
pub entered_by: String,
332+
pub received_date: String,
333+
pub origination_date: Option<String>,
330334
pub card: Option<CardResponse>,
335+
pub attempt_number: i64,
331336
pub response: ResponseStatus,
337+
pub links: ForteLink,
338+
pub biller_name: Option<String>,
339+
}
340+
341+
#[derive(Debug, Deserialize, Serialize)]
342+
pub struct ForteLink {
343+
pub disputes: String,
344+
pub settlements: String,
345+
#[serde(rename = "self")]
346+
pub self_url: String,
332347
}
333348

334349
impl<F, T> TryFrom<ResponseRouterData<F, FortePaymentsSyncResponse, T, PaymentsResponseData>>

0 commit comments

Comments
 (0)