Skip to content

Commit

Permalink
Add missing subscription fields (#14)
Browse files Browse the repository at this point in the history
* Add missing subscription struct fields

Add missing fields from subscription struct: AutoResumeDate, GracePeriodExpiresDate, RefundedAt, OwnershipType, StoreTransactionID.
Also add OwnershipType type to be consistent with rest of code.

* Fix preexisting typo in Store type comment

fix preexisting type in Store type comment
  • Loading branch information
dgalambos authored Oct 21, 2024
1 parent a5f8242 commit 7fe5fbf
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions subscribers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ type Entitlement struct {

// https://docs.revenuecat.com/reference#the-subscription-object
type Subscription struct {
ExpiresDate *time.Time `json:"expires_date"`
PurchaseDate time.Time `json:"purchase_date"`
OriginalPurchaseDate time.Time `json:"original_purchase_date"`
PeriodType PeriodType `json:"period_type"`
Store Store `json:"store"`
IsSandbox bool `json:"is_sandbox"`
UnsubscribeDetectedAt *time.Time `json:"unsubscribe_detected_at"`
BillingIssuesDetectedAt *time.Time `json:"billing_issues_detected_at"`
ExpiresDate *time.Time `json:"expires_date"`
PurchaseDate time.Time `json:"purchase_date"`
OriginalPurchaseDate time.Time `json:"original_purchase_date"`
PeriodType PeriodType `json:"period_type"`
Store Store `json:"store"`
IsSandbox bool `json:"is_sandbox"`
UnsubscribeDetectedAt *time.Time `json:"unsubscribe_detected_at"`
BillingIssuesDetectedAt *time.Time `json:"billing_issues_detected_at"`
AutoResumeDate *time.Time `json:"auto_resume_date"`
GracePeriodExpiresDate *time.Time `json:"grace_period_expires_date"`
RefundedAt *time.Time `json:"refunded_at"`
OwnershipType OwnershipType `json:"ownership_type"`
StoreTransactionID string `json:"store_transaction_id"`
}

// https://docs.revenuecat.com/reference#section-the-non-subscription-object
Expand All @@ -62,7 +67,15 @@ const (
IntroPeriodType PeriodType = "intro"
)

// PeriodType holds the predefined values for a store.
// OwnershipType holds the predefined values for a subscription ownership type.
type OwnershipType string

const (
PurchasedOwnershipType OwnershipType = "PURCHASED"
FamilySharedOwnershipType OwnershipType = "FAMILY_SHARED"
)

// Store holds the predefined values for a store.
type Store string

// https://docs.revenuecat.com/reference#the-subscription-object
Expand Down

0 comments on commit 7fe5fbf

Please sign in to comment.