Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update to 12.5 compatible stripe pod #286

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.0.12]
- update Stripe iOS dependency to support Xcode 12.5 (#286) (by @mclark4386)

## [1.0.11]
- fix #258 (by @Trede98)

Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/StripePaymentPlugin.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#import "StripePaymentPlugin.h"
#import <Stripe/Stripe.h>
#import "TPSStripeManager.h"

@import Stripe;

@implementation StripePaymentPlugin {
FlutterResult flutterResult;
StripeModule* stripeModule;
Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/TPSStripeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

#import <Foundation/Foundation.h>
#import <PassKit/PassKit.h>
#import <Stripe/Stripe.h>
#import "RCTConvert.h"

@import Stripe;

/**
* Block that bridge modules use to resolve the JS promise waiting for a result.
* Nil results are supported and are converted to JS's undefined value.
Expand Down
19 changes: 10 additions & 9 deletions ios/Classes/TPSStripeManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
//

#import "TPSStripeManager.h"
#import <Stripe/Stripe.h>

#import "TPSError.h"
#import "TPSStripeManager+Constants.h"

@import Stripe;

// If you change these, make sure to also change:
// android/src/main/java/com/gettipsi/stripe/StripeModule.java
// Relevant Docs:
Expand Down Expand Up @@ -301,7 +302,7 @@ -(void)init:(NSDictionary *)options errorCodes:(NSDictionary *)errors {
publishableKey = options[@"publishableKey"];
merchantId = options[@"merchantId"];
errorCodes = errors;
[Stripe setDefaultPublishableKey:publishableKey];
[StripeAPI setDefaultPublishableKey:publishableKey];
}

-(void)setStripeAccount:(NSString *)_stripeAccount {
Expand Down Expand Up @@ -856,7 +857,7 @@ -(void)paymentRequestWithApplePay:(NSArray *)items
[summaryItems addObject:summaryItem];
}

PKPaymentRequest *paymentRequest = [Stripe paymentRequestWithMerchantIdentifier:merchantId country:countryCode currency:currencyCode];
PKPaymentRequest *paymentRequest = [StripeAPI paymentRequestWithMerchantIdentifier:merchantId country:countryCode currency:currencyCode];

[paymentRequest setRequiredShippingAddressFields:requiredShippingAddressFields];
[paymentRequest setRequiredBillingAddressFields:requiredBillingAddressFields];
Expand Down Expand Up @@ -1183,7 +1184,7 @@ - (void)resetApplePayCallback {
}

- (BOOL)canSubmitPaymentRequest:(PKPaymentRequest *)paymentRequest rejecter:(RCTPromiseRejectBlock)reject {
if (![Stripe deviceSupportsApplePay]) {
if (![StripeAPI deviceSupportsApplePay]) {
NSDictionary *error = [errorCodes valueForKey:kErrorKeyDeviceNotSupportsNativePay];
reject(error[kErrorKeyCode], error[kErrorKeyDescription], nil);
return NO;
Expand Down Expand Up @@ -1211,7 +1212,7 @@ - (BOOL)canSubmitPaymentRequest:(PKPaymentRequest *)paymentRequest rejecter:(RCT

- (void)addCardViewController:(STPAddCardViewController *)addCardViewController
didCreatePaymentMethod:(STPPaymentMethod *)paymentMethod
completion:(STPErrorBlock)completion {
completion:(void (^)(NSError * _Nullable))completion {
[RCTPresentedViewController() dismissViewControllerAnimated:YES completion:nil];

requestIsCompleted = YES;
Expand Down Expand Up @@ -1295,7 +1296,7 @@ - (STPAPIClient *)newAPIClient {
url:TPSAppInfoURL];
});

STPAPIClient * client = [[STPAPIClient alloc] initWithPublishableKey:[Stripe defaultPublishableKey]];
STPAPIClient * client = [[STPAPIClient alloc] initWithPublishableKey:[StripeAPI defaultPublishableKey]];
client.appInfo = info;
client.stripeAccount = stripeAccount;

Expand Down Expand Up @@ -1488,7 +1489,7 @@ - (NSString *)cardBrandAsBrandSlug:(STPCardBrand)inputBrand {
return @"discover";
case STPCardBrandDinersClub:
return @"diners";
case STPCardBrandMasterCard:
case STPCardBrandMastercard:
return @"mastercard";
case STPCardBrandUnionPay:
return @"unionpay";
Expand All @@ -1500,7 +1501,7 @@ - (NSString *)cardBrandAsBrandSlug:(STPCardBrand)inputBrand {

/// API: https://stripe.com/docs/api/cards/object#card_object-brand
- (NSString *)cardBrandAsPresentableBrandString:(STPCardBrand)inputBrand {
return STPStringFromCardBrand(inputBrand);
return [STPCardBrandUtilities stringFromCardBrand:inputBrand];
}

- (NSString *)cardFunding:(STPCardFundingType)inputFunding {
Expand Down Expand Up @@ -1599,7 +1600,7 @@ - (NSString *)sourceType:(STPSourceType)inputType {
return @"bancontact";
case STPSourceTypeGiropay:
return @"giropay";
case STPSourceTypeIDEAL:
case STPSourceTypeiDEAL:
return @"ideal";
case STPSourceTypeSEPADebit:
return @"sepaDebit";
Expand Down
4 changes: 2 additions & 2 deletions ios/stripe_payment.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ A new flutter plugin project.
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'Stripe', '~> 19.4.0'
s.ios.deployment_target = '10.0'
s.dependency 'Stripe', '~> 21.3.1'
s.ios.deployment_target = '11.0'
end
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stripe_payment
description: A Flutter plugin to integrate the stripe libraries for iOS and Android. Supports Apple / Google Pay, SCA, PSD2 and much more.
version: 1.0.11
version: 1.0.12
homepage: https://github.com/jonasbark/flutter_stripe_payment

environment:
Expand Down