fix small compilation errors
This commit is contained in:
parent
6e67767766
commit
e1a44999ec
|
@ -6,12 +6,11 @@
|
|||
//
|
||||
|
||||
#import "Stripe.h"
|
||||
|
||||
#import "MBProgressHUD.h"
|
||||
|
||||
#import "PaymentViewController.h"
|
||||
#import "PKView.h"
|
||||
#import <Parse/Parse.h>
|
||||
#import "Constants.h"
|
||||
|
||||
@interface PaymentViewController ()<PKViewDelegate>
|
||||
@property(weak, nonatomic) PKView *paymentView;
|
||||
|
|
|
@ -54,6 +54,17 @@
|
|||
|
||||
- (void)createBackendChargeWithToken:(STPToken *)token
|
||||
completion:(void (^)(PKPaymentAuthorizationStatus))completion {
|
||||
if (!ParseApplicationId || !ParseClientKey) {
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Todo: Submit this token to your backend"
|
||||
message:[NSString stringWithFormat:@"Good news! Stripe turned your credit card into a token: %@ \nYou can follow the instructions in the README to set up Parse as an example backend, or use this token to manually create charges at dashboard.stripe.com .", token.tokenId]
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", @"OK")
|
||||
otherButtonTitles:nil];
|
||||
|
||||
[message show];
|
||||
completion(PKPaymentAuthorizationStatusSuccess);
|
||||
return;
|
||||
}
|
||||
NSDictionary *chargeParams = @{
|
||||
@"token": token.tokenId,
|
||||
@"currency": @"usd",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
|
||||
|
||||
#import "PKPayment.h"
|
||||
#import <PassKit/PassKit.h>
|
||||
|
||||
extern NSString * const STPSuccessfulChargeCardNumber;
|
||||
extern NSString * const STPFailingChargeCardNumber;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "PKPaymentAuthorizationViewController.h"
|
||||
#import <PassKit/PassKit.h>
|
||||
|
||||
@interface STPTestPaymentAuthorizationViewController : UIViewController
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#import "STPAPIConnection.h"
|
||||
#import "Stripe.h"
|
||||
#import "STPUtils.h"
|
||||
#import "STPTestPaymentAuthorizationViewController.h"
|
||||
#import "PKPayment+STPTestKeys.h"
|
||||
|
||||
NSString *const kStripeiOSVersion = @"1.1.4";
|
||||
|
||||
|
@ -314,6 +316,7 @@ static NSString *const tokenEndpoint = @"tokens";
|
|||
PKPaymentRequest *paymentRequest = [PKPaymentRequest new];
|
||||
PKPaymentSummaryItem *totalItem = [PKPaymentSummaryItem summaryItemWithLabel:description amount:amount];
|
||||
[paymentRequest setMerchantIdentifier:merchantIdentifier];
|
||||
[paymentRequest setSupportedNetworks:@[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]];
|
||||
[paymentRequest setMerchantCapabilities:PKMerchantCapability3DS];
|
||||
[paymentRequest setCountryCode:@"US"];
|
||||
[paymentRequest setCurrencyCode:currency];
|
||||
|
@ -323,7 +326,7 @@ static NSString *const tokenEndpoint = @"tokens";
|
|||
|
||||
+ (UIViewController *)paymentControllerWithRequest:(PKPaymentRequest *)request
|
||||
delegate:(id<PKPaymentAuthorizationViewControllerDelegate>)delegate {
|
||||
if ([self isSimulatorBuild] && ![PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:request.supportedNetworks]) {
|
||||
if ([self isSimulatorBuild]) {
|
||||
STPTestPaymentAuthorizationViewController *test = [STPTestPaymentAuthorizationViewController new];
|
||||
test.delegate = delegate;
|
||||
return test;
|
||||
|
|
Loading…
Reference in New Issue