You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
var coupon = recurly.Coupon();
coupon.coupon_code = 'off20';
// Reset the id setter so it does not automatically assigns its value to coupon_code.
coupon.__defineSetter__('id', function() {});
coupon.fetch(function(err, response) {
if (err) return res.status(400).json(err);
console.assert(response.coupon_code, 'off20'); // true now
});
Hi,
I noticed
coupon_code
returned from coupon.fetch has the value ofid
and not of the coupon code. I think it's becausecoupon_code
is used as theidField
for the Coupon model (here).I think this piece is responsible. It looks like when setting
id
(in. inflate()
), the value ofid
is also assigned to theidField
, which iscoupon_code
.The text was updated successfully, but these errors were encountered: