Skip to content

Commit

Permalink
feat: add missing plan override (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartek1912 committed Mar 5, 2022
1 parent d381642 commit 5c5393b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions subscription.go
Expand Up @@ -18,6 +18,7 @@ type (
AutoRenewal bool `json:"auto_renewal,omitempty"`
ApplicationContext *ApplicationContext `json:"application_context,omitempty"`
CustomID string `json:"custom_id,omitempty"`
Plan *PlanOverride `json:"plan,omitempty"`
}

SubscriptionDetails struct {
Expand Down Expand Up @@ -73,6 +74,34 @@ type (
CaptureType CaptureType `json:"capture_type"`
Amount Money `json:"amount"`
}

// https://developer.paypal.com/docs/api/subscriptions/v1/#definition-plan_override
PlanOverride struct {
BillingCycles []BillingCycleOverride `json:"billing_cycles,omitempty"`
PaymentPreferences *PaymentPreferencesOverride `json:"payment_preferences,omitempty"`
Taxes *TaxesOverride `json:"taxes,omitempty"`
}

// https://developer.paypal.com/docs/api/subscriptions/v1/#definition-payment_preferences_override
PaymentPreferencesOverride struct {
AutoBillOutstanding bool `json:"auto_bill_outstanding,omitempty"`
SetupFee Money `json:"setup_fee,omitempty"`
SetupFeeFailureAction SetupFeeFailureAction `json:"setup_fee_failure_action,omitempty"`
PaymentFailureThreshold int `json:"payment_failure_threshold,omitempty"`
}

// https://developer.paypal.com/docs/api/subscriptions/v1/#definition-payment_preferences_override
TaxesOverride struct {
Percentage string `json:"percentage,omitempty"`
Inclusive *bool `json:"inclusive,omitempty"`
}

// https://developer.paypal.com/docs/api/subscriptions/v1/#definition-billing_cycle_override
BillingCycleOverride struct {
PricingScheme PricingScheme `json:"pricing_scheme,omitempty"`
Sequence *int `json:"sequence,omitempty"`
TotalCycles *int `json:"total_cycles,omitempty"`
}
)

func (self *Subscription) GetUpdatePatch() []Patch {
Expand Down

0 comments on commit 5c5393b

Please sign in to comment.