emico / magento-2-robinhq
Magento 2 module for RobinHQ integration. Provides API endpoints for RobinHQ dynamic API
Installs: 206 846
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 10
Forks: 12
Open Issues: 3
Type:magento2-module
Requires
- php: >=8.0 <=8.4
- ext-json: *
- emico/robinhq-lib: ^4.0
- laminas/laminas-diactoros: ^2.0|^3.0
- magento/framework: 101.*|102.*|103.*
- magento/module-catalog: 102.*|103.*|104.*
- magento/module-config: 101.*
- magento/module-customer: 101.*|102.*|103.*
- magento/module-sales: 101.*|102.*|103.*
- webmozart/assert: ^1.4
Requires (Dev)
- codeception/codeception: ^5.1
- mockery/mockery: ^1.6
Suggests
- magento/framework-message-queue: Use Magento AMQP queuing for POST requests. Highly recommended
- magento/module-message-queue: Use Magento AMQP queuing for POST requests. Highly recommended
- dev-master
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0
- v3.0.0
- v2.5.1
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.0
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- 1.2.1
- v1.2.0
- v1.2.0-beta.1
- v1.1.3
- v1.1.3-beta.2
- v1.1.3-beta.1
- v1.1.2
- v1.1.1
- v1.1
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-rc1
- v0.1.1
- v0.1.0
- v0.1.0-beta3
- v0.1.0-beta2
- v0.1.0-beta1
- dev-fix/depersonalized-customer-issue
- dev-fix/view
- dev-bramstroker-patch-1
- dev-feat/js-widgets
- dev-feature/magento2.4.6-compatibility
- dev-issue/magento-244-p2-config-compatibility
- dev-fix/magento-243-compat2
- dev-fix/magento-243-compat
- dev-fix/search-customer-for-all-websites
- dev-issue/37-dutch-phonenumber-recognition
- dev-feature/php-compatibility
- dev-feature/magento-2.4.4-compatibility
- dev-feature/rma
- dev-feature/tracktrace
This package is auto-updated.
Last update: 2024-12-17 10:03:43 UTC
README
Provides API integrations with the RobinHQ platform / dashboards
Installation
Prerequisites
- Magento 2.4.4 or higher
- PHP 8.0 or higher
Install package using composer
composer require emico/magento-2-robinhq
Run installers
php bin/magento setup:upgrade
Dynamic API
This module provides 5 endpoints for the RobinHQ dynamic API integration. This endpoints are called directly from within the RobinHQ dashboard, providing the latest up to date information from Magento.
The following endpoints are available:
- /robinhq/api/customer?email=
$EmailAddress
- /robinhq/api/customerOrders?email=
$EmailAddress
- /robinhq/api/order?orderNumber=
$Id
- /robinhq/api/search?searchTerm=
$Expression
- /robinhq/api/lifetime?email=
$Email
Those are accessible from the root of your magento domain. http://my.shop.nl/robinhq/api/customer
To enable the dynamic API functionality you have to enable it in the configuration.
Stores
-> Configuration
-> Emico
-> RobinHQ
-> Enable dynamic API
Authentication
The authentication of the dynamic API is done by a pre shared key which must be communicated to RobinHQ.
You can define an API key and secret in the RobinHQ configuration.
When issueing requests to the dynamic API endpoint you have to include a Basic authentication header.
The value you have to sent is a base64-encoding of {apiKey}:{apiSecret}
.
For example you have set up API key to abc
and API secret to def
.
The value would be base64(abc:def)
, which resolves to YWJjOmRlZg==
.
The full authorization header is:
Authorization: Basic YWJjOmRlZg==
Customize panelview and detailview
Some endpoints provide the possibility to provide custom data in the Robin dashboards.
For example when retrieving customer details using /robinhq/api/customer
the following payload is returned.
{
"naam": "Robin Doe",
...
"panel_view": {
"street": "Lovinklaan 1",
...
"my_customfield1": "234",
"loyalty_card_number": "1265645456"
}
}
You can simply add custom attributes to these views in the configuration.
Stores
-> Configuration
-> Emico
-> RobinHQ
-> Custom Attributes
section.
When you need even more control or implement your own bussiness logic you can implement the interfaces DetailViewProviderInterface
or CustomerPanelViewProviderInterface
.
For example:
namespace MyVendor\MyModule;
class MyPanelViewProvider implements CustomerPanelViewProviderInterface
{
public function getData(CustomerInterface $customer): array
{
return [
'my_custom_field' => 'some value'
]
}
}
Register in your di.xml
<virtualType name="Emico\RobinHq\DataProvider\PanelView\CustomerPanelViewProvider" type="Emico\RobinHq\DataProvider\PanelView\AggregateProvider">
<arguments>
<argument name="providers" xsi:type="array">
<item name="mydata" xsi:type="object">MyVendor\MyModule\MyPanelViewProvider</item>
</argument>
</arguments>
</virtualType>
Dynamic API POST requests
For complete integration with Robin dynamic API the Magento module needs to issue POST requests to the RobinHQ platform.
For this functionality to work correctly it is mandatory to have a working RabbitMQ instance. You can read more about setting this up in the Magento documentation.
Use the following command to process the message queue:
bin/magento queue:consumers:start EmicoRobinHq
You can configure this in a cronjob or preferably using supervisor.
Frontend widgets
This module provides a widget to display the RobinHQ tracking script on your website. This makes it possible to gain insight into all products viewed by the customer and the contents of the shopping cart. Should work out of the box with the default Luma theme.
See: https://developers.cm.com/mobile-service-cloud/docs/viewed-products
To enable this feature you have to enable it in the configuration.
Stores
-> Configuration
-> Emico
-> RobinHQ
-> Enable viewed products tracking