@mpgd/game-services 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -75,8 +75,9 @@ export interface AppsInTossPurchaseAuthorityInput {
|
|
|
75
75
|
export interface AppsInTossPurchaseOrderRecord {
|
|
76
76
|
readonly orderId: string;
|
|
77
77
|
/**
|
|
78
|
-
* Server-authenticated game player identity associated with
|
|
79
|
-
* user
|
|
78
|
+
* Server-authenticated game player identity associated with this order.
|
|
79
|
+
* It may be bound through a Toss Login user key or through a verified
|
|
80
|
+
* platform-anonymous game identity plus a consume-once order authority.
|
|
80
81
|
*/
|
|
81
82
|
readonly playerId: string;
|
|
82
83
|
readonly sku: string;
|
|
@@ -76,10 +76,11 @@ export interface AppsInTossPartnerApiClient {
|
|
|
76
76
|
getIapOrderStatus(input: {
|
|
77
77
|
readonly orderId: string;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
* lookup to the same authenticated user
|
|
79
|
+
* Optional user key resolved through Apps in Toss login. Supplying it
|
|
80
|
+
* narrows the lookup to the same authenticated user; the official API also
|
|
81
|
+
* supports an order-id-only lookup when a game does not require login.
|
|
81
82
|
*/
|
|
82
|
-
readonly tossUserKey
|
|
83
|
+
readonly tossUserKey?: string;
|
|
83
84
|
readonly signal?: AbortSignal;
|
|
84
85
|
}): Promise<AppsInTossIapOrderStatusResult>;
|
|
85
86
|
}
|
|
@@ -35,10 +35,16 @@ export function createAppsInTossPartnerApiClient(input) {
|
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
37
|
const envelope = requireSuccessEnvelope(response);
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// The OpenAPI schema uses a boolean while older Apps in Toss examples use
|
|
39
|
+
// strings. Both false forms are ordinary rejections; every other shape
|
|
40
|
+
// remains malformed and fails closed below.
|
|
41
|
+
if (envelope.success === true || envelope.success === 'true') {
|
|
42
|
+
return true;
|
|
40
43
|
}
|
|
41
|
-
|
|
44
|
+
if (envelope.success === false || envelope.success === 'false') {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
throw new AppsInTossPartnerApiError('Apps in Toss returned an invalid anonymous-key verification response.', response.status);
|
|
42
48
|
},
|
|
43
49
|
async sendFunctionalMessage(request) {
|
|
44
50
|
const recipient = normalizeRecipient(request.recipient);
|
|
@@ -91,12 +97,14 @@ export function createAppsInTossPartnerApiClient(input) {
|
|
|
91
97
|
},
|
|
92
98
|
async getIapOrderStatus(request) {
|
|
93
99
|
const orderId = normalizeIdentifier(request.orderId, 'orderId');
|
|
94
|
-
const tossUserKey =
|
|
100
|
+
const tossUserKey = request.tossUserKey === undefined
|
|
101
|
+
? undefined
|
|
102
|
+
: normalizeTossUserKey(request.tossUserKey, 'tossUserKey');
|
|
95
103
|
const response = await requestJson({
|
|
96
104
|
mtls: input.mtls,
|
|
97
105
|
method: 'POST',
|
|
98
106
|
url: new URL(getIapOrderStatusPath, baseUrl).href,
|
|
99
|
-
headers: { 'x-toss-user-key': tossUserKey },
|
|
107
|
+
headers: tossUserKey === undefined ? {} : { 'x-toss-user-key': tossUserKey },
|
|
100
108
|
body: { orderId },
|
|
101
109
|
timeoutMs,
|
|
102
110
|
...(request.signal === undefined ? {} : { signal: request.signal }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/game-services",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Client, contract, server, store, and test helpers for authoritative mpgd game services.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -130,9 +130,9 @@
|
|
|
130
130
|
"@orpc/client": "2.0.0-beta.14",
|
|
131
131
|
"@orpc/contract": "2.0.0-beta.14",
|
|
132
132
|
"@orpc/server": "2.0.0-beta.14",
|
|
133
|
-
"@mpgd/
|
|
134
|
-
"@mpgd/
|
|
135
|
-
"@mpgd/
|
|
133
|
+
"@mpgd/analytics": "0.3.11",
|
|
134
|
+
"@mpgd/catalog": "0.7.1",
|
|
135
|
+
"@mpgd/platform": "0.11.0"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
138
|
"ttsc": "0.18.4",
|