Commit a70f4de0 by Rune Madsen

Merge branch 'develop' into runmad.checkout-attributes

parents a5723dd1 f5c7af61
......@@ -7,14 +7,14 @@
objects = {
/* Begin PBXBuildFile section */
902C9B8C1BB06BF300FC456E /* GetShopOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B8B1BB06BF300FC456E /* GetShopOperation.m */; settings = {ASSET_TAGS = (); }; };
902C9B8F1BB0729F00FC456E /* ShippingRateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B8E1BB0729F00FC456E /* ShippingRateTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B911BB08FF500FC456E /* SummaryItemsTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
9079F5F41BB1AAA100CB1B35 /* CollectionListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */; settings = {ASSET_TAGS = (); }; };
902C9B8C1BB06BF300FC456E /* GetShopOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B8B1BB06BF300FC456E /* GetShopOperation.m */; };
902C9B8F1BB0729F00FC456E /* ShippingRateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B8E1BB0729F00FC456E /* ShippingRateTableViewCell.m */; };
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B911BB08FF500FC456E /* SummaryItemsTableViewCell.m */; };
9079F5F41BB1AAA100CB1B35 /* CollectionListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */; };
90A6F42D1BA8BCAC003E7C4F /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90A6F42C1BA8BCAC003E7C4F /* PassKit.framework */; };
90B2623E1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B2623D1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
90B262411BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262401BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
90B262441BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262431BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
90B2623E1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B2623D1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m */; };
90B262411BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262401BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m */; };
90B262441BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262431BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m */; };
BE3437A21BC5C19D00C71330 /* Buy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; };
BE3437A31BC5C19D00C71330 /* Buy.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BE8B82511B8CF49D00E3F871 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8B82501B8CF49D00E3F871 /* main.m */; };
......@@ -31,13 +31,6 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BE3437981BC5C18400C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 90F7BA681B0D1DAF0067864D;
remoteInfo = Playground;
};
BE34379A1BC5C18400C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
......@@ -162,7 +155,6 @@
BE3437901BC5C18400C71330 /* Products */ = {
isa = PBXGroup;
children = (
BE3437991BC5C18400C71330 /* Playground.app */,
BE34379B1BC5C18400C71330 /* Mobile Buy SDK Tests.xctest */,
BE34379D1BC5C18400C71330 /* Buy.framework */,
BE34379F1BC5C18400C71330 /* Buy.framework */,
......@@ -311,13 +303,6 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
BE3437991BC5C18400C71330 /* Playground.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = Playground.app;
remoteRef = BE3437981BC5C18400C71330 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
BE34379B1BC5C18400C71330 /* Mobile Buy SDK Tests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
......
......@@ -184,12 +184,20 @@ NSString * const MerchantId = @"";
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:self.checkout.order.statusURL];
safariViewController.delegate = self;
[self presentViewController:safariViewController animated:YES completion:NULL];
}]];
[self presentViewController:alertController animated:YES completion:nil];
}
#pragma mark - SafariViewControllerDelegate
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
#pragma mark Native Checkout
- (void)checkoutWithCreditCard
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
......
# Mobile Buy SDK - Product View
The SDK includes an easy-to-use product view to make selling simple in any app. The `BUYProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_1.png)
You can also theme the `BUYProductViewController` to better match your app and products being displayed:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_2.png)
Simply initialize the `BUYProductViewController` and present it from any view controller in your app to sell a product from you shop.
### Getting started
The `BUYProductViewController` needs a `BUYClient` setup with your shop's credentials to work, so first create a `BUYClient` object:
```objc
BUYClient *client = [[BUYClient alloc] initWithShopDomain:@"yourshop.myshopify.com"
apiKey:@"aaaaaaaaaaaaaaaaaa"
channelId:@"99999"];
```
Now, create a `BUYProductViewController` with the `BUYClient`, and optionally add Apple Pay and a custom theme.
```objc
// Optionally customize the UI:
BUYTheme *theme = [[BUYTheme alloc] init];
theme.style = BUYThemeStyleLight;
theme.tintColor = [UIColor redColor];
BUYProductViewController *productViewController = [[BUYProductViewController alloc] initWithClient:self.client theme:theme];
// Optionally enable Apple Pay:
productViewController.merchantId = @"MERCHANT_ID";
```
Now the `BUYProductViewController` is ready to load a product and be presented in your app:
```objc
[productViewController loadProduct:@"PRODUCT_ID" completion:^(BOOL success, NSError *error) {
if (success) {
[self presentViewController:self.productViewController animated:YES completion:nil];
} else {
NSLog(@"Error: %@", error.userInfo);
}
}];
```
If you have already loaded a product, you can call `loadWithProduct:completion:` instead.
For a complete demo, check out the [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/README.md), which demoes more UI customization with `BUYTheme` and both modal and navigation controller push presentations.
......@@ -17,13 +17,6 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BE3437B11BC5C20700C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE3437A81BC5C20700C71330 /* Mobile Buy SDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 90F7BA681B0D1DAF0067864D;
remoteInfo = Playground;
};
BE3437B31BC5C20700C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE3437A81BC5C20700C71330 /* Mobile Buy SDK.xcodeproj */;
......@@ -101,7 +94,6 @@
BE3437A91BC5C20700C71330 /* Products */ = {
isa = PBXGroup;
children = (
BE3437B21BC5C20700C71330 /* Playground.app */,
BE3437B41BC5C20700C71330 /* Mobile Buy SDK Tests.xctest */,
BE3437B61BC5C20700C71330 /* Buy.framework */,
BE3437B81BC5C20700C71330 /* Buy.framework */,
......@@ -210,13 +202,6 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
BE3437B21BC5C20700C71330 /* Playground.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = Playground.app;
remoteRef = BE3437B11BC5C20700C71330 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
BE3437B41BC5C20700C71330 /* Mobile Buy SDK Tests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -23,13 +23,6 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
9019318E1BC5C62800D1134E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 901931851BC5C62700D1134E /* Mobile Buy SDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 90F7BA681B0D1DAF0067864D;
remoteInfo = Playground;
};
901931901BC5C62800D1134E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 901931851BC5C62700D1134E /* Mobile Buy SDK.xcodeproj */;
......@@ -131,7 +124,6 @@
901931861BC5C62700D1134E /* Products */ = {
isa = PBXGroup;
children = (
9019318F1BC5C62800D1134E /* Playground.app */,
901931911BC5C62800D1134E /* Mobile Buy SDK Tests.xctest */,
901931931BC5C62800D1134E /* Buy.framework */,
901931951BC5C62800D1134E /* Buy.framework */,
......@@ -267,13 +259,6 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
9019318F1BC5C62800D1134E /* Playground.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = Playground.app;
remoteRef = 9019318E1BC5C62800D1134E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
901931911BC5C62800D1134E /* Mobile Buy SDK Tests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -364,13 +364,13 @@
{
BUYAddress *newAddress = [self buyAddressWithTestRecordFullDetails:NO];
XCTAssertNotNil(newAddress);
XCTAssertEqualObjects(BUYPartialAddressPlaceholder, newAddress.address1);
XCTAssertEqualObjects(nil, newAddress.address1);
XCTAssertEqualObjects(@"Ottawa", newAddress.city);
XCTAssertEqualObjects(@"Ontario", newAddress.province);
XCTAssertEqualObjects(@"K1N5T5", newAddress.zip);
XCTAssertNil(newAddress.country);
XCTAssertEqualObjects(@"CA", newAddress.countryCode);
XCTAssertEqualObjects(BUYPartialAddressPlaceholder, newAddress.phone);
XCTAssertEqualObjects(nil, newAddress.phone);
}
- (void)testAddressFromContact
......
......@@ -109,7 +109,11 @@
checkout = [[BUYCheckout alloc] initWithCart:cart];
BUYAddress *partialAddress = [[BUYAddress alloc] init];
partialAddress.address1 = BUYPartialAddressPlaceholder;
partialAddress.address1 = nil;
if ([partialAddress isPartialAddress]) {
checkout.partialAddresses = YES;
}
checkout.shippingAddress = partialAddress;
task = [self.client createCheckout:checkout completion:nil];
......
......@@ -997,6 +997,10 @@
[self createCart];
_checkout = [[BUYCheckout alloc] initWithCart:_cart];
_checkout.shippingAddress = [self partialShippingAddress];
if ([_checkout.shippingAddress isPartialAddress]) {
_checkout.partialAddresses = YES;
}
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
return [self shouldUseMocks];
......@@ -1025,6 +1029,7 @@
//Update with full addresses
_checkout.shippingAddress = [self shippingAddress];
_checkout.billingAddress = [self billingAddress];
[self updateCheckout];
//We use a credit card here because we're not generating apple pay tokens in the tests
......@@ -1242,14 +1247,14 @@
- (BUYAddress *)partialShippingAddress
{
BUYAddress *address = [[BUYAddress alloc] init];
address.address1 = BUYPartialAddressPlaceholder;
address.address1 = nil;
address.city = @"Ottawa";
address.firstName = BUYPartialAddressPlaceholder;
address.lastName = BUYPartialAddressPlaceholder;
address.firstName = nil;
address.lastName = nil;
address.countryCode = @"CA";
address.provinceCode = @"ON";
address.zip = @"K1N5T5";
address.phone = BUYPartialAddressPlaceholder;
address.phone = nil;
return address;
}
......
......@@ -56,7 +56,6 @@
901930ED1BC5B9BC00D1134E /* BUYProductViewHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 90516C861B4C6F7000E35E45 /* BUYProductViewHeader.m */; };
901930EE1BC5B9BC00D1134E /* BUYNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90516CC21B4F1ED700E35E45 /* BUYNavigationController.m */; };
901930EF1BC5B9BC00D1134E /* BUYVariantSelectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE9496B11B4D96D800B38949 /* BUYVariantSelectionViewController.m */; };
901930F01BC5B9BC00D1134E /* BUYCheckout+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = BE6C5E711B1CF776003AD9D0 /* BUYCheckout+Additions.m */; };
901930F11BC5B9BC00D1134E /* NSString+Trim.m in Sources */ = {isa = PBXBuildFile; fileRef = F76CFF1C19CB7BE30079C703 /* NSString+Trim.m */; };
901930F21BC5B9BC00D1134E /* BUYOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = 90E83BC31B9F550E00C95A1B /* BUYOrder.m */; };
901930F31BC5B9BC00D1134E /* BUYAddress+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = BE33B4FA1B177EC80067982B /* BUYAddress+Additions.m */; };
......@@ -118,7 +117,6 @@
9019312D1BC5B9BC00D1134E /* BUYTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 90516CB61B4F0DD500E35E45 /* BUYTheme.h */; settings = {ATTRIBUTES = (Public, ); }; };
9019312E1BC5B9BC00D1134E /* BUYProductDescriptionCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 90516C951B4D76D900E35E45 /* BUYProductDescriptionCell.h */; };
9019312F1BC5B9BC00D1134E /* BUYLineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = F7FDA16C19C939FF00AF4E93 /* BUYLineItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
901931301BC5B9BC00D1134E /* BUYCheckout+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = BE6C5E701B1CF776003AD9D0 /* BUYCheckout+Additions.h */; };
901931311BC5B9BC00D1134E /* BUYProductViewHeaderOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 907874971B7276BA0023775B /* BUYProductViewHeaderOverlay.h */; };
901931321BC5B9BC00D1134E /* NSString+Trim.h in Headers */ = {isa = PBXBuildFile; fileRef = F76CFF1B19CB7BE30079C703 /* NSString+Trim.h */; };
901931331BC5B9BC00D1134E /* BUYAddress+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = BE33B4F91B177EC80067982B /* BUYAddress+Additions.h */; };
......@@ -283,8 +281,6 @@
BE9A64751B503D370033E558 /* BUYApplePayHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = BE33B4EE1B15FF4D0067982B /* BUYApplePayHelpers.m */; };
BE9A64781B503D3F0033E558 /* BUYAddress+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = BE33B4FA1B177EC80067982B /* BUYAddress+Additions.m */; };
BE9A64791B503D420033E558 /* BUYAddress+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = BE33B4F91B177EC80067982B /* BUYAddress+Additions.h */; };
BE9A647A1B503D450033E558 /* BUYCheckout+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = BE6C5E701B1CF776003AD9D0 /* BUYCheckout+Additions.h */; };
BE9A647B1B503D470033E558 /* BUYCheckout+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = BE6C5E711B1CF776003AD9D0 /* BUYCheckout+Additions.m */; };
BE9A647E1B503D930033E558 /* BUYStoreViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BE1C4DF31AE98FBB00E21624 /* BUYStoreViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
BE9A647F1B503D960033E558 /* BUYStoreViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE1C4DF41AE98FBB00E21624 /* BUYStoreViewController.m */; };
BE9A64801B503D990033E558 /* BUYViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BE1C4DF51AE98FBB00E21624 /* BUYViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -484,8 +480,6 @@
BE5DC39F1B71B13700B2BC1E /* NSURL+BUYAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+BUYAdditions.m"; sourceTree = "<group>"; };
BE6C07031BB1DE1D00BD9F7B /* OHHTTPStubs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OHHTTPStubs.framework; path = "Mobile Buy SDK Tests/OHHTTPStubs.framework"; sourceTree = "<group>"; };
BE6C07051BB1E46900BD9F7B /* mocked_responses.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = mocked_responses.json; sourceTree = "<group>"; };
BE6C5E701B1CF776003AD9D0 /* BUYCheckout+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BUYCheckout+Additions.h"; sourceTree = "<group>"; };
BE6C5E711B1CF776003AD9D0 /* BUYCheckout+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BUYCheckout+Additions.m"; sourceTree = "<group>"; };
BE6D05971BD6BA6700772EBB /* NSDictionary+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Additions.h"; sourceTree = "<group>"; };
BE6D05981BD6BA6700772EBB /* NSDictionary+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Additions.m"; sourceTree = "<group>"; };
BE9496681B45CCF400B38949 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; };
......@@ -821,8 +815,6 @@
F70CE40E1A8BF1D90055BEB8 /* BUYApplePayAdditions.m */,
BE33B4ED1B15FF4D0067982B /* BUYApplePayHelpers.h */,
BE33B4EE1B15FF4D0067982B /* BUYApplePayHelpers.m */,
BE6C5E701B1CF776003AD9D0 /* BUYCheckout+Additions.h */,
BE6C5E711B1CF776003AD9D0 /* BUYCheckout+Additions.m */,
909944471B71B76800C40A33 /* UIFont+BUYAdditions.h */,
909944481B71B76800C40A33 /* UIFont+BUYAdditions.m */,
900E7C811B5DA32F006F3C81 /* BUYImageKit.h */,
......@@ -903,7 +895,6 @@
9019312E1BC5B9BC00D1134E /* BUYProductDescriptionCell.h in Headers */,
9019312F1BC5B9BC00D1134E /* BUYLineItem.h in Headers */,
90C856B51BD6B0F300936926 /* Buy.h in Headers */,
901931301BC5B9BC00D1134E /* BUYCheckout+Additions.h in Headers */,
901931311BC5B9BC00D1134E /* BUYProductViewHeaderOverlay.h in Headers */,
901931321BC5B9BC00D1134E /* NSString+Trim.h in Headers */,
901931331BC5B9BC00D1134E /* BUYAddress+Additions.h in Headers */,
......@@ -979,7 +970,6 @@
BEB74A2B1B554C150005A300 /* BUYTheme.h in Headers */,
BEB74A6B1B55641B0005A300 /* BUYProductDescriptionCell.h in Headers */,
BE9A645B1B503CDC0033E558 /* BUYLineItem.h in Headers */,
BE9A647A1B503D450033E558 /* BUYCheckout+Additions.h in Headers */,
907874991B7276BA0023775B /* BUYProductViewHeaderOverlay.h in Headers */,
BE9A64721B503D290033E558 /* NSString+Trim.h in Headers */,
BE9A64791B503D420033E558 /* BUYAddress+Additions.h in Headers */,
......@@ -1221,7 +1211,6 @@
901930ED1BC5B9BC00D1134E /* BUYProductViewHeader.m in Sources */,
901930EE1BC5B9BC00D1134E /* BUYNavigationController.m in Sources */,
901930EF1BC5B9BC00D1134E /* BUYVariantSelectionViewController.m in Sources */,
901930F01BC5B9BC00D1134E /* BUYCheckout+Additions.m in Sources */,
901930F11BC5B9BC00D1134E /* NSString+Trim.m in Sources */,
901930F21BC5B9BC00D1134E /* BUYOrder.m in Sources */,
901930F31BC5B9BC00D1134E /* BUYAddress+Additions.m in Sources */,
......@@ -1317,7 +1306,6 @@
BEB74A741B5564380005A300 /* BUYProductViewHeader.m in Sources */,
BEB74A681B55640F0005A300 /* BUYNavigationController.m in Sources */,
BEB74A7E1B5564890005A300 /* BUYVariantSelectionViewController.m in Sources */,
BE9A647B1B503D470033E558 /* BUYCheckout+Additions.m in Sources */,
BE9A64731B503D2C0033E558 /* NSString+Trim.m in Sources */,
90E83BC51B9F550E00C95A1B /* BUYOrder.m in Sources */,
BE9A64781B503D3F0033E558 /* BUYAddress+Additions.m in Sources */,
......@@ -1396,7 +1384,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1.2.1;
CURRENT_PROJECT_VERSION = 1.2.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
......@@ -1428,7 +1416,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.2.1;
CURRENT_PROJECT_VERSION = 1.2.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
......@@ -1548,7 +1536,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1.2.1;
CURRENT_PROJECT_VERSION = 1.2.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
......@@ -1580,7 +1568,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.2.1;
CURRENT_PROJECT_VERSION = 1.2.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
......
......@@ -33,7 +33,6 @@
#import "BUYProduct.h"
#import "BUYShippingRate.h"
#import "BUYShop.h"
#import "BUYCheckout+Additions.h"
#import "BUYCheckout_Private.h"
#import "NSDecimalNumber+BUYAdditions.h"
#import "BUYError.h"
......@@ -54,7 +53,7 @@
#define kMinSuccessfulStatusCode 200
#define kMaxSuccessfulStatusCode 299
NSString * const BUYVersionString = @"1.2.1";
NSString * const BUYVersionString = @"1.2.2";
@interface BUYClient () <NSURLSessionDelegate>
......@@ -252,7 +251,7 @@ NSString * const BUYVersionString = @"1.2.1";
// Inject channel and marketing attributions
[self configureCheckout:checkout];
NSDictionary *json = [checkout jsonDictionaryForUpdatingCheckout];
NSDictionary *json = [checkout jsonDictionaryForCheckout];
return [self postCheckout:json completion:block];
}
......@@ -261,7 +260,7 @@ NSString * const BUYVersionString = @"1.2.1";
BUYCheckout *checkout = [[BUYCheckout alloc] initWithCartToken:cartToken];
[self configureCheckout:checkout];
NSDictionary *json = [checkout jsonDictionaryForUpdatingCheckout];
NSDictionary *json = [checkout jsonDictionaryForCheckout];
return [self postCheckout:json completion:block];
}
......@@ -343,7 +342,7 @@ NSString * const BUYVersionString = @"1.2.1";
- (NSURLSessionDataTask *)updateCheckout:(BUYCheckout *)checkout completion:(BUYDataCheckoutBlock)block
{
NSDictionary *json = [checkout jsonDictionaryForUpdatingCheckout];
NSDictionary *json = [checkout jsonDictionaryForCheckout];
NSData *data = [NSJSONSerialization dataWithJSONObject:json options:0 error:nil];
NSURLSessionDataTask *task = nil;
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -255,6 +255,11 @@
@property (nonatomic, strong, readonly) BUYOrder *order;
/**
* Flag used to inform server that the shipping address is partially filled, suitable to retrieve shipping rates
*/
@property (nonatomic, assign) BOOL partialAddresses;
/**
* It is recommended to instantiate a checkout with a cart, or cart token
*
* @return Checkout
......
......@@ -27,8 +27,6 @@
@import Foundation;
#import "BUYAddress.h"
extern NSString * const BUYPartialAddressPlaceholder;
@interface BUYAddress (Additions)
/**
......
......@@ -26,16 +26,14 @@
#import "BUYAddress+Additions.h"
NSString * const BUYPartialAddressPlaceholder = @"---";
@implementation BUYAddress (Additions)
- (BOOL)isPartialAddress
{
if ([self.address1 isEqualToString:BUYPartialAddressPlaceholder] ||
[self.firstName isEqualToString:BUYPartialAddressPlaceholder] ||
[self.lastName isEqualToString:BUYPartialAddressPlaceholder]) {
if (self.address1.length == 0 ||
self.firstName.length == 0 ||
self.lastName.length == 0) {
return YES;
}
......
......@@ -47,7 +47,7 @@
if (hasDiscount || [self.lineItems count] > 1) {
NSDecimalNumber *lineItemSubtotal = [NSDecimalNumber zero];
for (BUYLineItem *lineItem in self.lineItems) {
lineItemSubtotal = [lineItemSubtotal decimalNumberByAdding:lineItem.price];
lineItemSubtotal = [lineItemSubtotal decimalNumberByAdding:lineItem.linePrice];
}
[summaryItems addObject:[PKPaymentSummaryItem summaryItemWithLabel:@"CART TOTAL" amount:lineItemSubtotal]];
}
......@@ -143,14 +143,7 @@
//Grab the simple information
address.firstName = (__bridge_transfer NSString *)ABRecordCopyValue(record, kABPersonFirstNameProperty);
if ([address.firstName length] == 0) {
address.firstName = BUYPartialAddressPlaceholder;
}
address.lastName = (__bridge_transfer NSString *)ABRecordCopyValue(record, kABPersonLastNameProperty);
if ([[address lastName] length] == 0) {
address.lastName = BUYPartialAddressPlaceholder;
}
//Grab the address information
ABMultiValueRef addressMultiValue = ABRecordCopyValue(record, kABPersonAddressProperty);
......@@ -160,10 +153,6 @@
//NOTE: We do not receive an address1 line right now via this partial address, as Apple deemds it unimportant to calculate the shipping rates. We get the actual address later on in a later step.
address.address1 = (__bridge NSString *)CFDictionaryGetValue(firstAddress, kABPersonAddressStreetKey);
if (address.address1 == nil) {
address.address1 = BUYPartialAddressPlaceholder;
}
address.city = (__bridge NSString *)CFDictionaryGetValue(firstAddress, kABPersonAddressCityKey);
address.province = (__bridge NSString *)CFDictionaryGetValue(firstAddress, kABPersonAddressStateKey);
address.zip = (__bridge NSString *)CFDictionaryGetValue(firstAddress, kABPersonAddressZIPKey);
......@@ -185,9 +174,7 @@
if (allPhoneNumbers && CFArrayGetCount(allPhoneNumbers) > 0) {
address.phone = (__bridge NSString *)CFArrayGetValueAtIndex(allPhoneNumbers, 0);
}
if ([address.phone length] == 0) {
address.phone = BUYPartialAddressPlaceholder;
}
CFSafeRelease(phoneMultiValue);
CFSafeRelease(allPhoneNumbers);
......@@ -198,15 +185,15 @@
{
BUYAddress *address = [[BUYAddress alloc] init];
address.firstName = [contact.name.givenName length] ? contact.name.givenName : BUYPartialAddressPlaceholder;
address.lastName = [contact.name.familyName length] ? contact.name.familyName : BUYPartialAddressPlaceholder;
address.firstName = contact.name.givenName;
address.lastName = contact.name.familyName;
if (contact.postalAddress) {
// break up the address:
NSArray *addressComponents = [contact.postalAddress.street componentsSeparatedByString:@"\n"];
address.address1 = [addressComponents[0] length] ? addressComponents[0] : BUYPartialAddressPlaceholder;
address.address2 = ([addressComponents count] > 1 && addressComponents[1]) ? addressComponents[1] : nil;
address.city = [contact.postalAddress.city length] ? contact.postalAddress.city : BUYPartialAddressPlaceholder;
address.address1 = addressComponents[0];
address.address2 = (addressComponents.count > 1) ? addressComponents[1] : nil;
address.city = contact.postalAddress.city;
address.province = contact.postalAddress.state;
address.zip = contact.postalAddress.postalCode;
// The Checkout API accepts country OR ISO country code.
......@@ -219,7 +206,7 @@
}
}
address.phone = contact.phoneNumber.stringValue ?: BUYPartialAddressPlaceholder;
address.phone = contact.phoneNumber.stringValue;
return address;
}
......
......@@ -90,11 +90,18 @@ const NSTimeInterval PollDelay = 0.5;
// Update the checkout with the rest of the information. Apple has now provided us with a FULL billing address and a FULL shipping address.
// We now update the checkout with our new found data so that you can ship the products to the right address, and we collect whatever else we need.
self.checkout.shippingAddress = self.checkout.requiresShipping ? [BUYAddress buy_addressFromRecord:[payment shippingAddress]] : nil;
self.checkout.billingAddress = [BUYAddress buy_addressFromRecord:[payment billingAddress]];
self.checkout.email = [BUYAddress buy_emailFromRecord:[payment billingAddress]];
if (self.checkout.email == nil) {
self.checkout.email = [BUYAddress buy_emailFromRecord:[payment shippingAddress]];
self.checkout.partialAddresses = NO;
if ([payment respondsToSelector:@selector(shippingContact)]) {
self.checkout.email = payment.shippingContact.emailAddress;
self.checkout.shippingAddress = self.checkout.requiresShipping ? [BUYAddress buy_addressFromContact:payment.shippingContact] : nil;
} else {
self.checkout.email = [BUYAddress buy_emailFromRecord:payment.shippingAddress];
self.checkout.shippingAddress = self.checkout.requiresShipping ? [BUYAddress buy_addressFromRecord:payment.shippingAddress] : nil;
}
if ([payment respondsToSelector:@selector(billingContact)]) {
self.checkout.billingAddress = [BUYAddress buy_addressFromContact:payment.billingContact];
} else {
self.checkout.billingAddress = [BUYAddress buy_addressFromRecord:payment.billingAddress];
}
[self.client updateCheckout:self.checkout completion:^(BUYCheckout *checkout, NSError *error) {
......@@ -158,7 +165,9 @@ const NSTimeInterval PollDelay = 0.5;
#pragma mark -
- (void)updateCheckoutWithAddressCompletion:(void (^)(PKPaymentAuthorizationStatus, NSArray *shippingMethods, NSArray *summaryItems))completion
{
{
self.checkout.partialAddresses = [self.checkout.shippingAddress isPartialAddress];
if ([self.checkout.shippingAddress isValidAddressForShippingRates]) {
[self.client updateCheckout:self.checkout completion:^(BUYCheckout *checkout, NSError *error) {
......
//
// BUYCheckout+Additions.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "BUYCheckout.h"
@interface BUYCheckout (Additions)
/**
* Used for Apple Pay, specifically, to append true for
* the payload to set whether the address(es) are partial.
*
* @return A jsonDictionaryForCheckout JSON with optional "checkout.partial_addresses" key.
*/
- (NSDictionary *)jsonDictionaryForUpdatingCheckout;
@end
//
// BUYCheckout+Additions.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "BUYCheckout+Additions.h"
#import "BUYAddress+Additions.h"
@implementation BUYCheckout (Additions)
- (NSDictionary *)jsonDictionaryForUpdatingCheckout
{
NSMutableDictionary *json = [[self jsonDictionaryForCheckout] mutableCopy];
if ([self.shippingAddress isPartialAddress]) {
json[@"checkout"][@"partial_addresses"] = @YES;
}
return [json copy];
}
@end
......@@ -71,7 +71,11 @@
{
if ([self.variants count] == 1) {
BUYProductVariant *productVariant = [self.variants firstObject];
if ([productVariant.title isEqualToString:@"Default Title"]) {
BUYOptionValue *optionValue = [productVariant.options firstObject];
NSString *defaultTitleString = @"Default Title";
NSString *defaultString = @"Default";
if ([productVariant.title isEqualToString:defaultTitleString] &&
([optionValue.value isEqualToString:defaultTitleString] || [optionValue.value isEqualToString:defaultString])) {
return YES;
}
}
......
......@@ -117,6 +117,8 @@ NSString * BUYURLKey = @"url";
- (void)startApplePayCheckout:(BUYCheckout *)checkout
{
// Default to the failure state, since cancelling a payment would not update the state and thus appear as a success
self.paymentAuthorizationStatus = PKPaymentAuthorizationStatusFailure;
if (self.shop == nil && self.isLoadingShop == NO) {
// since requests are sent serially, this will return before the checkout is created
......
......@@ -6,7 +6,6 @@
<title>{{page.title}}</title>
<link rel="stylesheet" href="{{page.cssPath}}">
<link rel="stylesheet" href="/api/mobile-buy-sdk/ios/api/css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
{{#strings.appledocData}}<meta name="generator" content="{{tool}} {{version}} (build {{build}})">{{/strings.appledocData}}
</head>
......@@ -58,7 +57,6 @@
</div>
</article>
<script src="/api/mobile-buy-sdk/ios/api/script.js"></script>
<script src="{{page.jsPath}}"></script>
</body>
</html>
......
......@@ -6,7 +6,6 @@
<title>{{page.title}}</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="/api/mobile-buy-sdk/ios/api/css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
{{#strings.appledocData}}<meta name="generator" content="{{tool}} {{version}} (build {{build}})">{{/strings.appledocData}}
</head>
......@@ -92,7 +91,6 @@
</div>
</article>
<script src="/api/mobile-buy-sdk/ios/api/script.js"></script>
<script src="js/script.js"></script>
</body>
</html>
......@@ -108,5 +106,5 @@ Section Classes
EndSection
Section Navigation
<li><a href="/api/mobile-buy-sdk/ios/api/index.html">Home</a></li>
<li><a href="index.html">Home</a></li>
EndSection
......@@ -6,7 +6,6 @@
<title>{{page.title}}</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="/api/mobile-buy-sdk/ios/api/css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
{{#strings.appledocData}}<meta name="generator" content="{{tool}} {{version}} (build {{build}})">{{/strings.appledocData}}
</head>
......@@ -57,7 +56,7 @@
<h2 class="index-title">{{page.docsTitle}}</h2>
<ul>
{{#docs}}
<li><a href="/api/mobile-buy-sdk/ios/api/{{href}}">{{title}}</a></li>
<li><a href="{{href}}">{{title}}</a></li>
{{/docs}}
</ul>
</div>
......@@ -68,7 +67,7 @@
<h2 class="index-title">{{strings.indexPage.classesTitle}}</h2>
<ul>
{{#classes}}
<li><a href="/api/mobile-buy-sdk/ios/api/{{href}}">{{title}}</a></li>
<li><a href="{{href}}">{{title}}</a></li>
{{/classes}}
</ul>
</div>
......@@ -80,7 +79,7 @@
<h2 class="index-title">{{strings.indexPage.protocolsTitle}}</h2>
<ul>
{{#protocols}}
<li><a href="/api/mobile-buy-sdk/ios/api/{{href}}">{{title}}</a></li>
<li><a href="{{href}}">{{title}}</a></li>
{{/protocols}}
</ul>
{{/hasProtocols}}
......@@ -89,7 +88,7 @@
<h2 class="index-title">{{strings.indexPage.constantsTitle}}</h2>
<ul>
{{#constants}}
<li><a href="/api/mobile-buy-sdk/ios/api/{{href}}">{{title}}</a></li>
<li><a href="{{href}}">{{title}}</a></li>
{{/constants}}
</ul>
{{/hasConstants}}
......@@ -98,7 +97,7 @@
<h2 class="index-title">{{strings.indexPage.categoriesTitle}}</h2>
<ul>
{{#categories}}
<li><a href="/api/mobile-buy-sdk/ios/api/{{href}}">{{title}}</a></li>
<li><a href="{{href}}">{{title}}</a></li>
{{/categories}}
</ul>
{{/hasCategories}}
......@@ -121,11 +120,10 @@
</div>
</article>
<script src="/api/mobile-buy-sdk/ios/api/script.js"></script>
<script src="js/script.js"></script>
</body>
</html>
Section Navigation
<li><a href="/api/mobile-buy-sdk/ios/api/hierarchy.html">Hierarchy</a></li>
<li><a href="hierarchy.html">Hierarchy</a></li>
EndSection
......@@ -6,7 +6,6 @@
<title>{{page.title}}</title>
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="/api/mobile-buy-sdk/ios/api/css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
{{#strings.appledocData}}<meta name="generator" content="{{tool}} {{version}} (build {{build}})">{{/strings.appledocData}}
</head>
......@@ -370,8 +369,8 @@ EndSection
Section Navigation
<li><a href="/api/mobile-buy-sdk/ios/api/index.html">Index</a></li>
<li><a href="/api/mobile-buy-sdk/ios/api/hierarchy.html">Hierarchy</a></li>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
EndSection
Section JumpTo
......
Pod::Spec.new do |s|
s.name = 'Mobile-Buy-SDK'
s.version = '1.2.1'
s.version = '1.2.2'
s.summary = 'Sell with Shopify in iOS apps'
s.description = 'Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.'
s.homepage = 'https://developers.shopify.com/mobile-buy-sdk'
......
![Mobile Buy SDK](http://s3.amazonaws.com/shopify-marketing_assets/static/mbsdk-github.png)
![Mobile Buy SDK](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Mobile_Buy_SDK_Github_banner.png)
[![Build status](https://badge.buildkite.com/3951692121947fbf7bb06c4b741601fc091efea3fa119a4f88.svg)](https://buildkite.com/shopify/mobile-buy-sdk-ios)
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/Shopify/mobile-buy-sdk-ios/blob/master/LICENSE)
......@@ -12,11 +12,15 @@ Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your
### Documentation
Please find all documentation on the [Mobile Buy SDK for iOS page](https://docs.shopify.com/mobile-buy-sdk/ios).
Official documentation can be found on the [Mobile Buy SDK for iOS page](https://docs.shopify.com/mobile-buy-sdk/ios).
#### API Documentation
API docs can be generated with the `Documentation` scheme or viewed on Cocoadocs: [http://cocoadocs.org/docsets/Mobile-Buy-SDK/](http://cocoadocs.org/docsets/Mobile-Buy-SDK/).
### Installation
<a href="../../releases/latest">Download the latest version</a>
<a href="https://github.com/Shopify/mobile-buy-sdk-ios/releases/latest">Download the latest version</a>
#### Dynamic Framework Installation
......@@ -24,7 +28,7 @@ Please find all documentation on the [Mobile Buy SDK for iOS page](https://docs.
2. Add the `Buy` target as a `Target Dependancy` in the `Build Phases` of your project's target
3. Add the `Buy` (second target on the list is the Dynamic framework) target in the `Embedded Binaries` section in `Build Phases`
See the [Sample Apps](/Mobile Buy SDK Sample Apps/) for an example of Dynamic Framework usage.
See the [Sample Apps](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/) for an example of Dynamic Framework usage.
#### Static Framework Installation
......@@ -112,12 +116,24 @@ The Mobile Buy SDK includes a number of targets and schemes:
The repo includes 3 sample apps. Each sample apps embeds the dynamic framework and includes readme files with more information:
* [Advanced Sample App](/Mobile Buy SDK Sample Apps/Sample App Advanced/README.md)
* [Swift Sample App](/Mobile Buy SDK Sample Apps/Sample App Swift/README.md)
* [Web Sample App](/Mobile Buy SDK Sample Apps/Sample App Web/README.md)
* [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/README.md)
* [Swift Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Swift/README.md)
* [Web Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Web/README.md)
We suggest you take a look at the **Advanced Sample App** and test your shop with the sample app before you begin. If you run into any issues, the **Advanced Sample App** is also a great resource for debugging integration issues and checkout.
### Product View
The SDK includes an easy-to-use product view to make selling simple in any app. The `BUYProductViewController` displays any product, it's images, price and details and includes a variant selection flow. It will even handle Apple Pay and web checkout automatically:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_1.png)
You can also theme the `BUYProductViewController` to better match your app and products being displayed:
![Product View Screenshot](https://raw.github.com/Shopify/mobile-buy-sdk-ios/master/Assets/Product_View_Screenshot_2.png)
The [Advanced Sample App](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/) includes a demo of the `BUYProductViewController`. Documentation on how to use the `BUYProductViewController` is also available [here](https://github.com/Shopify/mobile-buy-sdk-ios/tree/master/Mobile Buy SDK Sample Apps/Sample App Advanced/PRODUCT_VIEW_README.md).
### Unit Tests
To run the Mobile Buy SDK integration tests against an actual shop, you will need a Shopify shop that is publicly accessible (not password protected). Please note that the integration tests **will create an order** on that shop. This is to validate that the SDK works properly with Shopify. Modify the **test_shop_data.json** file to contain your shop's credentials and the required product IDs, gift cards, and discounts as necessary.
......
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