use serde::Serialize; //Why are these few in snake_case but rest is camelCase? #[derive(Serialize, Debug, Clone)] pub struct CheckoutCalculateTaxesResponse { pub shipping_price_gross_amount: f32, pub shipping_price_net_amount: f32, pub shipping_tax_rate: f32, pub lines: Vec, } #[derive(Serialize, Debug, Clone)] pub struct LinesResponse { pub total_gross_amount: f32, pub total_net_amount: f32, pub tax_rate: f32, } #[derive(Serialize, Debug, Clone)] pub struct CheckoutFilterShippingMethodsResponse { pub excluded_methods: Vec, } #[derive(Serialize, Debug, Clone)] pub struct ExcludedMethodsResponse { pub id: String, pub reason: Option, } #[derive(Serialize, Debug, Clone)] pub struct OrderCalculateTaxes(CheckoutCalculateTaxesResponse); #[derive(Serialize, Debug, Clone)] pub struct OrderFilterShippingMethods(CheckoutFilterShippingMethodsResponse); #[derive(Serialize, Debug, Clone)] pub struct ShippingListMethodsForCheckout(Vec); #[derive(Serialize, Debug, Clone)] struct ShippingListMethodsForCheckoutVec { pub id: String, pub name: Option, pub amount: f32, pub currency: String, pub maximum_delivery_days: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum ChargeRequestedResult { ChargeSuccess, ChargeFailiure, } #[derive(Serialize, Debug, Clone)] pub struct TransactionChargeRequestedResponse { pub psp_reference: String, pub result: Option, pub amount: Option, pub time: Option, pub external_url: Option, pub message: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum RefundRequestedResult { RefundSuccess, RefundFailiure, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct TransactionRefundRequestedResponse { pub psp_reference: String, pub result: Option, pub amount: Option, pub time: Option, pub external_url: Option, pub message: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum CancelationRequestedResult { CancelSuccess, CancelFailiure, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct TransactionCancelationRequestedResponse { pub psp_reference: String, pub result: Option, pub amount: Option, pub time: Option, pub external_url: Option, pub message: Option, } #[derive(Serialize, Debug, Clone)] pub struct PaymentGatewayInitializeSessionResponse { pub data: T, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum TransactionSessionResult { ChargeSuccess, ChargeFailiure, ChargeRequested, ChargeActionRequired, AuthorizationSuccess, AuthorizationFailure, AuthorizationRequested, AuthorizationActionRequired, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct TransactionInitializeSessionResponse { pub psp_reference: Option, pub data: Option, pub result: TransactionSessionResult, pub amount: f32, pub time: Option, pub external_url: Option, pub message: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct TransactionProcessSessionResponse { pub psp_reference: Option, pub data: Option, pub result: TransactionSessionResult, pub amount: f32, pub time: Option, pub external_url: Option, pub message: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum PaymentMethodTokenizationResult { SucessfullyTokenized, AdditionalActionRequired, Pending, FailedToTokenize, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct PaymentMethodProcessTokenizationSession { pub result: PaymentMethodTokenizationResult, /** Should be present when `PaymentMethodTokenizationResult::{SuccessfullyTokenized && AdditionalActionRequired}` */ pub id: Option, pub data: Option, pub error: Option, } #[derive(Serialize, Debug, Clone)] pub struct PaymentMethodInitializeTokenizationSession( PaymentMethodProcessTokenizationSession, ); #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum PaymentGatewayTokenisationResult { SuccessfullyInitialized, FailedToInitialize, } #[derive(Serialize, Debug, Clone)] pub struct PaymentGatewayInitializeTokenizationSession { pub result: PaymentGatewayTokenisationResult, pub data: Option, pub error: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum StoredPaymentMethodDeleteResult { SucessfullyDeleted, FailedToDelete, } #[derive(Serialize, Debug, Clone)] pub struct StoredPaymentMethodDeleteRequested { pub result: StoredPaymentMethodDeleteResult, pub error: Option, } //TODO: Dahek is Array<"INTERACTIVE"> from app-sdk/../sync-webhook-response-builder.ts:LIST_STORED_PAYMENT_METHODS? #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct PaymentMethod { pub id: String, pub supported_payment_flows: Vec, #[serde(rename = "type")] pub typ: String, pub credit_card_info: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct CreditCardInfo { brand: String, last_digits: String, exp_month: String, exp_year: String, first_digits: Option, } #[derive(Serialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct ListStoredPaymentMethodsResponse { payment_methods: Vec>, name: Option, data: Option, }