@paykit-sdk/polar 1.1.4 → 1.1.6
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/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var toPaykitSubscription = (subscription) => {
|
|
|
61
61
|
status: toPaykitSubscriptionStatus(subscription.status),
|
|
62
62
|
current_period_start: new Date(subscription.currentPeriodStart),
|
|
63
63
|
current_period_end: new Date(subscription.currentPeriodEnd),
|
|
64
|
-
metadata: (0, import_core.stringifyObjectValues)({ ...subscription.metadata ?? {}, customFieldData: subscription.customFieldData })
|
|
64
|
+
metadata: (0, import_core.stringifyObjectValues)({ ...subscription.metadata ?? {}, $customFieldData: subscription.customFieldData })
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
var toPaykitInvoice = (invoice) => {
|
|
@@ -69,7 +69,7 @@ var toPaykitInvoice = (invoice) => {
|
|
|
69
69
|
id: invoice.id,
|
|
70
70
|
amount: invoice.totalAmount,
|
|
71
71
|
currency: invoice.currency,
|
|
72
|
-
metadata: (0, import_core.stringifyObjectValues)(invoice.metadata ?? {}),
|
|
72
|
+
metadata: (0, import_core.stringifyObjectValues)({ ...invoice.metadata ?? {}, $customFieldData: invoice.customFieldData }),
|
|
73
73
|
customer_id: invoice.customerId
|
|
74
74
|
};
|
|
75
75
|
};
|
|
@@ -156,7 +156,7 @@ var PolarProvider = class {
|
|
|
156
156
|
return (0, import_core2.toPaykitEvent)({ type: "$customerDeleted", created: parseInt(timestamp), id, data: null });
|
|
157
157
|
} else if (type === "checkout.created") {
|
|
158
158
|
return (0, import_core2.toPaykitEvent)({ type: "$checkoutCreated", created: parseInt(timestamp), id, data: toPaykitCheckout(data) });
|
|
159
|
-
} else if (type === "order.
|
|
159
|
+
} else if (type === "order.paid" && data.status == "paid") {
|
|
160
160
|
return (0, import_core2.toPaykitEvent)({ type: "$invoicePaid", created: parseInt(timestamp), id, data: toPaykitInvoice(data) });
|
|
161
161
|
}
|
|
162
162
|
throw new Error(`Unhandled event type: ${type}`);
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,7 @@ var toPaykitSubscription = (subscription) => {
|
|
|
39
39
|
status: toPaykitSubscriptionStatus(subscription.status),
|
|
40
40
|
current_period_start: new Date(subscription.currentPeriodStart),
|
|
41
41
|
current_period_end: new Date(subscription.currentPeriodEnd),
|
|
42
|
-
metadata: stringifyObjectValues({ ...subscription.metadata ?? {}, customFieldData: subscription.customFieldData })
|
|
42
|
+
metadata: stringifyObjectValues({ ...subscription.metadata ?? {}, $customFieldData: subscription.customFieldData })
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
var toPaykitInvoice = (invoice) => {
|
|
@@ -47,7 +47,7 @@ var toPaykitInvoice = (invoice) => {
|
|
|
47
47
|
id: invoice.id,
|
|
48
48
|
amount: invoice.totalAmount,
|
|
49
49
|
currency: invoice.currency,
|
|
50
|
-
metadata: stringifyObjectValues(invoice.metadata ?? {}),
|
|
50
|
+
metadata: stringifyObjectValues({ ...invoice.metadata ?? {}, $customFieldData: invoice.customFieldData }),
|
|
51
51
|
customer_id: invoice.customerId
|
|
52
52
|
};
|
|
53
53
|
};
|
|
@@ -134,7 +134,7 @@ var PolarProvider = class {
|
|
|
134
134
|
return toPaykitEvent({ type: "$customerDeleted", created: parseInt(timestamp), id, data: null });
|
|
135
135
|
} else if (type === "checkout.created") {
|
|
136
136
|
return toPaykitEvent({ type: "$checkoutCreated", created: parseInt(timestamp), id, data: toPaykitCheckout(data) });
|
|
137
|
-
} else if (type === "order.
|
|
137
|
+
} else if (type === "order.paid" && data.status == "paid") {
|
|
138
138
|
return toPaykitEvent({ type: "$invoicePaid", created: parseInt(timestamp), id, data: toPaykitInvoice(data) });
|
|
139
139
|
}
|
|
140
140
|
throw new Error(`Unhandled event type: ${type}`);
|