refactor(payments_response): remove setter from payments response (#5676)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-08-26 12:19:54 +05:30
committed by GitHub
parent e98ff95b10
commit 800da6a16a
12 changed files with 507 additions and 255 deletions

View File

@ -99,9 +99,9 @@ impl ApiEventMetric for PaymentsRequest {
impl ApiEventMetric for PaymentsResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
self.payment_id
.clone()
.map(|payment_id| ApiEventsType::Payment { payment_id })
Some(ApiEventsType::Payment {
payment_id: self.payment_id.clone(),
})
}
}

View File

@ -3554,16 +3554,7 @@ pub struct ReceiverDetails {
amount_remaining: Option<i64>,
}
#[derive(
Setter,
Clone,
Default,
Debug,
PartialEq,
serde::Serialize,
ToSchema,
router_derive::PolymorphicSchema,
)]
#[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema, router_derive::PolymorphicSchema)]
#[generate_schemas(PaymentsCreateResponseOpenApi)]
pub struct PaymentsResponse {
@ -3574,12 +3565,12 @@ pub struct PaymentsResponse {
max_length = 30,
example = "pay_mbabizu24mvu3mela5njyhpit4"
)]
pub payment_id: Option<String>,
pub payment_id: String,
/// This is an identifier for the merchant account. This is inferred from the API key
/// provided during the request
#[schema(max_length = 255, example = "merchant_1668273825", value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
#[schema(max_length = 255, example = "merchant_1668273825", value_type = String)]
pub merchant_id: id_type::MerchantId,
#[schema(value_type = IntentStatus, example = "failed", default = "requires_confirmation")]
pub status: api_enums::IntentStatus,
@ -3595,10 +3586,10 @@ pub struct PaymentsResponse {
/// The maximum amount that could be captured from the payment
#[schema(value_type = i64, minimum = 100, example = 6540)]
pub amount_capturable: Option<MinorUnit>,
pub amount_capturable: MinorUnit,
/// The amount which is already captured from the payment, this helps in the cases where merchants can't capture all capturable amount at once.
#[schema(value_type = i64, example = 6540)]
#[schema(value_type = Option<i64>, example = 6540)]
pub amount_received: Option<MinorUnit>,
/// The connector used for the payment
@ -3658,7 +3649,6 @@ pub struct PaymentsResponse {
pub mandate_id: Option<String>,
/// Provided mandate information for creating a mandate
#[auth_based]
pub mandate_data: Option<MandateData>,
/// Indicates that you intend to make future payments with this Payments payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
@ -3682,12 +3672,10 @@ pub struct PaymentsResponse {
/// The payment method that is to be used
#[schema(value_type = PaymentMethod, example = "bank_transfer")]
#[auth_based]
pub payment_method: Option<api_enums::PaymentMethod>,
/// The payment method information provided for making a payment
#[schema(value_type = Option<PaymentMethodDataResponseWithBilling>, example = "bank_transfer")]
#[auth_based]
#[serde(serialize_with = "serialize_payment_method_data_response")]
pub payment_method_data: Option<PaymentMethodDataResponseWithBilling>,