Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Requirement Gathering:

    • Plugin Dashboard Repo - Local Dev Setup & Research. 

      • Develop overview of system.

      • Define system purpose.

    • Shopify Dashboard & Research.

      • Develop overview of Shopify system.

      • Define Shopify requirements.

  2. Planning & Design:
    The plugin is broken down into components, namely:

    1. Shopify Admin App Setup

    2. DB Schema

    3. App install

    4. App uninstall

    5. App Configuration

  3. Implementation:

    1. Plugin Dashboard Repo - Local Dev Setup & Research. 

      1. Setup environment to develop - environment specifics needed for the repo to work.

        1. RabbitMQ : Add settings.

          1. Docker-Compose file:

            Code Block
              rabbitmq:
                image: rabbitmq:3.8
                container_name: plugindashboard_rabbitmq
                ports:
                  - "5672:5672"
                  - "15672:15672"
                healthcheck:
                  test: ["CMD", "rabbitmqctl", "status"]
                  interval: 30s
                restart: unless-stopped
                volumes:
                  - ../shared-data/rabbitmq:/var/lib/rabbitmq
        2. Docker-Compose and Parameters file need to have the App’s Client Id & Client Secret added.
          Both are Hex value strings.

          1. Docker-Compose file:

            Code Block
                  NETCOMM_API_KEY: 2de2b028c0c30db8de8e44c5bacfd5ed 
                  NETCOMM_API_SECRET: c3c5932fa8aeb97b80eddf132bc11abf
          2. Parameters file:

            Code Block
                netcomm_api_key: '%env(NETCOMM_API_KEY)%'
                netcomm_api_secret: '%env(NETCOMM_API_SECRET)%'
        3. So based upon our tech stack it seems like we actually just use the PHP library / dependancy to intergrate the app with Shopify.

          1. Composerr.json → "phpclassic/php-shopify": "~1.0",
            https://github.com/phpclassic/php-shopify.git

    2. Shopify Dashboard & Research.

      1. Learn what Shopify requires and how to do development with them.
        Shopify PHP - https://github.com/Shopify/shopify-api-php
        https://shopify.dev/docs/apps/launch/app-requirements-checklist
        https://shopify.dev/docs/api/app-bridge

      2. Shopify app authentication and authorization.
        https://shopify.dev/docs/apps/build/authentication-authorization
        https://shopify.dev/docs/apps/build/authentication-authorization/set-embedded-app-authorization?extension=javascript

        1. Authentication is the process of verifying the identity of the user or the app. To keep transactions on Shopify’s platform safe and secure, all apps connecting with Shopify APIs must authenticate when making API requests.

        2. Authorization is the process of giving permissions to apps. When an app user installs a Shopify app they authorize the app, enabling the app to acquire an access token. For example, an app might be authorized to access orders and product data in a store.
          Outline of the Shopify Auth process:

          1. Create a route for starting the OAuth method such as /installAction.

          2. In this route, the Shopify\Auth\OAuth::begin method will be used.

          3. The begin method returns a URL that will be used for redirecting the user to the Shopify Authentication screen to complete the OAuth process, your app needs to validate the callback request made by Shopify after the merchant authorizes your app to access their store data.

          4. To do that, you can call the Shopify\Auth\OAuth::callbackAction method in the endpoint defined in the redirectPath argument of the begin method.

        3. In the Shopify App Dashboard Configuration Settings these must be added for installation and authentication (The callback verification):

          1. App URL

          2. Preferences URL (optional)

          3. Allowed redirection URL(s)

        4. Compliance Webhooks that Shopify requires to be registered.
          Every app that's distributed through the Shopify App Store must subscribe to the following compliance webhook topics in the Partner Dashboard:

          1. Customer data request endpoint - customers/data_request - Requests to view stored customer data.

          2. Customer data erasure endpoint - customers/redact - Requests to delete customer data.

          3. Shop data erasure endpoint - shop/redact - Requests to delete shop data.
            When you receive one of the compliance webhooks, you need to take the following actions:

            • Confirm that you've received the request by responding with a 200 series status code.

            • Complete the action within 30 days of receiving the request. However, if you're unable to comply with a redaction request because you're legally required to retain data, then you shouldn't complete the action.

      3. Shopify - Ngrok.
        In the Shopify ecosystem, embedded apps run in an iframe in a production environment. In order to test the functionality of your app within that context in development, you’re going to want to tunnel what you have running locally to an accessible URL.

        1. https://ngrok.com/

        2. Setup Ngrok for local development with Shopify platform.

          1. Set the Ngrok URL as the URL for your webhook call backs in Shopify Admin.

          2. Customer data request endpoint → https://a80d-41-193-138-209.ngrok-free.app/netcomm/customers/data_request

    3. DB Schema

      Code Block TABLE `netcomm_configuration` : `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `shop_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `access_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `app_uninstall_web_hook_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_fulfilled_web_hook_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `widget_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `widget_language` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `terms_and_conditions` tinyint(1) NOT NULL DEFAULT '1', `instruction` tinyint(1) NOT NULL, `shop_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `shop_interface_password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `netcomm_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `store_data` longtext COLLATE utf8_unicode_ci, `enabled` tinyint(1) NOT NULL DEFAULT 'false', `created` datetime NOT NULL, `updated` datetime NOT NULL, `member_of_netcomm` tinyint(1) NOT NULL DEFAULT 'false', `member_of_ekomi` tinyint(1) NOT NULL DEFAULT 'false', PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_89D23822678D9590` (`shop_url`), UNIQUE KEY `UNIQ_89D238224D16C4DD` (`shop_id`), UNIQUE KEY `UNIQ_89D23822B6A2DD68` (`access_token`), UNIQUE KEY `UNIQ_89D23822A76ED395` (`user_id`), CONSTRAINT `FK_89D23822A76ED395` FOREIGN KEY (`user_id`) REFERENCES `fos_user` (`id`)

      Create Table: netcomm_configuration
      Advised to have the user_id and other fields as they will probably part of a plan or future relationship.

      netcomm.pngImage Added

    4. Install - Process definition:

      1. Install requires registration as an app provider.

      2. Authentication process and Token exchange.

      3. The app registers within Shopify and Customer shop.

      4. Privilege establishment.

      5. Persists to DB.

    5. Uninstall

      1. Authentication process and Token exchange.

      2. The app un-registers within Shopify and Customer shop.

      3. Deletes from DB.
        Link to Uninstall process flow.

    6. Configuration CRUD

      1. Configuration settings. App requires configuring.
        Options are provided to be either an eKomi client or Netcomm or both.

        1. eKomi Client settings:

          1. ShopId

          2. Shop Interface Password

        2. Netcomm Client settings:

          1. NetcommId

      2. App configuration will be persisted in the DB.
        CRUD functionality.
        Link to Configuration process flow.

    7. Refactor / Testing Phase.

    8. Identify issues and refactor

    9. Documentation / Commenting.

      1. Document Shopify requirements for apps.

      2. Explain where app meets requirements.

      3. Comment functions and classes.

...