@@ -95,13 +95,15 @@ func createSubscriptionAndroid(c *gin.Context) {
9595 zero := lineItems [0 ].(map [string ]interface {})
9696 offerDetails := zero ["offerDetails" ].(map [string ]interface {})
9797 plan := offerDetails ["basePlanId" ].(string )
98+ expires := time .Now ().AddDate (0 , 2 , 0 )
9899
99100 if receipt .ProductID == "basic" && plan == "basic-monthly" {
100101 receipt .ProductID = "basic_monthly"
101102 }
102103
103104 if receipt .ProductID == "basic" && plan == "basic-yearly" {
104105 receipt .ProductID = "basic_yearly"
106+ expires = time .Now ().AddDate (1 , 0 , 0 )
105107 }
106108
107109 if receipt .ProductID == "premium" && plan == "premium-monthly" {
@@ -110,6 +112,7 @@ func createSubscriptionAndroid(c *gin.Context) {
110112
111113 if receipt .ProductID == "premium" && plan == "premium-yearly" {
112114 receipt .ProductID = "premium_yearly"
115+ expires = time .Now ().AddDate (1 , 0 , 0 )
113116 }
114117
115118 if receipt .ProductID == "professional" && plan == "professional-monthly" {
@@ -118,6 +121,7 @@ func createSubscriptionAndroid(c *gin.Context) {
118121
119122 if receipt .ProductID == "professional" && plan == "professional-yearly" {
120123 receipt .ProductID = "professional_yearly"
124+ expires = time .Now ().AddDate (1 , 0 , 0 )
121125 }
122126
123127 customer_name := receipt .Name
@@ -131,7 +135,6 @@ func createSubscriptionAndroid(c *gin.Context) {
131135 relays := 0
132136 autoRenew := false
133137 issued := time .Now ()
134- expires := time .Now ().AddDate (0 , 2 , 0 )
135138
136139 switch receipt .ProductID {
137140 case "basic_monthly" :
@@ -1082,14 +1085,17 @@ func createSubscriptionApple(c *gin.Context) {
10821085 name = "Basic Service (monthly)"
10831086 case "basic_yearly" :
10841087 name = "Basic Service (yearly)"
1088+ expires = time .Now ().AddDate (1 , 0 , 0 )
10851089 case "premium_monthly" :
10861090 name = "Premium Service (monthly)"
10871091 case "premium_yearly" :
10881092 name = "Premium Service (yearly)"
1093+ expires = time .Now ().AddDate (1 , 0 , 0 )
10891094 case "professional_monthly" :
10901095 name = "Professional Service (monthly)"
10911096 case "professional_yearly" :
10921097 name = "Professional Service (yearly)"
1098+ expires = time .Now ().AddDate (1 , 0 , 0 )
10931099 default :
10941100 log .Errorf ("unknown sku %s" , receipt .ProductID )
10951101 }
0 commit comments