@adaptware/eagles-db 0.5.51 → 0.5.53
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/client/edge.js +83 -4
- package/client/index-browser.js +80 -1
- package/client/index.d.ts +5405 -225
- package/client/index.js +83 -4
- package/client/package.json +1 -1
- package/client/schema.prisma +116 -0
- package/client/wasm.js +83 -4
- package/package.json +1 -1
- package/prisma/schema/integration.prisma +1 -0
- package/prisma/schema/organisation.prisma +2 -0
- package/prisma/schema/payment/billingTransaction.prisma +83 -0
- package/prisma/schema/payment/paymentWebhookEvent.prisma +28 -0
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -1826,6 +1826,7 @@ enum IntegrationProvider {
|
|
|
1826
1826
|
MICROSOFT
|
|
1827
1827
|
ZOOM
|
|
1828
1828
|
CALENDLY
|
|
1829
|
+
RAZORPAY
|
|
1829
1830
|
|
|
1830
1831
|
@@schema("public")
|
|
1831
1832
|
}
|
|
@@ -3577,6 +3578,8 @@ model Organisation {
|
|
|
3577
3578
|
licensing_ledger_entries LicensingLedgerEntry[]
|
|
3578
3579
|
license_package_organisations LicensePackageOrganisation[]
|
|
3579
3580
|
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3581
|
+
billing_transactions BillingTransaction[]
|
|
3582
|
+
payment_webhook_events PaymentWebhookEvent[]
|
|
3580
3583
|
|
|
3581
3584
|
@@index([name])
|
|
3582
3585
|
@@schema("public")
|
|
@@ -3596,6 +3599,119 @@ model OrganisationConfig {
|
|
|
3596
3599
|
@@schema("public")
|
|
3597
3600
|
}
|
|
3598
3601
|
|
|
3602
|
+
// PAYMENT SERVICE boundary — portable payment microservice owns these enums/columns.
|
|
3603
|
+
|
|
3604
|
+
enum BillingTransactionStatus {
|
|
3605
|
+
INITIATED
|
|
3606
|
+
ORDER_CREATED
|
|
3607
|
+
PAYMENT_PENDING
|
|
3608
|
+
SUCCESS
|
|
3609
|
+
FAILED
|
|
3610
|
+
CANCELLED
|
|
3611
|
+
REFUND_PENDING
|
|
3612
|
+
REFUND_FAILED
|
|
3613
|
+
REFUNDED
|
|
3614
|
+
|
|
3615
|
+
@@schema("public")
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
enum BillingTransactionType {
|
|
3619
|
+
PURCHASE
|
|
3620
|
+
TOP_UP
|
|
3621
|
+
REFUND
|
|
3622
|
+
|
|
3623
|
+
@@schema("public")
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
enum BillingTransactionFailureCategory {
|
|
3627
|
+
RAZORPAY_ORDER
|
|
3628
|
+
RAZORPAY_PAYMENT
|
|
3629
|
+
REFUND
|
|
3630
|
+
INTERNAL
|
|
3631
|
+
|
|
3632
|
+
@@schema("public")
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
/// Payment reconciliation state when Treadspace status is FAILED but Razorpay captured payment.
|
|
3636
|
+
enum BillingPaymentMismatchStatus {
|
|
3637
|
+
DETECTED
|
|
3638
|
+
UNFULFILLED
|
|
3639
|
+
|
|
3640
|
+
@@schema("public")
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
/// Financial transaction lifecycle for organisation billing purchases.
|
|
3644
|
+
model BillingTransaction {
|
|
3645
|
+
id String @id @default(uuid())
|
|
3646
|
+
organisation_id String
|
|
3647
|
+
/// Opaque plan/product identity supplied at checkout. Not a catalog FK.
|
|
3648
|
+
purchase_reference String
|
|
3649
|
+
/// Human-readable snapshot captured at checkout for invoices and receipts.
|
|
3650
|
+
purchase_display_name String?
|
|
3651
|
+
transaction_type BillingTransactionType
|
|
3652
|
+
status BillingTransactionStatus @default(INITIATED)
|
|
3653
|
+
failure_category BillingTransactionFailureCategory?
|
|
3654
|
+
/// Human-readable or provider detail (e.g. Razorpay error_description).
|
|
3655
|
+
failure_reason String?
|
|
3656
|
+
amount Int
|
|
3657
|
+
currency String @default("INR")
|
|
3658
|
+
razorpay_order_id String?
|
|
3659
|
+
razorpay_payment_id String? @unique
|
|
3660
|
+
/// Razorpay payment method at capture (card, netbanking, upi, wallet, etc.).
|
|
3661
|
+
payment_method String?
|
|
3662
|
+
razorpay_subscription_id String?
|
|
3663
|
+
razorpay_refund_id String?
|
|
3664
|
+
refund_reason String?
|
|
3665
|
+
refund_amount Int?
|
|
3666
|
+
idempotency_key String @unique
|
|
3667
|
+
invoice_number String? @unique
|
|
3668
|
+
/// Email of the org Admin who initiated checkout (bill-to).
|
|
3669
|
+
purchaser_email String?
|
|
3670
|
+
/// Set when FAILED but Razorpay order/payment is captured (reconciliation path).
|
|
3671
|
+
payment_mismatch_status BillingPaymentMismatchStatus?
|
|
3672
|
+
/// Strict same-intent SUCCESS transaction that fulfilled the purchase (UNFULFILLED only).
|
|
3673
|
+
payment_mismatch_fulfilled_by_id String?
|
|
3674
|
+
created_at DateTime @default(now())
|
|
3675
|
+
updated_at DateTime @updatedAt
|
|
3676
|
+
|
|
3677
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id])
|
|
3678
|
+
|
|
3679
|
+
@@index([organisation_id, status])
|
|
3680
|
+
@@index([purchase_reference])
|
|
3681
|
+
@@index([razorpay_order_id])
|
|
3682
|
+
@@map("billing_transactions")
|
|
3683
|
+
@@schema("public")
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
enum PaymentWebhookEventStatus {
|
|
3687
|
+
RECEIVED
|
|
3688
|
+
PROCESSED
|
|
3689
|
+
FAILED
|
|
3690
|
+
|
|
3691
|
+
@@schema("public")
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
/// Idempotent record of payment provider webhook deliveries.
|
|
3695
|
+
model PaymentWebhookEvent {
|
|
3696
|
+
id String @id @default(uuid())
|
|
3697
|
+
organisation_id String?
|
|
3698
|
+
provider String
|
|
3699
|
+
provider_event_id String
|
|
3700
|
+
event_type String
|
|
3701
|
+
status PaymentWebhookEventStatus @default(RECEIVED)
|
|
3702
|
+
billing_transaction_id String?
|
|
3703
|
+
error_message String?
|
|
3704
|
+
processed_at DateTime?
|
|
3705
|
+
created_at DateTime @default(now())
|
|
3706
|
+
|
|
3707
|
+
organisation Organisation? @relation(fields: [organisation_id], references: [id])
|
|
3708
|
+
|
|
3709
|
+
@@unique([provider, provider_event_id])
|
|
3710
|
+
@@index([status, created_at])
|
|
3711
|
+
@@map("payment_webhook_events")
|
|
3712
|
+
@@schema("public")
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3599
3715
|
model Permission {
|
|
3600
3716
|
id String @id @default(uuid())
|
|
3601
3717
|
permissions String[] @default([])
|