Skip to content

Commit b129229

Browse files
committed
cleanup apple
1 parent 468befb commit b129229

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

api/v1/subscription/subscription.go

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ func createSubscriptionApple(c *gin.Context) {
6565
issued := time.Now()
6666
expires := time.Now().AddDate(1, 0, 0)
6767

68+
switch receipt.ProductID {
69+
case "basic_monthly":
70+
name = "Basic Service (monthly)"
71+
case "basic_yearly":
72+
name = "Basic Service (yearly)"
73+
case "premium_monthly":
74+
name = "Premium Service (monthly)"
75+
case "premium_yearly":
76+
name = "Premium Service (yearly)"
77+
case "professional_monthly":
78+
name = "Professional Service (monthly)"
79+
case "professional_yearly":
80+
name = "Professional Service (yearly)"
81+
default:
82+
log.Errorf("unknown sku %s", receipt.ProductID)
83+
}
6884
// set the credits, name, and description based on the sku
6985
switch receipt.ProductID {
7086
case "24_hours":
@@ -97,20 +113,14 @@ func createSubscriptionApple(c *gin.Context) {
97113
relays = 1
98114
autoRenew = false
99115
expires = time.Now().AddDate(0, 0, 7)
100-
case "basic_monthly":
101-
fallthrough
102-
case "basic_yearly":
103-
credits = 1
104-
name = "Basic Service"
116+
case "basic_monthly", "basic_yearly":
105117
description = "A single tunnel or relay in any region"
106118
devices = 5
107119
networks = 1
108120
members = 2
109121
relays = 1
110122
autoRenew = true
111-
case "premium_monthly":
112-
fallthrough
113-
case "premium_yearly":
123+
case "premium_monthly", "premium_yearly":
114124
credits = 5
115125
name = "Premium"
116126
description = "Up to 5 tunnels or relays in any region"
@@ -119,9 +129,7 @@ func createSubscriptionApple(c *gin.Context) {
119129
members = 5
120130
relays = 5
121131
autoRenew = true
122-
case "professional_monthly":
123-
fallthrough
124-
case "professional_yearly":
132+
case "professional_monthly", "professional_yearly":
125133
credits = 10
126134
name = "Professional"
127135
description = "Up to 10 tunnels or relays in any region"

0 commit comments

Comments
 (0)