diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index b0b3ea2e43..398888e140 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -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>, //FIXME Add enums for all PM enums + pub payment_methods_incl: Option>, pub payment_methods_excl: Option>, pub payment_method_types_incl: Option>, pub payment_method_types_excl: Option>, @@ -115,7 +115,7 @@ pub struct PaymentMethods { pub maximum_amount: Option, pub recurring_enabled: bool, pub installment_payment_enabled: bool, - pub payment_experience: Option>, //TODO + pub payment_experience: Option>, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 8e7edf6ba8..0bce7999c3 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -33,14 +33,9 @@ pub struct PaymentMethodResponse { pub payment_method_issuer: Option, pub payment_method_issuer_code: Option, pub card: Option, - //TODO: Populate this on request? - // pub accepted_country: Option>, - // pub accepted_currency: Option>, - // pub minimum_amount: Option, - // pub maximum_amount: Option, pub recurring_enabled: bool, pub installment_payment_enabled: bool, - pub payment_experience: Option>, //TODO change it to enum + pub payment_experience: Option>, pub metadata: Option, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub created: Option, @@ -174,7 +169,7 @@ pub struct ListPaymentMethodResponse { pub maximum_amount: Option, pub recurring_enabled: bool, pub installment_payment_enabled: bool, - pub payment_experience: Option>, //TODO change it to enum + pub payment_experience: Option>, } #[derive(Debug, serde::Serialize)] @@ -197,20 +192,27 @@ pub struct CustomerPaymentMethod { pub payment_method_type: Option, pub payment_method_issuer: Option, pub payment_method_issuer_code: Option, - //TODO: Populate this on request? - // pub accepted_country: Option>, - // pub accepted_currency: Option>, - // pub minimum_amount: Option, - // pub maximum_amount: Option, pub recurring_enabled: bool, pub installment_payment_enabled: bool, - pub payment_experience: Option>, //TODO change it to enum + pub payment_experience: Option>, pub card: Option, pub metadata: Option, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub created: Option, } +#[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, diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index c197d46647..912250c133 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -399,7 +399,7 @@ pub struct PaymentsResponse { pub statement_descriptor_suffix: Option, pub next_action: Option, pub cancellation_reason: Option, - pub error_code: Option, //TODO: Add error code column to the database + pub error_code: Option, pub error_message: Option, } diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs index 2586b1a576..31abe43f82 100644 --- a/crates/api_models/src/refunds.rs +++ b/crates/api_models/src/refunds.rs @@ -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, @@ -10,11 +10,18 @@ pub struct RefundRequest { pub merchant_id: Option, pub amount: Option, pub reason: Option, - //FIXME: Make it refund_type instant or scheduled refund - pub force_process: Option, + pub refund_type: Option, pub metadata: Option, } +#[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, diff --git a/crates/masking/README.md b/crates/masking/README.md index c2f2a24911..3cee5d1208 100644 --- a/crates/masking/README.md +++ b/crates/masking/README.md @@ -14,20 +14,20 @@ This solution has such advantages over alternatives: To convert non-secret variable into secret use `new()`. Sample: -```rust,ignore +```rust expiry_year: ccard.map(|x| Secret::new(x.card_exp_year.to_string())), // output: "expiry_year: *** alloc::string::String ***" ``` To get value from secret use `expose()`. Sample: -```rust,ignore +```rust last4_digits: Some(card_number.expose()) ``` Most fields are under `Option`. To simplify dealing with `Option`, use `expose_option()`. Sample: -```rust,ignore +```rust card_info.push_str( &card_detail .card_holder_name @@ -36,17 +36,17 @@ Most fields are under `Option`. To simplify dealing with `Option`, use `expose_o ); ``` - - +## Files Tree Layout - +```