Giter Club home page Giter Club logo

mobile-buy-sdk-ios's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-buy-sdk-ios's Issues

BUYObject#dirtyProperties Purpose

In digging into the SDK, I found a fairly nasty looking runtime hack that appears to amount to the simple ability to magically track "dirty properties" on a model. It looks like this is only used when sending partial checkout representations to the API.

Is this an API requirement that only diffs be sent? If not, what's the decision behind this? Just curious...

No price in BUYProduct class?

I'm loading my products to my Table View Controller, with product details in each cell (works great - e.g. title, htmlDescription, etc) - but is there no string to display the price in the Product List Controller? Eg. cell.productDescrip.text = product.price ? I'm asking this ridiculous question because when I try running the Sample App in the simulator, it simply crashes, and there is no documentation stating what can/can't be referenced other than this:

http://cocoadocs.org/docsets/Mobile-Buy-SDK/1.2.2/Classes/BUYProduct.html#overview

And still no mention of price... O_O

-[BUYProductViewController presentingViewController] is not always a UINavigationController

Line 452 of BUYProductViewController occasionally results in an unrecognized selector exception (-[UINavigationController navigationBar] being sent to a UIViewController*)

if (self.presentingViewController) {
                topInset = CGRectGetHeight([[(UINavigationController*)self.presentingViewController navigationBar] bounds]) + self.presentingViewController.topLayoutGuide.length;
            }

In my specific situation, I am presenting the BUYProductViewController from a view controller that is the root of a navigation controller. the navigation controller is one of a tabbarcontroller's tabs.

Product unavailable error

Our shop contains exactly one variant for each product and one item for each variant. The user has the ability to view the cart and modify it (add/remove products).

Scenario 1:
The user goes for checkout.
The app creates an empty BUYCart(), then adds the product variants to it, then creates the BUYCheckout with the cart and calls BUYClient.createCheckuot().
Then the user decides that she wants to modify the cart so she goes back, adds another product the process starts again.
The app has to recreate the cart since I cannot find a way to modify an existing cart, but the original products are already reserved so now createCheckout gives back the error: checkout-line_items-quantity-not_enought_in_stock but doesn't specify which product id gives the error.

Scenario 2:
For scneario 1, I found the method BUYClient.removeProductReservationsFromCheckout so let's say I call it when the user modifies the checkout so I can start from scratch. But imagine this one: the user goes for checkout, then she sends the app in background for whatever reason and the app gets killed. Coming back I need to recreate the cart and checkout, but again the products are already reserved.

Scenario 3:
Two users go for checkout pretty much in the same time, both having the same product in their cart. This is possible, because when getting the product details they show as available, although they are reserved.
Again in the checkout process we get the same error but we cannot tell the user which product is already reserved by another user.

Bottom line:
I'm either doing something wrong and there's a different way to implement this or we may need some of the following:

  • a way to modify the products in an existing BUYCart
  • meaningful errors for reserved products so that we can show the user something useful and also for any other error. Or a list of all possible error codes so we can treat them all inside the application.
  • a way to serialise/deserialise the BUYCart object so we can do a proper cleanup when starting over (I
    think we can maybe do this using the cartToken. Please confirm)

Better Checkout Error Handling

In our app, we have had several reports from users having issues at checkout. We currently show an UIAlertView when an error occurs during the checkout process (from the many delegate methods available) showing the error's description. The most common message is The operation could not be completed. (shopify error 422).

From being able to reproduce the issue locally, I can see that userInfo object has some rather raw JSON describing what appears to be an out of stock scenario for one of the products in the cart.

Would it be possible to receive specific NSErrorcodes or something so we can better describe the issue at hand to our users?

Checkout won't update - UIButton unresponsive

I'm trying to update my CheckOut with shipping/address details, and when I tap my UIButton it's completely unresponsive. I've logged the cart, and my selected object is present. Is there a field I'm missing in terms of the saveAddress button? Tapping the button doesn't even throw me my logs (success or error).

Follow up question: Does Shopify have a console of some sort that generates a backend report?

  • (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    self.cart = [BUYCart singleton];
    NSLog(@"%@", cart);

    BUYCheckout *checkout = [[BUYCheckout alloc]initWithCart:self.cart];
    BUYClient *client = [BUYClient singleton];

    [client createCheckout:checkout completion:^(BUYCheckout *checkout, NSError *error) {
    if (error == nil) {
    self.checkout = checkout;
    } else {
    // [self controller:self failedToCreateCheckout:error];
    }

    }];

  • (IBAction)saveAddress:(id)sender {

    BUYAddress *details = [[BUYAddress alloc] init];
    details.firstName = @"Brittany";
    details.lastName = @"Blair";
    details.address1 = @"1111 Beach Street";
    details.city = @"Vancouver";
    details.province = @"BC";
    details.zip = @"000000";
    details.countryCode = @"CA";

    self.checkout.shippingAddress = details;
    self.checkout.billingAddress = details;
    self.checkout.email = @"[email protected]";

    NSLog(@"%@", cart);

    [client updateCheckout:self.checkout completion:^(BUYCheckout *checkout, NSError *error) {
    if (error == nil) {
    self.checkout = checkout;
    NSLog(@"SUCCESS");
    } else {
    NSLog(@"FAIL");
    }
    }];

}

Cache

Do we support any caching in the mobile buy sdk?

e.g.

  1. fetch products A-Z
  2. fetch products Z-A
  3. fetch products A-Z <-- I would expect this to use the cached version

How to fetch metafields from mobile-buy-sdk?

Hey guys, been looking around and couldn't find elsewhere a way to fetch metafields without using private apps. In our mobile app, we have extra information about the shop and collections. We need these information in order to display them nicely in our app, which means it's fine to be public.

I dig into the BUYClient.m code, seeing lots of public endpoints that are not documented like: collection_publications.json, meta.json for shop, etc.

So question: will you guys expose metafields into the mobile-buy-sdk in the future? If not soon, is there a way I can fetch it publicly?

No way to clear credit card from BUYCheckout

If a user adds an invalid credit card and tries (fails) to checkout, all future updates to the BUYCheckout object (excluding updating the credit card) get a "payment session id invalid" error. This could happen if a user decides to update their shipping address before changing their credit card after an unsuccessful attempt to complete a purchase.

If, however, the credit card is removed from the BUYCheckout object after an unsuccessful checkout attempt, the 'payment session id invalid' error can be avoided. Unfortunately, there doesn't appear to be a built-in way to do this, so I've had to resort to completely destroying and rebuilding the entire BUYCheckout object. Would be great to have a non-hacky way to remove the credit card.

V 1.2.2 - Module 'Buy' STILL not found?

Hey all -

I've downloaded V1.2.2, and when I drag Mobile Buy SDK.xcodeproj into my existing project, add Buy to my target dependencies and embedded frameworks, I still get the "Module Buy not found" when I try importing it into my ViewController header?

I've double checked the podspec file, and the module name is correct.

Help :/

Ability to persist BUYCart between app launches

Is there a way to persist the cart object between app launches? If there's not already, could you add a way to serialize/deserialize the cart to JSON?

BUYCart implements BUYSerializable to get a JSON dictionary, but there is no corresponding initWithDictionary: method.

Thanks!

[BUYViewController] failedToUpdateCheckout with error == nil

To reproduce:

  • On Shopify backend, try setting a shipping area to San Francisco.
  • On device, choose the default shipping address to be New York
  • Experiencing that the Apple Pay process will keep failing to update the checkout
  • Only way to solve this is remove New York from the default shipping address and replace with San Francisco instead.

In short, once the shipping address is chosen wrongly, users have to cancel the Apple Pay sheet and start again. Otherwise it will keep failing without specific error given.

Add test for product tags

Since we're changing tags from a comma-separated string to an NSSet, tests need to be added to confirm they work as expected.

Apple Pay Checkout / Load Shop Race-Condition

Occasionally, users have reported that upon starting an Apple Pay checkout, they will receive an error message. After looking into it further, it appears it is because of the pre-condition that the shop must be loaded before a checkout can occur.

NSLog(@"loadShopWithCallback: must be called before starting an Apple Pay checkout");

In the code for starting an Apple Pay Checkout, it is assumed that because network requests are run serially that the shop information should be loaded prior to a checkout being created. This is some times not the case.

Is there any way to improve this behavior? Perhaps chaining the checkout creation only after a successful shop load?

Wrong Tag Name

Naming tags things like 1.2.2 when they are prerelease breaks semantic versioning (and tools like Carthage). Please use something like 1.1.1-beta.1 instead.

Login & using customer information

Hi,

I am creating a mobile app with this SDK, I am looking to log the user using Shopify so I can show an order history as well as use reward points I have saved against the customers account.

I cannot see any API availability to do this, is it on your roadmap?

Payment Error

In my app I add all the needed information to the checkout and call updateCheckout several times.
Once the user gets in the payment screen, I add the billing address, call updateCheckout, then call storeCreditCard. If the nameOnCard field is only one word I get the following error (which is correct):

{
    errors =     {
        checkout =         {
            "credit_card" =             {
                "last_name" =                 (
                                        {
                        code = blank;
                        message = "can't be blank";
                        options =                         {
                        };
                    }
                );
                month =                 (
                );
                number =                 (
                );
                "start_month" =                 (
                );
                "start_year" =                 (
                );
                year =                 (
                );
            };
            "payment_gateway" =             (
            );
        };
    };
}

But then, if I try to modify the checkout, like changing the billing address, I get this error when I call updateCheckout:

{
    errors =     {
        checkout =         {
            "payment_session_id" =             (
                                {
                    code = invalid;
                    message = "is invalid";
                    options =                     {
                    };
                }
            );
        };
    };
}

I can't find a way to unstore the credit card or to reset it. What should I do?

I think that a state diagram with all the possible states for the checkout, all the possible transitions and all possible errors will simplify our lives and will let us be sure that we covered all the cases.

Remove deprecated properties, methods

For the next major release, we will be removing deprecated methods that are stale:

  • orderId and orderStatusURL on BUYCheckout
  • enableApplePayWithMerchantId: on BUYClient

Remove shippingRateId

shippingRateId on BUYCheckout is deprecated and BUYShippingRate takes care of this for us.

Should be removed.

Apple Pay checkout without province field

Hi guys, we’re integrating mobile SDK in many of our Apps (Shopify App: https://apps.shopify.com/mooncode)

But when trying to checkout with an address that does not contain any province (France for instance, but many other countries too), Apple Pay renders the shipping address in red saying that it is not valid.

The method doing this issue is inside "BUYAddress+Additions.h”: “- (BOOL)isValidAddressForShippingRates”.

This method will ALWAYS render NO if no province is entered.

Our workaround (for the moment):

  • (BOOL)isValidAddressForShippingRates
    {
    BOOL valid = NO;

    if (self.city.length > 0 &&
    self.zip.length > 0 &&
    // self.province.length > 0 &&
    (self.country.length > 0 || self.countryCode.length == 2)) {

    valid = YES;
    

    }

    return valid;
    }

Is there any plan to support countries outside of US / Canada for shipping? We have many customers that need that :)

Anyway, you’re doing a great job with that SDK!

Amaury

Version 2.0 Milestone

iOS Buy SDK 2.0

Overview

Shopify's APIs are evolving, and the Buy SDK is being revised to keep in sync. The next version of the SDK is underway, with a targeted release date for the end of April, 2016. Many of the features of the next version area already in use in private projects within Shopify. Over the next few weeks, we'll be cleaning up and deploying those features into this repository.

New 2.0 changes will be integrated on the version-2 integration branch. When it's ready, it will take over as the master branch. The current develop branch will be renamed and deprecated at that time.

Goals for Buy SDK 2.0

  • support for the latest version of the Shopify Checkout API
  • support for the latest version of the Shopify Channels API
  • support for the new Shopify Customer API
  • declarative data model and auto-generated model classes
  • dynamic JSON serialization support
  • hooks to allow developers to extend the SDK with local caching solutions (including Core Data)
  • streamlined framework target, focussed solely on exposing API features
  • sample UI and view controllers provided as part of sample apps

Revised data model management

The Shopify data model will be represented by a Core Data Managed Object Model. It's a rarely exploited fact that the Managed Object Model classes are useful even without a Core Data persistence stack. We've converted the old models, and are generating new model class files with mogenerator. Some model types and property names will be updated to be more consistent with Apple Objective-C naming standards.

Hand-written JSON serialization will be replaced with a fully dynamic solution relying on extensions to the Core Data model description classes: NSEntityDescription and NSPropertyDescription (and subclasses: NSAttributeDescription and NSRelationshipDescription). These will implement a set of reasonable conventions for JSON<->model transformations. But, they can be customized using user info settings defined in the model file to support variations, including custom key mappings, custom data formats, custom relationship mappings, transient-only properties, documentation, and more.

Model object lifecycle will now be owned by a model manager (BUYModelManager), to ensure creation and deletion of objects is properly tracked. The BUYClient will instantiate new models via BUYModelManager when processing responses from Shopify APIs.

Project Management

The new version of the SDK will continue to be written in Objective-C, to ensure support for apps written in both Objective-C and Swift.

We will be looking at improvements to the current target structure, but may have to defer significant changes to a later milestone.

In the short term, we will be making a few small changes to allow opt-in for some features. The first optional feature will be for Core Data caching support. Because model objects in Core Data must inherit from NSManagedObject, a build setting will allow enabling Core Data support. This will change the default inheritance of model classes. It will also conditionally compile some methods either on BUYObject, or BUYManagedObject, to ensure a consistent interface, regardless of whether the feature is enabled. Input from 3rd party developers is desired, regarding these designs.

Note that full support for Core Data-based caching is not a goal of this new version. At the moment, we want to limit the growth of complexity of the SDK for the majority of users. Developers who wish to opt in to local data caching support must have the experience to manage a Core Data persistence stack. Furthermore, they are strongly recommended to contact their Shopify representative for information about joining our Shopify Plus program.

Milestone Issues

  • migrate UI components form Buy.framework to Advanced Sample App target: #121
  • introduce new extensions to Foundation classes: #118
  • relocate existing model files in preparation for transition to generated model files: #130
  • introduce new JSON serialization extensions: #120
  • introduce BUYModelManager and BUYManagedObject: #122
  • introduce Buy.xcdatamodel, mogenerator tool and templates, new build phase, and generated models: #123
  • introduce customer login API: #126
  • introduce app extensions and new catalogue (collection/product) URLs: #124
  • migrate to checkout version 2: #125 descoped
  • unify object identifier types: #127
  • Update all version strings (Info.plist and BUYClient)

cc @davidmuzi @dbart01

Include SDK via CocoaPods without the Passkit Framework?

Apologies if this isn't the correct way to ask this question, but is there any way to use the Mobile BUY SDK cocoapod without linking the Passkit framework? Apple prevents app transfers for any apps built that include this framework, and I don't currently need any of the ApplePay integration.

NSURLSessionDataTask is delayed or stuck forever when internet is connecting

To reproduce this, use any API call from BUYClient that returns NSURLSessionDataTask.

Example:
Step 1: turn off internet connection
Step 2: turn on internet connection and immediately fire the API call. Like:

[buyClient getCollections:^(NSArray *collections, NSError *error) {
  // observing completionBlock is delayed for several seconds or never fired at all
}];

Expected result: completionBlock should be called either with error or results.

Ability to View Resource Metafields

A powerful feature of Shopify is the ability to add metafields to products, collections, etc. These fields are available via liquid to be used within our web shops, but they are currently not available via the mobile SDK.

Are there any plans to add them?

No Such module 'Buy' Cocoapods

I'm using the SDK via Cocoapods in a Swift project. In a controller I'm trying to import the framework by including import Buy, but I'm getting an error that says no such module 'Buy'. Any ideas?

Mobile buy SDK Web checkout not working.

Hi,

We configured the mobile buy SDK with the below information

shopDomain = "jumkey.myshopify.com"
apiKey = "XXXXXXXXXXXXX"
channelId = “14070401"
productId = “1923353089” —> This is the Product I am checking out.

Breakdown of Calls at Mobile Buy SDK

  1. Get the Product Details based on Product ID
  2. Checkout JSON is formed based on the configured info. JSON Looks as below
    checkout = {
    "channel_id" = 14070401;
    "line_items" = (
    {
    price = 350;
    quantity = 1;
    "requires_shipping" = 1;
    title = "Default Title";
    "variant_id" = 5982045505;
    }
    );
    "marketing_attribution" = {
    medium = iOS;
    source = "Mobile Buy SDK Swift Sample";
    };
    "source_identifier" = 14070401;
    "source_name" = "mobile_app";
    };
    }
  3. With this the Mobile Buy SDK hits a Checkout POST METHOD -
    the URL isURL: https://jumkey.myshopify.com/anywhere/checkouts.json and POST Parameter is CHECKOUT JSON formed in step:2
  4. This post request throws this error
    {
    errors = {
    checkout = {
    "line_items" = (
    );
    "payment_gateway" = (
    {
    code = invalid;
    message = "is invalid";
    options = {
    };
    }
    );
    "reservation_time" = (
    );
    "source_name" = (
    );
    };
    };
    }

We are totally confused and not getting proper direction and help.

Our Payment gateway is PayU India(officially supported by Shopify Backend in India & Asia),
We like to hit the web Checkout Page in Shopify, from there it's a breeze.

Are we missing anything here?
Kindly help & Give us proper direction.

Thanks in advance.

Get Order name

I uses [self startApplePayCheckout:self.checkout];
Please tell me how can I get all the data about the successful order? name and date of creation?
Unfortunately I can not test it with a my credit card - this type of purchase is not available in my country and i have to work blindly

Carthage Build Error - Playground Scheme

In the current develop branch, carthage fails to build with this error:

A shell task failed with exit code 66:
xcodebuild: error: Scheme Playground is not currently configured for the build action.

Update Advanced Sample App to include BUYShop pre-fetching for Apple Pay

Currently the BUYShop object is not pre-fetched for Apple Pay. The shop name is needed to display for "PAY [SHOP NAME]" in the Apple Pay payment authorization controller.

The BUYAppleHelpers will fetch the BUYShop object if one isn't passed in, however this may result in the appearance of "PAY TOTAL" until the payment method, shipping address or shipping method are updated.

Error: 422 During Checkout - Shipping Rate can't be blank

After upgrading to v1.2.2 of the SDK, we're seeing this error returned when attempting to checkout using Apple Pay.

{
    errors =     {
        checkout =         {
            "cart_token" =             (
            );
            email =             (
            );
            "line_items" =             (
            );
            "location_id" =             (
            );
            "reservation_time" =             (
            );
            "shipping_rate_id" =             (
                                {
                    code = blank;
                    message = "can't be blank";
                    options =                     {
                    };
                }
            );
            "source_name" =             (
            );
            "user_id" =             (
            );
        };
    };
}

Return-to-App Button after web checkout missing

I'm creating a BUYCheckout object with the webReturnToURL and webReturnToLabel properties set (BUYClient also has URLScheme set), and I am then sending the app to Safari to complete checkout using the webCheckoutURL property on my BUYCheckout object. Once the checkout is complete, I am expecting there to be a back-to-app button, based on the documentation, but the button is never there. This also appears to be an issue in the advanced demo app.

Carthage Build Error

Building the framework using carthage update --platform ios produces an error of:

error: cannot parse the debug map for ".../Carthage/Build/iOS/Buy.framework/Buy": The file was not recognized as a valid object file

Xcode 7.0.1, Carthage 0.9.2

isApplePayAvailable loses state on memory warning

I'm integrating Shopify for a sizable client of ours. I spoke with a shopify engineer around a month ago by phone on this issue but he was still new on the iOS team and wasn't able to answer this issue...

What happens is, the bool, isApplePayAvailable, loses state when a memory issue occurs. Why is this bad? Once isApplePayAvailable is set to 0 and the button reverts to "Set up apple pay", the user is taken to the credit card setup every time. Somehow, [PKPaymentAuthorizationViewController canMakePayments] becomes unset.

NOTE: BOOL didIntegrationSucceed = [client testIntegrationWithMerchantId:MERCHANT_ID]; will always return true even with the memory issue. No issues there.

Does anyone have any insight? Im about to ditch Shopify for the client if I cant figure this out. The issue has been around for the past 3 releases now (3 months?).

Inconsistent data types.

The functions that fetch a product with a given identifier in BUYClient take a String product identifier, but product identifiers are defined as NSNumbers. Transitioning between those relies on the consumer making assumptions about the format of identifier. This responsibility should be placed entirely within the framework.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.