Skip to content

Commit

Permalink
Add response wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Jul 5, 2022
1 parent 3fb893a commit ddae341
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions packages/hub/node-tests/services/in-app-purchases-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ const mockResponses = {
VALID_RECEIPT: {
status: 200,
json: {
purchaseTimeMillis: '1630529397125',
purchaseState: 0,
consumptionState: 0,
developerPayload: '',
orderId: 'GPA.3374-2691-3583-90384',
acknowledgementState: 1,
kind: 'androidpublisher#productPurchase',
regionCode: 'RU',
resource: {
purchaseTimeMillis: '1630529397125',
purchaseState: 0,
consumptionState: 0,
developerPayload: '',
orderId: 'GPA.3374-2691-3583-90384',
acknowledgementState: 1,
kind: 'androidpublisher#productPurchase',
regionCode: 'RU',
},
},
},
INVALID_RECEIPT: {
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/services/in-app-purchases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class InAppPurchases {

let json = await response.json();

if (response.ok && json.purchaseState === 0) {
if (response.ok && json.resource.purchaseState === 0) {
return { valid: true, response: json };
} else {
return { valid: false, response: json };
Expand Down

0 comments on commit ddae341

Please sign in to comment.