feat(router): Added amount conversion function in core for connector module (#4710)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com>
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
This commit is contained in:
Sahkal Poddar
2024-05-30 19:21:33 +05:30
committed by GitHub
parent f7e99e1eda
commit 08eefdba4a
30 changed files with 577 additions and 150 deletions

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use common_utils::pii;
pub use common_utils::types::ChargeRefunds;
pub use common_utils::types::{ChargeRefunds, MinorUnit};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use utoipa::ToSchema;
@ -36,8 +36,8 @@ pub struct RefundRequest {
pub merchant_id: Option<String>,
/// Total amount for which the refund is to be initiated. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc., If not provided, this will default to the full payment amount
#[schema(minimum = 100, example = 6540)]
pub amount: Option<i64>,
#[schema(value_type = Option<i64> , minimum = 100, example = 6540)]
pub amount: Option<MinorUnit>,
/// Reason for the refund. Often useful for displaying to users and your customer support executive. In case the payment went through Stripe, this field needs to be passed with one of these enums: `duplicate`, `fraudulent`, or `requested_by_customer`
#[schema(max_length = 255, example = "Customer returned the product")]
@ -115,7 +115,8 @@ pub struct RefundResponse {
/// The payment id against which refund is initiated
pub payment_id: String,
/// The refund amount, which should be less than or equal to the total payment 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,
#[schema(value_type = i64 , minimum = 100, example = 6540)]
pub amount: MinorUnit,
/// The three-letter ISO currency code
pub currency: String,
/// The status for refund