Shopify / shopify-app-js

MIT License
284 stars 112 forks source link

Application Charge currency being returned as weird object with each letter as a different value #1345

Closed anastis closed 1 month ago

anastis commented 2 months ago

Issue summary

Before opening this issue, I have:

Description

This is really a duplicate of https://github.com/Shopify/shopify-api-js/issues/1325 but applicable to one-time charges (ApplicationCharge class). Not sure if this is the right repo, I observe the issue in a Remix app.

Current code: https://github.com/Shopify/shopify-app-js/blob/64e921bf80f65f9ee0f7bdf0ed9969e64e41e996/packages/apps/shopify-api/rest/admin/2024-07/application_charge.ts#L78

Previous fix in recurring charges: https://github.com/Shopify/shopify-api-js/commit/513f9e6c3bb6a9f1d289820a9a40602c5ef04d28#diff-b7fd618aa27ac126617eff6762287fed5dbe2aa82a516a1da587a788fc4bf786

Expected behavior

The charge's currency should be a string (to be consistent with recurring charges), or perhaps a proper currency object.

Actual behavior

currency property is an object like { 0: "U", 1: "S", 2: "D" }

image

Steps to reproduce the problem

  const charges = await admin.rest.resources.ApplicationCharge.all({
    session,
  });

  console.log(charges[0].currency);
lizkenyon commented 2 months ago

Thanks for flagging! I will add this to our work list.