pariola / paystack

Paystack API wrapper
103 stars 42 forks source link

Updating resources with path ID parameters also sends those IDs in the POST body #3

Closed temiyemi closed 6 years ago

temiyemi commented 6 years ago

Sending the id field with other post data throws an error from Paystack. Case in point:

paystack.customer.update({ id: 'CUS_uvwxyz', first_name: 'John', last_name: 'Doe', phone: '+23412341234' })
  .then(body => console.log(body))
  .catch(err => console.error(err))

The id parameter is only needed in the path for the endpoint, and not in the post body, but gets sent along anyways, therefore the above code throws a BAD_FIELD_ERROR from Paystack.

Introspecting, while parsing data used to invoke the functions, path parameters are not unset from the rest of the data.

pariola commented 6 years ago

Ohh, never expected that!. I thought only required fields would be pulled from the POST body.

Thanks again!

mikey247 commented 1 year ago

@temiyemi @pariola Please where do I add the customer id for this request??