From 80ec3f8bd599a2c9a1f11c337d815c1c47f94717 Mon Sep 17 00:00:00 2001 From: Brian Dorfman Date: Mon, 9 Oct 2017 15:13:03 -0700 Subject: [PATCH 1/2] Add reusable alipay source params. Alipay type already exists and is parsed and handled correctly, so adding reusable should theoretically only be a matter of adding this new helper method. --- Stripe/PublicHeaders/STPSourceParams.h | 13 +++++++++++++ Stripe/STPSourceParams.m | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/Stripe/PublicHeaders/STPSourceParams.h b/Stripe/PublicHeaders/STPSourceParams.h index e5930c1167d..fc99d75df8b 100644 --- a/Stripe/PublicHeaders/STPSourceParams.h +++ b/Stripe/PublicHeaders/STPSourceParams.h @@ -254,6 +254,19 @@ NS_ASSUME_NONNULL_BEGIN currency:(NSString *)currency returnURL:(NSString *)returnURL; +/** + Creates params for a reusable Alipay source + @see https://stripe.com/docs/sources/alipay#create-source + + @param currency The currency the payment is being created in. + @param returnURL The URL the customer should be redirected to after they have + successfully verified the payment. + + @return An STPSourceParams object populated with the provided values + */ ++ (STPSourceParams *)alipayReusableParamsWithCurrency:(NSString *)currency + returnURL:(NSString *)returnURL; + /** Creates params for a P24 source @see https://stripe.com/docs/sources/p24#create-source diff --git a/Stripe/STPSourceParams.m b/Stripe/STPSourceParams.m index e037db513d0..27e7a293780 100644 --- a/Stripe/STPSourceParams.m +++ b/Stripe/STPSourceParams.m @@ -271,6 +271,17 @@ + (STPSourceParams *)alipayParamsWithAmount:(NSUInteger)amount return params; } ++ (STPSourceParams *)alipayParamsWithCurrency:(NSString *)currency + returnURL:(NSString *)returnURL { + STPSourceParams *params = [self new]; + params.type = STPSourceTypeAlipay; + params.currency = currency; + params.redirect = @{ @"return_url": returnURL }; + params.usage = STPSourceUsageReusable; + + return params; +} + + (STPSourceParams *)p24ParamsWithAmount:(NSUInteger)amount currency:(NSString *)currency email:(NSString *)email From c54c019c33829c68257d6a70ec125d740bf52bfa Mon Sep 17 00:00:00 2001 From: Brian Dorfman Date: Mon, 9 Oct 2017 16:40:34 -0700 Subject: [PATCH 2/2] Fix method name. --- Stripe/STPSourceParams.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Stripe/STPSourceParams.m b/Stripe/STPSourceParams.m index 27e7a293780..61f89af8bf7 100644 --- a/Stripe/STPSourceParams.m +++ b/Stripe/STPSourceParams.m @@ -271,8 +271,8 @@ + (STPSourceParams *)alipayParamsWithAmount:(NSUInteger)amount return params; } -+ (STPSourceParams *)alipayParamsWithCurrency:(NSString *)currency - returnURL:(NSString *)returnURL { ++ (STPSourceParams *)alipayReusableParamsWithCurrency:(NSString *)currency + returnURL:(NSString *)returnURL { STPSourceParams *params = [self new]; params.type = STPSourceTypeAlipay; params.currency = currency;