backend-manager 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-manager",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
"wonderful-log": "^1.0.5",
|
|
70
70
|
"yargs": "^17.7.2"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|
|
@@ -154,7 +154,7 @@ SubscriptionResolver.prototype.resolve = function (options) {
|
|
|
154
154
|
// Resolve
|
|
155
155
|
const processor = self[`resolve_${profile.processor}`];
|
|
156
156
|
if (processor) {
|
|
157
|
-
processor(profile, resource, resolved);
|
|
157
|
+
processor(profile, resource, resolved, options);
|
|
158
158
|
} else {
|
|
159
159
|
throw new Error('Unknown processor');
|
|
160
160
|
}
|
|
@@ -241,7 +241,7 @@ SubscriptionResolver.prototype.resolve = function (options) {
|
|
|
241
241
|
return resolved;
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
-
SubscriptionResolver.prototype.resolve_paypal = function (profile, resource, resolved) {
|
|
244
|
+
SubscriptionResolver.prototype.resolve_paypal = function (profile, resource, resolved, options) {
|
|
245
245
|
const self = this;
|
|
246
246
|
|
|
247
247
|
// Set status
|
|
@@ -362,6 +362,17 @@ SubscriptionResolver.prototype.resolve_paypal = function (profile, resource, res
|
|
|
362
362
|
resolved.expires.timestamp = moment(
|
|
363
363
|
get(resource, 'billing_info.next_billing_time', 0)
|
|
364
364
|
)
|
|
365
|
+
|
|
366
|
+
/*
|
|
367
|
+
Special condition for PayPal #2
|
|
368
|
+
I want to put the subscription in a suspended state if it's even one day past due
|
|
369
|
+
*/
|
|
370
|
+
const trialLength = get(trialTenure, 'frequency.interval_count', 0);
|
|
371
|
+
const daysSinceStart = moment(resolved.start.timestamp).diff(moment(options.today), 'days');
|
|
372
|
+
if (daysSinceStart > trialLength) {
|
|
373
|
+
resolved.status = 'suspended';
|
|
374
|
+
resolved.trial.active = false;
|
|
375
|
+
}
|
|
365
376
|
}
|
|
366
377
|
resolved.trial.claimed = trialClaimed;
|
|
367
378
|
|
|
@@ -396,7 +407,7 @@ SubscriptionResolver.prototype.resolve_paypal = function (profile, resource, res
|
|
|
396
407
|
return resolved;
|
|
397
408
|
}
|
|
398
409
|
|
|
399
|
-
SubscriptionResolver.prototype.resolve_chargebee = function (profile, resource, resolved) {
|
|
410
|
+
SubscriptionResolver.prototype.resolve_chargebee = function (profile, resource, resolved, options) {
|
|
400
411
|
const self = this;
|
|
401
412
|
|
|
402
413
|
// Set status
|
|
@@ -589,7 +600,7 @@ SubscriptionResolver.prototype.resolve_chargebee = function (profile, resource,
|
|
|
589
600
|
return resolved;
|
|
590
601
|
}
|
|
591
602
|
|
|
592
|
-
SubscriptionResolver.prototype.resolve_stripe = function (profile, resource, resolved) {
|
|
603
|
+
SubscriptionResolver.prototype.resolve_stripe = function (profile, resource, resolved, options) {
|
|
593
604
|
const self = this;
|
|
594
605
|
|
|
595
606
|
// Subscription: https://stripe.com/docs/api/subscriptions/object#subscription_object-status
|
|
@@ -724,7 +735,7 @@ SubscriptionResolver.prototype.resolve_stripe = function (profile, resource, res
|
|
|
724
735
|
return resolved;
|
|
725
736
|
}
|
|
726
737
|
|
|
727
|
-
SubscriptionResolver.prototype.resolve_coinbase = function (profile, resource, resolved) {
|
|
738
|
+
SubscriptionResolver.prototype.resolve_coinbase = function (profile, resource, resolved, options) {
|
|
728
739
|
const self = this;
|
|
729
740
|
|
|
730
741
|
// Setup preliminary variables
|