@blocklet/payment-types 1.22.31 → 1.23.0

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.
@@ -188,7 +188,7 @@ export declare class CheckoutSession extends Model<InferAttributes<CheckoutSessi
188
188
  allowNull: boolean;
189
189
  };
190
190
  status: {
191
- type: DataTypes.EnumDataType<"open" | "complete" | "expired">;
191
+ type: DataTypes.EnumDataType<"expired" | "open" | "complete">;
192
192
  allowNull: boolean;
193
193
  };
194
194
  payment_status: {
@@ -1,9 +1,11 @@
1
1
  import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
2
  import type { LiteralUnion } from 'type-fest';
3
- import { CreditGrantApplicabilityConfig } from './types';
3
+ import { CreditGrantApplicabilityConfig, CreditGrantChainDetail, CreditGrantChainStatus } from './types';
4
4
  import { TPaymentCurrency } from './payment-currency';
5
+ import { TMeter } from './meter';
5
6
  type CreditGrantSummary = {
6
7
  paymentCurrency: TPaymentCurrency;
8
+ meter?: TMeter;
7
9
  totalAmount: string;
8
10
  remainingAmount: string;
9
11
  grantCount: number;
@@ -27,6 +29,8 @@ export declare class CreditGrant extends Model<InferAttributes<CreditGrant>, Inf
27
29
  voided_at?: number;
28
30
  status: LiteralUnion<'pending' | 'granted' | 'depleted' | 'expired' | 'voided', string>;
29
31
  remaining_amount: string;
32
+ chain_status?: CreditGrantChainStatus;
33
+ chain_detail?: CreditGrantChainDetail;
30
34
  created_by?: string;
31
35
  updated_by?: string;
32
36
  created_via: LiteralUnion<'api' | 'dashboard' | 'portal', string>;
@@ -102,7 +106,7 @@ export declare class CreditGrant extends Model<InferAttributes<CreditGrant>, Inf
102
106
  allowNull: boolean;
103
107
  };
104
108
  status: {
105
- type: DataTypes.EnumDataType<"pending" | "voided" | "expired" | "depleted" | "granted">;
109
+ type: DataTypes.EnumDataType<"pending" | "expired" | "voided" | "depleted" | "granted">;
106
110
  defaultValue: string;
107
111
  allowNull: boolean;
108
112
  };
@@ -110,6 +114,14 @@ export declare class CreditGrant extends Model<InferAttributes<CreditGrant>, Inf
110
114
  type: DataTypes.StringDataType;
111
115
  allowNull: boolean;
112
116
  };
117
+ chain_status: {
118
+ type: DataTypes.EnumDataType<"mint_pending" | "mint_completed" | "mint_failed" | "burn_pending" | "burn_completed" | "burn_failed">;
119
+ allowNull: boolean;
120
+ };
121
+ chain_detail: {
122
+ type: DataTypes.AbstractDataTypeConstructor;
123
+ allowNull: boolean;
124
+ };
113
125
  created_by: {
114
126
  type: DataTypes.StringDataType;
115
127
  allowNull: boolean;
@@ -143,6 +155,10 @@ export declare class CreditGrant extends Model<InferAttributes<CreditGrant>, Inf
143
155
  depleted: boolean;
144
156
  }>;
145
157
  isApplicableToPrice(priceId: string): boolean;
158
+ hasOnchainToken(): boolean;
159
+ static hasOnchainToken(grant: {
160
+ chain_status?: string | null;
161
+ }): boolean;
146
162
  static initialize(sequelize: any): void;
147
163
  static associate(models: any): void;
148
164
  static getAvailableCreditsForCustomer(customerId: string, currencyId: string, priceIds?: string[] | string): Promise<CreditGrant[]>;
@@ -14,6 +14,8 @@ export declare class CreditTransaction extends Model<InferAttributes<CreditTrans
14
14
  meter_unit: string;
15
15
  description?: string;
16
16
  metadata?: Record<string, any>;
17
+ transfer_status?: 'pending' | 'completed' | 'failed' | null;
18
+ transfer_hash?: string;
17
19
  created_at: CreationOptional<Date>;
18
20
  updated_at: CreationOptional<Date>;
19
21
  static readonly GENESIS_ATTRIBUTES: {
@@ -71,6 +73,14 @@ export declare class CreditTransaction extends Model<InferAttributes<CreditTrans
71
73
  type: DataTypes.AbstractDataTypeConstructor;
72
74
  allowNull: boolean;
73
75
  };
76
+ transfer_status: {
77
+ type: DataTypes.EnumDataType<"pending" | "completed" | "failed">;
78
+ allowNull: boolean;
79
+ };
80
+ transfer_hash: {
81
+ type: DataTypes.StringDataType;
82
+ allowNull: boolean;
83
+ };
74
84
  created_at: {
75
85
  type: DataTypes.DateDataTypeConstructor;
76
86
  defaultValue: DataTypes.AbstractDataTypeConstructor;
package/lib/invoice.d.ts CHANGED
@@ -200,7 +200,7 @@ export declare class Invoice extends Model<InferAttributes<Invoice>, InferCreati
200
200
  allowNull: boolean;
201
201
  };
202
202
  billing_reason: {
203
- type: DataTypes.EnumDataType<"subscription_create" | "subscription_cycle" | "subscription_update" | "subscription_threshold" | "subscription_cancel" | "subscription" | "manual" | "upcoming" | "slash_stake" | "stake" | "overdraft_protection" | "stake_overdraft_protection" | "recharge">;
203
+ type: DataTypes.EnumDataType<"manual" | "subscription_create" | "subscription_cycle" | "subscription_update" | "subscription_threshold" | "subscription_cancel" | "subscription" | "upcoming" | "slash_stake" | "stake" | "overdraft_protection" | "stake_overdraft_protection" | "recharge">;
204
204
  };
205
205
  custom_fields: {
206
206
  type: DataTypes.AbstractDataTypeConstructor;
@@ -23,6 +23,7 @@ export declare class PaymentCurrency extends Model<InferAttributes<PaymentCurren
23
23
  vault_config?: VaultConfig;
24
24
  type: LiteralUnion<'standard' | 'credit', string>;
25
25
  recharge_config?: RechargeConfig;
26
+ token_config?: Record<string, any> | null;
26
27
  static readonly GENESIS_ATTRIBUTES: {
27
28
  id: {
28
29
  type: DataTypes.StringDataType;
@@ -111,7 +112,17 @@ export declare class PaymentCurrency extends Model<InferAttributes<PaymentCurren
111
112
  static findByPkOrSymbol(id: string, options?: FindOptions<PaymentCurrency>): Promise<PaymentCurrency | null>;
112
113
  isLocked(): Promise<boolean>;
113
114
  isUsed(): Promise<boolean>;
114
- static createForMeter(meter: any, paymentMethodId: string): Promise<PaymentCurrency>;
115
+ static createForMeter(meter: any, paymentMethodId: string, tokenConfig?: Record<string, any>, options?: {
116
+ decimal?: number;
117
+ }): Promise<PaymentCurrency>;
115
118
  isCredit(): boolean;
119
+ isOnChainCredit(): boolean;
120
+ static isCredit(currency: {
121
+ type?: string | null;
122
+ }): boolean;
123
+ static isOnChainCredit(currency: {
124
+ type?: string | null;
125
+ token_config?: any;
126
+ }): boolean;
116
127
  }
117
128
  export type TPaymentCurrency = InferAttributes<PaymentCurrency>;
package/lib/refund.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class Refund extends Model<InferAttributes<Refund>, InferCreation
15
15
  invoice_id?: string;
16
16
  subscription_id?: string;
17
17
  metadata?: Record<string, any>;
18
- status: LiteralUnion<'pending' | 'requires_action' | 'failed' | 'canceled' | 'succeeded', string>;
18
+ status: LiteralUnion<'pending' | 'requires_action' | 'processing' | 'failed' | 'canceled' | 'succeeded', string>;
19
19
  reason?: LiteralUnion<'duplicate' | 'requested_by_customer' | 'requested_by_admin' | 'fraudulent' | 'expired_uncaptured_charge', string>;
20
20
  failure_reason?: LiteralUnion<'lost_or_stolen_card' | 'expired_or_canceled_card' | 'charge_for_pending_refund_disputed' | 'insufficient_funds' | 'declined' | 'merchant_request' | 'unknown', string>;
21
21
  attempt_count: number;
package/lib/types.d.ts CHANGED
@@ -501,4 +501,35 @@ export type StructuredSourceDataField = {
501
501
  group?: string;
502
502
  };
503
503
  export type SourceData = SimpleSourceData | StructuredSourceDataField[];
504
+ export type CreditGrantChainStatus = 'mint_pending' | 'mint_completed' | 'mint_failed' | 'burn_pending' | 'burn_completed' | 'burn_failed' | 'transfer_completed' | 'transfer_failed';
505
+ export type CreditGrantChainDetail = {
506
+ mint?: {
507
+ hash?: string;
508
+ at?: number;
509
+ error?: string;
510
+ failed_at?: number;
511
+ };
512
+ burn?: {
513
+ hash?: string;
514
+ at?: number;
515
+ amount?: string;
516
+ error?: string;
517
+ failed_at?: number;
518
+ };
519
+ expired_transfer?: {
520
+ hash?: string;
521
+ at?: number;
522
+ amount?: string;
523
+ error?: string;
524
+ failed_at?: number;
525
+ };
526
+ refund?: {
527
+ id?: string;
528
+ burn_hash?: string;
529
+ burned_amount?: string;
530
+ system_retained?: string;
531
+ burn_error?: string;
532
+ };
533
+ voided_reason?: 'refund' | 'expired' | 'manual';
534
+ };
504
535
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-types",
3
- "version": "1.22.31",
3
+ "version": "1.23.0",
4
4
  "description": "Typings for Payment Kit SDK",
5
5
  "keywords": [
6
6
  "types",
@@ -48,5 +48,5 @@
48
48
  "sequelize": "^6.37.7",
49
49
  "type-fest": "^4.41.0"
50
50
  },
51
- "gitHead": "fc03087134d309474256b122eba125e4a01dd6c0"
51
+ "gitHead": "d791ace5b095ff78f4b7328dac8a9575e6b2e265"
52
52
  }