Skip to content

Conversation

@BillWilson
Copy link

According to the parameters description here, the ApplyOn is required when creating new discount.

And it works as expected when creating new discount with empty apply_on.

{
  "message": "discounts[apply_on][0] : cannot be blank",
  "type": "invalid_request",
  "api_error_code": "invalid_request",
  "param": "discounts[apply_on][0]",
  "error_code": "param_should_not_be_blank",
  "error_msg": "cannot be blank",
  "error_param": "discounts[apply_on][0]",
  "http_status_code": 400
}

But when I try to delete a discount from subscription.
I always got this message unless I remove the key apply_on from the request payload.

{
  "message": "discounts[apply_on][0] : should not be sent when operation type is REMOVE",
  "type": "invalid_request",
  "api_error_code": "invalid_request",
  "param": "discounts[apply_on][0]",
  "error_code": "param_should_not_be_sent",
  "error_msg": "should not be sent when operation type is REMOVE",
  "error_param": "discounts[apply_on][0]",
  "http_status_code": 400
}

type UpdateForItemsDiscountParams struct {
ApplyOn enum.ApplyOn `json:"apply_on"`

@BillWilson BillWilson changed the title Change apply_on for remove discount in a subscription Change apply_on for remove discount in a subscription Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant