Skip to content

Commit

Permalink
chore: ignores event invoice.invoice_date_elapsed (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecktoteckto authored Sep 20, 2024
1 parent 6eb7d55 commit 9383da5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ node_modules/
.env.prod
.env.staging
.env.test
.turbo
.turbo
.idea/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ This server synchronizes your [Orb](https://www.withorb.com/) account to a Postg
- [x] subscription.cost_exceeded
- [x] subscription.plan_version_change_scheduled
- [x] subscription.plan_version_changed
- [x] invoice.invoice_date_elapsed
- [x] invoice.issue_failed
- [x] invoice.issued
- [x] invoice.payment_failed
Expand Down
17 changes: 10 additions & 7 deletions packages/orb-sync-lib/src/orb-sync.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Orb from 'orb-billing';
import type { HeadersLike } from 'orb-billing/core';
import type {
CreditNoteWebhook,
CreditNotesFetchParams,
CustomerWebhook,
CreditNoteWebhook,
CustomersFetchParams,
InvoiceWebhook,
CustomerWebhook,
InvoicesFetchParams,
InvoiceWebhook,
OrbWebhook,
PlansFetchParams,
SubscriptionWebhook,
SubscriptionsFetchParams,
SubscriptionWebhook,
} from './types';
import { PostgresClient } from './database/postgres';
import { fetchAndSyncCustomer, fetchAndSyncCustomers, syncCustomers } from './sync/customers';
Expand Down Expand Up @@ -54,7 +54,7 @@ export class OrbSync {
| CustomersFetchParams
| CreditNotesFetchParams
| SubscriptionsFetchParams
| PlansFetchParams
| PlansFetchParams,
): Promise<number> {
switch (entity) {
case 'invoices': {
Expand Down Expand Up @@ -107,12 +107,15 @@ export class OrbSync {
await syncSubscriptions(this.postgresClient, [(parsedData as SubscriptionWebhook).subscription]);
break;
}

case 'invoice.invoice_date_elapsed': {
// Is being ignored because from 2024-09-20 the webhook payload only contains a "minified" version of the invoice resource.
// We don't want to override invoice data with a minified version.
break;
}
case 'invoice.edited':
case 'invoice.issued':
case 'invoice.manually_marked_as_void':
case 'invoice.payment_failed':
case 'invoice.invoice_date_elapsed':
case 'invoice.issue_failed':
case 'invoice.manually_marked_as_paid':
case 'invoice.payment_processing':
Expand Down

0 comments on commit 9383da5

Please sign in to comment.