Skip to content

Commit 4f2d7b9

Browse files
authoredNov 4, 2022
Merge pull request #174 from dzoke/missing-rvs-response-field
Added missing RVS Response Fields
2 parents 543a5a4 + 610b42a commit 4f2d7b9

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed
 

‎amazon/validator.go

+13-12
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ func getSandboxURL() string {
2727

2828
// The IAPResponse type has the response properties
2929
type IAPResponse struct {
30-
ReceiptID string `json:"receiptId"`
31-
ProductType string `json:"productType"`
32-
ProductID string `json:"productId"`
33-
PurchaseDate int64 `json:"purchaseDate"`
34-
RenewalDate int64 `json:"renewalDate"`
35-
CancelDate int64 `json:"cancelDate"`
36-
TestTransaction bool `json:"testTransaction"`
37-
BetaProduct bool `json:"betaProduct"`
38-
ParentProductID string `json:"parentProductId"`
39-
Quantity int64 `json:"quantity"`
40-
Term string `json:"term"`
41-
TermSku string `json:"termSku"`
30+
ReceiptID string `json:"receiptId"`
31+
ProductType string `json:"productType"`
32+
ProductID string `json:"productId"`
33+
PurchaseDate int64 `json:"purchaseDate"`
34+
RenewalDate int64 `json:"renewalDate"`
35+
CancelDate int64 `json:"cancelDate"`
36+
TestTransaction bool `json:"testTransaction"`
37+
BetaProduct bool `json:"betaProduct"`
38+
ParentProductID string `json:"parentProductId"`
39+
Quantity int64 `json:"quantity"`
40+
Term string `json:"term"`
41+
TermSku string `json:"termSku"`
42+
FreeTrialEndDate int64 `json:"freeTrialEndDate"`
4243
}
4344

4445
// The IAPResponseError typs has error message and status.

‎amazon/validator_test.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,22 @@ func TestVerifySubscription(t *testing.T) {
111111
t.Parallel()
112112
server, client := testTools(
113113
200,
114-
"{\"purchaseDate\":1558424877035,\"receiptId\":\"q1YqVrJSSs7P1UvMTazKz9PLTCwoTswtyEktM9JLrShIzCvOzM-LL04tiTdW0lFKASo2NDEwMjCwMDM2MTC0AIqVAsUsLd1c4l18jIxdfTOK_N1d8kqLLHVLc8oK83OLgtPNCit9AoJdjJ3dXG2BGkqUrAxrAQ\",\"productId\":\"com.amazon.iapsamplev2.expansion_set_3\",\"parentProductId\":null,\"productType\":\"SUBSCRIPTION\",\"renewalDate\":1561103277035,\"quantity\":1,\"betaProduct\":false,\"testTransaction\":true,\"term\":\"1 Week\",\"termSku\":\"sub1-weekly\"}",
114+
"{\"purchaseDate\":1558424877035,\"receiptId\":\"q1YqVrJSSs7P1UvMTazKz9PLTCwoTswtyEktM9JLrShIzCvOzM-LL04tiTdW0lFKASo2NDEwMjCwMDM2MTC0AIqVAsUsLd1c4l18jIxdfTOK_N1d8kqLLHVLc8oK83OLgtPNCit9AoJdjJ3dXG2BGkqUrAxrAQ\",\"productId\":\"com.amazon.iapsamplev2.expansion_set_3\",\"parentProductId\":null,\"productType\":\"SUBSCRIPTION\",\"renewalDate\":1561103277035,\"quantity\":1,\"betaProduct\":false,\"testTransaction\":true,\"term\":\"1 Week\",\"termSku\":\"sub1-weekly\", \"freeTrialEndDate\":1561104377023}",
115115
)
116116
defer server.Close()
117117

118118
expected := IAPResponse{
119-
ReceiptID: "q1YqVrJSSs7P1UvMTazKz9PLTCwoTswtyEktM9JLrShIzCvOzM-LL04tiTdW0lFKASo2NDEwMjCwMDM2MTC0AIqVAsUsLd1c4l18jIxdfTOK_N1d8kqLLHVLc8oK83OLgtPNCit9AoJdjJ3dXG2BGkqUrAxrAQ",
120-
ProductType: "SUBSCRIPTION",
121-
ProductID: "com.amazon.iapsamplev2.expansion_set_3",
122-
PurchaseDate: 1558424877035,
123-
RenewalDate: 1561103277035,
124-
CancelDate: 0,
125-
TestTransaction: true,
126-
Quantity: 1,
127-
Term: "1 Week",
128-
TermSku: "sub1-weekly",
119+
ReceiptID: "q1YqVrJSSs7P1UvMTazKz9PLTCwoTswtyEktM9JLrShIzCvOzM-LL04tiTdW0lFKASo2NDEwMjCwMDM2MTC0AIqVAsUsLd1c4l18jIxdfTOK_N1d8kqLLHVLc8oK83OLgtPNCit9AoJdjJ3dXG2BGkqUrAxrAQ",
120+
ProductType: "SUBSCRIPTION",
121+
ProductID: "com.amazon.iapsamplev2.expansion_set_3",
122+
PurchaseDate: 1558424877035,
123+
RenewalDate: 1561103277035,
124+
CancelDate: 0,
125+
TestTransaction: true,
126+
Quantity: 1,
127+
Term: "1 Week",
128+
TermSku: "sub1-weekly",
129+
FreeTrialEndDate: 1561104377023,
129130
}
130131

131132
actual, _ := client.Verify(

0 commit comments

Comments
 (0)
Failed to load comments.