backend-manager 3.2.68 → 3.2.70
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,5 +1,6 @@
|
|
|
1
1
|
const moment = require('moment');
|
|
2
2
|
const { get } = require('lodash');
|
|
3
|
+
const { arrayify } = require('node-powertools');
|
|
3
4
|
|
|
4
5
|
function SubscriptionResolver(Manager, profile, resource) {
|
|
5
6
|
const self = this;
|
|
@@ -426,19 +427,20 @@ SubscriptionResolver.prototype.resolve_paypal = function (profile, resource, res
|
|
|
426
427
|
}
|
|
427
428
|
|
|
428
429
|
// Set completed
|
|
429
|
-
if (
|
|
430
|
-
resolved.payment.completed = !['CREATED', 'SAVED', 'APPROVED', 'VOIDED', 'PAYER_ACTION_REQUIRED'].includes(resource.status);
|
|
431
|
-
} else {
|
|
430
|
+
if (resource.plan) {
|
|
432
431
|
resolved.payment.completed = !['APPROVAL_PENDING', 'APPROVED'].includes(resource.status);
|
|
432
|
+
} else {
|
|
433
|
+
resolved.payment.completed = !['CREATED', 'SAVED', 'APPROVED', 'VOIDED', 'PAYER_ACTION_REQUIRED'].includes(resource.status);
|
|
433
434
|
}
|
|
434
435
|
|
|
435
436
|
// Check if refunded
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
} else {
|
|
439
|
-
const transactions = get(resource, 'transactions', []);
|
|
437
|
+
if (resource.plan) {
|
|
438
|
+
const transactions = arrayify(get(resource, 'transactions', []));
|
|
440
439
|
|
|
441
440
|
resolved.payment.refunded = transactions.some(t => t.status === 'REFUNDED');
|
|
441
|
+
// ALSO PARTIALLY_REFUNDED?
|
|
442
|
+
} else {
|
|
443
|
+
// resolved.payment.refunded = false; // @@@ TODO: check if this is correct
|
|
442
444
|
}
|
|
443
445
|
|
|
444
446
|
return resolved;
|