Skip to content

title: KB: iUsed - Refurbisher Connector Setup type: kb language: nl tags: [iused, citg, refurbisher, connector, laravel, horizon, orderverwerking, offerfeed, shipment]


KB: iUsed - Refurbisher Connector Setup

Terug naar klant: CITg iUsed

Example tasks

ClickUp tasks as an example of this procedure:

  • IUS-3304 refurbisher SYA - Orderkoppeling automatiseren

IRP Refurbisher Connector Configuration

URI (IRP Accept example):
/refurbisher-offers-configuration

IRP filepath

The configuration is saved as a JSON file in the IRP Storage filepath: /storage/app/config.json

Example configuration of Sell Your Apple

    "sellyourapple-test": {
      "name": "Sell Your Apple",
      "refurbisher_id": 20,
      "sandbox": true,
      "offers": {
        "connection": "web",
        "endpoint": "https://staging.publishtool.syanv.be/feeds/iused.json",
        "auth": {
          "type": "basicauth",
          "username": "iused",
          "password": "XXXXXX-ENCRYPTED-XXXXXXXX"
        },
        "type": "json",
        "paginate": false,
        "offer_location": "",
        "price_locale": "en_US",
        "mapping": {
          "name": "name",
          "sku": "sku",
          "stock_available": "stock",
          "ean": "ean",
          "price_purchase_amount": "price"
        }
      },
      "order": {
        "connection": "web",
        "endpoint": "https://staging.publishtool.syanv.be/api/v1/order",
        "auth": {
          "type": "basicauth",
          "username": "iused",
          "password": "XXXXXX-ENCRYPTED-XXXXXXXX"
        },
        "order_object": {
          "vendorOrderId": "id",
          "orderReference": "order.order_number",
          "shippingAddress.companyname": "orderShippingAddress.company",
          "shippingAddress.firstname": "orderShippingAddress.first_name",
          "shippingAddress.lastname": "orderShippingAddress.last_name",
          "shippingAddress.telephone": "!0612345678",
          "shippingAddress.zipCode": "orderShippingAddress.zipcode",
          "shippingAddress.houseNumber": "orderShippingAddress.house_number",
          "shippingAddress.houseNumberAddition": "orderShippingAddress.house_number_addition",
          "shippingAddress.street": "orderShippingAddress.street",
          "shippingAddress.city": "orderShippingAddress.city",
          "shippingAddress.countryCode": "orderShippingAddress.country->getIsoAlpha2",
          "shippingAddress.vatId": "!-",
          "shippingAddress.email": "!info@iused.nl",
          "items": "%ITEMS%"
        },
        "item_object": {
          "sku": "productVariant.refurbisherOffer.sku",
          "quantity": "quantity",
          "price": "productVariant.refurbisherOffer->getPricePurchaseAmountLocalizedWithoutCurrency(en_US)"
        },
        "response_object": {
          "asserts": {
            "status": "in:200",
            "orderId": "present|filled"
          },
          "fields": {
            "externalOrderReference": "orderId"
          }
        }
      }
    },

Password encryption: The passwords are encrypted using the Laravel encrypt() helper function via Laravel Tinker

# irp-accept@fl09plo-ius02:~/accept-portal.refurbishedcompany.com$ 
php artisan tinker
encrypt('XXXXXXXX-PASSWORD-XXXXXXXX');

Refurbisher Connector table

See MySQL table: refurbisher_configs

Insert query for creating this new Refurbisher Connector config:

INSERT INTO `refurbisher_configs` (`name`, `config_key`, `created_at`, `updated_at`) 
VALUES ('Sell Your Apple Sandbox', 'sellyourapple-test', NOW(), NOW());

Update query for setting the newly created Refurbisher Connector config to the Refurbisher:

UPDATE `refurbishers` SET `refurbisher_config_id` = 1007 WHERE `id` = 20;

Example offer JSON feed from Refurbisher

Example offer JSON feed from Refurbisher: "Sell Your Apple"

[
    {
        "name": "iMac|21,5\"|2019|3.0GHzCorei5(I5-8500)|1TBHDDFUSIONDRIVE|8GBRAM|SILVER|CGRADE|FRENCH",
        "sku": "5487567737986",
        "stock": 1,
        "ean": "5487567737986",
        "price": 359.27999999999997
    },
    {
        "name": "iMac|21,5\"|2019|3.0GHzCorei5(I5-8500)|1TBHDDFUSIONDRIVE|8GBRAM|SILVER|CGRADE|UK/NL",
        "sku": "5487567823009",
        "stock": 1,
        "ean": "5487567823009",
        "price": 359.27999999999997
    },
    {
        "name": "iMac|21,5\"|2019|3.0GHzCorei5(I5-8500)|1TBHDDFUSIONDRIVE|8GBRAM|SILVER|CGRADE|GERMAN",
        "sku": "5487568119743",
        "stock": 1,
        "ean": "5487568119743",
        "price": 359.27999999999997
    }
]

Example order push to Refurbisher

Example order push to Refurbisher: "Sell Your Apple"

{
    "vendorOrderId": "123",
    "orderReference": "orderReference",
    "shippingAddress": {
        "firstName": "John",
        "lastName": "Doe",
        "street": "Sesame Street",
        "houseNumber": "1",
        "houseNumberAddition": " bus A",
        "zipCode": "9000",
        "city": "Gent",
        "countryCode": "BE",
        "companyName": "Doe Inc",
        "vatId": "BE1234.567.890",
        "telephone": "+32 9 123 45 67",
        "email": "foo@bar.com"
    },
    "items": [
        {
            "sku": "8785253491271",
            "quantity": 2,
            "price": 123.45
        },
        {
            "sku": "8785253491272",
            "quantity": 1,
            "price": 456.78
        }
    ]
}