Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(Connector): [Stripe] Implement Wechatpay Digital Wallet (#1049)
AkshayaFoiger93947eaf258d
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rsindex 4538ae2d14..5124b0064d 100644--- a/crates/router/src/connector/stripe/transformers.rs+++ b/crates/router/src/connector/stripe/transformers.rs@@ -298,6 +298,7 @@ pub enum StripeWallet {ApplepayToken(StripeApplePay),GooglepayToken(GooglePayToken),ApplepayPayment(ApplepayPayment),+ WechatpayPayment(WechatpayPayment),AlipayPayment(AlipayPayment),}@@ -333,6 +334,22 @@ pub struct AlipayPayment {pub payment_method_data_type: StripePaymentMethodType,}+#[derive(Debug, Eq, PartialEq, Serialize)]+pub struct WechatpayPayment {+ #[serde(rename = "payment_method_types[]")]+ pub payment_method_types: StripePaymentMethodType,+ #[serde(rename = "payment_method_data[type]")]+ pub payment_method_data_type: StripePaymentMethodType,+ #[serde(rename = "payment_method_options[wechat_pay][client]")]+ pub client: WechatClient,+}++#[derive(Debug, Eq, PartialEq, Serialize, Clone, Copy)]+#[serde(rename_all = "snake_case")]+pub enum WechatClient {+ Web,+}+#[derive(Debug, Eq, PartialEq, Serialize)]pub struct GooglepayPayment {#[serde(rename = "payment_method_data[card][token]")]@@ -361,6 +378,8 @@ pub enum StripePaymentMethodType {Becs,#[serde(rename = "bacs_debit")]Bacs,+ #[serde(rename = "wechat_pay")]+ Wechatpay,Alipay,}@@ -819,6 +838,15 @@ fn create_stripe_payment_method(StripeBillingAddress::default(),)),+ payments::WalletData::WeChatPayRedirect(_) => Ok((+ StripePaymentMethodData::Wallet(StripeWallet::WechatpayPayment(WechatpayPayment {+ client: WechatClient::Web,+ payment_method_types: StripePaymentMethodType::Wechatpay,+ payment_method_data_type: StripePaymentMethodType::Wechatpay,+ })),+ StripePaymentMethodType::Wechatpay,+ StripeBillingAddress::default(),+ )),payments::WalletData::AliPay(_) => Ok((StripePaymentMethodData::Wallet(StripeWallet::AlipayPayment(AlipayPayment {payment_method_types: StripePaymentMethodType::Alipay,@@ -832,7 +860,6 @@ fn create_stripe_payment_method(StripePaymentMethodType::Card,StripeBillingAddress::default(),)),-_ => Err(errors::ConnectorError::NotImplemented("This wallet is not implemented for stripe".to_string(),)@@ -1251,8 +1278,9 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat| StripePaymentMethodOptions::Ach {}| StripePaymentMethodOptions::Bacs {}| StripePaymentMethodOptions::Becs {}- | StripePaymentMethodOptions::Sepa {}- | StripePaymentMethodOptions::Alipay {} => None,+ | StripePaymentMethodOptions::WechatPay {}+ | StripePaymentMethodOptions::Alipay {}+ | StripePaymentMethodOptions::Sepa {} => None,}),payment_method_id: Some(payment_method_id),}@@ -1412,6 +1440,7 @@ pub enum StripeNextActionResponse {RedirectToUrl(StripeRedirectToUrlResponse),AlipayHandleRedirect(StripeRedirectToUrlResponse),VerifyWithMicrodeposits(StripeVerifyWithMicroDepositsResponse),+ WechatPayDisplayQrCode(StripeRedirectToQr),}impl StripeNextActionResponse {@@ -1420,6 +1449,7 @@ impl StripeNextActionResponse {Self::RedirectToUrl(redirect_to_url) | Self::AlipayHandleRedirect(redirect_to_url) => {redirect_to_url.url.to_owned()}+ Self::WechatPayDisplayQrCode(redirect_to_url) => redirect_to_url.data.to_owned(),Self::VerifyWithMicrodeposits(verify_with_microdeposits) => {verify_with_microdeposits.hosted_verification_url.to_owned()}@@ -1453,6 +1483,11 @@ pub struct StripeRedirectToUrlResponse {url: Url,}+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]+pub struct StripeRedirectToQr {+ data: Url,+}+#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]pub struct StripeVerifyWithMicroDepositsResponse {hosted_verification_url: Url,@@ -1612,8 +1647,8 @@ pub struct StripeBillingAddress {#[derive(Debug, Clone, serde::Deserialize, Eq, PartialEq)]pub struct StripeRedirectResponse {- pub payment_intent: String,- pub payment_intent_client_secret: String,+ pub payment_intent: Option<String>,+ pub payment_intent_client_secret: Option<String>,pub source_redirect_slug: Option<String>,pub redirect_status: Option<StripePaymentStatus>,pub source_type: Option<Secret<String>>,@@ -1657,6 +1692,7 @@ pub enum StripePaymentMethodOptions {Becs {},#[serde(rename = "bacs_debit")]Bacs {},+ WechatPay {},Alipay {},}@@ -1945,6 +1981,14 @@ implOk(Self::Wallet(wallet_info))}+ payments::WalletData::WeChatPayRedirect(_) => {+ let wallet_info = StripeWallet::WechatpayPayment(WechatpayPayment {+ client: WechatClient::Web,+ payment_method_types: StripePaymentMethodType::Wechatpay,+ payment_method_data_type: StripePaymentMethodType::Wechatpay,+ });+ Ok(Self::Wallet(wallet_info))+ }payments::WalletData::AliPay(_) => {let wallet_info = StripeWallet::AlipayPayment(AlipayPayment {payment_method_types: StripePaymentMethodType::Alipay,