add receipt and device deletion

This commit is contained in:
Andre Medeiros 2021-07-26 13:54:24 -04:00
parent 8723bf6c5c
commit 4261c6771c
3 changed files with 20 additions and 0 deletions

View file

@ -67,6 +67,10 @@ func (a *api) Routes() *httprouter.Router {
router.POST("/v1/device", a.upsertDeviceHandler) router.POST("/v1/device", a.upsertDeviceHandler)
router.POST("/v1/device/:apns/test", a.testDeviceHandler) router.POST("/v1/device/:apns/test", a.testDeviceHandler)
router.POST("/v1/device/:apns/account", a.upsertAccountHandler) router.POST("/v1/device/:apns/account", a.upsertAccountHandler)
router.DELETE("/v1/device/:apns", a.deleteDeviceHandler)
router.POST("/v1/receipt", a.checkReceiptHandler)
router.POST("/v1/receipt/:apns", a.checkReceiptHandler)
return router return router
} }

View file

@ -91,3 +91,7 @@ func (a *api) testDeviceHandler(w http.ResponseWriter, r *http.Request, ps httpr
} }
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
} }
func (a *api) deleteDeviceHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.WriteHeader(http.StatusOK)
}

12
internal/api/receipt.go Normal file
View file

@ -0,0 +1,12 @@
package api
import (
"net/http"
"github.com/julienschmidt/httprouter"
)
func (a *api) checkReceiptHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.Write([]byte(`{"status_code": 11, "status_message": "Receipt is valid, lifetime subscription", "subscription_type": "lifetime"}`))
w.WriteHeader(http.StatusOK)
}