feat(router): add payments incremental authorization api (#3038)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2023-12-04 18:34:51 +05:30
committed by GitHub
parent 9274cefbdd
commit a0cfdd3fb1
60 changed files with 1792 additions and 22 deletions

View File

@ -2209,6 +2209,12 @@ pub struct PaymentsResponse {
/// If true incremental authorization can be performed on this payment
pub incremental_authorization_allowed: Option<bool>,
/// Total number of authorizations happened in an incremental_authorization payment
pub authorization_count: Option<i32>,
/// List of incremental authorizations happened to the payment
pub incremental_authorizations: Option<Vec<IncrementalAuthorizationResponse>>,
}
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
@ -2277,6 +2283,24 @@ pub struct PaymentListResponse {
// The list of payments response objects
pub data: Vec<PaymentsResponse>,
}
#[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)]
pub struct IncrementalAuthorizationResponse {
/// The unique identifier of authorization
pub authorization_id: String,
/// Amount the authorization has been made for
pub amount: i64,
#[schema(value_type= AuthorizationStatus)]
/// The status of the authorization
pub status: common_enums::AuthorizationStatus,
/// Error code sent by the connector for authorization
pub error_code: Option<String>,
/// Error message sent by the connector for authorization
pub error_message: Option<String>,
/// Previously authorized amount for the payment
pub previously_authorized_amount: i64,
}
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListResponseV2 {
/// The number of payments included in the list for given constraints
@ -2985,6 +3009,18 @@ pub struct PaymentsCancelRequest {
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
}
#[derive(Default, Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct PaymentsIncrementalAuthorizationRequest {
/// The identifier for the payment
#[serde(skip)]
pub payment_id: String,
/// The total amount including previously authorized amount and additional amount
#[schema(value_type = i64, example = 6540)]
pub amount: i64,
/// Reason for incremental authorization
pub reason: Option<String>,
}
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsApproveRequest {
/// The identifier for the payment