@paykit-sdk/polar 1.1.8 → 1.1.9

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 CHANGED
@@ -71,7 +71,8 @@ var toPaykitInvoice = (invoice) => {
71
71
  amount: invoice.totalAmount,
72
72
  currency: invoice.currency,
73
73
  metadata: (0, import_core.stringifyObjectValues)({ ...invoice.metadata ?? {}, $customFieldData: invoice.customFieldData }),
74
- customer_id: invoice.customerId
74
+ customer_id: invoice.customerId,
75
+ billing_mode: invoice.billingMode
75
76
  };
76
77
  };
77
78
 
@@ -154,25 +155,17 @@ var PolarProvider = class {
154
155
  type: "$invoicePaid",
155
156
  created: parseInt(timestamp),
156
157
  id,
157
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "payment" } })
158
+ data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {} }, billingMode: "one_time" })
158
159
  });
159
160
  },
160
161
  "order.created": (data2) => {
161
162
  const { billingReason, metadata, status } = data2;
162
- if (billingReason == "subscription_create") {
163
+ if (["subscription_create", "subscription_cycle"].includes(billingReason)) {
163
164
  return (0, import_core2.toPaykitEvent)({
164
165
  type: "$invoicePaid",
165
166
  created: parseInt(timestamp),
166
167
  id,
167
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "subscription" } })
168
- });
169
- }
170
- if (billingReason == "subscription_cycle") {
171
- return (0, import_core2.toPaykitEvent)({
172
- type: "$invoicePaid",
173
- created: parseInt(timestamp),
174
- id,
175
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "subscription" } })
168
+ data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {} }, billingMode: "recurring" })
176
169
  });
177
170
  }
178
171
  return null;
package/dist/index.mjs CHANGED
@@ -51,7 +51,8 @@ var toPaykitInvoice = (invoice) => {
51
51
  amount: invoice.totalAmount,
52
52
  currency: invoice.currency,
53
53
  metadata: stringifyObjectValues({ ...invoice.metadata ?? {}, $customFieldData: invoice.customFieldData }),
54
- customer_id: invoice.customerId
54
+ customer_id: invoice.customerId,
55
+ billing_mode: invoice.billingMode
55
56
  };
56
57
  };
57
58
 
@@ -134,25 +135,17 @@ var PolarProvider = class {
134
135
  type: "$invoicePaid",
135
136
  created: parseInt(timestamp),
136
137
  id,
137
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "payment" } })
138
+ data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {} }, billingMode: "one_time" })
138
139
  });
139
140
  },
140
141
  "order.created": (data2) => {
141
142
  const { billingReason, metadata, status } = data2;
142
- if (billingReason == "subscription_create") {
143
+ if (["subscription_create", "subscription_cycle"].includes(billingReason)) {
143
144
  return toPaykitEvent({
144
145
  type: "$invoicePaid",
145
146
  created: parseInt(timestamp),
146
147
  id,
147
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "subscription" } })
148
- });
149
- }
150
- if (billingReason == "subscription_cycle") {
151
- return toPaykitEvent({
152
- type: "$invoicePaid",
153
- created: parseInt(timestamp),
154
- id,
155
- data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {}, $mode: "subscription" } })
148
+ data: toPaykitInvoice({ ...data2, metadata: { ...metadata ?? {} }, billingMode: "recurring" })
156
149
  });
157
150
  }
158
151
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paykit-sdk/polar",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Polar provider for PayKit",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -24,7 +24,7 @@
24
24
  "@polar-sh/sdk": "^0.33.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@paykit-sdk/core": "^1.1.6"
27
+ "@paykit-sdk/core": "^1.1.7"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@paykit-sdk/core": "workspace:*",