Skip to content

Commit b206ecc

Browse files
Matheus Lucca do Carmograywolf336
andauthored
Add a new event type for subscriptions migrated to a bundle (#5)
* Add a new event type from subscriptions migrated to a bundle * Bump API version to 0.1.0 as now we have a new field and a new event type * Bump version to 1.1.0 instead of 0.1.0 * Change subscription migrated event name and move the declaration underneath subscriptions events * Add subscription migrated as a valid type Co-authored-by: Bradley Hilton <graywolf336@craftyn.com>
1 parent 6c43bdc commit b206ecc

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

data/subscription.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ type Subscription struct {
5757

5858
// FromBundleID indicates which bundle id triggered this subscription event for the app
5959
FromBundleID string `bson:"fromBundleId,omitempty" json:"fromBundleId,omitempty"`
60+
61+
// MigratedToBundle indicates if the subscription was migrated from a single app subscription to a bundle subscription
62+
MigratedToBundle bool `bson:"migratedToBundle,omitempty" json:"migratedToBundle,omitempty"`
6063
}
6164

6265
//#region PricingRecurrence

events/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type APIVersion string
4848

4949
const (
5050
// CurrentAPIVersion specify the lastest API version
51-
CurrentAPIVersion APIVersion = "1.0.0"
51+
CurrentAPIVersion APIVersion = "1.1.0"
5252
)
5353

5454
//#endregion APIVersion

events/types.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ const (
1616
// a subscription is modified
1717
AppSubscriptionModifiedEventType EventType = "app.subscription.modified"
1818

19+
// AppSubscriptionMigratedEventType defines the event related to when a subscription is migrate to use the bundle
20+
AppSubscriptionMigratedEventType EventType = "app.subscription.migrated"
21+
1922
// AppPurchasedEventType indicates which type the struct is. Could make it easier for us data map this event from the database
2023
AppPurchasedEventType EventType = "app.purchase.created"
2124
)
2225

2326
func (et EventType) Valid() bool {
24-
return et == AppSubscribedEventType || et == AppPurchasedEventType ||
25-
et == AppSubscriptionCancelledEventType || et == AppSubscriptionModifiedEventType
27+
return et == AppSubscribedEventType ||
28+
et == AppPurchasedEventType ||
29+
et == AppSubscriptionCancelledEventType ||
30+
et == AppSubscriptionModifiedEventType ||
31+
et == AppSubscriptionMigratedEventType
2632
}

0 commit comments

Comments
 (0)