Latest 1.4.6
Homepage http://www.mycheck.io/
License Custom
Platforms ios 9.0
Dependencies MyCheckCore, Gloss
Authors

Latest podspec

{
    "name": "MyCheckDine",
    "version": "1.4.6",
    "summary": "A SDK that enables the developer to open a table at a restaurant, follow the order and reorder items.",
    "description": "# MyCheck Dine SDKnnAn SDK that enables the developer to open a table at a restaurant, follow the order and reorder items (payment - coming soon).nnThis SDK will enable your app to access an open check on a table at a restaurant, view the check (bill), reorder items and pay the check (payment functions coming soon).nnThe basic flow of the transactions is:n-  The guest accesses the app to get a four digit coden- The code is given to the guest's food server who will access the open check on the POS and enter the code.n- The POS will connect the check with MyCheck servicesn- The guest will then be able to see the check and interact with the check by reordering existing items and paying.n- Once the guest pays the check he/she no longer has access to the check.nnn## RequirementsnniOS 9 or above.nnSwift 3.0nn## InstallationnnMyCheck Restaurant SDK is available through [CocoaPods](http://cocoapods.org). You will first need to ask a MyCheck team member to give you read privileges to the MyCheck Repository. Once you have gotten the privileges, install it by simply adding the following lines to the top of your Podfile:nn```nsource 'http://bitbucket.org/erez_spatz/pod-spec-repo.git'nsource 'http://github.com/CocoaPods/Specs.git'n```nThis will set both the public CocoaPods repo and the MyCheck private repo as targets for CocoaPods to search for frameworks from.nnYou can add [email protected] before the 'bitbucket.org' so the pod tool won't need to ask you for it every time you update or install.nnInside the target add:nn```npod "MyCheckDine"n```nNow you can run 'pod install'nn## UsenThe Dine Singleton will be the point of contact that will allow you to create, follow and make actions on the users order. In order to manage the users session (login, logout etc.) you will need to use the session singleton.nnStart by addingn```nimport MyCheckCoren```nnnto the top of the class where you want to use MyCheck.nnIn your app delegate's `application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)` function call the configure function of the Session singleton:nn```nSession.shared.configure(YOUR_PUBLISHABLE_KEY, environment: .sandbox)n```nThis will setup the SDK to work with the desired environment.nnBefore using any other functions you will have to login the user. Login is done by first obtaining a refresh token from your server (that, in turn, will obtain it from the MyCheck server using the secret). Once you have the refresh token call the login function on the Session singleton:nnn```nSession.shared.login(REFRESH_TOKEN, success: HANDLE_SUCCESSn}, fail: HANDLE_FAIL)nn```nOnce you are logged in, you can open a table. Now you can start doing  dine in specific actions using the Dine singleton. Import the Dine module of the SDK.n```nimport MyCheckDinen```nnBellow is a flow chart that explains the Dine in flow and explains what functions need to be called in each stage of the user experience.n![Dine flow chart](https://s3-eu-west-1.amazonaws.com/docs.mycheckapp.com/Resources/flowChart.jpg "Dine flow chart")nThe first step in the process is generating a 4 digit code. The code generated by the MyCheck server is valid for a limited time, for a specific user in a specific location. This code, when entered into the POS enables MyCheck to sync the client with his order on the POS and can start receiving order updates and perform actions on it. The user will need to have a method of payment in order for this to succeed. Once you have received a code, display it to the user so he, in turn, can show it to his waiter / bartender. If you wish to support Apple Pay you will need some additional setup, please read the Apple Pay section.nn```nDine.shared.generateCode(hotelId: HOTEL_ID , restaurantId: RESTUARANT_ID, success: HANDLE_SUCCESSn}, fail: HANDLE_FAIL)nn```nnNow that a code was generated and displayed you will probably want to start polling the MyCheck server in order to get order updates. You will get an update when the order is opened, and on every change made to the bill. In order to poll the order, turn on the poller and implement the 'OrderPollerDelegate'.nn```nDine.shared.poller.delegate = selfnnMyCheck.shared.poller.startPolling()nn```nnThe delegate example implementation:nn```nextension YOUR_VIEWCONTROLLER : OrderPollerDelegate{nnfunc orderUpdated(order:Order){nn//Deal with order updates. Check the 'status' variable to make sure the status didn't change, otherwise update the order displayed to the user with the updated bill.n}nnnfunc failingToReceiveUpdates(lastReceivedError: NSError , failCount:Int){n//this callback will be called if the poller failed the last few calls to the MyCheck server. This means your app may not be in sync with the POS.n}n}n```nnnIn order to reorder items send an array of tuples to the reorder call. Each tuple has an Int representing the amount to order and the item to reorder.nn```nMyCheck.shared.reorderItems(items: [(3, order.items.first!)], success: {n//Handle successn}, fail: {error inn// handle failn})n```n### PaymentnIf you have an open table with a non zero balance and a payment method you can make a payment.nThe first step is to create a `PaymentDetails` objectnn```nlet details = PaymentDetails(order: THE_ORDER, amount: THE_AMOUNT_TO_CHARGE, tip: TIP_AMOUNT, paymentMethod: A_PAYMENT_METHOD)nn// ORnnlet details = PaymentDetails(order: THE_ORDER, items: ITEMS_THAT_SHOULD_BE_BOUGHT, tip: TIP_AMOUNT, paymentMethod: A_PAYMENT_METHOD)n```nnThe `PaymentDetails` has 2 failable constructors. One is for paying by amount and the second is for paying by items. The constructors will fail if the order supplied is not open or if the amount is greater than the order balance.nYou will also need to get a `PaymentMethodInterface` object, For more on this please review the MyCheckWalletUI documents.nOnce you have a `PaymentDetails` object call the `makePayment` function.nn```nDine.shared.makePayment(paymentDetails: details, displayDelegate: self, success: {nn}, fail: {error innn})n```nn## Apple PaynnIn order to set up Apple Pay please review the MyCheckWallet or MyCheckWalletUI docs. Once Apple Pay is set up their are 2 additional changes you will need to make in order for it to work with the Dine SDK.n### Generate CodenWhen generating a code MyCheck must be able to charge the default payment method without the users interaction in certain cases (for example if the user walks out and forgets to pay). Apple Pay creates tokens that can be used only once that expires after some time. For this reason we will need to prompt the user to Pay with Apple Pay at this point.nIn order to accomplish this the generateCode function has 2 extra optional parameters (that are required for Apple Pay support):n1. DisplayViewControllerDelegate :  The delegate function will be called when a Apple Pay view controller needs to be displayed or dismissed.n2. ApplePayController -  The controller will supply the Dine SDK with the means to query the wallet about Apple Pay and create Apple Pay tokens. You should get the instance of the ApplePayController from the Wallet singleton (e.g. 'Wallet.shared.applePayController')nnThe code snippet bellow demonstrates how the generate code is called when Apple Pay must be supportednn```nDine.shared.generateCode(hotelId: nil, restaurantId: THE_ID, displayDelegate: self, applePayController: Wallet.shared.applePayController, success: {ncode innn}n}, fail: {error innn})nnn//DisplayViewControllerDelegate implementationnfunc display(viewController: UIViewController) {nnself.present(viewController, animated: true, completion: nil)nn}nnnfunc dismiss(viewController: UIViewController) {nnviewController.dismiss(animated: true, completion: nil)nn}n```nIn the same manner, you must pass the `displayDelegate` to the payment function in order for Apple Pay to work.nnn##BenefitsnnIn order to support benefits add the following line to your podfile:n```npod "MyCheckDine/Benefits"n```nnYou can now use the static functions in the Benefits class to query and redeem benefits. Please refer to the API docs for more information.n## AuthorsnnElad Schiller, [email protected]## LicensennPlease read the LICENSE file available in the project",
    "homepage": "http://www.mycheck.io/",
    "license": {
        "type": "Custom",
        "file": "LICENSE"
    },
    "authors": {
        "elad schiller": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mycheck888/MyCheckDine.git",
        "tag": "1.4.6"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": [
        "MyCheckDine/Classes/*",
        "MyCheckDine/Classes/extenshions tools/**",
        "MyCheckDine/Classes/Networking/**",
        "MyCheckDine/Classes/objects/**",
        "MyCheckDine/Classes/OrderPoller/**"
    ],
    "dependencies": {
        "MyCheckCore": [],
        "Gloss": []
    },
    "subspecs": [
        {
            "name": "Benefits",
            "dependencies": {
                "MyCheckCore": []
            },
            "source_files": "MyCheckDine/Classes/Benefits/**/*",
            "platforms": {
                "ios": "9.0"
            }
        }
    ]
}

Pin It on Pinterest

Share This