make shop required for instantiation

parent be59c98e
No related merge requests found
......@@ -34,17 +34,9 @@
@class BUYCheckout;
@class BUYShop;
@interface BUYApplePayHelpers : NSObject <PKPaymentAuthorizationViewControllerDelegate>
NS_ASSUME_NONNULL_BEGIN
/**
* Initializes a helper to support Apple Pay
*
* @param client A configured client
* @param checkout The checkout which is to be completed using Apple Pay
*
* @return helper object
*/
- (instancetype)initWithClient:(BUYClient *)client checkout:(BUYCheckout *)checkout;
@interface BUYApplePayHelpers : NSObject <PKPaymentAuthorizationViewControllerDelegate>
/**
* Initializes a helper to support Apple Pay
......@@ -132,3 +124,5 @@
- (BUYAddress *)buyAddressWithContact:(PKContact *)contact NS_AVAILABLE_IOS(9_0);
@end
NS_ASSUME_NONNULL_END
......@@ -51,11 +51,6 @@ const NSTimeInterval PollDelay = 0.5;
@implementation BUYApplePayHelpers
- (instancetype)initWithClient:(BUYClient *)client checkout:(BUYCheckout *)checkout
{
return [self initWithClient:client checkout:checkout shop:nil];
}
- (instancetype)initWithClient:(BUYClient *)client checkout:(BUYCheckout *)checkout shop:(BUYShop *)shop
{
NSParameterAssert(client);
......@@ -66,25 +61,12 @@ const NSTimeInterval PollDelay = 0.5;
if (self) {
self.client = client;
self.checkout = checkout;
// We need a shop object to display the business name in the pay sheet
if (shop) {
self.shop = shop;
}
else {
[self.client getShop:^(BUYShop *shop, NSError *error) {
if (shop) {
self.shop = shop;
}
}];
}
self.shop = shop;
}
return self;
}
#pragma mark - PKPaymentAuthorizationDelegate methods
- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment