-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi_send_consumption_information.go
36 lines (33 loc) · 1.33 KB
/
api_send_consumption_information.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package appstoreserverapi
import (
"bytes"
"encoding/json"
"net/http"
)
// ApiSendConsumptionInformation 发送消费信息
// Send Consumption Information
// doc: https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information
func (c *client) ApiSendConsumptionInformation(transactionId string, req ConsumptionRequest) error {
reqUrl := c.apiSendConsumptionInformationUrl + transactionId
b, _ := json.Marshal(req)
_, err := c.doRequest(http.MethodPut, reqUrl, bytes.NewReader(b))
if err != nil {
return err
}
return nil
}
// ConsumptionRequest 消费请求
// doc: https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest
type ConsumptionRequest struct {
AccountTenure uint8 `json:"accountTenure"`
AppAccountToken string `json:"appAccountToken"`
ConsumptionStatus uint8 `json:"consumptionStatus"`
CustomerConsented bool `json:"customerConsented"`
DeliveryStatus uint8 `json:"deliveryStatus"`
LifetimeDollarsPurchased uint8 `json:"lifetimeDollarsPurchased"`
LifetimeDollarsRefunded uint8 `json:"lifetimeDollarsRefunded"`
Platform uint8 `json:"platform"`
PlayTime uint8 `json:"playTime"`
SampleContentProvided bool `json:"sampleContentProvided"`
UserStatus uint8 `json:"userStatus"`
}