GithubHelp home page GithubHelp logo

commercelayer / commercelayer-sdk Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 5.0 10.39 MB

The official Commerce Layer JavaScript library wrapper, that makes it quick and easy to interact with Commerce Layer API.

License: MIT License

TypeScript 99.38% Smarty 0.59% JavaScript 0.03%
commercelayer

commercelayer-sdk's People

Contributors

acasazza avatar bolajiayodeji avatar dependabot[bot] avatar glemmal avatar marcomontalbano avatar pviti avatar semantic-release-bot avatar sfiorucci avatar

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

Watchers

 avatar  avatar  avatar  avatar

commercelayer-sdk's Issues

Breaking change in a minor release

Type: Versioning issue

Hey there!

While trying to upgrade this sdk from version 2.0.1 to 2.3.6, I'm getting issues with the install related to my node version.
In the previous release the engine version was not set, but with this change the node engine version is introduced (asking for v16.0.0) causing the install to fail.

4846a36#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R72

Node version: v14.18.1

This change wouldn't be expected to land in a minor version following semantic versioning.

Is it related to some installed dependency necessary for this SDK?
Is it possible to backport the added changes to a stable 2.x.x version?

Additional note:
There's no changelog kept in which we could find the previous version to resolve easily, which does not include these changes so we can use a stable version of this package.

Updates to the build system break absolute import paths

Type: Bug

Hey guys!

After updating to v2.3.7 I found that our imports (like import * from '@commercelayer/sdk/lib/resources/...') do not work anymore as the entrypoint is changed from lib/index.js to lib/cjs/index.js. We still could resolve through the cjs path, but this change requires unexpected updates inside our codebase.

This was introduced in this change.
937310f

For now I have made the version strict to v2.2.0 which does not change the build process.
This kind of change would be a breaking change as the consumers of the package need to actively update their applications to support it!
Thanks for looking into it!

Update resources to schema v4.15.1

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

Update SDK resources to API schema v4.5.1

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

no

Additional context

No response

The automated release is failing 🚨

🚨 The automated release from the sdk4 branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the sdk4 branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 4.27.1 on branch sdk4 cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=5.0.0 can be published from branch sdk4.

The following commits are responsible for the invalid release:

  • fix(core): fix release script (b12de32)
  • fix(core): update resources to schema 4.1.3 (fce379e)
  • chore(core): update resources to schema 4.1.2 (bfd19a1)

Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch sdk4 with git revert or git reset.

A valid branch could be main or sdk4.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Self references are not normalized

Let's say we have an order with two line items:

{
  "id": "abc",
  "type": "orders",
  "line_items": [{
    "id": "111",
    "type": "line_items"
  }, {
    "id": "222",
    "type": "line_items"
  }]
}

When executing a CRUD action on one of the line items and including the order and order.line_items references, the normalized order.line_items object doesn't include the line item that the CRUD operation was executed upon:

await client.line_items.update({
  id: "111",
  quantity: 1,
}, {
  include: ["order", "order.line_items"],
})

returns

{
  id: "111",
  type: "line_items",
  // ...
  order: {
    id: "abc",
    type: "orders",
    // ...
    line_items: [{
      id: "222",
      type: "line_items",
    }
    // line item "111" is missing here, while it's part of the order
    ]
  },
}

My guess is the API doesn't return this information to save on bytes sent, but the normalization function doesn't take this circular reference into account.

Could the SDK be changed such that the line item with ID "111" would be included in the response?

Remove Axios to make isomorphic ?

Any chance you can build a isomorphic SDK here? Currently, you use axios for the fetch in client.ts, which makes it impossible to use this SDK on the newer edge platforms like Cloudflare Workers (NextJs Edge also, which runs on Cloudflare) or Deno. I believe if you just switched the client to simply use standard fetch, it would work fine on Cloudflare Workers/Deno.

Add PayPal payment source method results in API 500 error

Hi @pviti - @acasazza - We are trying to create a PayPal payment source to an order where user selected this payment method, the order entity is:

{
  "id": "wLmohaoYRy",
  "type": "orders",
  "number": 17093789,
  "autorefresh": true,
  "status": "draft",
  "payment_status": "unpaid",
  "fulfillment_status": "unfulfilled",
  "guest": true,
  "editable": true,
  "customer_email": null,
  "language_code": "en",
  "currency_code": "CAD",
  "tax_included": false,
  "tax_rate": null,
  "freight_taxable": null,
  "requires_billing_info": false,
  "country_code": "CA",
  "shipping_country_code_lock": null,
  "coupon_code": null,
  "gift_card_code": null,
  "gift_card_or_coupon_code": null,
  "subtotal_amount_cents": 7200,
  "subtotal_amount_float": 72,
  "formatted_subtotal_amount": "$72.00",
  "shipping_amount_cents": 0,
  "shipping_amount_float": 0,
  "formatted_shipping_amount": "$0.00",
  "payment_method_amount_cents": 0,
  "payment_method_amount_float": 0,
  "formatted_payment_method_amount": "$0.00",
  "discount_amount_cents": 0,
  "discount_amount_float": 0,
  "formatted_discount_amount": "$0.00",
  "adjustment_amount_cents": 0,
  "adjustment_amount_float": 0,
  "formatted_adjustment_amount": "$0.00",
  "gift_card_amount_cents": 0,
  "gift_card_amount_float": 0,
  "formatted_gift_card_amount": "$0.00",
  "total_tax_amount_cents": 0,
  "total_tax_amount_float": 0,
  "formatted_total_tax_amount": "$0.00",
  "subtotal_tax_amount_cents": 0,
  "subtotal_tax_amount_float": 0,
  "formatted_subtotal_tax_amount": "$0.00",
  "shipping_tax_amount_cents": 0,
  "shipping_tax_amount_float": 0,
  "formatted_shipping_tax_amount": "$0.00",
  "payment_method_tax_amount_cents": 0,
  "payment_method_tax_amount_float": 0,
  "formatted_payment_method_tax_amount": "$0.00",
  "adjustment_tax_amount_cents": 0,
  "adjustment_tax_amount_float": 0,
  "formatted_adjustment_tax_amount": "$0.00",
  "total_amount_cents": 7200,
  "total_amount_float": 72,
  "formatted_total_amount": "$72.00",
  "total_taxable_amount_cents": 7200,
  "total_taxable_amount_float": 72,
  "formatted_total_taxable_amount": "$72.00",
  "subtotal_taxable_amount_cents": 7200,
  "subtotal_taxable_amount_float": 72,
  "formatted_subtotal_taxable_amount": "$72.00",
  "shipping_taxable_amount_cents": 0,
  "shipping_taxable_amount_float": 0,
  "formatted_shipping_taxable_amount": "$0.00",
  "payment_method_taxable_amount_cents": 0,
  "payment_method_taxable_amount_float": 0,
  "formatted_payment_method_taxable_amount": "$0.00",
  "adjustment_taxable_amount_cents": 0,
  "adjustment_taxable_amount_float": 0,
  "formatted_adjustment_taxable_amount": "$0.00",
  "total_amount_with_taxes_cents": 7200,
  "total_amount_with_taxes_float": 72,
  "formatted_total_amount_with_taxes": "$72.00",
  "fees_amount_cents": 0,
  "fees_amount_float": 0,
  "formatted_fees_amount": "$0.00",
  "duty_amount_cents": null,
  "duty_amount_float": null,
  "formatted_duty_amount": null,
  "skus_count": 7,
  "line_item_options_count": 0,
  "shipments_count": 1,
  "payment_source_details": null,
  "cart_url": null,
  "return_url": null,
  "terms_url": null,
  "privacy_url": null,
  "checkout_url": null,
  "placed_at": null,
  "approved_at": null,
  "cancelled_at": null,
  "payment_updated_at": null,
  "fulfillment_updated_at": null,
  "refreshed_at": null,
  "archived_at": null,
  "expires_at": null,
  "created_at": "2021-12-15T14:48:43.093Z",
  "updated_at": "2021-12-15T14:48:47.323Z",
  "reference": null,
  "reference_origin": null,
  "metadata": {},
  "shipping_address": {
    "id": "bRMNuORrex",
    "type": "addresses",
    "business": false,
    "first_name": "Alonso",
    "last_name": "Shipping",
    "company": null,
    "full_name": "Alonso Shipping",
    "line_1": "shipping address test street 23",
    "line_2": null,
    "city": "Toronto",
    "zip_code": "66777",
    "state_code": "ON",
    "country_code": "CA",
    "phone": "877 734 9292",
    "full_address": "shipping address test street 23, 66777 Toronto ON (CA) 877 734 9292",
    "name": "Alonso Shipping, shipping address test street 23, 66777 Toronto ON (CA) 877 734 9292",
    "email": null,
    "notes": null,
    "lat": null,
    "lng": null,
    "is_localized": false,
    "is_geocoded": false,
    "provider_name": null,
    "map_url": null,
    "static_map_url": null,
    "billing_info": null,
    "created_at": "2021-12-15T14:48:44.568Z",
    "updated_at": "2021-12-15T14:48:44.568Z",
    "reference": null,
    "reference_origin": null,
    "metadata": {}
  },
  "billing_address": null,
  "available_payment_methods": [
    {
      "id": "ZMDJWsDzzm",
      "type": "payment_methods",
      "payment_source_type": "paypal_payments",
      "name": "Paypal Payment",
      "moto": false,
      "disabled_at": null,
      "price_amount_cents": 0,
      "price_amount_float": 0,
      "formatted_price_amount": "$0.00",
      "created_at": "2021-12-01T18:49:07.218Z",
      "updated_at": "2021-12-01T18:49:07.218Z",
      "reference": "",
      "reference_origin": "",
      "metadata": {}
    },
    {
      "id": "GMvVesxZxM",
      "type": "payment_methods",
      "payment_source_type": "stripe_payments",
      "name": "Stripe Payment",
      "moto": false,
      "disabled_at": null,
      "price_amount_cents": 0,
      "price_amount_float": 0,
      "formatted_price_amount": "$0.00",
      "created_at": "2021-11-30T20:38:09.590Z",
      "updated_at": "2021-11-30T20:38:09.590Z",
      "reference": "",
      "reference_origin": "",
      "metadata": {}
    }
  ],
  "payment_method": {
    "id": "ZMDJWsDzzm",
    "type": "payment_methods",
    "payment_source_type": "paypal_payments",
    "name": "Paypal Payment",
    "moto": false,
    "disabled_at": null,
    "price_amount_cents": 0,
    "price_amount_float": 0,
    "formatted_price_amount": "$0.00",
    "created_at": "2021-12-01T18:49:07.218Z",
    "updated_at": "2021-12-01T18:49:07.218Z",
    "reference": "",
    "reference_origin": "",
    "metadata": {}
  },
  "payment_source": null,
  "line_items": [
    {
      "id": "NmnptYWOdo",
      "type": "line_items",
      "sku_code": null,
      "bundle_code": null,
      "quantity": 1,
      "currency_code": "CAD",
      "unit_amount_cents": 0,
      "unit_amount_float": 0,
      "formatted_unit_amount": "$0.00",
      "options_amount_cents": 0,
      "options_amount_float": 0,
      "formatted_options_amount": "$0.00",
      "discount_cents": 0,
      "discount_float": 0,
      "formatted_discount": "$0.00",
      "total_amount_cents": 0,
      "total_amount_float": 0,
      "formatted_total_amount": "$0.00",
      "tax_amount_cents": 0,
      "tax_amount_float": 0,
      "formatted_tax_amount": "$0.00",
      "name": "Paypal Payment",
      "image_url": null,
      "discount_breakdown": {},
      "tax_rate": 0,
      "tax_breakdown": {},
      "item_type": "payment_methods",
      "created_at": "2021-12-15T14:48:47.321Z",
      "updated_at": "2021-12-15T14:48:47.321Z",
      "reference": null,
      "reference_origin": null,
      "metadata": {}
    },
    {
      "id": "yWEZtQwBlD",
      "type": "line_items",
      "sku_code": "10152101048",
      "bundle_code": null,
      "quantity": 2,
      "currency_code": "CAD",
      "unit_amount_cents": 1100,
      "unit_amount_float": 11,
      "formatted_unit_amount": "$11.00",
      "options_amount_cents": 0,
      "options_amount_float": 0,
      "formatted_options_amount": "$0.00",
      "discount_cents": 0,
      "discount_float": 0,
      "formatted_discount": "$0.00",
      "total_amount_cents": 2200,
      "total_amount_float": 22,
      "formatted_total_amount": "$22.00",
      "tax_amount_cents": 0,
      "tax_amount_float": 0,
      "formatted_tax_amount": "$0.00",
      "name": "AEROCHAMBER PLUS* FLOW-VU* Chamber Small Mask",
      "image_url": "",
      "discount_breakdown": {},
      "tax_rate": 0,
      "tax_breakdown": {},
      "item_type": "skus",
      "created_at": "2021-12-15T14:48:43.576Z",
      "updated_at": "2021-12-15T14:48:43.576Z",
      "reference": null,
      "reference_origin": null,
      "metadata": {}
    },
    {
      "id": "kqYatlnXgB",
      "type": "line_items",
      "sku_code": "12350101060",
      "bundle_code": null,
      "quantity": 5,
      "currency_code": "CAD",
      "unit_amount_cents": 1000,
      "unit_amount_float": 10,
      "formatted_unit_amount": "$10.00",
      "options_amount_cents": 0,
      "options_amount_float": 0,
      "formatted_options_amount": "$0.00",
      "discount_cents": 0,
      "discount_float": 0,
      "formatted_discount": "$0.00",
      "total_amount_cents": 5000,
      "total_amount_float": 50,
      "formatted_total_amount": "$50.00",
      "tax_amount_cents": 0,
      "tax_amount_float": 0,
      "formatted_tax_amount": "$0.00",
      "name": "AEROCHAMBER2GO* Chamber",
      "image_url": "",
      "discount_breakdown": {},
      "tax_rate": 0,
      "tax_breakdown": {},
      "item_type": "skus",
      "created_at": "2021-12-15T14:48:43.562Z",
      "updated_at": "2021-12-15T14:48:43.562Z",
      "reference": null,
      "reference_origin": null,
      "metadata": {}
    }
  ],
  "shipments": [
    {
      "id": "YOvmCZzmZb",
      "type": "shipments",
      "number": "17093789/S/001",
      "status": "draft",
      "currency_code": "CAD",
      "cost_amount_cents": 0,
      "cost_amount_float": 0,
      "formatted_cost_amount": "$0.00",
      "skus_count": 7,
      "selected_rate_id": null,
      "rates": [],
      "purchase_error_code": null,
      "purchase_error_message": null,
      "get_rates_started_at": null,
      "get_rates_completed_at": null,
      "purchase_started_at": null,
      "purchase_completed_at": null,
      "purchase_failed_at": null,
      "created_at": "2021-12-15T14:48:44.940Z",
      "updated_at": "2021-12-15T14:48:44.940Z",
      "reference": null,
      "reference_origin": null,
      "metadata": {},
      "shipping_method": null,
      "available_shipping_methods": [
        {
          "id": "vNKdPFoGXV",
          "type": "shipping_methods",
          "name": "SM.CAD.FlatFee",
          "disabled_at": null,
          "currency_code": "CAD",
          "price_amount_cents": 500,
          "price_amount_float": 5,
          "formatted_price_amount": "$5.00",
          "free_over_amount_cents": 20000,
          "free_over_amount_float": 200,
          "formatted_free_over_amount": "$200.00",
          "price_amount_for_shipment_cents": 500,
          "price_amount_for_shipment_float": 5,
          "formatted_price_amount_for_shipment": "$5.00",
          "created_at": "2021-11-08T21:39:12.242Z",
          "updated_at": "2021-12-13T13:37:48.438Z",
          "reference": "",
          "reference_origin": "",
          "metadata": {}
        },
        {
          "id": "yVwXrFDLlE",
          "type": "shipping_methods",
          "name": "SM.CAD.Ground",
          "disabled_at": null,
          "currency_code": "CAD",
          "price_amount_cents": 1000,
          "price_amount_float": 10,
          "formatted_price_amount": "$10.00",
          "free_over_amount_cents": 20000,
          "free_over_amount_float": 200,
          "formatted_free_over_amount": "$200.00",
          "price_amount_for_shipment_cents": 1000,
          "price_amount_for_shipment_float": 10,
          "formatted_price_amount_for_shipment": "$10.00",
          "created_at": "2021-11-08T21:39:47.653Z",
          "updated_at": "2021-12-14T17:56:11.448Z",
          "reference": "",
          "reference_origin": "",
          "metadata": {}
        },
        {
          "id": "ZEkJxFoMRV",
          "type": "shipping_methods",
          "name": "SM.CAD.Express",
          "disabled_at": null,
          "currency_code": "CAD",
          "price_amount_cents": 1500,
          "price_amount_float": 15,
          "formatted_price_amount": "$15.00",
          "free_over_amount_cents": 20000,
          "free_over_amount_float": 200,
          "formatted_free_over_amount": "$200.00",
          "price_amount_for_shipment_cents": 1500,
          "price_amount_for_shipment_float": 15,
          "formatted_price_amount_for_shipment": "$15.00",
          "created_at": "2021-11-08T21:40:16.684Z",
          "updated_at": "2021-12-14T17:56:31.552Z",
          "reference": "",
          "reference_origin": "",
          "metadata": {}
        }
      ]
    }
  ]
}

When calling the payment source creation like this:

const paymentSource = {
{
    "return_url": "https://checkout.yourdomain.com/jNbQLhMeqo/success",
    "cancel_url": "https://checkout.yourdomain.com/jNbQLhMeqo/cancel",
    order: clClient.orders.relationship(order.id),
}

await clClient.paypal_payments.create(paymentSource)

We received the following error:
Screenshot 2021-12-15 at 15 59 05

Is hard to know what's happening because the 500 error don't provide any details, the PayPal gateway is properly configured in the CL administration UI and the required parameters are passed following the API TS definition and the example from: https://docs.commercelayer.io/developers/v/how-tos/payments/paypal/adding-a-paypal-payment-source

Can you provide guidance on what is missing in this API call that could be originating this error?

Thanks!

Order resource or order ID reference not returned on line item create

When creating a order SKU line item and resolving the response, the resulting resource is not providing the order entity nor the order reference ID, this force the need of fetching again the created line item or the order including 'line_items'.

We have implemented a code like this:

  const createPromises = orderItems.map((orderItem) => {
      return clClient.line_items.create(orderItem)
    })

    // TODO: Created order items don't return associated order, open CL issue.
    const itemsCreated = await Promise.all(createPromises)
    console.log('Create line item: ', itemsCreated)
    // Get order ID from first create line item reference and load the latest order state.
    const orderId = first(orderItems).order.id
    const order = await clClient.orders.retrieve(orderId, {
      include: ['line_items']
    })

    dispatch(composeDataAction(actionTypes.CREATE_DRAFT_ORDER, order))
  } catch (error) {
    console.log('Add order items error: ', error)
  }

The orderItems are LineItemCreate objects like this:

    const orderItems = [
      {
        sku_code: 'BABYONBU000000E63E746MXX',
        quantity: 2,
        order: clClient.orders.relationship(order.id)
      }
    ]

When the line item is created, this is the returned resource:

    Create line item:  [
        {
          id: 'ywLGtLwwaA',
          type: 'line_items',
          sku_code: 'BABYONBU000000E63E746MXX',
          bundle_code: null,
          quantity: 2,
          currency_code: 'USD',
          unit_amount_cents: 3480,
          unit_amount_float: 34.8,
          formatted_unit_amount: '$34.80',
          options_amount_cents: 0,
          options_amount_float: 0,
          formatted_options_amount: '$0.00',
          discount_cents: 0,
          discount_float: 0,
          formatted_discount: '$0.00',
          total_amount_cents: 6960,
          total_amount_float: 69.6,
          formatted_total_amount: '$69.60',
          tax_amount_cents: 0,
          tax_amount_float: 0,
          formatted_tax_amount: '$0.00',
          name: 'Black Baby Onesie Short Sleeve with Pink Logo (6 Months)',
          image_url: 'https://img.commercelayer.io/skus/BABYONBU000000E63E74.png?fm=jpg&q=90',
          discount_breakdown: {},
          tax_rate: 0,
          tax_breakdown: {},
          item_type: 'skus',
          created_at: '2021-10-26T20:23:45.757Z',
          updated_at: '2021-10-26T20:23:45.757Z',
          reference: null,
          reference_origin: null,
          metadata: {}
        }
      ]

I tried to experiment with the params object as you did in the test https://github.com/commercelayer/commercelayer-sdk/blob/main/specs/resources/line_items.spec.ts#L34 to see if there was a way to include the "order" field but all the experiments that tried don't work and still need another request to get the order. Please let me know if there is a way to include the order in the response. Thanks!

Wrong enum in payment_source_type

Describe the bug

Attribute payment_source_type has wrong enum and description in the following resources:

payment_methods
payment_options

To Reproduce

No response

System

No response

Additional context

No response

Migration from js-sdk

Hi guys. I can't find a migration guide from the commercelayer-js-sdk to this one.

Is there one, or is it just a straight swap?

Cannot update cart quantity

I am trying to update the line item's quantity in the order but the API returns a validation error.

Steps:

  1. Add an SKU to the cart with external_price set to true.
  2. Try to update the quantity of the line item using line_items.update({id, quantity}).
  3. Update fails with error unit_amount_cents - doesn't match with the associated item one.

I think it is because I haven't created a dedicated price for this SKU.

Expectation:

It should let me update the quantity as I added the item to the cart using an external pricing mechanism.

Denormalizing response payloads

I spent some time reading the source code searching for a way to use the SDK types given a Commerce Layer response, and I could not find it.

I'm currently working on an external tax calculator. From the order payload it receives, I would like to use the Order type as if I was fetching the data manually.

As far as I can see, internally, the SDK has the normalize and denormalize functions that help with that. However, they are not being exposed to me.

Is there a way to do it?

What I have in mind right now would be something like the following:

const handler = (req: Request, res: Response) => {
  const order = denormalize<Order>(req.body) // `const order` is now implicitly of the `type Order`
  ...
}

Am I missing something? Is there an easier way to tackle that?
Any help is appreciated. Thank you!

Sometimes placing an order that use PayPal payment method result in SDK timeout

Hi @pviti - We are experiencing many SDK timeout requests when placing an order (transition to placed state) that use a PayPal payment source. Looks like behind the scenes CL backend is doing some operations that are time consuming and the SDK that tolerate a max timeout of 3 seconds determined that it took so much time and aborts the request. This is the error we see:

Screenshot 2022-01-06 at 16 19 00

However, besides this error, it looks that the order transition correctly to "placed" state and completes the PayPal payment processing because the order state looks like this:

Screenshot 2022-01-06 at 16 16 44

Is there a way to extend the SDK timeout? Can you help us to debug and determine why the "place" operation is taking 3 seconds sometimes and other times completing without exceeding the timeout?

The order ID of this test is: NbQLhleWOz

Thanks for your support!

Handle empty body errors

Describe the bug

SDK fails when an error ha an empty body (it shouldn't never happen but sometimes happens)

To Reproduce

No response

System

No response

Additional context

No response

The automated release is failing 🚨

🚨 The automated release from the sdk4 branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the sdk4 branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 4.28.0 on branch sdk4 cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=5.32.0 can be published from branch sdk4.

The following commits are responsible for the invalid release:

  • chore: add semantic-release (56bb5a9)
  • feat: update resources to schema v4.24.0 (aab9c11)
  • fix: bump version to v4.41.0 (76ac8ad)
  • feat: update resources to schema 4.23.0 (94d5586)
  • feat: update resources to schema v4.19.0 (58b7d6e)
  • chore: bump version to v4.39.0 (f972890)
  • feat: update resources to schema v4.18.0 (208af34)
  • feat(core): update resources to schema v4.16.0 (2e277c9)
  • feat(core): update resources to schema 4.14.0 (7affa7d)
  • chore(core): bump version to 4.36.0 (57424a1)
  • feat(core): update resources to schema 4.13.0 (647e442)
  • chore(core): bump version to 4.35.0 (2bfc24f)
  • feat(core): update resources to schema 4.12.0 (2d4595d)
  • fix(core): fix type export (f67d571)
  • feat(core): update resources to schema 4.11.0 (3834640)
  • feat(core): update resources to schema v4.10.1 (37756ed)
  • feat(core): update resources to schema v4.10.0 (160f081)
  • chore(core): update dependencies (2f52241)
  • chore(core): bump version to 4.31.0 (50577ca)
  • feat(core): update resources to schema 4.9.0 (240b106)
  • chore(core): bump version to 4.30.0 (7d203e0)
  • feat(core): update resources to version 4.8.0 (5795eac)
  • feat(core): update resources to schema 4.5.0 (61008fd)
  • chore(core): bump version to 4.28.0 (bbcb5c7)
  • feat(core): update resources to schema 4.4.0 (a46e81e)
  • chore(core): update dependencies (6ce43b9)
  • fix(core): disable release script (4ffda8b)
  • fic(core): fix release script (b1723f3)
  • fix(core): fix release script (b12de32)
  • fix(core): update resources to schema 4.1.3 (fce379e)
  • chore(core): update resources to schema 4.1.2 (bfd19a1)

Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch sdk4 with git revert or git reset.

A valid branch could be main or sdk4.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

SDK 404 error when updating Payment Gateway resource

Hi @pviti, we are experiencing an error when updating a Payment Gateway resource to add a metadata field using a SDK procedure that is working well in other resources like SDK or PriceLists so seems to be specific issue to the Payment Gateway resource:

We have the following resource and apply the update with the following payload:
Screenshot 2022-02-22 at 15 18 51

The update procedure looks like this:
Screenshot 2022-02-22 at 15 40 17

Once the update run we receive the following error:
Screenshot 2022-02-22 at 15 19 03

Can you help us to investigate why the update is indicating that the resource is not found (404 error).

Thanks for your support!

jcont filter doesn't work

Describe the bug

We might have found a bug in your SDK library.
We are trying to search for a user with a specific field value in his metadata object.
According to this documentation it says that what we need to do is filter[q][metadata_jcont]={"key": "value"}
So here is how our SDK function call looks like.
client.customers.list({ filters: { metadata_jcont: { firstName: 'joh' } } });
But it seems like the SDK doesn’t transform this into the correct query params.
Looking at the SDK code we have found that inside generateQueryStringParams function you are doing
if (params.filters) {
Object.entries(params.filters).forEach(([p, v]) => {
qp[filter[q][${p}]] = String(v)
})
}
However String(v) in our case it will be String({ firstName: 'joh' }) which will result in [object Object]
We have changed it to
qp[filter[q][${p}]] = JSON.stringify(v)
which it seems like is fixing the problem.
Unfortunately that is not a valid fix because if we do for example
client.customers.list({ filters: { id_eq: "id_value" } });
That will not work, because JSON.stringify("id_value") will result to '"id_value"' .
We are going to with a dirty patch fix for now which it will be something like this
if (params.filters) {
Object.entries(params.filters).forEach(([p, v]) => {
if (p === 'metadata_jcont') {
qp[filter[q][${p}]] = JSON.stringify(v);
} else {
qp[filter[q][${p}]] = String(v);
}
});
}
but do you think it is a bug that you may consider fixing soon ?

To Reproduce

No response

System

No response

Additional context

No response

Add Stripe credit card payment source procedure is not clear

Hi @pviti - We was trying to figure out how to add a stripe payment source for a guest order but got errors when following the guides:

We are able to successfully get the order available payment methods and select (reference) one of this methods as the order payment method but when trying to create a payment source the example from your documentation is only passing the following payload:

"data": {
    "type": "stripe_payments",
    "attributes": {},
    "relationships": {
      "order": {
        "data": {
          "type": "orders",
          "id": "eqkykhjlVw"
        }
      }
    }

With the CL SDK I'm replicating this step in the following manner:

  const order = myOrderEntity
  const paymentSource = {
    options: {},
    order: clClient.orders.relationship(order.id),
  }
  // Create payment method source.
  const newPaymentSource = await clClient.stripe_payments.create(paymentSource)
  console.log('NewPaymentSource: ', newPaymentSource)

This produces the following errors:

Screenshot 2021-11-30 at 20 58 48

If we don't pass the options argument, the stripe_payments.create call don't produce an exception but returns undefined. Also is not clear at what step the customer needs to fill the credit card details and if that data should be passed as options, we was not able to find any example in the SDK specs tests or in the official documentation. Can you guide us on how to properly create a customer Stripe credit card payment source and associate to a guest order?

Thanks!

Improve middleware options

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

This SDK uses Axios under the hood, but doesn't expose it, making it unable for users to use libraries like axios-retry or axios-debug-log.

Even implementing something like axios-retry (exponential backoff) yourself for this client is nearly impossible because of the limited flexibility of the middleware. (There's no way to retry an operation in the error interceptor.)

I think this client could greatly benefit from exposing a standard way of adding request middleware, preferably by just using fetch and allowing developers to pass their own fetch implementation:

import { CommerceLayer } from "@commercelayer/sdk";

const extendedFetch = extendFetch(fetch);
const client = CommerceLayer({ fetch: extendedFetch });

Having control over the fetch function (or the Axios instance) function gives developers the ability to make all sorts of middlewares.

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

no

Additional context

No response

Circular inclusion

Describe the bug

const findIncluded = (rel, included = []) => {
^

RangeError: Maximum call stack size exceeded
at findIncluded (/Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:28:22)
at /Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:48:70
at Array.map ()
at /Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:48:41
at Array.forEach ()
at denormalizeResource (/Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:44:40)
at /Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:50:37
at Array.forEach ()
at denormalizeResource (/Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:44:40)
at /Users/elian/Documents/GitHub/viu/playground/clplayground/node_modules/@commercelayer/sdk/lib/cjs/jsonapi.js:48:50

To Reproduce

const test = await cl.shipments.retrieve("eQqGCXaLqE", {
    include: ["stock_transfers.line_item.stock_transfers"]
})

System

No response

Additional context

const denormalizeResource = (res, included, lastResources = []) => {
    if (!res)
        return res;
    const resource = {
        id: res.id,
        type: res.type,
        ...res.attributes,
    };
    if (res.relationships)
        Object.keys(res.relationships).forEach(key => {
            const rel = res.relationships[key].data;
            if (rel) {
                if (Array.isArray(rel))
                    resource[key] = rel.map(r => {
                        if (lastResources.filter(element => element === r.id).length <= 2) {
                            return denormalizeResource(findIncluded(r, included), included, [...lastResources, r.id])
                        }
                        return null
                    }).filter(element => element !== null);
                else
                    resource[key] = denormalizeResource(findIncluded(rel, included), included, [...lastResources, rel.id]);
            } else if (rel === null)
                resource[key] = null;
        });
    return resource;
};

Prices list filtering by price_list reference not narrowing results

We are using the following SDK query to get all the prices that belong to a price list:

const prices = await clSdk.prices.list({
include: ['sku'],
filters: { price_list_eq: 'nLNWECENrB' },
pageSize: 25,
pageNumber: 1,
})

The expectation is to get only the prices that reference the price list with ID "nLNWECENrB" but we are getting prices that belong to different price lists so it seems that the filter is just omitted, here is the response:

(Note that mix prices in different currencies that are from different price lists)

`
[
{
"id": "aydWUmyjKg",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000E63E74MXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.219Z",
"updated_at": "2021-08-24T19:59:53.219Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "nGDMSAXPoZ",
"type": "skus",
"code": "TSHIRTMM000000E63E74MXXX",
"name": "Black Men T-shirt with Pink Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.205Z",
"updated_at": "2021-08-24T19:59:53.205Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "adKYUZrjVg",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000E63E74MXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.260Z",
"updated_at": "2021-08-24T19:59:53.260Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "nGDMSAXPoZ",
"type": "skus",
"code": "TSHIRTMM000000E63E74MXXX",
"name": "Black Men T-shirt with Pink Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.205Z",
"updated_at": "2021-08-24T19:59:53.205Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "aORmUXZVWg",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000E63E74LXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.292Z",
"updated_at": "2021-08-24T19:59:53.292Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ZwpOSxRjeW",
"type": "skus",
"code": "TSHIRTMM000000E63E74LXXX",
"name": "Black Men T-shirt with Pink Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.279Z",
"updated_at": "2021-08-24T19:59:53.279Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "abDKUDNOPA",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000E63E74LXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.329Z",
"updated_at": "2021-08-24T19:59:53.329Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ZwpOSxRjeW",
"type": "skus",
"code": "TSHIRTMM000000E63E74LXXX",
"name": "Black Men T-shirt with Pink Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.279Z",
"updated_at": "2021-08-24T19:59:53.279Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "pvKWUNYLvA",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000E63E74XLXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.366Z",
"updated_at": "2021-08-24T19:59:53.366Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WOpOSjROrB",
"type": "skus",
"code": "TSHIRTMM000000E63E74XLXX",
"name": "Black Men T-shirt with Pink Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.348Z",
"updated_at": "2021-08-24T19:59:53.348Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gwYzUwqYKp",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000E63E74XLXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.409Z",
"updated_at": "2021-08-24T19:59:53.409Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WOpOSjROrB",
"type": "skus",
"code": "TSHIRTMM000000E63E74XLXX",
"name": "Black Men T-shirt with Pink Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.348Z",
"updated_at": "2021-08-24T19:59:53.348Z",
"reference": "TSHIRTMM000000E63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gBklUBwQEa",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000FFFFFFMXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.435Z",
"updated_at": "2021-08-24T19:59:53.435Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WzPQSjgQxn",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFMXXX",
"name": "Black Men T-shirt with White Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.426Z",
"updated_at": "2021-08-24T19:59:53.426Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gqwEUejbnp",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000FFFFFFMXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.469Z",
"updated_at": "2021-08-24T19:59:53.469Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WzPQSjgQxn",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFMXXX",
"name": "Black Men T-shirt with White Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.426Z",
"updated_at": "2021-08-24T19:59:53.426Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "pVOMUKQjVA",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000FFFFFFLXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.500Z",
"updated_at": "2021-08-24T19:59:53.500Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "BrxeSvwjDZ",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFLXXX",
"name": "Black Men T-shirt with White Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.489Z",
"updated_at": "2021-08-24T19:59:53.489Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gLQzUGRzwa",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000FFFFFFLXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.539Z",
"updated_at": "2021-08-24T19:59:53.539Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "BrxeSvwjDZ",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFLXXX",
"name": "Black Men T-shirt with White Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.489Z",
"updated_at": "2021-08-24T19:59:53.489Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "peNYUBEYJA",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMM000000FFFFFFXLXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.563Z",
"updated_at": "2021-08-24T19:59:53.563Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WLgbSAmwMZ",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFXLXX",
"name": "Black Men T-shirt with White Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.554Z",
"updated_at": "2021-08-24T19:59:53.554Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "aGqWUqLkJA",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMM000000FFFFFFXLXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.596Z",
"updated_at": "2021-08-24T19:59:53.596Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WLgbSAmwMZ",
"type": "skus",
"code": "TSHIRTMM000000FFFFFFXLXX",
"name": "Black Men T-shirt with White Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMM000000FFFFFF.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.554Z",
"updated_at": "2021-08-24T19:59:53.554Z",
"reference": "TSHIRTMM000000FFFFFF",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gMJQUProNa",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFF000000MXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.622Z",
"updated_at": "2021-08-24T19:59:53.622Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ZjwqSkrbgW",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000MXXX",
"name": "White Men T-shirt with Black Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.609Z",
"updated_at": "2021-08-24T19:59:53.609Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "glnlUDQXkp",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFF000000MXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.658Z",
"updated_at": "2021-08-24T19:59:53.658Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ZjwqSkrbgW",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000MXXX",
"name": "White Men T-shirt with Black Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.609Z",
"updated_at": "2021-08-24T19:59:53.609Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "ARXmUZyRKa",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFF000000LXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.683Z",
"updated_at": "2021-08-24T19:59:53.683Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WvAJSAoRKZ",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000LXXX",
"name": "White Men T-shirt with Black Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.671Z",
"updated_at": "2021-08-24T19:59:53.671Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "grBlUPVrzg",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFF000000LXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.723Z",
"updated_at": "2021-08-24T19:59:53.723Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WvAJSAoRKZ",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000LXXX",
"name": "White Men T-shirt with Black Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.671Z",
"updated_at": "2021-08-24T19:59:53.671Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gmnyUdvqba",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFF000000XLXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.749Z",
"updated_at": "2021-08-24T19:59:53.749Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "BbpjSEVXkZ",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000XLXX",
"name": "White Men T-shirt with Black Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.739Z",
"updated_at": "2021-08-24T19:59:53.739Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "pZBYUDoNBp",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFF000000XLXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.785Z",
"updated_at": "2021-08-24T19:59:53.785Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "BbpjSEVXkZ",
"type": "skus",
"code": "TSHIRTMMFFFFFF000000XLXX",
"name": "White Men T-shirt with Black Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFF000000.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.739Z",
"updated_at": "2021-08-24T19:59:53.739Z",
"reference": "TSHIRTMMFFFFFF000000",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "AJJmULMGwA",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFFE63E74MXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.818Z",
"updated_at": "2021-08-24T19:59:53.818Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ByyESmQNOB",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74MXXX",
"name": "White Men T-shirt with Pink Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.797Z",
"updated_at": "2021-08-24T19:59:53.797Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gNzPUPmNVg",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFFE63E74MXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.855Z",
"updated_at": "2021-08-24T19:59:53.855Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "ByyESmQNOB",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74MXXX",
"name": "White Men T-shirt with Pink Logo (M)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.797Z",
"updated_at": "2021-08-24T19:59:53.797Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "ajKQUyXWDp",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFFE63E74LXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.881Z",
"updated_at": "2021-08-24T19:59:53.881Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WKjRSbrYvZ",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74LXXX",
"name": "White Men T-shirt with Pink Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.871Z",
"updated_at": "2021-08-24T19:59:53.871Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "AKeQUMlmLa",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFFE63E74LXXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.916Z",
"updated_at": "2021-08-24T19:59:53.916Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WKjRSbrYvZ",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74LXXX",
"name": "White Men T-shirt with Pink Logo (L)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.871Z",
"updated_at": "2021-08-24T19:59:53.871Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "pYwMUExGvg",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTMMFFFFFFE63E74XLXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:53.943Z",
"updated_at": "2021-08-24T19:59:53.943Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WJoqSwYAOB",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74XLXX",
"name": "White Men T-shirt with Pink Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.930Z",
"updated_at": "2021-08-24T19:59:53.930Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "aWQNURXEzA",
"type": "prices",
"currency_code": "USD",
"sku_code": "TSHIRTMMFFFFFFE63E74XLXX",
"amount_cents": 3480,
"amount_float": 34.8,
"formatted_amount": "$34.80",
"compare_at_amount_cents": 4524,
"compare_at_amount_float": 45.24,
"formatted_compare_at_amount": "$45.24",
"created_at": "2021-08-24T19:59:53.997Z",
"updated_at": "2021-08-24T19:59:53.997Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WJoqSwYAOB",
"type": "skus",
"code": "TSHIRTMMFFFFFFE63E74XLXX",
"name": "White Men T-shirt with Pink Logo (XL)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTMMFFFFFFE63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:53.930Z",
"updated_at": "2021-08-24T19:59:53.930Z",
"reference": "TSHIRTMMFFFFFFE63E74",
"reference_origin": null,
"metadata": {}
}
},
{
"id": "gQVmULNOOa",
"type": "prices",
"currency_code": "EUR",
"sku_code": "TSHIRTWF000000E63E74SXXX",
"amount_cents": 2900,
"amount_float": 29,
"formatted_amount": "€29,00",
"compare_at_amount_cents": 3770,
"compare_at_amount_float": 37.7,
"formatted_compare_at_amount": "€37,70",
"created_at": "2021-08-24T19:59:54.021Z",
"updated_at": "2021-08-24T19:59:54.021Z",
"reference": null,
"reference_origin": null,
"metadata": {},
"sku": {
"id": "WaDeSqJPEZ",
"type": "skus",
"code": "TSHIRTWF000000E63E74SXXX",
"name": "Black Women T-shirt with Pink Logo (S)",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pellentesque in neque vitae tincidunt. In gravida eu ipsum non condimentum. Curabitur libero leo, gravida a dictum
vestibulum, sollicitudin vel quam.",
"image_url": "https://img.commercelayer.io/skus/TSHIRTWF000000E63E74.png?fm=jpg&q=90",
"pieces_per_pack": null,
"weight": null,
"unit_of_weight": null,
"hs_tariff_number": null,
"do_not_ship": false,
"do_not_track": false,
"created_at": "2021-08-24T19:59:54.008Z",
"updated_at": "2021-08-24T19:59:54.008Z",
"reference": "TSHIRTWF000000E63E74",
"reference_origin": null,
"metadata": {}
}
}
]


Is there something we are doing wrong in this filter? Thanks for your support!

JS process breaks when trying to set a shipping method to draft order shipment

Hi @pviti, we are experiencing a weird error, when associating a shipping method to an order shipment resource.

We created a Redux Thunk action to get the available shipping methods from an order shipment resource and other action to set (select) that shipping method to the shipment resource. When trying to handle the shipment update to associate the shipping method as is indicated in the steps from API docs: https://docs.commercelayer.io/developers/v/how-tos/checkout/selecting-a-shipping-method but using SDK, we experience JS execution breaking without any error and no exception, this are the steps:

We have a shipment resource from a draft order:

{
  "id": "YzgnCNnnOa",
  "type": "shipments",
  "number": "16088866/S/001",
  "status": "draft",
  "currency_code": "EUR",
  "cost_amount_cents": 0,
  "cost_amount_float": 0,
  "formatted_cost_amount": "$0.00",
  "skus_count": 7,
  "selected_rate_id": null,
  "rates": [],
  "purchase_error_code": null,
  "purchase_error_message": null,
  "get_rates_started_at": null,
  "get_rates_completed_at": null,
  "purchase_started_at": null,
  "purchase_completed_at": null,
  "purchase_failed_at": null,
  "created_at": "2021-11-29T21:40:31.683Z",
  "updated_at": "2021-11-29T21:40:31.683Z",
  "reference": null,
  "reference_origin": null,
  "metadata": {},
  "available_shipping_methods": [
    {
      "id": "RNpozFzMgO",
      "type": "shipping_methods",
      "name": "Standard Canada",
      "disabled_at": null,
      "currency_code": "EUR",
      "price_amount_cents": 700,
      "price_amount_float": 7,
      "formatted_price_amount": "€7,00",
      "free_over_amount_cents": null,
      "free_over_amount_float": null,
      "formatted_free_over_amount": null,
      "price_amount_for_shipment_cents": 700,
      "price_amount_for_shipment_float": 7,
      "formatted_price_amount_for_shipment": "€7,00",
      "created_at": "2021-11-29T18:25:37.231Z",
      "updated_at": "2021-11-29T18:25:37.231Z",
      "reference": "",
      "reference_origin": "",
      "metadata": {}
    }
  ]
}

There is only one available shipping method so we try to associate it as the selected method in the order shipment with the following code:

      const shippingMethodId = 'RNpozFzMgO'
      // This object is the one dumped in previous JSON code block
      const firstShipment = first(order.shipments)

      /**
       * @type {ShipmentUpdate}
       */
      const updateData = {
        id: firstShipment.id,
        shipping_method: clClient.shipping_methods.relationship(shippingMethodId),
      }

      const result = await clClient.shipments.update(updateData)
      const updatedOrder = await retrieveOrder(clClient, order.id)

When the call to "clClient.shipments.update" is executed, the Jest test we wrote with an integration test, breaks without any error or exception. It just stop the JS process. Therefore, the retrieve order is never reached.

Here is the date that is composed in updateData variable:

  updateData:  {
      id: 'YzgnCNnnOa',
      shipping_method: { id: 'RNpozFzMgO', type: 'shipping_methods' }
    }

Screenshot 2021-11-29 at 22 54 17

Can you confirm our procedure to set a shipping method selection is correct? Any idea what could be causing the silent error that breaks execution?

Thanks for your support!

Missing Satispay related resources

Hi, the Satispay related resources are missing and I was wondering when the schema will be updated. Could you give me an idea of when we might expect the update to happen?
Thanks!

Add support for array filters

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

const customers = await cl.customers.list({ filters: { 'email_cont_any': ['[email protected]','[email protected]'] } })

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

Define a more user friendly interface for relationships

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

cl.tags.releationship([]) to empty a 1-n relationship
cl.tags.relationship() to empty a 1-1 relationship (would solve also TS type problem)
cl.tags.relationship('id1', 'id2', 'id3') to create a 1-n relationship
...

Describe alternatives you've considered

Make relationship function abstract in parent class to handle common cases

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

Add user agent to sdk client config

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

Add the possibility to definr header User-Agent during initialization of Commerce Layer client

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

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.