@paykit-sdk/polar 1.1.3 → 1.1.5

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/README.md CHANGED
@@ -180,7 +180,6 @@ POLAR_WEBHOOK_SECRET=your-webhook-secret
180
180
  ## Support
181
181
 
182
182
  - [Polar Documentation](https://docs.polar.sh/)
183
- - [PayKit Issues](https://github.com/devodii/paykit/issues)
184
183
 
185
184
  ## License
186
185
 
package/dist/index.js CHANGED
@@ -60,7 +60,8 @@ var toPaykitSubscription = (subscription) => {
60
60
  customer_id: subscription.customerId,
61
61
  status: toPaykitSubscriptionStatus(subscription.status),
62
62
  current_period_start: new Date(subscription.currentPeriodStart),
63
- current_period_end: new Date(subscription.currentPeriodEnd)
63
+ current_period_end: new Date(subscription.currentPeriodEnd),
64
+ metadata: (0, import_core.stringifyObjectValues)({ ...subscription.metadata ?? {}, customFieldData: subscription.customFieldData })
64
65
  };
65
66
  };
66
67
  var toPaykitInvoice = (invoice) => {
@@ -155,7 +156,7 @@ var PolarProvider = class {
155
156
  return (0, import_core2.toPaykitEvent)({ type: "$customerDeleted", created: parseInt(timestamp), id, data: null });
156
157
  } else if (type === "checkout.created") {
157
158
  return (0, import_core2.toPaykitEvent)({ type: "$checkoutCreated", created: parseInt(timestamp), id, data: toPaykitCheckout(data) });
158
- } else if (type === "order.created") {
159
+ } else if (type === "order.paid" && data.status == "paid") {
159
160
  return (0, import_core2.toPaykitEvent)({ type: "$invoicePaid", created: parseInt(timestamp), id, data: toPaykitInvoice(data) });
160
161
  }
161
162
  throw new Error(`Unhandled event type: ${type}`);
package/dist/index.mjs CHANGED
@@ -38,7 +38,8 @@ var toPaykitSubscription = (subscription) => {
38
38
  customer_id: subscription.customerId,
39
39
  status: toPaykitSubscriptionStatus(subscription.status),
40
40
  current_period_start: new Date(subscription.currentPeriodStart),
41
- current_period_end: new Date(subscription.currentPeriodEnd)
41
+ current_period_end: new Date(subscription.currentPeriodEnd),
42
+ metadata: stringifyObjectValues({ ...subscription.metadata ?? {}, customFieldData: subscription.customFieldData })
42
43
  };
43
44
  };
44
45
  var toPaykitInvoice = (invoice) => {
@@ -133,7 +134,7 @@ var PolarProvider = class {
133
134
  return toPaykitEvent({ type: "$customerDeleted", created: parseInt(timestamp), id, data: null });
134
135
  } else if (type === "checkout.created") {
135
136
  return toPaykitEvent({ type: "$checkoutCreated", created: parseInt(timestamp), id, data: toPaykitCheckout(data) });
136
- } else if (type === "order.created") {
137
+ } else if (type === "order.paid" && data.status == "paid") {
137
138
  return toPaykitEvent({ type: "$invoicePaid", created: parseInt(timestamp), id, data: toPaykitInvoice(data) });
138
139
  }
139
140
  throw new Error(`Unhandled event type: ${type}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paykit-sdk/polar",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
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.2"
27
+ "@paykit-sdk/core": "^1.1.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@paykit-sdk/core": "workspace:*",