@happyvertical/smrt-commerce 0.51.33 → 0.51.34

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.
Files changed (37) hide show
  1. package/AGENTS.md +17 -0
  2. package/README.md +88 -0
  3. package/dist/__tests__/helpers/crypto-rail.d.ts +69 -0
  4. package/dist/__tests__/helpers/crypto-rail.d.ts.map +1 -0
  5. package/dist/__tests__/helpers/fake-stripe.d.ts +1 -0
  6. package/dist/__tests__/helpers/fake-stripe.d.ts.map +1 -1
  7. package/dist/billing/btcpay.d.ts +40 -0
  8. package/dist/billing/btcpay.d.ts.map +1 -0
  9. package/dist/billing/credits.d.ts +6 -1
  10. package/dist/billing/credits.d.ts.map +1 -1
  11. package/dist/billing/crypto.d.ts +32 -0
  12. package/dist/billing/crypto.d.ts.map +1 -0
  13. package/dist/billing/events.d.ts +10 -1
  14. package/dist/billing/events.d.ts.map +1 -1
  15. package/dist/billing/index.d.ts +5 -1
  16. package/dist/billing/index.d.ts.map +1 -1
  17. package/dist/billing/invoice-payments.d.ts +29 -0
  18. package/dist/billing/invoice-payments.d.ts.map +1 -0
  19. package/dist/billing/payment-attempts.d.ts +143 -0
  20. package/dist/billing/payment-attempts.d.ts.map +1 -0
  21. package/dist/billing/provider.d.ts +97 -1
  22. package/dist/billing/provider.d.ts.map +1 -1
  23. package/dist/billing/runtime.d.ts +107 -4
  24. package/dist/billing/runtime.d.ts.map +1 -1
  25. package/dist/billing/stripe.d.ts +5 -0
  26. package/dist/billing/stripe.d.ts.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4055 -2859
  30. package/dist/index.js.map +1 -1
  31. package/dist/manifest.json +920 -91
  32. package/dist/models/billing.d.ts +103 -0
  33. package/dist/models/billing.d.ts.map +1 -1
  34. package/dist/models/index.d.ts +1 -1
  35. package/dist/models/index.d.ts.map +1 -1
  36. package/dist/smrt-knowledge.json +319 -8
  37. package/package.json +10 -9
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-commerce",
5
- "packageVersion": "0.51.33",
5
+ "packageVersion": "0.51.34",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-commerce:ContractCollection": {
8
8
  "name": "contractcollection",
@@ -12594,6 +12594,528 @@
12594
12594
  },
12595
12595
  "importPath": "@happyvertical/smrt-commerce"
12596
12596
  },
12597
+ "@happyvertical/smrt-commerce:BillingPaymentAttempt": {
12598
+ "name": "billingpaymentattempt",
12599
+ "className": "BillingPaymentAttempt",
12600
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingPaymentAttempt",
12601
+ "collection": "billingpaymentattempts",
12602
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12603
+ "packageName": "@happyvertical/smrt-commerce",
12604
+ "fields": {
12605
+ "sellerTenantId": {
12606
+ "type": "crossPackageRef",
12607
+ "required": true,
12608
+ "related": "@happyvertical/smrt-users:Tenant",
12609
+ "_meta": {
12610
+ "required": true
12611
+ }
12612
+ },
12613
+ "payerTenantId": {
12614
+ "type": "crossPackageRef",
12615
+ "required": true,
12616
+ "related": "@happyvertical/smrt-users:Tenant",
12617
+ "_meta": {
12618
+ "required": true
12619
+ }
12620
+ },
12621
+ "billingAccountId": {
12622
+ "type": "text",
12623
+ "required": false,
12624
+ "default": ""
12625
+ },
12626
+ "purpose": {
12627
+ "type": "text",
12628
+ "required": false,
12629
+ "default": "credit_purchase"
12630
+ },
12631
+ "invoiceId": {
12632
+ "type": "text",
12633
+ "required": false,
12634
+ "default": ""
12635
+ },
12636
+ "spendingPolicyId": {
12637
+ "type": "text",
12638
+ "required": false,
12639
+ "default": ""
12640
+ },
12641
+ "provider": {
12642
+ "type": "text",
12643
+ "required": false,
12644
+ "default": ""
12645
+ },
12646
+ "orderId": {
12647
+ "type": "text",
12648
+ "required": false,
12649
+ "default": ""
12650
+ },
12651
+ "checkoutId": {
12652
+ "type": "text",
12653
+ "required": false,
12654
+ "default": ""
12655
+ },
12656
+ "status": {
12657
+ "type": "text",
12658
+ "required": false,
12659
+ "default": "open"
12660
+ },
12661
+ "exception": {
12662
+ "type": "text",
12663
+ "required": false,
12664
+ "default": "none"
12665
+ },
12666
+ "flag": {
12667
+ "type": "text",
12668
+ "required": false,
12669
+ "default": ""
12670
+ },
12671
+ "amount": {
12672
+ "type": "integer",
12673
+ "required": false,
12674
+ "default": 0
12675
+ },
12676
+ "currency": {
12677
+ "type": "text",
12678
+ "required": false,
12679
+ "default": "USD"
12680
+ },
12681
+ "amountPaid": {
12682
+ "type": "integer",
12683
+ "required": false,
12684
+ "default": 0
12685
+ },
12686
+ "nativeCurrency": {
12687
+ "type": "text",
12688
+ "required": false,
12689
+ "default": ""
12690
+ },
12691
+ "nativeAmountDue": {
12692
+ "type": "integer",
12693
+ "required": false,
12694
+ "default": 0
12695
+ },
12696
+ "nativeAmountPaid": {
12697
+ "type": "integer",
12698
+ "required": false,
12699
+ "default": 0
12700
+ },
12701
+ "rate": {
12702
+ "type": "text",
12703
+ "required": false,
12704
+ "default": ""
12705
+ },
12706
+ "rateSource": {
12707
+ "type": "text",
12708
+ "required": false,
12709
+ "default": ""
12710
+ },
12711
+ "checkoutUrl": {
12712
+ "type": "text",
12713
+ "required": false,
12714
+ "default": ""
12715
+ },
12716
+ "expiresAt": {
12717
+ "type": "datetime",
12718
+ "required": false,
12719
+ "_meta": {
12720
+ "nullable": true
12721
+ }
12722
+ },
12723
+ "payments": {
12724
+ "type": "json",
12725
+ "required": false,
12726
+ "default": []
12727
+ },
12728
+ "timeline": {
12729
+ "type": "json",
12730
+ "required": false,
12731
+ "default": []
12732
+ },
12733
+ "settledAt": {
12734
+ "type": "datetime",
12735
+ "required": false,
12736
+ "_meta": {
12737
+ "nullable": true
12738
+ }
12739
+ },
12740
+ "paymentId": {
12741
+ "type": "text",
12742
+ "required": false,
12743
+ "default": ""
12744
+ },
12745
+ "creditGrantId": {
12746
+ "type": "text",
12747
+ "required": false,
12748
+ "default": ""
12749
+ },
12750
+ "resolution": {
12751
+ "type": "text",
12752
+ "required": false,
12753
+ "default": ""
12754
+ },
12755
+ "resolvedAt": {
12756
+ "type": "datetime",
12757
+ "required": false,
12758
+ "_meta": {
12759
+ "nullable": true
12760
+ }
12761
+ },
12762
+ "outOfBandRequestedAt": {
12763
+ "type": "datetime",
12764
+ "required": false,
12765
+ "_meta": {
12766
+ "nullable": true
12767
+ }
12768
+ },
12769
+ "pausedStanding": {
12770
+ "type": "text",
12771
+ "required": false,
12772
+ "default": ""
12773
+ },
12774
+ "excessAmount": {
12775
+ "type": "integer",
12776
+ "required": false,
12777
+ "default": 0
12778
+ },
12779
+ "excessRevision": {
12780
+ "type": "integer",
12781
+ "required": false,
12782
+ "default": 0
12783
+ },
12784
+ "settlementOutcome": {
12785
+ "type": "text",
12786
+ "required": false,
12787
+ "default": ""
12788
+ },
12789
+ "refundedAmount": {
12790
+ "type": "integer",
12791
+ "required": false,
12792
+ "default": 0
12793
+ },
12794
+ "refundedPrincipal": {
12795
+ "type": "integer",
12796
+ "required": false,
12797
+ "default": 0
12798
+ },
12799
+ "refunds": {
12800
+ "type": "json",
12801
+ "required": false,
12802
+ "default": []
12803
+ }
12804
+ },
12805
+ "methods": {},
12806
+ "decoratorConfig": {
12807
+ "tableName": "_smrt_billing_payment_attempts",
12808
+ "conflictColumns": [
12809
+ "provider",
12810
+ "checkout_id"
12811
+ ],
12812
+ "api": false,
12813
+ "cli": false,
12814
+ "mcp": false
12815
+ },
12816
+ "extends": "SmrtObject",
12817
+ "exportName": "BillingPaymentAttempt",
12818
+ "collectionExportName": "BillingPaymentAttemptCollection",
12819
+ "validationRules": [
12820
+ {
12821
+ "field": "sellerTenantId",
12822
+ "rule": "required",
12823
+ "fieldType": "crossPackageRef"
12824
+ },
12825
+ {
12826
+ "field": "payerTenantId",
12827
+ "rule": "required",
12828
+ "fieldType": "crossPackageRef"
12829
+ }
12830
+ ],
12831
+ "schema": {
12832
+ "tableName": "_smrt_billing_payment_attempts",
12833
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_payment_attempts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"seller_tenant_id\" UUID NOT NULL,\n \"payer_tenant_id\" UUID NOT NULL,\n \"billing_account_id\" TEXT DEFAULT '',\n \"purpose\" TEXT DEFAULT 'credit_purchase',\n \"invoice_id\" TEXT DEFAULT '',\n \"spending_policy_id\" TEXT DEFAULT '',\n \"provider\" TEXT DEFAULT '',\n \"order_id\" TEXT DEFAULT '',\n \"checkout_id\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'open',\n \"exception\" TEXT DEFAULT 'none',\n \"flag\" TEXT DEFAULT '',\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"amount_paid\" INTEGER DEFAULT 0,\n \"native_currency\" TEXT DEFAULT '',\n \"native_amount_due\" INTEGER DEFAULT 0,\n \"native_amount_paid\" INTEGER DEFAULT 0,\n \"rate\" TEXT DEFAULT '',\n \"rate_source\" TEXT DEFAULT '',\n \"checkout_url\" TEXT DEFAULT '',\n \"expires_at\" TIMESTAMP,\n \"payments\" JSON DEFAULT '[]',\n \"timeline\" JSON DEFAULT '[]',\n \"settled_at\" TIMESTAMP,\n \"payment_id\" TEXT DEFAULT '',\n \"credit_grant_id\" TEXT DEFAULT '',\n \"resolution\" TEXT DEFAULT '',\n \"resolved_at\" TIMESTAMP,\n \"out_of_band_requested_at\" TIMESTAMP,\n \"paused_standing\" TEXT DEFAULT '',\n \"excess_amount\" INTEGER DEFAULT 0,\n \"excess_revision\" INTEGER DEFAULT 0,\n \"settlement_outcome\" TEXT DEFAULT '',\n \"refunded_amount\" INTEGER DEFAULT 0,\n \"refunded_principal\" INTEGER DEFAULT 0,\n \"refunds\" JSON DEFAULT '[]'\n);",
12834
+ "columns": {
12835
+ "id": {
12836
+ "type": "UUID",
12837
+ "primaryKey": true,
12838
+ "referenceKind": "id",
12839
+ "notNull": true
12840
+ },
12841
+ "slug": {
12842
+ "type": "TEXT",
12843
+ "notNull": true
12844
+ },
12845
+ "context": {
12846
+ "type": "TEXT",
12847
+ "notNull": true,
12848
+ "default": ""
12849
+ },
12850
+ "created_at": {
12851
+ "type": "TIMESTAMP",
12852
+ "notNull": true,
12853
+ "default": "current_timestamp"
12854
+ },
12855
+ "updated_at": {
12856
+ "type": "TIMESTAMP",
12857
+ "notNull": true,
12858
+ "default": "current_timestamp"
12859
+ },
12860
+ "seller_tenant_id": {
12861
+ "type": "UUID",
12862
+ "referenceKind": "crossPackageRef",
12863
+ "notNull": true,
12864
+ "unique": false
12865
+ },
12866
+ "payer_tenant_id": {
12867
+ "type": "UUID",
12868
+ "referenceKind": "crossPackageRef",
12869
+ "notNull": true,
12870
+ "unique": false
12871
+ },
12872
+ "billing_account_id": {
12873
+ "type": "TEXT",
12874
+ "notNull": false,
12875
+ "unique": false,
12876
+ "default": ""
12877
+ },
12878
+ "purpose": {
12879
+ "type": "TEXT",
12880
+ "notNull": false,
12881
+ "unique": false,
12882
+ "default": "credit_purchase"
12883
+ },
12884
+ "invoice_id": {
12885
+ "type": "TEXT",
12886
+ "notNull": false,
12887
+ "unique": false,
12888
+ "default": ""
12889
+ },
12890
+ "spending_policy_id": {
12891
+ "type": "TEXT",
12892
+ "notNull": false,
12893
+ "unique": false,
12894
+ "default": ""
12895
+ },
12896
+ "provider": {
12897
+ "type": "TEXT",
12898
+ "notNull": false,
12899
+ "unique": false,
12900
+ "default": ""
12901
+ },
12902
+ "order_id": {
12903
+ "type": "TEXT",
12904
+ "notNull": false,
12905
+ "unique": false,
12906
+ "default": ""
12907
+ },
12908
+ "checkout_id": {
12909
+ "type": "TEXT",
12910
+ "notNull": false,
12911
+ "unique": false,
12912
+ "default": ""
12913
+ },
12914
+ "status": {
12915
+ "type": "TEXT",
12916
+ "notNull": false,
12917
+ "unique": false,
12918
+ "default": "open"
12919
+ },
12920
+ "exception": {
12921
+ "type": "TEXT",
12922
+ "notNull": false,
12923
+ "unique": false,
12924
+ "default": "none"
12925
+ },
12926
+ "flag": {
12927
+ "type": "TEXT",
12928
+ "notNull": false,
12929
+ "unique": false,
12930
+ "default": ""
12931
+ },
12932
+ "amount": {
12933
+ "type": "INTEGER",
12934
+ "notNull": false,
12935
+ "unique": false,
12936
+ "default": 0
12937
+ },
12938
+ "currency": {
12939
+ "type": "TEXT",
12940
+ "notNull": false,
12941
+ "unique": false,
12942
+ "default": "USD"
12943
+ },
12944
+ "amount_paid": {
12945
+ "type": "INTEGER",
12946
+ "notNull": false,
12947
+ "unique": false,
12948
+ "default": 0
12949
+ },
12950
+ "native_currency": {
12951
+ "type": "TEXT",
12952
+ "notNull": false,
12953
+ "unique": false,
12954
+ "default": ""
12955
+ },
12956
+ "native_amount_due": {
12957
+ "type": "INTEGER",
12958
+ "notNull": false,
12959
+ "unique": false,
12960
+ "default": 0
12961
+ },
12962
+ "native_amount_paid": {
12963
+ "type": "INTEGER",
12964
+ "notNull": false,
12965
+ "unique": false,
12966
+ "default": 0
12967
+ },
12968
+ "rate": {
12969
+ "type": "TEXT",
12970
+ "notNull": false,
12971
+ "unique": false,
12972
+ "default": ""
12973
+ },
12974
+ "rate_source": {
12975
+ "type": "TEXT",
12976
+ "notNull": false,
12977
+ "unique": false,
12978
+ "default": ""
12979
+ },
12980
+ "checkout_url": {
12981
+ "type": "TEXT",
12982
+ "notNull": false,
12983
+ "unique": false,
12984
+ "default": ""
12985
+ },
12986
+ "expires_at": {
12987
+ "type": "TIMESTAMP",
12988
+ "notNull": false,
12989
+ "unique": false
12990
+ },
12991
+ "payments": {
12992
+ "type": "JSON",
12993
+ "notNull": false,
12994
+ "unique": false,
12995
+ "default": []
12996
+ },
12997
+ "timeline": {
12998
+ "type": "JSON",
12999
+ "notNull": false,
13000
+ "unique": false,
13001
+ "default": []
13002
+ },
13003
+ "settled_at": {
13004
+ "type": "TIMESTAMP",
13005
+ "notNull": false,
13006
+ "unique": false
13007
+ },
13008
+ "payment_id": {
13009
+ "type": "TEXT",
13010
+ "notNull": false,
13011
+ "unique": false,
13012
+ "default": ""
13013
+ },
13014
+ "credit_grant_id": {
13015
+ "type": "TEXT",
13016
+ "notNull": false,
13017
+ "unique": false,
13018
+ "default": ""
13019
+ },
13020
+ "resolution": {
13021
+ "type": "TEXT",
13022
+ "notNull": false,
13023
+ "unique": false,
13024
+ "default": ""
13025
+ },
13026
+ "resolved_at": {
13027
+ "type": "TIMESTAMP",
13028
+ "notNull": false,
13029
+ "unique": false
13030
+ },
13031
+ "out_of_band_requested_at": {
13032
+ "type": "TIMESTAMP",
13033
+ "notNull": false,
13034
+ "unique": false
13035
+ },
13036
+ "paused_standing": {
13037
+ "type": "TEXT",
13038
+ "notNull": false,
13039
+ "unique": false,
13040
+ "default": ""
13041
+ },
13042
+ "excess_amount": {
13043
+ "type": "INTEGER",
13044
+ "notNull": false,
13045
+ "unique": false,
13046
+ "default": 0
13047
+ },
13048
+ "excess_revision": {
13049
+ "type": "INTEGER",
13050
+ "notNull": false,
13051
+ "unique": false,
13052
+ "default": 0
13053
+ },
13054
+ "settlement_outcome": {
13055
+ "type": "TEXT",
13056
+ "notNull": false,
13057
+ "unique": false,
13058
+ "default": ""
13059
+ },
13060
+ "refunded_amount": {
13061
+ "type": "INTEGER",
13062
+ "notNull": false,
13063
+ "unique": false,
13064
+ "default": 0
13065
+ },
13066
+ "refunded_principal": {
13067
+ "type": "INTEGER",
13068
+ "notNull": false,
13069
+ "unique": false,
13070
+ "default": 0
13071
+ },
13072
+ "refunds": {
13073
+ "type": "JSON",
13074
+ "notNull": false,
13075
+ "unique": false,
13076
+ "default": []
13077
+ }
13078
+ },
13079
+ "indexes": [
13080
+ {
13081
+ "name": "_smrt_billing_payment_attempts_provider_checkout_id_idx",
13082
+ "columns": [
13083
+ "provider",
13084
+ "checkout_id"
13085
+ ],
13086
+ "unique": true,
13087
+ "nullsNotDistinct": true
13088
+ },
13089
+ {
13090
+ "name": "_smrt_billing_payment_attempts_slug_context_idx",
13091
+ "columns": [
13092
+ "slug",
13093
+ "context"
13094
+ ]
13095
+ },
13096
+ {
13097
+ "name": "_smrt_billing_payment_attempts_created_at_idx",
13098
+ "columns": [
13099
+ "created_at"
13100
+ ]
13101
+ },
13102
+ {
13103
+ "name": "_smrt_billing_payment_attempts_seller_tenant_id_idx",
13104
+ "columns": [
13105
+ "seller_tenant_id"
13106
+ ]
13107
+ },
13108
+ {
13109
+ "name": "_smrt_billing_payment_attempts_payer_tenant_id_idx",
13110
+ "columns": [
13111
+ "payer_tenant_id"
13112
+ ]
13113
+ }
13114
+ ],
13115
+ "version": "43aceca7"
13116
+ },
13117
+ "importPath": "@happyvertical/smrt-commerce"
13118
+ },
12597
13119
  "@happyvertical/smrt-commerce:BillingAccountCollection": {
12598
13120
  "name": "billingaccountcollection",
12599
13121
  "className": "BillingAccountCollection",
@@ -12870,131 +13392,309 @@
12870
13392
  "referenceKind": "foreignKey",
12871
13393
  "notNull": false,
12872
13394
  "unique": false,
12873
- "foreignKey": {
12874
- "table": "invoices",
12875
- "column": "id",
12876
- "onDelete": "NO ACTION",
12877
- "onUpdate": "CASCADE"
12878
- }
13395
+ "foreignKey": {
13396
+ "table": "invoices",
13397
+ "column": "id",
13398
+ "onDelete": "NO ACTION",
13399
+ "onUpdate": "CASCADE"
13400
+ }
13401
+ },
13402
+ "provider_invoice_id": {
13403
+ "type": "TEXT",
13404
+ "notNull": false,
13405
+ "unique": false,
13406
+ "default": ""
13407
+ },
13408
+ "subtotal": {
13409
+ "type": "INTEGER",
13410
+ "notNull": false,
13411
+ "unique": false,
13412
+ "default": 0
13413
+ },
13414
+ "line_count": {
13415
+ "type": "INTEGER",
13416
+ "notNull": false,
13417
+ "unique": false,
13418
+ "default": 0
13419
+ },
13420
+ "issued_at": {
13421
+ "type": "TIMESTAMP",
13422
+ "notNull": false,
13423
+ "unique": false
13424
+ },
13425
+ "lease_token": {
13426
+ "type": "TEXT",
13427
+ "notNull": false,
13428
+ "unique": false
13429
+ },
13430
+ "lease_expires_at": {
13431
+ "type": "TIMESTAMP",
13432
+ "notNull": false,
13433
+ "unique": false
13434
+ },
13435
+ "attempts": {
13436
+ "type": "INTEGER",
13437
+ "notNull": false,
13438
+ "unique": false,
13439
+ "default": 0
13440
+ },
13441
+ "last_error": {
13442
+ "type": "TEXT",
13443
+ "notNull": false,
13444
+ "unique": false,
13445
+ "default": ""
13446
+ }
13447
+ },
13448
+ "indexes": [
13449
+ {
13450
+ "name": "_smrt_billing_period_closes_seller_tenant_id_kind_idx",
13451
+ "columns": [
13452
+ "seller_tenant_id",
13453
+ "kind",
13454
+ "payer_tenant_id",
13455
+ "currency",
13456
+ "period_start",
13457
+ "period_end"
13458
+ ],
13459
+ "unique": true,
13460
+ "nullsNotDistinct": true
13461
+ },
13462
+ {
13463
+ "name": "_smrt_billing_period_closes_slug_context_idx",
13464
+ "columns": [
13465
+ "slug",
13466
+ "context"
13467
+ ]
13468
+ },
13469
+ {
13470
+ "name": "_smrt_billing_period_closes_created_at_idx",
13471
+ "columns": [
13472
+ "created_at"
13473
+ ]
13474
+ },
13475
+ {
13476
+ "name": "_smrt_billing_period_closes_payer_tenant_id_idx",
13477
+ "columns": [
13478
+ "payer_tenant_id"
13479
+ ]
13480
+ },
13481
+ {
13482
+ "name": "_smrt_billing_period_closes_billing_account_id_idx",
13483
+ "columns": [
13484
+ "billing_account_id"
13485
+ ]
13486
+ },
13487
+ {
13488
+ "name": "_smrt_billing_period_closes_invoice_id_idx",
13489
+ "columns": [
13490
+ "invoice_id"
13491
+ ]
13492
+ }
13493
+ ],
13494
+ "version": "753d2e86"
13495
+ },
13496
+ "importPath": "@happyvertical/smrt-commerce"
13497
+ },
13498
+ "@happyvertical/smrt-commerce:BillingLineSourceCollection": {
13499
+ "name": "billinglinesourcecollection",
13500
+ "className": "BillingLineSourceCollection",
13501
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingLineSourceCollection",
13502
+ "collection": "billinglinesources",
13503
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
13504
+ "packageName": "@happyvertical/smrt-commerce",
13505
+ "fields": {},
13506
+ "methods": {},
13507
+ "decoratorConfig": {
13508
+ "tableName": "_smrt_billing_line_sources",
13509
+ "api": false,
13510
+ "mcp": false,
13511
+ "cli": false
13512
+ },
13513
+ "extends": "SmrtCollection",
13514
+ "extendsTypeArg": "BillingLineSource",
13515
+ "exportName": "BillingLineSourceCollection",
13516
+ "collectionExportName": "BillingLineSourceCollectionCollection",
13517
+ "schema": {
13518
+ "tableName": "_smrt_billing_line_sources",
13519
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_line_sources\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"seller_tenant_id\" UUID NOT NULL,\n \"period_close_id\" UUID,\n \"source_type\" TEXT DEFAULT 'client_charge',\n \"source_id\" TEXT DEFAULT '',\n \"line_key\" TEXT DEFAULT '',\n \"line_description\" TEXT DEFAULT '',\n \"amount\" INTEGER DEFAULT 0,\n \"discount\" INTEGER DEFAULT 0,\n \"quantity\" REAL DEFAULT 0,\n \"chain_sequence\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP\n);",
13520
+ "columns": {
13521
+ "id": {
13522
+ "type": "UUID",
13523
+ "primaryKey": true,
13524
+ "referenceKind": "id",
13525
+ "notNull": true
13526
+ },
13527
+ "slug": {
13528
+ "type": "TEXT",
13529
+ "notNull": true
13530
+ },
13531
+ "context": {
13532
+ "type": "TEXT",
13533
+ "notNull": true,
13534
+ "default": ""
13535
+ },
13536
+ "created_at": {
13537
+ "type": "TIMESTAMP",
13538
+ "notNull": true,
13539
+ "default": "current_timestamp"
13540
+ },
13541
+ "updated_at": {
13542
+ "type": "TIMESTAMP",
13543
+ "notNull": true,
13544
+ "default": "current_timestamp"
13545
+ },
13546
+ "seller_tenant_id": {
13547
+ "type": "UUID",
13548
+ "referenceKind": "crossPackageRef",
13549
+ "notNull": true,
13550
+ "unique": false
13551
+ },
13552
+ "period_close_id": {
13553
+ "type": "UUID",
13554
+ "referenceKind": "foreignKey",
13555
+ "notNull": false,
13556
+ "unique": false,
13557
+ "foreignKey": {
13558
+ "table": "_smrt_billing_period_closes",
13559
+ "column": "id",
13560
+ "onDelete": "NO ACTION",
13561
+ "onUpdate": "CASCADE"
13562
+ }
13563
+ },
13564
+ "source_type": {
13565
+ "type": "TEXT",
13566
+ "notNull": false,
13567
+ "unique": false,
13568
+ "default": "client_charge"
13569
+ },
13570
+ "source_id": {
13571
+ "type": "TEXT",
13572
+ "notNull": false,
13573
+ "unique": false,
13574
+ "default": ""
13575
+ },
13576
+ "line_key": {
13577
+ "type": "TEXT",
13578
+ "notNull": false,
13579
+ "unique": false,
13580
+ "default": ""
12879
13581
  },
12880
- "provider_invoice_id": {
13582
+ "line_description": {
12881
13583
  "type": "TEXT",
12882
13584
  "notNull": false,
12883
13585
  "unique": false,
12884
13586
  "default": ""
12885
13587
  },
12886
- "subtotal": {
13588
+ "amount": {
12887
13589
  "type": "INTEGER",
12888
13590
  "notNull": false,
12889
13591
  "unique": false,
12890
13592
  "default": 0
12891
13593
  },
12892
- "line_count": {
13594
+ "discount": {
12893
13595
  "type": "INTEGER",
12894
13596
  "notNull": false,
12895
13597
  "unique": false,
12896
13598
  "default": 0
12897
13599
  },
12898
- "issued_at": {
12899
- "type": "TIMESTAMP",
12900
- "notNull": false,
12901
- "unique": false
12902
- },
12903
- "lease_token": {
12904
- "type": "TEXT",
12905
- "notNull": false,
12906
- "unique": false
12907
- },
12908
- "lease_expires_at": {
12909
- "type": "TIMESTAMP",
13600
+ "quantity": {
13601
+ "type": "REAL",
12910
13602
  "notNull": false,
12911
- "unique": false
13603
+ "unique": false,
13604
+ "default": 0
12912
13605
  },
12913
- "attempts": {
13606
+ "chain_sequence": {
12914
13607
  "type": "INTEGER",
12915
13608
  "notNull": false,
12916
13609
  "unique": false,
12917
13610
  "default": 0
12918
13611
  },
12919
- "last_error": {
13612
+ "currency": {
12920
13613
  "type": "TEXT",
12921
13614
  "notNull": false,
12922
13615
  "unique": false,
12923
- "default": ""
13616
+ "default": "USD"
13617
+ },
13618
+ "period_start": {
13619
+ "type": "TIMESTAMP",
13620
+ "notNull": false,
13621
+ "unique": false
13622
+ },
13623
+ "period_end": {
13624
+ "type": "TIMESTAMP",
13625
+ "notNull": false,
13626
+ "unique": false
12924
13627
  }
12925
13628
  },
12926
13629
  "indexes": [
12927
13630
  {
12928
- "name": "_smrt_billing_period_closes_seller_tenant_id_kind_idx",
13631
+ "name": "_smrt_billing_line_sources_source_type_source_id_idx",
12929
13632
  "columns": [
12930
- "seller_tenant_id",
12931
- "kind",
12932
- "payer_tenant_id",
12933
- "currency",
12934
- "period_start",
12935
- "period_end"
13633
+ "source_type",
13634
+ "source_id"
12936
13635
  ],
12937
13636
  "unique": true,
12938
13637
  "nullsNotDistinct": true
12939
13638
  },
12940
13639
  {
12941
- "name": "_smrt_billing_period_closes_slug_context_idx",
13640
+ "name": "_smrt_billing_line_sources_slug_context_idx",
12942
13641
  "columns": [
12943
13642
  "slug",
12944
13643
  "context"
12945
13644
  ]
12946
13645
  },
12947
13646
  {
12948
- "name": "_smrt_billing_period_closes_created_at_idx",
13647
+ "name": "_smrt_billing_line_sources_line_key_chain_sequence_idx",
12949
13648
  "columns": [
12950
- "created_at"
13649
+ "line_key",
13650
+ "chain_sequence"
12951
13651
  ]
12952
13652
  },
12953
13653
  {
12954
- "name": "_smrt_billing_period_closes_payer_tenant_id_idx",
13654
+ "name": "_smrt_billing_line_sources_created_at_idx",
12955
13655
  "columns": [
12956
- "payer_tenant_id"
13656
+ "created_at"
12957
13657
  ]
12958
13658
  },
12959
13659
  {
12960
- "name": "_smrt_billing_period_closes_billing_account_id_idx",
13660
+ "name": "_smrt_billing_line_sources_seller_tenant_id_idx",
12961
13661
  "columns": [
12962
- "billing_account_id"
13662
+ "seller_tenant_id"
12963
13663
  ]
12964
13664
  },
12965
13665
  {
12966
- "name": "_smrt_billing_period_closes_invoice_id_idx",
13666
+ "name": "_smrt_billing_line_sources_period_close_id_idx",
12967
13667
  "columns": [
12968
- "invoice_id"
13668
+ "period_close_id"
12969
13669
  ]
12970
13670
  }
12971
13671
  ],
12972
- "version": "753d2e86"
13672
+ "version": "35e3aaa7"
12973
13673
  },
12974
13674
  "importPath": "@happyvertical/smrt-commerce"
12975
13675
  },
12976
- "@happyvertical/smrt-commerce:BillingLineSourceCollection": {
12977
- "name": "billinglinesourcecollection",
12978
- "className": "BillingLineSourceCollection",
12979
- "qualifiedName": "@happyvertical/smrt-commerce:BillingLineSourceCollection",
12980
- "collection": "billinglinesources",
13676
+ "@happyvertical/smrt-commerce:BillingPaymentAttemptCollection": {
13677
+ "name": "billingpaymentattemptcollection",
13678
+ "className": "BillingPaymentAttemptCollection",
13679
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingPaymentAttemptCollection",
13680
+ "collection": "billingpaymentattempts",
12981
13681
  "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12982
13682
  "packageName": "@happyvertical/smrt-commerce",
12983
13683
  "fields": {},
12984
13684
  "methods": {},
12985
13685
  "decoratorConfig": {
12986
- "tableName": "_smrt_billing_line_sources",
13686
+ "tableName": "_smrt_billing_payment_attempts",
12987
13687
  "api": false,
12988
13688
  "mcp": false,
12989
13689
  "cli": false
12990
13690
  },
12991
13691
  "extends": "SmrtCollection",
12992
- "extendsTypeArg": "BillingLineSource",
12993
- "exportName": "BillingLineSourceCollection",
12994
- "collectionExportName": "BillingLineSourceCollectionCollection",
13692
+ "extendsTypeArg": "BillingPaymentAttempt",
13693
+ "exportName": "BillingPaymentAttemptCollection",
13694
+ "collectionExportName": "BillingPaymentAttemptCollectionCollection",
12995
13695
  "schema": {
12996
- "tableName": "_smrt_billing_line_sources",
12997
- "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_line_sources\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"seller_tenant_id\" UUID NOT NULL,\n \"period_close_id\" UUID,\n \"source_type\" TEXT DEFAULT 'client_charge',\n \"source_id\" TEXT DEFAULT '',\n \"line_key\" TEXT DEFAULT '',\n \"line_description\" TEXT DEFAULT '',\n \"amount\" INTEGER DEFAULT 0,\n \"discount\" INTEGER DEFAULT 0,\n \"quantity\" REAL DEFAULT 0,\n \"chain_sequence\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP\n);",
13696
+ "tableName": "_smrt_billing_payment_attempts",
13697
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_payment_attempts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"seller_tenant_id\" UUID NOT NULL,\n \"payer_tenant_id\" UUID NOT NULL,\n \"billing_account_id\" TEXT DEFAULT '',\n \"purpose\" TEXT DEFAULT 'credit_purchase',\n \"invoice_id\" TEXT DEFAULT '',\n \"spending_policy_id\" TEXT DEFAULT '',\n \"provider\" TEXT DEFAULT '',\n \"order_id\" TEXT DEFAULT '',\n \"checkout_id\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'open',\n \"exception\" TEXT DEFAULT 'none',\n \"flag\" TEXT DEFAULT '',\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"amount_paid\" INTEGER DEFAULT 0,\n \"native_currency\" TEXT DEFAULT '',\n \"native_amount_due\" INTEGER DEFAULT 0,\n \"native_amount_paid\" INTEGER DEFAULT 0,\n \"rate\" TEXT DEFAULT '',\n \"rate_source\" TEXT DEFAULT '',\n \"checkout_url\" TEXT DEFAULT '',\n \"expires_at\" TIMESTAMP,\n \"payments\" JSON DEFAULT '[]',\n \"timeline\" JSON DEFAULT '[]',\n \"settled_at\" TIMESTAMP,\n \"payment_id\" TEXT DEFAULT '',\n \"credit_grant_id\" TEXT DEFAULT '',\n \"resolution\" TEXT DEFAULT '',\n \"resolved_at\" TIMESTAMP,\n \"out_of_band_requested_at\" TIMESTAMP,\n \"paused_standing\" TEXT DEFAULT '',\n \"excess_amount\" INTEGER DEFAULT 0,\n \"excess_revision\" INTEGER DEFAULT 0,\n \"settlement_outcome\" TEXT DEFAULT '',\n \"refunded_amount\" INTEGER DEFAULT 0,\n \"refunded_principal\" INTEGER DEFAULT 0,\n \"refunds\" JSON DEFAULT '[]'\n);",
12998
13698
  "columns": {
12999
13699
  "id": {
13000
13700
  "type": "UUID",
@@ -13027,37 +13727,67 @@
13027
13727
  "notNull": true,
13028
13728
  "unique": false
13029
13729
  },
13030
- "period_close_id": {
13730
+ "payer_tenant_id": {
13031
13731
  "type": "UUID",
13032
- "referenceKind": "foreignKey",
13732
+ "referenceKind": "crossPackageRef",
13733
+ "notNull": true,
13734
+ "unique": false
13735
+ },
13736
+ "billing_account_id": {
13737
+ "type": "TEXT",
13033
13738
  "notNull": false,
13034
13739
  "unique": false,
13035
- "foreignKey": {
13036
- "table": "_smrt_billing_period_closes",
13037
- "column": "id",
13038
- "onDelete": "NO ACTION",
13039
- "onUpdate": "CASCADE"
13040
- }
13740
+ "default": ""
13041
13741
  },
13042
- "source_type": {
13742
+ "purpose": {
13043
13743
  "type": "TEXT",
13044
13744
  "notNull": false,
13045
13745
  "unique": false,
13046
- "default": "client_charge"
13746
+ "default": "credit_purchase"
13047
13747
  },
13048
- "source_id": {
13748
+ "invoice_id": {
13049
13749
  "type": "TEXT",
13050
13750
  "notNull": false,
13051
13751
  "unique": false,
13052
13752
  "default": ""
13053
13753
  },
13054
- "line_key": {
13754
+ "spending_policy_id": {
13055
13755
  "type": "TEXT",
13056
13756
  "notNull": false,
13057
13757
  "unique": false,
13058
13758
  "default": ""
13059
13759
  },
13060
- "line_description": {
13760
+ "provider": {
13761
+ "type": "TEXT",
13762
+ "notNull": false,
13763
+ "unique": false,
13764
+ "default": ""
13765
+ },
13766
+ "order_id": {
13767
+ "type": "TEXT",
13768
+ "notNull": false,
13769
+ "unique": false,
13770
+ "default": ""
13771
+ },
13772
+ "checkout_id": {
13773
+ "type": "TEXT",
13774
+ "notNull": false,
13775
+ "unique": false,
13776
+ "default": ""
13777
+ },
13778
+ "status": {
13779
+ "type": "TEXT",
13780
+ "notNull": false,
13781
+ "unique": false,
13782
+ "default": "open"
13783
+ },
13784
+ "exception": {
13785
+ "type": "TEXT",
13786
+ "notNull": false,
13787
+ "unique": false,
13788
+ "default": "none"
13789
+ },
13790
+ "flag": {
13061
13791
  "type": "TEXT",
13062
13792
  "notNull": false,
13063
13793
  "unique": false,
@@ -13069,85 +13799,184 @@
13069
13799
  "unique": false,
13070
13800
  "default": 0
13071
13801
  },
13072
- "discount": {
13802
+ "currency": {
13803
+ "type": "TEXT",
13804
+ "notNull": false,
13805
+ "unique": false,
13806
+ "default": "USD"
13807
+ },
13808
+ "amount_paid": {
13073
13809
  "type": "INTEGER",
13074
13810
  "notNull": false,
13075
13811
  "unique": false,
13076
13812
  "default": 0
13077
13813
  },
13078
- "quantity": {
13079
- "type": "REAL",
13814
+ "native_currency": {
13815
+ "type": "TEXT",
13816
+ "notNull": false,
13817
+ "unique": false,
13818
+ "default": ""
13819
+ },
13820
+ "native_amount_due": {
13821
+ "type": "INTEGER",
13080
13822
  "notNull": false,
13081
13823
  "unique": false,
13082
13824
  "default": 0
13083
13825
  },
13084
- "chain_sequence": {
13826
+ "native_amount_paid": {
13085
13827
  "type": "INTEGER",
13086
13828
  "notNull": false,
13087
13829
  "unique": false,
13088
13830
  "default": 0
13089
13831
  },
13090
- "currency": {
13832
+ "rate": {
13091
13833
  "type": "TEXT",
13092
13834
  "notNull": false,
13093
13835
  "unique": false,
13094
- "default": "USD"
13836
+ "default": ""
13095
13837
  },
13096
- "period_start": {
13838
+ "rate_source": {
13839
+ "type": "TEXT",
13840
+ "notNull": false,
13841
+ "unique": false,
13842
+ "default": ""
13843
+ },
13844
+ "checkout_url": {
13845
+ "type": "TEXT",
13846
+ "notNull": false,
13847
+ "unique": false,
13848
+ "default": ""
13849
+ },
13850
+ "expires_at": {
13097
13851
  "type": "TIMESTAMP",
13098
13852
  "notNull": false,
13099
13853
  "unique": false
13100
13854
  },
13101
- "period_end": {
13855
+ "payments": {
13856
+ "type": "JSON",
13857
+ "notNull": false,
13858
+ "unique": false,
13859
+ "default": []
13860
+ },
13861
+ "timeline": {
13862
+ "type": "JSON",
13863
+ "notNull": false,
13864
+ "unique": false,
13865
+ "default": []
13866
+ },
13867
+ "settled_at": {
13868
+ "type": "TIMESTAMP",
13869
+ "notNull": false,
13870
+ "unique": false
13871
+ },
13872
+ "payment_id": {
13873
+ "type": "TEXT",
13874
+ "notNull": false,
13875
+ "unique": false,
13876
+ "default": ""
13877
+ },
13878
+ "credit_grant_id": {
13879
+ "type": "TEXT",
13880
+ "notNull": false,
13881
+ "unique": false,
13882
+ "default": ""
13883
+ },
13884
+ "resolution": {
13885
+ "type": "TEXT",
13886
+ "notNull": false,
13887
+ "unique": false,
13888
+ "default": ""
13889
+ },
13890
+ "resolved_at": {
13102
13891
  "type": "TIMESTAMP",
13103
13892
  "notNull": false,
13104
13893
  "unique": false
13894
+ },
13895
+ "out_of_band_requested_at": {
13896
+ "type": "TIMESTAMP",
13897
+ "notNull": false,
13898
+ "unique": false
13899
+ },
13900
+ "paused_standing": {
13901
+ "type": "TEXT",
13902
+ "notNull": false,
13903
+ "unique": false,
13904
+ "default": ""
13905
+ },
13906
+ "excess_amount": {
13907
+ "type": "INTEGER",
13908
+ "notNull": false,
13909
+ "unique": false,
13910
+ "default": 0
13911
+ },
13912
+ "excess_revision": {
13913
+ "type": "INTEGER",
13914
+ "notNull": false,
13915
+ "unique": false,
13916
+ "default": 0
13917
+ },
13918
+ "settlement_outcome": {
13919
+ "type": "TEXT",
13920
+ "notNull": false,
13921
+ "unique": false,
13922
+ "default": ""
13923
+ },
13924
+ "refunded_amount": {
13925
+ "type": "INTEGER",
13926
+ "notNull": false,
13927
+ "unique": false,
13928
+ "default": 0
13929
+ },
13930
+ "refunded_principal": {
13931
+ "type": "INTEGER",
13932
+ "notNull": false,
13933
+ "unique": false,
13934
+ "default": 0
13935
+ },
13936
+ "refunds": {
13937
+ "type": "JSON",
13938
+ "notNull": false,
13939
+ "unique": false,
13940
+ "default": []
13105
13941
  }
13106
13942
  },
13107
13943
  "indexes": [
13108
13944
  {
13109
- "name": "_smrt_billing_line_sources_source_type_source_id_idx",
13945
+ "name": "_smrt_billing_payment_attempts_provider_checkout_id_idx",
13110
13946
  "columns": [
13111
- "source_type",
13112
- "source_id"
13947
+ "provider",
13948
+ "checkout_id"
13113
13949
  ],
13114
13950
  "unique": true,
13115
13951
  "nullsNotDistinct": true
13116
13952
  },
13117
13953
  {
13118
- "name": "_smrt_billing_line_sources_slug_context_idx",
13954
+ "name": "_smrt_billing_payment_attempts_slug_context_idx",
13119
13955
  "columns": [
13120
13956
  "slug",
13121
13957
  "context"
13122
13958
  ]
13123
13959
  },
13124
13960
  {
13125
- "name": "_smrt_billing_line_sources_line_key_chain_sequence_idx",
13126
- "columns": [
13127
- "line_key",
13128
- "chain_sequence"
13129
- ]
13130
- },
13131
- {
13132
- "name": "_smrt_billing_line_sources_created_at_idx",
13961
+ "name": "_smrt_billing_payment_attempts_created_at_idx",
13133
13962
  "columns": [
13134
13963
  "created_at"
13135
13964
  ]
13136
13965
  },
13137
13966
  {
13138
- "name": "_smrt_billing_line_sources_seller_tenant_id_idx",
13967
+ "name": "_smrt_billing_payment_attempts_seller_tenant_id_idx",
13139
13968
  "columns": [
13140
13969
  "seller_tenant_id"
13141
13970
  ]
13142
13971
  },
13143
13972
  {
13144
- "name": "_smrt_billing_line_sources_period_close_id_idx",
13973
+ "name": "_smrt_billing_payment_attempts_payer_tenant_id_idx",
13145
13974
  "columns": [
13146
- "period_close_id"
13975
+ "payer_tenant_id"
13147
13976
  ]
13148
13977
  }
13149
13978
  ],
13150
- "version": "35e3aaa7"
13979
+ "version": "43aceca7"
13151
13980
  },
13152
13981
  "importPath": "@happyvertical/smrt-commerce"
13153
13982
  }