mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
fix: todos and fixmes resolution for api_models (#144)
This commit is contained in:
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use self::CreateMerchantAccount as MerchantAccountResponse;
|
||||
use super::payments::AddressDetails;
|
||||
use crate::enums as api_enums;
|
||||
use crate::{enums as api_enums, payment_methods};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@ -55,7 +55,7 @@ pub struct WebhookDetails {
|
||||
#[derive(Default, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CustomRoutingRules {
|
||||
pub payment_methods_incl: Option<Vec<api_enums::PaymentMethodType>>, //FIXME Add enums for all PM enums
|
||||
pub payment_methods_incl: Option<Vec<api_enums::PaymentMethodType>>,
|
||||
pub payment_methods_excl: Option<Vec<api_enums::PaymentMethodType>>,
|
||||
pub payment_method_types_incl: Option<Vec<api_enums::PaymentMethodSubType>>,
|
||||
pub payment_method_types_excl: Option<Vec<api_enums::PaymentMethodSubType>>,
|
||||
@ -115,7 +115,7 @@ pub struct PaymentMethods {
|
||||
pub maximum_amount: Option<i32>,
|
||||
pub recurring_enabled: bool,
|
||||
pub installment_payment_enabled: bool,
|
||||
pub payment_experience: Option<Vec<String>>, //TODO
|
||||
pub payment_experience: Option<Vec<payment_methods::PaymentExperience>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@ -33,14 +33,9 @@ pub struct PaymentMethodResponse {
|
||||
pub payment_method_issuer: Option<String>,
|
||||
pub payment_method_issuer_code: Option<api_enums::PaymentMethodIssuerCode>,
|
||||
pub card: Option<CardDetailFromLocker>,
|
||||
//TODO: Populate this on request?
|
||||
// pub accepted_country: Option<Vec<String>>,
|
||||
// pub accepted_currency: Option<Vec<enums::Currency>>,
|
||||
// pub minimum_amount: Option<i32>,
|
||||
// pub maximum_amount: Option<i32>,
|
||||
pub recurring_enabled: bool,
|
||||
pub installment_payment_enabled: bool,
|
||||
pub payment_experience: Option<Vec<String>>, //TODO change it to enum
|
||||
pub payment_experience: Option<Vec<PaymentExperience>>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub created: Option<time::PrimitiveDateTime>,
|
||||
@ -174,7 +169,7 @@ pub struct ListPaymentMethodResponse {
|
||||
pub maximum_amount: Option<i32>,
|
||||
pub recurring_enabled: bool,
|
||||
pub installment_payment_enabled: bool,
|
||||
pub payment_experience: Option<Vec<String>>, //TODO change it to enum
|
||||
pub payment_experience: Option<Vec<PaymentExperience>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
@ -197,20 +192,27 @@ pub struct CustomerPaymentMethod {
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodSubType>,
|
||||
pub payment_method_issuer: Option<String>,
|
||||
pub payment_method_issuer_code: Option<api_enums::PaymentMethodIssuerCode>,
|
||||
//TODO: Populate this on request?
|
||||
// pub accepted_country: Option<Vec<String>>,
|
||||
// pub accepted_currency: Option<Vec<enums::Currency>>,
|
||||
// pub minimum_amount: Option<i32>,
|
||||
// pub maximum_amount: Option<i32>,
|
||||
pub recurring_enabled: bool,
|
||||
pub installment_payment_enabled: bool,
|
||||
pub payment_experience: Option<Vec<String>>, //TODO change it to enum
|
||||
pub payment_experience: Option<Vec<PaymentExperience>>,
|
||||
pub card: Option<CardDetailFromLocker>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub created: Option<time::PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[non_exhaustive]
|
||||
pub enum PaymentExperience {
|
||||
RedirectToUrl,
|
||||
InvokeSdkClient,
|
||||
DisplayQrCode,
|
||||
OneClick,
|
||||
LinkWallet,
|
||||
InvokePaymentApp,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PaymentMethodId {
|
||||
pub payment_method_id: String,
|
||||
@ -243,7 +245,7 @@ pub struct DeleteTokenizeByTokenRequest {
|
||||
pub lookup_key: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)] //FIXME yet to be implemented
|
||||
#[derive(Debug, serde::Serialize)] // Blocked: Yet to be implemented by `basilisk`
|
||||
pub struct DeleteTokenizeByDateRequest {
|
||||
pub buffer_minutes: i32,
|
||||
pub service_name: String,
|
||||
|
||||
@ -399,7 +399,7 @@ pub struct PaymentsResponse {
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
pub next_action: Option<NextAction>,
|
||||
pub cancellation_reason: Option<String>,
|
||||
pub error_code: Option<String>, //TODO: Add error code column to the database
|
||||
pub error_code: Option<String>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::enums;
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default, Debug, Clone, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct RefundRequest {
|
||||
pub refund_id: Option<String>,
|
||||
@ -10,11 +10,18 @@ pub struct RefundRequest {
|
||||
pub merchant_id: Option<String>,
|
||||
pub amount: Option<i32>,
|
||||
pub reason: Option<String>,
|
||||
//FIXME: Make it refund_type instant or scheduled refund
|
||||
pub force_process: Option<bool>,
|
||||
pub refund_type: Option<RefundType>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RefundType {
|
||||
#[default]
|
||||
Scheduled,
|
||||
Instant,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct RefundResponse {
|
||||
pub refund_id: String,
|
||||
|
||||
Reference in New Issue
Block a user