mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(payment_charges): add support for collecting and refunding charges on payments (#4628)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Narayan Bhat <48803246+Narayanbhat166@users.noreply.github.com> Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: YongJoon Kim <penubokim@gmail.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com> Co-authored-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Co-authored-by: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com> Co-authored-by: Chethan Rao <70657455+Chethan-rao@users.noreply.github.com> Co-authored-by: Sampras Lopes <Sampras.lopes@juspay.in>
This commit is contained in:
@ -157,6 +157,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
mandate_data: payment_attempt.mandate_data,
|
||||
payment_method_billing_address_id: payment_attempt.payment_method_billing_address_id,
|
||||
fingerprint_id: payment_attempt.fingerprint_id,
|
||||
charge_id: payment_attempt.charge_id,
|
||||
client_source: payment_attempt.client_source,
|
||||
client_version: payment_attempt.client_version,
|
||||
};
|
||||
|
||||
@ -108,6 +108,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
fingerprint_id: new.fingerprint_id,
|
||||
session_expiry: new.session_expiry,
|
||||
request_external_three_ds_authentication: new.request_external_three_ds_authentication,
|
||||
charges: new.charges,
|
||||
frm_metadata: new.frm_metadata,
|
||||
};
|
||||
payment_intents.push(payment_intent.clone());
|
||||
|
||||
@ -413,6 +413,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
.payment_method_billing_address_id
|
||||
.clone(),
|
||||
fingerprint_id: payment_attempt.fingerprint_id.clone(),
|
||||
charge_id: payment_attempt.charge_id.clone(),
|
||||
client_source: payment_attempt.client_source.clone(),
|
||||
client_version: payment_attempt.client_version.clone(),
|
||||
};
|
||||
@ -1197,6 +1198,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
|
||||
payment_method_billing_address_id: self.payment_method_billing_address_id,
|
||||
fingerprint_id: self.fingerprint_id,
|
||||
charge_id: self.charge_id,
|
||||
client_source: self.client_source,
|
||||
client_version: self.client_version,
|
||||
}
|
||||
@ -1263,6 +1265,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
.map(MandateDetails::from_storage_model),
|
||||
payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
|
||||
fingerprint_id: storage_model.fingerprint_id,
|
||||
charge_id: storage_model.charge_id,
|
||||
client_source: storage_model.client_source,
|
||||
client_version: storage_model.client_version,
|
||||
}
|
||||
@ -1333,6 +1336,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
|
||||
payment_method_billing_address_id: self.payment_method_billing_address_id,
|
||||
fingerprint_id: self.fingerprint_id,
|
||||
charge_id: self.charge_id,
|
||||
client_source: self.client_source,
|
||||
client_version: self.client_version,
|
||||
}
|
||||
@ -1397,6 +1401,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
.map(MandateDetails::from_storage_model),
|
||||
payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
|
||||
fingerprint_id: storage_model.fingerprint_id,
|
||||
charge_id: storage_model.charge_id,
|
||||
client_source: storage_model.client_source,
|
||||
client_version: storage_model.client_version,
|
||||
}
|
||||
@ -1585,6 +1590,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
unified_code,
|
||||
unified_message,
|
||||
payment_method_data,
|
||||
charge_id,
|
||||
} => DieselPaymentAttemptUpdate::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1606,6 +1612,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
unified_code,
|
||||
unified_message,
|
||||
payment_method_data,
|
||||
charge_id,
|
||||
},
|
||||
Self::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@ -1709,12 +1716,14 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
encoded_data,
|
||||
connector_transaction_id,
|
||||
connector,
|
||||
charge_id,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::ConnectorResponse {
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
connector_transaction_id,
|
||||
connector,
|
||||
charge_id,
|
||||
updated_by,
|
||||
},
|
||||
Self::IncrementalAuthorizationAmountUpdate {
|
||||
@ -1913,6 +1922,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
unified_code,
|
||||
unified_message,
|
||||
payment_method_data,
|
||||
charge_id,
|
||||
} => Self::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1933,6 +1943,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
unified_code,
|
||||
unified_message,
|
||||
payment_method_data,
|
||||
charge_id,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@ -2034,12 +2045,14 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
encoded_data,
|
||||
connector_transaction_id,
|
||||
connector,
|
||||
charge_id,
|
||||
updated_by,
|
||||
} => Self::ConnectorResponse {
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
connector_transaction_id,
|
||||
connector,
|
||||
charge_id,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {
|
||||
|
||||
@ -118,6 +118,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
|
||||
session_expiry: new.session_expiry,
|
||||
request_external_three_ds_authentication: new
|
||||
.request_external_three_ds_authentication,
|
||||
charges: new.charges.clone(),
|
||||
};
|
||||
let redis_entry = kv::TypedSql {
|
||||
op: kv::DBOperation::Insert {
|
||||
@ -849,6 +850,7 @@ impl DataModelExt for PaymentIntentNew {
|
||||
fingerprint_id: self.fingerprint_id,
|
||||
session_expiry: self.session_expiry,
|
||||
request_external_three_ds_authentication: self.request_external_three_ds_authentication,
|
||||
charges: self.charges,
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,6 +899,7 @@ impl DataModelExt for PaymentIntentNew {
|
||||
session_expiry: storage_model.session_expiry,
|
||||
request_external_three_ds_authentication: storage_model
|
||||
.request_external_three_ds_authentication,
|
||||
charges: storage_model.charges,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -948,6 +951,7 @@ impl DataModelExt for PaymentIntent {
|
||||
fingerprint_id: self.fingerprint_id,
|
||||
session_expiry: self.session_expiry,
|
||||
request_external_three_ds_authentication: self.request_external_three_ds_authentication,
|
||||
charges: self.charges,
|
||||
frm_metadata: self.frm_metadata,
|
||||
}
|
||||
}
|
||||
@ -997,6 +1001,7 @@ impl DataModelExt for PaymentIntent {
|
||||
session_expiry: storage_model.session_expiry,
|
||||
request_external_three_ds_authentication: storage_model
|
||||
.request_external_three_ds_authentication,
|
||||
charges: storage_model.charges,
|
||||
frm_metadata: storage_model.frm_metadata,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user