Skip to content

Coupon's coupon_code gets overwritten with value of id #89

@codynguyen

Description

@codynguyen

Hi,

I noticed coupon_code returned from coupon.fetch has the value of id and not of the coupon code. I think it's because coupon_code is used as the idField for the Coupon model (here).

var coupon = recurly.Coupon();
coupon.coupon_code = 'off20';

coupon.fetch(function(err, response) {
  if (err) return res.status(400).json(err);

  console.assert(response.coupon_code, 'off20'); // false
});

I think this piece is responsible. It looks like when setting id (in . inflate()), the value of id is also assigned to the idField, which is coupon_code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions