backend-manager 2.5.38 → 2.5.40
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
|
@@ -8,7 +8,7 @@ function SubscriptionResolver(profile, resource) {
|
|
|
8
8
|
self.resource = resource;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SubscriptionResolver.prototype.resolve = function () {
|
|
11
|
+
SubscriptionResolver.prototype.resolve = function (options) {
|
|
12
12
|
const self = this;
|
|
13
13
|
|
|
14
14
|
const resolved = {
|
|
@@ -32,6 +32,13 @@ SubscriptionResolver.prototype.resolve = function () {
|
|
|
32
32
|
const profile = self.profile;
|
|
33
33
|
const resource = self.resource;
|
|
34
34
|
|
|
35
|
+
options = options || {};
|
|
36
|
+
|
|
37
|
+
if (options.log) {
|
|
38
|
+
console.log('profile', profile);
|
|
39
|
+
console.log('resource', resource);
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
// Process differently based on each provider
|
|
36
43
|
if (profile.processor === 'paypal') {
|
|
37
44
|
// Set status
|
|
@@ -118,7 +125,7 @@ SubscriptionResolver.prototype.resolve = function () {
|
|
|
118
125
|
);
|
|
119
126
|
|
|
120
127
|
// Set completed
|
|
121
|
-
resolved.payment.completed = resource.payments.find(p => p.status === 'CONFIRMED');
|
|
128
|
+
resolved.payment.completed = !!resource.payments.find(p => p.status === 'CONFIRMED');
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
// If there was NEVER any payment sent
|
|
@@ -149,6 +156,10 @@ SubscriptionResolver.prototype.resolve = function () {
|
|
|
149
156
|
|
|
150
157
|
// console.log('---resolved', resolved);
|
|
151
158
|
|
|
159
|
+
if (options.log) {
|
|
160
|
+
console.log('resolved', resolved);
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
self.resolved = resolved;
|
|
153
164
|
|
|
154
165
|
return resolved;
|