Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription schedule fixes #264

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public struct SubscriptionScheduleCurrentPhase: Codable {

public struct SubscriptionScheduleDefaultSettings: Codable {
/// A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner’s Stripe account during this phase of the schedule.
public var applicationFeePercent: String?
public var applicationFeePercent: Float?
/// Default settings for automatic tax computation.
public var automaticTax: SubscriptionScheduleDefaultSettingsAutomaticTax?
/// Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle documentation.
Expand All @@ -119,7 +119,7 @@ public struct SubscriptionScheduleDefaultSettings: Codable {
/// The account (if any) the subscription’s payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription’s invoices.
public var transferData: SubscriptionScheduleTransferData?

public init(applicationFeePercent: String? = nil,
public init(applicationFeePercent: Float? = nil,
automaticTax: SubscriptionScheduleDefaultSettingsAutomaticTax? = nil,
billingCycleAnchor: SubscriptionScheduleBillingCycleAnchor? = nil,
billingThresholds: SubscriptionScheduleDefaultSettingsBillingThresholds? = nil,
Expand Down Expand Up @@ -198,7 +198,7 @@ public struct SubscriptionSchedulePhase: Codable {
/// A list of prices and quantities that will generate invoice items appended to the first invoice for this phase.
public var addInvoiceItems: [SubscriptionSchedulePhaseAddInvoiceItem]?
/// A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner’s Stripe account during this phase of the schedule.
public var applicationFeePercent: String?
public var applicationFeePercent: Float?
/// Automatic tax settings for this phase.
public var automaticTax: SubscriptionSchedulePhaseAutomaticTax?
/// Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If automatic then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle documentation.
Expand Down Expand Up @@ -237,7 +237,7 @@ public struct SubscriptionSchedulePhase: Codable {
public var trialEnd: Date?

public init(addInvoiceItems: [SubscriptionSchedulePhaseAddInvoiceItem]? = nil,
applicationFeePercent: String? = nil,
applicationFeePercent: Float? = nil,
automaticTax: SubscriptionSchedulePhaseAutomaticTax? = nil,
billingCycleAnchor: SubscriptionScheduleBillingCycleAnchor? = nil,
billingThresholds: SubscriptionScheduleDefaultSettingsBillingThresholds? = nil,
Expand Down Expand Up @@ -366,6 +366,7 @@ public enum SubscriptionScheduleStatus: String, Codable {

public enum SubscriptionSchedulePhaseProrationBehavior: String, Codable {
case createProrations = "create_prorations"
case alwaysInvoice = "always_invoice"
case none
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public protocol SubscriptionScheduleRoutes: StripeAPIRoute {
startDate: Date?,
defaultSettings: [String: Any]?,
endBehavior: SubscriptionScheduleEndBehavior?,
fromSubscription: Bool?,
fromSubscription: String?,
expand: [String]?) async throws -> SubscriptionSchedule

/// Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.
Expand Down Expand Up @@ -97,7 +97,7 @@ public struct StripeSubscriptionScheduleRoutes: SubscriptionScheduleRoutes {
startDate: Date? = nil,
defaultSettings: [String: Any]? = nil,
endBehavior: SubscriptionScheduleEndBehavior? = nil,
fromSubscription: Bool? = nil,
fromSubscription: String? = nil,
expand: [String]? = nil) async throws -> SubscriptionSchedule {
var body: [String: Any] = [:]

Expand Down