-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I'm currently trying to implement behavior that pauses/unpauses a subscription based on what internal plan the user chose. This is my code:
const pm = paymill.getContext(paymillPrivateKey);
if (plan.paymillOfferId) {
// update old subscription
const updatedSubscription =
await pm.subscriptions.changeOfferChangeCaptureDateAndRefund(
subscriptionId,
plan.paymillOfferId,
);
if (updatedSubscription.status === 'inactive') {
await pm.subscriptions.unpause(updatedSubscription.id);
}
} else {
// Allow for free plans to be purchased
await pm.subscriptions.pause(subscriptionId);
}
While that code can pause the subscription just fine, calling pm.subscriptions.unpause() never managed to set the status to 'active' again. I dug through the source code and found this piece here at line 3950:
SubscriptionService.prototype.unpause = function(obj, cb) {
var map = { "pause" : true };
return this._updateWithMap(obj, map, cb);
};
I guess it really should be
SubscriptionService.prototype.unpause = function(obj, cb) {
var map = { "pause" : false };
return this._updateWithMap(obj, map, cb);
};
What do you think?
Metadata
Metadata
Assignees
Labels
No labels