mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 16:07:42 +00:00
tweak on receipt check
This commit is contained in:
parent
079cc9a5c5
commit
bbb3001544
1 changed files with 10 additions and 13 deletions
|
@ -36,11 +36,7 @@ func (a *api) checkReceiptHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if iapr.DeleteDevice {
|
if iapr.DeleteDevice {
|
||||||
if dev.GracePeriodExpiresAt.After(time.Now()) {
|
if dev.GracePeriodExpiresAt.Before(time.Now()) {
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
accs, err := a.accountRepo.GetByAPNSToken(ctx, apns)
|
accs, err := a.accountRepo.GetByAPNSToken(ctx, apns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.errorResponse(w, r, 500, err)
|
a.errorResponse(w, r, 500, err)
|
||||||
|
@ -52,6 +48,7 @@ func (a *api) checkReceiptHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = a.deviceRepo.Delete(ctx, apns)
|
_ = a.deviceRepo.Delete(ctx, apns)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dev.ExpiresAt = time.Now().Add(domain.DeviceActiveAfterReceitCheckDuration)
|
dev.ExpiresAt = time.Now().Add(domain.DeviceActiveAfterReceitCheckDuration)
|
||||||
dev.GracePeriodExpiresAt = dev.ExpiresAt.Add(domain.DeviceGracePeriodAfterReceiptExpiry)
|
dev.GracePeriodExpiresAt = dev.ExpiresAt.Add(domain.DeviceGracePeriodAfterReceiptExpiry)
|
||||||
|
|
Loading…
Reference in a new issue