mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 07:27:43 +00:00
be more forgiving with itunes receipt verification outages
This commit is contained in:
parent
647995271e
commit
fdcb900297
1 changed files with 13 additions and 0 deletions
|
@ -23,6 +23,19 @@ func (a *api) checkReceiptHandler(w http.ResponseWriter, r *http.Request) {
|
|||
iapr, err := itunes.NewIAPResponse(string(body), true)
|
||||
|
||||
if err != nil {
|
||||
// treat as if it's a valid subscription, given that this is not the user's fault
|
||||
if apns != "" {
|
||||
dev, err := a.deviceRepo.GetByAPNSToken(ctx, apns)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r, 500, err)
|
||||
return
|
||||
}
|
||||
|
||||
dev.ExpiresAt = time.Now().Add(domain.DeviceActiveAfterReceitCheckDuration)
|
||||
dev.GracePeriodExpiresAt = dev.ExpiresAt.Add(domain.DeviceGracePeriodAfterReceiptExpiry)
|
||||
_ = a.deviceRepo.Update(ctx, &dev)
|
||||
}
|
||||
|
||||
a.logger.Info("failed to verify receipt", zap.Error(err))
|
||||
a.errorResponse(w, r, 500, err)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue