Passed
Push — main ( 7d04df...f2cd2d )
by Yuri
01:12 queued 13s
created

src/mappings.ts

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 59
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 0
eloc 52
mnd 0
bc 0
fnc 0
dl 0
loc 59
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
ccs 1
cts 1
cp 1
1
export type ReceiptFieldsKeyValues =
2
  | 2
3
  | 3
4
  | 4
5
  | 5
6
  | 12
7
  | 18
8
  | 19
9
  | 1701
10
  | 1702
11
  | 1703
12
  | 1704
13
  | 1705
14
  | 1706
15
  | 1708
16
  | 1711
17
  | 1712
18
19
export type ReceiptFieldsKeyNames =
20
  | 'BUNDLE_ID'
21
  | 'APP_VERSION'
22
  | 'OPAQUE_VALUE'
23
  | 'SHA1_HASH'
24
  | 'RECEIPT_CREATION_DATE'
25
  | 'ORIGINAL_PURCHASE_DATE'
26
  | 'ORIGINAL_APP_VERSION'
27
  | 'IN_APP_QUANTITY'
28
  | 'IN_APP_PRODUCT_ID'
29
  | 'IN_APP_TRANSACTION_ID'
30
  | 'IN_APP_PURCHASE_DATE'
31
  | 'IN_APP_ORIGINAL_TRANSACTION_ID'
32
  | 'IN_APP_ORIGINAL_PURCHASE_DATE'
33
  | 'IN_APP_EXPIRES_DATE'
34
  | 'IN_APP_WEB_ORDER_LINE_ITEM_ID'
35
  | 'IN_APP_CANCELLATION_DATE'
36
37
/**
38
 * Receipt fields
39
 * @see https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html
40
 */
41 1
export const RECEIPT_FIELDS_MAP: ReadonlyMap<ReceiptFieldsKeyValues, ReceiptFieldsKeyNames> = new Map([
42
  [2, 'BUNDLE_ID'],
43
  [3, 'APP_VERSION'],
44
  [4, 'OPAQUE_VALUE'],
45
  [5, 'SHA1_HASH'],
46
  [12, 'RECEIPT_CREATION_DATE'],
47
  [18, 'ORIGINAL_PURCHASE_DATE'],
48
  [19, 'ORIGINAL_APP_VERSION'],
49
  [1701, 'IN_APP_QUANTITY'],
50
  [1702, 'IN_APP_PRODUCT_ID'],
51
  [1703, 'IN_APP_TRANSACTION_ID'],
52
  [1704, 'IN_APP_PURCHASE_DATE'],
53
  [1705, 'IN_APP_ORIGINAL_TRANSACTION_ID'],
54
  [1706, 'IN_APP_ORIGINAL_PURCHASE_DATE'],
55
  [1708, 'IN_APP_EXPIRES_DATE'],
56
  [1711, 'IN_APP_WEB_ORDER_LINE_ITEM_ID'],
57
  [1712, 'IN_APP_CANCELLATION_DATE'],
58
])
59
60