feat(core): add psync for multiple partial captures (#1934)

This commit is contained in:
Hrithikesh
2023-08-23 10:13:54 +05:30
committed by GitHub
parent 1b346fcf56
commit 5657ad6933
30 changed files with 1219 additions and 1020 deletions

View File

@ -308,7 +308,7 @@ pub struct PaymentAttemptResponse {
/// The payment attempt amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
pub amount: i64,
/// The currency of the amount of the payment attempt
#[schema(value_type = Option<Currency>, example = "usd")]
#[schema(value_type = Option<Currency>, example = "USD")]
pub currency: Option<enums::Currency>,
/// The connector used for the payment
pub connector: Option<String>,
@ -346,6 +346,38 @@ pub struct PaymentAttemptResponse {
pub reference_id: Option<String>,
}
#[derive(
Default, Debug, serde::Serialize, Clone, PartialEq, ToSchema, router_derive::PolymorphicSchema,
)]
pub struct CaptureResponse {
/// unique identifier for the capture
pub capture_id: String,
/// The status of the capture
#[schema(value_type = CaptureStatus, example = "charged")]
pub status: enums::CaptureStatus,
/// The capture amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
pub amount: i64,
/// The currency of the amount of the capture
#[schema(value_type = Option<Currency>, example = "USD")]
pub currency: Option<enums::Currency>,
/// The connector used for the payment
pub connector: String,
/// unique identifier for the parent attempt on which this capture is made
pub authorized_attempt_id: String,
/// A unique identifier for a capture provided by the connector
pub connector_capture_id: Option<String>,
/// sequence number of this capture
pub capture_sequence: i16,
/// If there was an error while calling the connector the error message is received here
pub error_message: Option<String>,
/// If there was an error while calling the connectors the code is received here
pub error_code: Option<String>,
/// If there was an error while calling the connectors the reason is received here
pub error_reason: Option<String>,
/// reference to the capture at connector side
pub reference_id: Option<String>,
}
impl PaymentsRequest {
pub fn get_feature_metadata_as_value(
&self,
@ -1711,6 +1743,11 @@ pub struct PaymentsResponse {
#[serde(skip_serializing_if = "Option::is_none")]
pub attempts: Option<Vec<PaymentAttemptResponse>>,
/// List of captures done on latest attempt
#[schema(value_type = Option<Vec<CaptureResponse>>)]
#[serde(skip_serializing_if = "Option::is_none")]
pub captures: Option<Vec<CaptureResponse>>,
/// A unique identifier to link the payment to a mandate, can be use instead of payment_method_data
#[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3")]
pub mandate_id: Option<String>,