@blocklet/payment-types 1.23.11 → 1.24.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.
@@ -1,6 +1,6 @@
1
1
  import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
2
  import type { LiteralUnion } from 'type-fest';
3
- import type { PaymentDetails, PaymentSettings, PriceRecurring, ServiceAction, SubscriptionBillingThresholds } from './types';
3
+ import type { CreditScheduleState, PaymentDetails, PaymentSettings, PriceRecurring, ServiceAction, SubscriptionBillingThresholds } from './types';
4
4
  export declare const nextSubscriptionId: (size?: number) => string;
5
5
  export declare class Subscription extends Model<InferAttributes<Subscription>, InferCreationAttributes<Subscription>> {
6
6
  id: CreationOptional<string>;
@@ -70,6 +70,7 @@ export declare class Subscription extends Model<InferAttributes<Subscription>, I
70
70
  payment_method_id: string;
71
71
  payment_details: PaymentDetails;
72
72
  };
73
+ credit_schedule_state?: CreditScheduleState;
73
74
  static readonly GENESIS_ATTRIBUTES: {
74
75
  id: {
75
76
  type: DataTypes.StringDataType;
package/lib/types.d.ts CHANGED
@@ -501,6 +501,37 @@ export type StructuredSourceDataField = {
501
501
  group?: string;
502
502
  };
503
503
  export type SourceData = SimpleSourceData | StructuredSourceDataField[];
504
+ export type CreditScheduleConfig = {
505
+ enabled: boolean;
506
+ delivery_mode: 'invoice' | 'schedule';
507
+ interval_value: number;
508
+ interval_unit: 'hour' | 'day' | 'week' | 'month';
509
+ amount_per_grant?: string;
510
+ first_grant_timing?: 'immediate' | 'after_trial' | 'after_first_payment';
511
+ expire_with_next_grant?: boolean;
512
+ max_grants_per_period?: number;
513
+ };
514
+ export type CreditConfig = {
515
+ credit_amount: string;
516
+ currency_id: string;
517
+ applicable_prices?: string[];
518
+ valid_duration_value?: number;
519
+ valid_duration_unit?: 'hours' | 'days' | 'weeks' | 'months' | 'years';
520
+ priority?: number;
521
+ schedule?: CreditScheduleConfig;
522
+ };
523
+ export type CreditSchedulePriceState = {
524
+ enabled: boolean;
525
+ schedule_anchor_at: number;
526
+ next_grant_at: number;
527
+ last_grant_seq: number;
528
+ grants_in_current_period: number;
529
+ last_grant_id?: string;
530
+ last_error?: string;
531
+ };
532
+ export type CreditScheduleState = {
533
+ [priceId: string]: CreditSchedulePriceState;
534
+ };
504
535
  export type CreditGrantChainStatus = 'mint_pending' | 'mint_completed' | 'mint_failed' | 'burn_pending' | 'burn_completed' | 'burn_failed' | 'transfer_completed' | 'transfer_failed';
505
536
  export type CreditGrantChainDetail = {
506
537
  mint?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-types",
3
- "version": "1.23.11",
3
+ "version": "1.24.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": "72af80fc6e91e88058665212985002966f55787c"
51
+ "gitHead": "f3fad0829a1377422d51f9b6445a3502d0e94719"
52
52
  }