Open jstoeffler opened 7 months ago
Hi,
Thanks for maintaining this super helpful library!
I am facing a new issue: It doesn't seem possible to change a Promotion Asset from "Money Amount Off" to "Percent Off".
I have created a repo with a minimal example to reproduce the problem.
I have tried 3 approaches:
money_amount_off
null
await customer.assets.update([ { resource_name: resourceName, promotion_asset: { percent_off: toMicros(0.2), money_amount_off: null, }, }, ]);
=> this raises this error:
{ "errors": [ { "error_code": { "asset_error": "PROMOTION_CANNOT_SET_PERCENT_OFF_AND_MONEY_AMOUNT_OFF" }, "message": "Cannot set both percent off and money amount off fields of promotion asset.", "location": { "field_path_elements": [ { "field_name": "operations", "index": 0 }, { "field_name": "update" }, { "field_name": "promotion_asset" }, { "field_name": "percent_off" } ] } } ], }
=> Same error
{currency_code: "USD",amount_micros:0}
await customer.assets.update([ { resource_name: resourceName, promotion_asset: { percent_off: toMicros(0.2), money_amount_off: { currency_code: "USD", amount_micros: 0 }, }, }, ]);
{ "errors": [ { "error_code": { "range_error": "TOO_LOW" }, "message": "Too low.", "trigger": { "int64_value": "0" }, "location": { "field_path_elements": [ { "field_name": "operations", "index": 0 }, { "field_name": "update" }, { "field_name": "promotion_asset" }, { "field_name": "money_amount_off" }, { "field_name": "amount_micros" } ] } } ], }
What makes me think this could be a bug, is that switching from "Percent Off" to "Money Amount Off" is possible by setting the percent_off property to 0 (my sample code does that). It's the opposite that's not possible.
percent_off
Hi,
Thanks for maintaining this super helpful library!
I am facing a new issue: It doesn't seem possible to change a Promotion Asset from "Money Amount Off" to "Percent Off".
I have created a repo with a minimal example to reproduce the problem.
I have tried 3 approaches:
money_amount_off
tonull
=> this raises this error:
money_amount_off
=> Same error
money_amount_off
to{currency_code: "USD",amount_micros:0}
=> this raises this error:
What makes me think this could be a bug, is that switching from "Percent Off" to "Money Amount Off" is possible by setting the
percent_off
property to 0 (my sample code does that). It's the opposite that's not possible.