RazorpaySubscription constructor

  1. @JsonSerializable(includeIfNull: false)
const RazorpaySubscription({
  1. required String id,
  2. required String entity,
  3. required String plan_id,
  4. required SubscriptionStatus status,
  5. required int total_count,
  6. required int quantity,
  7. required int paid_count,
  8. required bool has_scheduled_changes,
  9. required String remaining_count,
  10. @JsonKey(toJson: _boolToInt, fromJson: _intToBool) bool? customer_notify,
  11. String? offer_id,
  12. int? expire_by,
  13. List<RazorpaySubscriptionAddonsItem>? addons,
  14. IMap? notes,
  15. int? current_start,
  16. int? current_end,
  17. int? ended_at,
  18. int? change_scheduled_at,
  19. String? customer_id,
  20. String? payment_method,
})

Implementation

@JsonSerializable(includeIfNull: false)
const factory RazorpaySubscription({
  required String id,
  required String entity,
  required String plan_id,
  required SubscriptionStatus status,
  required int total_count,
  required int quantity,
  required int paid_count,
  required bool
      has_scheduled_changes, // d.ts shows quantity as optional in base, but required here? Assume required., required int start_at, // Non-nullable in response, required int charge_at, // Unix timestamp, required int end_at, // Unix timestamp (calculated end), required int auth_attempts, required int paid_count, required int created_at, // Unix timestamp, required String short_url, required bool has_scheduled_changes, required String source, // e.g., 'api', 'dashboard', required String
  required String
      remaining_count, // String in d.ts? Assume int based on context. Revert if needed.
  @JsonKey(toJson: _boolToInt, fromJson: _intToBool) bool? customer_notify,
  String? offer_id,
  int? expire_by, // Still nullable? Or defaults? Assuming nullable.
  List<RazorpaySubscriptionAddonsItem>?
      addons, // Reflects addons at creation?
  IMap<dynamic>? notes,
  // ScheduleChangeAt? schedule_change_at, // Usually not part of the main response

  // Response specific fields
  int? current_start, // Nullable Unix timestamp
  int? current_end, // Nullable Unix timestamp
  int? ended_at, // Nullable Unix timestamp
  int? change_scheduled_at, // Nullable Unix timestamp
  String? customer_id, // Nullable string
  String? payment_method, // Nullable string
}) = _RazorpaySubscription;