@@ -298,6 +298,7 @@ pub enum StripeWallet {
298
298
ApplepayToken ( StripeApplePay ) ,
299
299
GooglepayToken ( GooglePayToken ) ,
300
300
ApplepayPayment ( ApplepayPayment ) ,
301
+ WechatpayPayment ( WechatpayPayment ) ,
301
302
AlipayPayment ( AlipayPayment ) ,
302
303
}
303
304
@@ -333,6 +334,22 @@ pub struct AlipayPayment {
333
334
pub payment_method_data_type : StripePaymentMethodType ,
334
335
}
335
336
337
+ #[ derive( Debug , Eq , PartialEq , Serialize ) ]
338
+ pub struct WechatpayPayment {
339
+ #[ serde( rename = "payment_method_types[]" ) ]
340
+ pub payment_method_types : StripePaymentMethodType ,
341
+ #[ serde( rename = "payment_method_data[type]" ) ]
342
+ pub payment_method_data_type : StripePaymentMethodType ,
343
+ #[ serde( rename = "payment_method_options[wechat_pay][client]" ) ]
344
+ pub client : WechatClient ,
345
+ }
346
+
347
+ #[ derive( Debug , Eq , PartialEq , Serialize , Clone , Copy ) ]
348
+ #[ serde( rename_all = "snake_case" ) ]
349
+ pub enum WechatClient {
350
+ Web ,
351
+ }
352
+
336
353
#[ derive( Debug , Eq , PartialEq , Serialize ) ]
337
354
pub struct GooglepayPayment {
338
355
#[ serde( rename = "payment_method_data[card][token]" ) ]
@@ -361,6 +378,8 @@ pub enum StripePaymentMethodType {
361
378
Becs ,
362
379
#[ serde( rename = "bacs_debit" ) ]
363
380
Bacs ,
381
+ #[ serde( rename = "wechat_pay" ) ]
382
+ Wechatpay ,
364
383
Alipay ,
365
384
}
366
385
@@ -819,6 +838,15 @@ fn create_stripe_payment_method(
819
838
StripeBillingAddress :: default ( ) ,
820
839
) ) ,
821
840
841
+ payments:: WalletData :: WeChatPayRedirect ( _) => Ok ( (
842
+ StripePaymentMethodData :: Wallet ( StripeWallet :: WechatpayPayment ( WechatpayPayment {
843
+ client : WechatClient :: Web ,
844
+ payment_method_types : StripePaymentMethodType :: Wechatpay ,
845
+ payment_method_data_type : StripePaymentMethodType :: Wechatpay ,
846
+ } ) ) ,
847
+ StripePaymentMethodType :: Wechatpay ,
848
+ StripeBillingAddress :: default ( ) ,
849
+ ) ) ,
822
850
payments:: WalletData :: AliPay ( _) => Ok ( (
823
851
StripePaymentMethodData :: Wallet ( StripeWallet :: AlipayPayment ( AlipayPayment {
824
852
payment_method_types : StripePaymentMethodType :: Alipay ,
@@ -832,7 +860,6 @@ fn create_stripe_payment_method(
832
860
StripePaymentMethodType :: Card ,
833
861
StripeBillingAddress :: default ( ) ,
834
862
) ) ,
835
-
836
863
_ => Err ( errors:: ConnectorError :: NotImplemented (
837
864
"This wallet is not implemented for stripe" . to_string ( ) ,
838
865
)
@@ -1251,8 +1278,9 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat
1251
1278
| StripePaymentMethodOptions :: Ach { }
1252
1279
| StripePaymentMethodOptions :: Bacs { }
1253
1280
| StripePaymentMethodOptions :: Becs { }
1254
- | StripePaymentMethodOptions :: Sepa { }
1255
- | StripePaymentMethodOptions :: Alipay { } => None ,
1281
+ | StripePaymentMethodOptions :: WechatPay { }
1282
+ | StripePaymentMethodOptions :: Alipay { }
1283
+ | StripePaymentMethodOptions :: Sepa { } => None ,
1256
1284
} ) ,
1257
1285
payment_method_id : Some ( payment_method_id) ,
1258
1286
}
@@ -1412,6 +1440,7 @@ pub enum StripeNextActionResponse {
1412
1440
RedirectToUrl ( StripeRedirectToUrlResponse ) ,
1413
1441
AlipayHandleRedirect ( StripeRedirectToUrlResponse ) ,
1414
1442
VerifyWithMicrodeposits ( StripeVerifyWithMicroDepositsResponse ) ,
1443
+ WechatPayDisplayQrCode ( StripeRedirectToQr ) ,
1415
1444
}
1416
1445
1417
1446
impl StripeNextActionResponse {
@@ -1420,6 +1449,7 @@ impl StripeNextActionResponse {
1420
1449
Self :: RedirectToUrl ( redirect_to_url) | Self :: AlipayHandleRedirect ( redirect_to_url) => {
1421
1450
redirect_to_url. url . to_owned ( )
1422
1451
}
1452
+ Self :: WechatPayDisplayQrCode ( redirect_to_url) => redirect_to_url. data . to_owned ( ) ,
1423
1453
Self :: VerifyWithMicrodeposits ( verify_with_microdeposits) => {
1424
1454
verify_with_microdeposits. hosted_verification_url . to_owned ( )
1425
1455
}
@@ -1453,6 +1483,11 @@ pub struct StripeRedirectToUrlResponse {
1453
1483
url : Url ,
1454
1484
}
1455
1485
1486
+ #[ derive( Clone , Debug , Eq , PartialEq , Deserialize , Serialize ) ]
1487
+ pub struct StripeRedirectToQr {
1488
+ data : Url ,
1489
+ }
1490
+
1456
1491
#[ derive( Clone , Debug , Eq , PartialEq , Deserialize ) ]
1457
1492
pub struct StripeVerifyWithMicroDepositsResponse {
1458
1493
hosted_verification_url : Url ,
@@ -1612,8 +1647,8 @@ pub struct StripeBillingAddress {
1612
1647
1613
1648
#[ derive( Debug , Clone , serde:: Deserialize , Eq , PartialEq ) ]
1614
1649
pub struct StripeRedirectResponse {
1615
- pub payment_intent : String ,
1616
- pub payment_intent_client_secret : String ,
1650
+ pub payment_intent : Option < String > ,
1651
+ pub payment_intent_client_secret : Option < String > ,
1617
1652
pub source_redirect_slug : Option < String > ,
1618
1653
pub redirect_status : Option < StripePaymentStatus > ,
1619
1654
pub source_type : Option < Secret < String > > ,
@@ -1657,6 +1692,7 @@ pub enum StripePaymentMethodOptions {
1657
1692
Becs { } ,
1658
1693
#[ serde( rename = "bacs_debit" ) ]
1659
1694
Bacs { } ,
1695
+ WechatPay { } ,
1660
1696
Alipay { } ,
1661
1697
}
1662
1698
@@ -1945,6 +1981,14 @@ impl
1945
1981
Ok ( Self :: Wallet ( wallet_info) )
1946
1982
}
1947
1983
1984
+ payments:: WalletData :: WeChatPayRedirect ( _) => {
1985
+ let wallet_info = StripeWallet :: WechatpayPayment ( WechatpayPayment {
1986
+ client : WechatClient :: Web ,
1987
+ payment_method_types : StripePaymentMethodType :: Wechatpay ,
1988
+ payment_method_data_type : StripePaymentMethodType :: Wechatpay ,
1989
+ } ) ;
1990
+ Ok ( Self :: Wallet ( wallet_info) )
1991
+ }
1948
1992
payments:: WalletData :: AliPay ( _) => {
1949
1993
let wallet_info = StripeWallet :: AlipayPayment ( AlipayPayment {
1950
1994
payment_method_types : StripePaymentMethodType :: Alipay ,
0 commit comments