@@ -100,9 +100,7 @@ func (m LagoClient) CreateCustomerWithPlan(ctx context.Context, userEmail string
100
100
}
101
101
102
102
walletName := "Porter Credits"
103
- expiresAt := time .Now ().UTC ().AddDate (0 , 1 , 0 ).Truncate (24 * time .Hour )
104
-
105
- err = m .CreateCreditsGrant (ctx , projectID , walletName , defaultStarterCreditsCents , & expiresAt , sandboxEnabled )
103
+ err = m .CreateCreditsGrant (ctx , projectID , walletName , defaultStarterCreditsCents , sandboxEnabled )
106
104
if err != nil {
107
105
return telemetry .Error (ctx , span , err , "error while creating starter credits grant" )
108
106
}
@@ -145,8 +143,8 @@ func (m LagoClient) CheckIfCustomerExists(ctx context.Context, projectID uint, e
145
143
return true , nil
146
144
}
147
145
148
- // GetCustomeActivePlan will return the active plan for the customer
149
- func (m LagoClient ) GetCustomeActivePlan (ctx context.Context , projectID uint , sandboxEnabled bool ) (plan types.Plan , err error ) {
146
+ // GetCustomerActivePlan will return the active plan for the customer
147
+ func (m LagoClient ) GetCustomerActivePlan (ctx context.Context , projectID uint , sandboxEnabled bool ) (plan types.Plan , err error ) {
150
148
ctx , span := telemetry .NewSpan (ctx , "get-active-subscription" )
151
149
defer span .End ()
152
150
@@ -261,7 +259,7 @@ func (m LagoClient) CheckCustomerCouponExpiration(ctx context.Context, projectID
261
259
}
262
260
263
261
// CreateCreditsGrant will create a new credit grant for the customer with the specified amount
264
- func (m LagoClient ) CreateCreditsGrant (ctx context.Context , projectID uint , name string , grantAmount int64 , expiresAt * time. Time , sandboxEnabled bool ) (err error ) {
262
+ func (m LagoClient ) CreateCreditsGrant (ctx context.Context , projectID uint , name string , grantAmount int64 , sandboxEnabled bool ) (err error ) {
265
263
ctx , span := telemetry .NewSpan (ctx , "create-credits-grant" )
266
264
defer span .End ()
267
265
@@ -283,13 +281,12 @@ func (m LagoClient) CreateCreditsGrant(ctx context.Context, projectID uint, name
283
281
Currency : lago .USD ,
284
282
GrantedCredits : strconv .FormatInt (grantAmount , 10 ),
285
283
// Rate is 1 credit = 1 cent
286
- RateAmount : "0.01" ,
287
- ExpirationAt : expiresAt ,
284
+ RateAmount : "0.01" ,
288
285
}
289
286
290
287
_ , lagoErr := m .client .Wallet ().Create (ctx , walletInput )
291
288
if lagoErr != nil {
292
- return telemetry .Error (ctx , span , fmt .Errorf (lagoErr .ErrorCode ), "failed to create credits grant " )
289
+ return telemetry .Error (ctx , span , fmt .Errorf (lagoErr .ErrorCode ), "failed to create wallet " )
293
290
}
294
291
295
292
return nil
0 commit comments