Source file values.ml

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
(* generated by: awso-codegen generate-all --botocore-data vendor/botocore/botocore/data -o aws --runtime-dir lib/runtime/awso --cli-dir awso-cli *)
open Awso
open! Import
[@@@warning "-32"]
let service = Service.payment_cryptography_data
let apiVersion = "2022-02-03"
let endpointPrefix = "dataplane.payment-cryptography"
let serviceFullName = "Payment Cryptography Data Plane"
let signatureVersion = "v4"
let protocol = "rest_json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let simple_to_json to_value x =
  Botodata.Json.value_to_json_scalar (to_value x)
let composed_to_json to_value x = Botodata.Json.value_to_json (to_value x)
let to_query to_value x = Client.Query.of_value (to_value x)
let structure_to_value_aux st ~f =
  let filter = function | (k, Some v) -> Some (k, v) | _ -> None in
  let pair k v = (k, v) in
  let defer_value (k, dv) = pair k dv in
  ((List.filter_map st ~f:filter) |> (List.map ~f:defer_value)) |>
    (fun x -> `Structure (f x))
let structure_to_value = structure_to_value_aux ~f:Fn.id
let structure_to_wrapped_value ~wrapper ~response =
  structure_to_value_aux
    ~f:(fun x -> [(wrapper, (`Structure x)); (response, (`Structure []))])
module String_ =
  struct
    type nonrec t = string
    let context_ = "String"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"String" j
    let to_json = simple_to_json to_value
  end
module CertificateType =
  struct
    type nonrec t = string
    let context_ = "CertificateType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:32768) >>=
                  (fun () -> check_pattern i ~pattern:"[^\\[;\\]<>]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"CertificateType" j
    let to_json = simple_to_json to_value
  end
module KeyArnOrKeyAliasType =
  struct
    type nonrec t = string
    let context_ = "KeyArnOrKeyAliasType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:7) >>=
             (fun () ->
                (check_string_max i ~max:322) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"arn:aws:payment-cryptography:[a-z]{2}-[a-z]{1,16}-[0-9]+:[0-9]{12}:(key/[0-9a-zA-Z]{16,64}|alias/[a-zA-Z0-9/_-]+)$|^alias/[a-zA-Z0-9/_-]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"KeyArnOrKeyAliasType" j
    let to_json = simple_to_json to_value
  end
module KeyDerivationFunction =
  struct
    type nonrec t =
      | NIST_SP800 
      | ANSI_X963 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | NIST_SP800 -> "NIST_SP800"
      | ANSI_X963 -> "ANSI_X963"
      | Non_static_id s -> s
    let of_string =
      function
      | "NIST_SP800" -> NIST_SP800
      | "ANSI_X963" -> ANSI_X963
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration KeyDerivationFunction" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"KeyDerivationFunction" j)
    let to_json = simple_to_json to_value
  end
module KeyDerivationHashAlgorithm =
  struct
    type nonrec t =
      | SHA_256 
      | SHA_384 
      | SHA_512 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | SHA_256 -> "SHA_256"
      | SHA_384 -> "SHA_384"
      | SHA_512 -> "SHA_512"
      | Non_static_id s -> s
    let of_string =
      function
      | "SHA_256" -> SHA_256
      | "SHA_384" -> SHA_384
      | "SHA_512" -> SHA_512
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration KeyDerivationHashAlgorithm"
           xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"KeyDerivationHashAlgorithm" j)
    let to_json = simple_to_json to_value
  end
module SharedInformation =
  struct
    type nonrec t = string
    let context_ = "SharedInformation"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:2048) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"SharedInformation" j
    let to_json = simple_to_json to_value
  end
module SymmetricKeyAlgorithm =
  struct
    type nonrec t =
      | TDES_2KEY 
      | TDES_3KEY 
      | AES_128 
      | AES_192 
      | AES_256 
      | HMAC_SHA256 
      | HMAC_SHA384 
      | HMAC_SHA512 
      | HMAC_SHA224 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | TDES_2KEY -> "TDES_2KEY"
      | TDES_3KEY -> "TDES_3KEY"
      | AES_128 -> "AES_128"
      | AES_192 -> "AES_192"
      | AES_256 -> "AES_256"
      | HMAC_SHA256 -> "HMAC_SHA256"
      | HMAC_SHA384 -> "HMAC_SHA384"
      | HMAC_SHA512 -> "HMAC_SHA512"
      | HMAC_SHA224 -> "HMAC_SHA224"
      | Non_static_id s -> s
    let of_string =
      function
      | "TDES_2KEY" -> TDES_2KEY
      | "TDES_3KEY" -> TDES_3KEY
      | "AES_128" -> AES_128
      | "AES_192" -> AES_192
      | "AES_256" -> AES_256
      | "HMAC_SHA256" -> HMAC_SHA256
      | "HMAC_SHA384" -> HMAC_SHA384
      | "HMAC_SHA512" -> HMAC_SHA512
      | "HMAC_SHA224" -> HMAC_SHA224
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration SymmetricKeyAlgorithm" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"SymmetricKeyAlgorithm" j)
    let to_json = simple_to_json to_value
  end
module ApplicationCryptogramType =
  struct
    type nonrec t = string
    let context_ = "ApplicationCryptogramType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ApplicationCryptogramType" j
    let to_json = simple_to_json to_value
  end
module HexLengthEquals4 =
  struct
    type nonrec t = string
    let context_ = "HexLengthEquals4"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:4) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLengthEquals4" j
    let to_json = simple_to_json to_value
  end
module PinBlockLengthEquals16 =
  struct
    type nonrec t = string
    let context_ = "PinBlockLengthEquals16"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PinBlockLengthEquals16" j
    let to_json = simple_to_json to_value
  end
module ValidationExceptionField =
  struct
    type nonrec t =
      {
      path: String_.t option
        [@ocaml.doc
          "The request was denied due to an invalid request error."];
      message: String_.t option
        [@ocaml.doc
          "The request was denied due to an invalid request error."]}
    let make ?path = fun ?message -> fun () -> { path; message }
    let to_value x =
      structure_to_value
        [("path", (Option.map x.path ~f:String_.to_value));
        ("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      let path = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "path") in
      make ?message ?path ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "message" String_.of_json in
      let path = field_map json__ "path" String_.of_json in
      make ?message ?path ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to an invalid request error."]
module DecimalizationTableType =
  struct
    type nonrec t = string
    let context_ = "DecimalizationTableType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"DecimalizationTableType" j
    let to_json = simple_to_json to_value
  end
module HexLengthEquals1 =
  struct
    type nonrec t = string
    let context_ = "HexLengthEquals1"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:1) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9A-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLengthEquals1" j
    let to_json = simple_to_json to_value
  end
module PinOffsetType =
  struct
    type nonrec t = string
    let context_ = "PinOffsetType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:12) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PinOffsetType" j
    let to_json = simple_to_json to_value
  end
module PinValidationDataType =
  struct
    type nonrec t = string
    let context_ = "PinValidationDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PinValidationDataType" j
    let to_json = simple_to_json to_value
  end
module IntegerRangeBetween0And6 =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:6) >>= (fun () -> check_int_min i ~min:0));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for IntegerRangeBetween0And6"
           xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module VerificationValueType =
  struct
    type nonrec t = string
    let context_ = "VerificationValueType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:12) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"VerificationValueType" j
    let to_json = simple_to_json to_value
  end
module EcdhDerivationAttributes =
  struct
    type nonrec t =
      {
      certificateAuthorityPublicKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyArn of the certificate that signed the client's PublicKeyCertificate."];
      publicKeyCertificate: CertificateType.t
        [@ocaml.doc
          "The client's public key certificate in PEM format (base64 encoded) to use for ECDH key derivation."];
      keyAlgorithm: SymmetricKeyAlgorithm.t
        [@ocaml.doc "The key algorithm of the derived ECDH key."];
      keyDerivationFunction: KeyDerivationFunction.t
        [@ocaml.doc
          "The key derivation function to use for deriving a key using ECDH."];
      keyDerivationHashAlgorithm: KeyDerivationHashAlgorithm.t
        [@ocaml.doc "The hash type to use for deriving a key using ECDH."];
      sharedInformation: SharedInformation.t
        [@ocaml.doc
          "A byte string containing information that binds the ECDH derived key to the two parties involved or to the context of the key. It may include details like identities of the two parties deriving the key, context of the operation, session IDs, and optionally a nonce. It must not contain zero bytes, and re-using shared information for multiple ECDH key derivations is not recommended."]}
    let context_ = "EcdhDerivationAttributes"
    let make ~certificateAuthorityPublicKeyIdentifier =
      fun ~publicKeyCertificate ->
        fun ~keyAlgorithm ->
          fun ~keyDerivationFunction ->
            fun ~keyDerivationHashAlgorithm ->
              fun ~sharedInformation ->
                fun () ->
                  {
                    certificateAuthorityPublicKeyIdentifier;
                    publicKeyCertificate;
                    keyAlgorithm;
                    keyDerivationFunction;
                    keyDerivationHashAlgorithm;
                    sharedInformation
                  }
    let to_value x =
      structure_to_value
        [("CertificateAuthorityPublicKeyIdentifier",
           (Some
              (KeyArnOrKeyAliasType.to_value
                 x.certificateAuthorityPublicKeyIdentifier)));
        ("PublicKeyCertificate",
          (Some (CertificateType.to_value x.publicKeyCertificate)));
        ("KeyAlgorithm",
          (Some (SymmetricKeyAlgorithm.to_value x.keyAlgorithm)));
        ("KeyDerivationFunction",
          (Some (KeyDerivationFunction.to_value x.keyDerivationFunction)));
        ("KeyDerivationHashAlgorithm",
          (Some
             (KeyDerivationHashAlgorithm.to_value
                x.keyDerivationHashAlgorithm)));
        ("SharedInformation",
          (Some (SharedInformation.to_value x.sharedInformation)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let sharedInformation =
        SharedInformation.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "SharedInformation") in
      let keyDerivationHashAlgorithm =
        KeyDerivationHashAlgorithm.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "KeyDerivationHashAlgorithm") in
      let keyDerivationFunction =
        KeyDerivationFunction.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyDerivationFunction") in
      let keyAlgorithm =
        SymmetricKeyAlgorithm.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyAlgorithm") in
      let publicKeyCertificate =
        CertificateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PublicKeyCertificate") in
      let certificateAuthorityPublicKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "CertificateAuthorityPublicKeyIdentifier") in
      make ~sharedInformation ~keyDerivationHashAlgorithm
        ~keyDerivationFunction ~keyAlgorithm ~publicKeyCertificate
        ~certificateAuthorityPublicKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let sharedInformation =
        field_map_exn json__ "SharedInformation" SharedInformation.of_json in
      let keyDerivationHashAlgorithm =
        field_map_exn json__ "KeyDerivationHashAlgorithm"
          KeyDerivationHashAlgorithm.of_json in
      let keyDerivationFunction =
        field_map_exn json__ "KeyDerivationFunction"
          KeyDerivationFunction.of_json in
      let keyAlgorithm =
        field_map_exn json__ "KeyAlgorithm" SymmetricKeyAlgorithm.of_json in
      let publicKeyCertificate =
        field_map_exn json__ "PublicKeyCertificate" CertificateType.of_json in
      let certificateAuthorityPublicKeyIdentifier =
        field_map_exn json__ "CertificateAuthorityPublicKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ~sharedInformation ~keyDerivationHashAlgorithm
        ~keyDerivationFunction ~keyAlgorithm ~publicKeyCertificate
        ~certificateAuthorityPublicKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters required to establish ECDH based key exchange."]
module Tr31WrappedKeyBlock =
  struct
    type nonrec t = string
    let context_ = "Tr31WrappedKeyBlock"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:56) >>=
             (fun () ->
                (check_string_max i ~max:9984) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-zA-Z]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Tr31WrappedKeyBlock" j
    let to_json = simple_to_json to_value
  end
module DukptDerivationType =
  struct
    type nonrec t =
      | TDES_2KEY 
      | TDES_3KEY 
      | AES_128 
      | AES_192 
      | AES_256 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | TDES_2KEY -> "TDES_2KEY"
      | TDES_3KEY -> "TDES_3KEY"
      | AES_128 -> "AES_128"
      | AES_192 -> "AES_192"
      | AES_256 -> "AES_256"
      | Non_static_id s -> s
    let of_string =
      function
      | "TDES_2KEY" -> TDES_2KEY
      | "TDES_3KEY" -> TDES_3KEY
      | "AES_128" -> AES_128
      | "AES_192" -> AES_192
      | "AES_256" -> AES_256
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration DukptDerivationType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DukptDerivationType" j)
    let to_json = simple_to_json to_value
  end
module DukptKeyVariant =
  struct
    type nonrec t =
      | BIDIRECTIONAL 
      | REQUEST 
      | RESPONSE 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | BIDIRECTIONAL -> "BIDIRECTIONAL"
      | REQUEST -> "REQUEST"
      | RESPONSE -> "RESPONSE"
      | Non_static_id s -> s
    let of_string =
      function
      | "BIDIRECTIONAL" -> BIDIRECTIONAL
      | "REQUEST" -> REQUEST
      | "RESPONSE" -> RESPONSE
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration DukptKeyVariant" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DukptKeyVariant" j)
    let to_json = simple_to_json to_value
  end
module HexLength16Or20Or24 =
  struct
    type nonrec t = string
    let context_ = "HexLength16Or20Or24"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:24) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"(?:[0-9a-fA-F]{16}|[0-9a-fA-F]{20}|[0-9a-fA-F]{24})")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLength16Or20Or24" j
    let to_json = simple_to_json to_value
  end
module MajorKeyDerivationMode =
  struct
    type nonrec t =
      | EMV_OPTION_A 
      | EMV_OPTION_B 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | EMV_OPTION_A -> "EMV_OPTION_A"
      | EMV_OPTION_B -> "EMV_OPTION_B"
      | Non_static_id s -> s
    let of_string =
      function
      | "EMV_OPTION_A" -> EMV_OPTION_A
      | "EMV_OPTION_B" -> EMV_OPTION_B
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration MajorKeyDerivationMode" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"MajorKeyDerivationMode" j)
    let to_json = simple_to_json to_value
  end
module NumberLengthEquals2 =
  struct
    type nonrec t = string
    let context_ = "NumberLengthEquals2"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:2) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"NumberLengthEquals2" j
    let to_json = simple_to_json to_value
  end
module PrimaryAccountNumberType =
  struct
    type nonrec t = string
    let context_ = "PrimaryAccountNumberType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:12) >>=
             (fun () ->
                (check_string_max i ~max:19) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PrimaryAccountNumberType" j
    let to_json = simple_to_json to_value
  end
module SessionKeyDerivationMode =
  struct
    type nonrec t =
      | EMV_COMMON_SESSION_KEY 
      | EMV2000 
      | AMEX 
      | MASTERCARD_SESSION_KEY 
      | VISA 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | EMV_COMMON_SESSION_KEY -> "EMV_COMMON_SESSION_KEY"
      | EMV2000 -> "EMV2000"
      | AMEX -> "AMEX"
      | MASTERCARD_SESSION_KEY -> "MASTERCARD_SESSION_KEY"
      | VISA -> "VISA"
      | Non_static_id s -> s
    let of_string =
      function
      | "EMV_COMMON_SESSION_KEY" -> EMV_COMMON_SESSION_KEY
      | "EMV2000" -> EMV2000
      | "AMEX" -> AMEX
      | "MASTERCARD_SESSION_KEY" -> MASTERCARD_SESSION_KEY
      | "VISA" -> VISA
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration SessionKeyDerivationMode" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"SessionKeyDerivationMode" j)
    let to_json = simple_to_json to_value
  end
module SessionKeyDerivationValue =
  struct
    type nonrec t =
      {
      applicationCryptogram: ApplicationCryptogramType.t option
        [@ocaml.doc
          "The cryptogram provided by the terminal during transaction processing."];
      applicationTransactionCounter: HexLengthEquals4.t option
        [@ocaml.doc
          "The transaction counter that is provided by the terminal during transaction processing."]}
    let make ?applicationCryptogram =
      fun ?applicationTransactionCounter ->
        fun () -> { applicationCryptogram; applicationTransactionCounter }
    let to_value x =
      structure_to_value
        [("ApplicationCryptogram",
           (Option.map x.applicationCryptogram
              ~f:ApplicationCryptogramType.to_value));
        ("ApplicationTransactionCounter",
          (Option.map x.applicationTransactionCounter
             ~f:HexLengthEquals4.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        (Option.map ~f:HexLengthEquals4.of_xml)
          (Xml.child xml_arg0 "ApplicationTransactionCounter") in
      let applicationCryptogram =
        (Option.map ~f:ApplicationCryptogramType.of_xml)
          (Xml.child xml_arg0 "ApplicationCryptogram") in
      make ?applicationTransactionCounter ?applicationCryptogram ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let applicationCryptogram =
        field_map json__ "ApplicationCryptogram"
          ApplicationCryptogramType.of_json in
      make ?applicationTransactionCounter ?applicationCryptogram ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key value using a MAC EMV algorithm."]
module CardExpiryDateType =
  struct
    type nonrec t = string
    let context_ = "CardExpiryDateType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:4) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"CardExpiryDateType" j
    let to_json = simple_to_json to_value
  end
module ServiceCodeType =
  struct
    type nonrec t = string
    let context_ = "ServiceCodeType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:3) >>=
             (fun () ->
                (check_string_max i ~max:3) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ServiceCodeType" j
    let to_json = simple_to_json to_value
  end
module HexLengthBetween2And4 =
  struct
    type nonrec t = string
    let context_ = "HexLengthBetween2And4"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:4) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLengthBetween2And4" j
    let to_json = simple_to_json to_value
  end
module HexLengthBetween2And8 =
  struct
    type nonrec t = string
    let context_ = "HexLengthBetween2And8"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:8) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLengthBetween2And8" j
    let to_json = simple_to_json to_value
  end
module TrackDataType =
  struct
    type nonrec t = string
    let context_ = "TrackDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:160) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"TrackDataType" j
    let to_json = simple_to_json to_value
  end
module HexLengthEquals8 =
  struct
    type nonrec t = string
    let context_ = "HexLengthEquals8"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:8) >>=
             (fun () ->
                (check_string_max i ~max:8) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexLengthEquals8" j
    let to_json = simple_to_json to_value
  end
module ProprietaryAuthenticationDataType =
  struct
    type nonrec t = string
    let context_ = "ProprietaryAuthenticationDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j =
      string_of_json ~kind:"ProprietaryAuthenticationDataType" j
    let to_json = simple_to_json to_value
  end
module DiffieHellmanDerivationData =
  struct
    type nonrec t =
      {
      sharedInformation: SharedInformation.t option
        [@ocaml.doc
          "A string containing information that binds the ECDH derived key to the two parties involved or to the context of the key. It may include details like identities of the two parties deriving the key, context of the operation, session IDs, and optionally a nonce. It must not contain zero bytes. It is not recommended to reuse shared information for multiple ECDH key derivations, as it could result in derived key material being the same across different derivations."]}
    let make ?sharedInformation = fun () -> { sharedInformation }
    let to_value x =
      structure_to_value
        [("SharedInformation",
           (Option.map x.sharedInformation ~f:SharedInformation.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let sharedInformation =
        (Option.map ~f:SharedInformation.of_xml)
          (Xml.child xml_arg0 "SharedInformation") in
      make ?sharedInformation ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let sharedInformation =
        field_map json__ "SharedInformation" SharedInformation.of_json in
      make ?sharedInformation ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The shared information used when deriving a key using ECDH."]
module DukptEncryptionMode =
  struct
    type nonrec t =
      | ECB 
      | CBC 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function | ECB -> "ECB" | CBC -> "CBC" | Non_static_id s -> s
    let of_string =
      function | "ECB" -> ECB | "CBC" -> CBC | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration DukptEncryptionMode" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DukptEncryptionMode" j)
    let to_json = simple_to_json to_value
  end
module InitializationVectorType =
  struct
    type nonrec t = string
    let context_ = "InitializationVectorType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:32) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"(?:[0-9a-fA-F]{16}|[0-9a-fA-F]{32})")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"InitializationVectorType" j
    let to_json = simple_to_json to_value
  end
module EncryptionMode =
  struct
    type nonrec t =
      | ECB 
      | CBC 
      | CFB 
      | CFB1 
      | CFB8 
      | CFB64 
      | CFB128 
      | OFB 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | ECB -> "ECB"
      | CBC -> "CBC"
      | CFB -> "CFB"
      | CFB1 -> "CFB1"
      | CFB8 -> "CFB8"
      | CFB64 -> "CFB64"
      | CFB128 -> "CFB128"
      | OFB -> "OFB"
      | Non_static_id s -> s
    let of_string =
      function
      | "ECB" -> ECB
      | "CBC" -> CBC
      | "CFB" -> CFB
      | "CFB1" -> CFB1
      | "CFB8" -> CFB8
      | "CFB64" -> CFB64
      | "CFB128" -> CFB128
      | "OFB" -> OFB
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration EncryptionMode" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"EncryptionMode" j)
    let to_json = simple_to_json to_value
  end
module PaddingType =
  struct
    type nonrec t =
      | PKCS1 
      | OAEP_SHA1 
      | OAEP_SHA256 
      | OAEP_SHA512 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | PKCS1 -> "PKCS1"
      | OAEP_SHA1 -> "OAEP_SHA1"
      | OAEP_SHA256 -> "OAEP_SHA256"
      | OAEP_SHA512 -> "OAEP_SHA512"
      | Non_static_id s -> s
    let of_string =
      function
      | "PKCS1" -> PKCS1
      | "OAEP_SHA1" -> OAEP_SHA1
      | "OAEP_SHA256" -> OAEP_SHA256
      | "OAEP_SHA512" -> OAEP_SHA512
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration PaddingType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"PaddingType" j)
    let to_json = simple_to_json to_value
  end
module EncryptedPinBlockType =
  struct
    type nonrec t = string
    let context_ = "EncryptedPinBlockType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:32) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"EncryptedPinBlockType" j
    let to_json = simple_to_json to_value
  end
module CurrentPinAttributes =
  struct
    type nonrec t =
      {
      currentPinPekIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc "The keyArn of the current PIN PEK."];
      currentEncryptedPinBlock: PinBlockLengthEquals16.t
        [@ocaml.doc
          "The encrypted pinblock of the current pin stored on the chip card."]}
    let context_ = "CurrentPinAttributes"
    let make ~currentPinPekIdentifier =
      fun ~currentEncryptedPinBlock ->
        fun () -> { currentPinPekIdentifier; currentEncryptedPinBlock }
    let to_value x =
      structure_to_value
        [("CurrentPinPekIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.currentPinPekIdentifier)));
        ("CurrentEncryptedPinBlock",
          (Some (PinBlockLengthEquals16.to_value x.currentEncryptedPinBlock)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let currentEncryptedPinBlock =
        PinBlockLengthEquals16.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "CurrentEncryptedPinBlock") in
      let currentPinPekIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CurrentPinPekIdentifier") in
      make ~currentEncryptedPinBlock ~currentPinPekIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let currentEncryptedPinBlock =
        field_map_exn json__ "CurrentEncryptedPinBlock"
          PinBlockLengthEquals16.of_json in
      let currentPinPekIdentifier =
        field_map_exn json__ "CurrentPinPekIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ~currentEncryptedPinBlock ~currentPinPekIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The parameter values of the current PIN to be changed on the EMV chip card."]
module EmvEncryptionMode =
  struct
    type nonrec t =
      | ECB 
      | CBC 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function | ECB -> "ECB" | CBC -> "CBC" | Non_static_id s -> s
    let of_string =
      function | "ECB" -> ECB | "CBC" -> CBC | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration EmvEncryptionMode" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"EmvEncryptionMode" j)
    let to_json = simple_to_json to_value
  end
module PinBlockLengthPosition =
  struct
    type nonrec t =
      | NONE 
      | FRONT_OF_PIN_BLOCK 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | NONE -> "NONE"
      | FRONT_OF_PIN_BLOCK -> "FRONT_OF_PIN_BLOCK"
      | Non_static_id s -> s
    let of_string =
      function
      | "NONE" -> NONE
      | "FRONT_OF_PIN_BLOCK" -> FRONT_OF_PIN_BLOCK
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration PinBlockLengthPosition" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"PinBlockLengthPosition" j)
    let to_json = simple_to_json to_value
  end
module PinBlockPaddingType =
  struct
    type nonrec t =
      | NO_PADDING 
      | ISO_IEC_7816_4 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | NO_PADDING -> "NO_PADDING"
      | ISO_IEC_7816_4 -> "ISO_IEC_7816_4"
      | Non_static_id s -> s
    let of_string =
      function
      | "NO_PADDING" -> NO_PADDING
      | "ISO_IEC_7816_4" -> ISO_IEC_7816_4
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration PinBlockPaddingType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"PinBlockPaddingType" j)
    let to_json = simple_to_json to_value
  end
module As2805RandomKeyMaterial =
  struct
    type nonrec t = string
    let context_ = "As2805RandomKeyMaterial"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:32) >>=
             (fun () ->
                (check_string_max i ~max:48) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"(?:[0-9a-fA-F]{32}|[0-9a-fA-F]{48})")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"As2805RandomKeyMaterial" j
    let to_json = simple_to_json to_value
  end
module EmvMajorKeyDerivationMode =
  struct
    type nonrec t =
      | EMV_OPTION_A 
      | EMV_OPTION_B 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | EMV_OPTION_A -> "EMV_OPTION_A"
      | EMV_OPTION_B -> "EMV_OPTION_B"
      | Non_static_id s -> s
    let of_string =
      function
      | "EMV_OPTION_A" -> EMV_OPTION_A
      | "EMV_OPTION_B" -> EMV_OPTION_B
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration EmvMajorKeyDerivationMode" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"EmvMajorKeyDerivationMode" j)
    let to_json = simple_to_json to_value
  end
module SessionDerivationDataType =
  struct
    type nonrec t = string
    let context_ = "SessionDerivationDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"SessionDerivationDataType" j
    let to_json = simple_to_json to_value
  end
module ValidationExceptionFieldList =
  struct
    type nonrec t = ValidationExceptionField.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:ValidationExceptionField.to_value)) |>
        (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:ValidationExceptionField.of_xml)
    let of_json j =
      list_of_json ~kind:"ValidationExceptionFieldList"
        ~of_json:ValidationExceptionField.of_json j
    let to_json v = composed_to_json to_value v
  end
module VerificationFailedReason =
  struct
    type nonrec t =
      | INVALID_MAC 
      | INVALID_PIN 
      | INVALID_VALIDATION_DATA 
      | INVALID_AUTH_REQUEST_CRYPTOGRAM 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | INVALID_MAC -> "INVALID_MAC"
      | INVALID_PIN -> "INVALID_PIN"
      | INVALID_VALIDATION_DATA -> "INVALID_VALIDATION_DATA"
      | INVALID_AUTH_REQUEST_CRYPTOGRAM -> "INVALID_AUTH_REQUEST_CRYPTOGRAM"
      | Non_static_id s -> s
    let of_string =
      function
      | "INVALID_MAC" -> INVALID_MAC
      | "INVALID_PIN" -> INVALID_PIN
      | "INVALID_VALIDATION_DATA" -> INVALID_VALIDATION_DATA
      | "INVALID_AUTH_REQUEST_CRYPTOGRAM" -> INVALID_AUTH_REQUEST_CRYPTOGRAM
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration VerificationFailedReason" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"VerificationFailedReason" j)
    let to_json = simple_to_json to_value
  end
module Ibm3624PinVerification =
  struct
    type nonrec t =
      {
      decimalizationTable: DecimalizationTableType.t
        [@ocaml.doc
          "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."];
      pinValidationDataPadCharacter: HexLengthEquals1.t
        [@ocaml.doc "The padding character for validation data."];
      pinValidationData: PinValidationDataType.t
        [@ocaml.doc "The unique data for cardholder identification."];
      pinOffset: PinOffsetType.t [@ocaml.doc "The PIN offset value."]}
    let context_ = "Ibm3624PinVerification"
    let make ~decimalizationTable =
      fun ~pinValidationDataPadCharacter ->
        fun ~pinValidationData ->
          fun ~pinOffset ->
            fun () ->
              {
                decimalizationTable;
                pinValidationDataPadCharacter;
                pinValidationData;
                pinOffset
              }
    let to_value x =
      structure_to_value
        [("DecimalizationTable",
           (Some (DecimalizationTableType.to_value x.decimalizationTable)));
        ("PinValidationDataPadCharacter",
          (Some (HexLengthEquals1.to_value x.pinValidationDataPadCharacter)));
        ("PinValidationData",
          (Some (PinValidationDataType.to_value x.pinValidationData)));
        ("PinOffset", (Some (PinOffsetType.to_value x.pinOffset)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinOffset =
        PinOffsetType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinOffset") in
      let pinValidationData =
        PinValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinValidationData") in
      let pinValidationDataPadCharacter =
        HexLengthEquals1.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "PinValidationDataPadCharacter") in
      let decimalizationTable =
        DecimalizationTableType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecimalizationTable") in
      make ~pinOffset ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinOffset = field_map_exn json__ "PinOffset" PinOffsetType.of_json in
      let pinValidationData =
        field_map_exn json__ "PinValidationData"
          PinValidationDataType.of_json in
      let pinValidationDataPadCharacter =
        field_map_exn json__ "PinValidationDataPadCharacter"
          HexLengthEquals1.of_json in
      let decimalizationTable =
        field_map_exn json__ "DecimalizationTable"
          DecimalizationTableType.of_json in
      make ~pinOffset ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Ibm3624 PIN verification PIN."]
module VisaPinVerification =
  struct
    type nonrec t =
      {
      pinVerificationKeyIndex: IntegerRangeBetween0And6.t
        [@ocaml.doc
          "The value for PIN verification index. It is used in the Visa PIN algorithm to calculate the PVV (PIN Verification Value)."];
      verificationValue: VerificationValueType.t
        [@ocaml.doc
          "Parameters that are required to generate or verify Visa PVV (PIN Verification Value)."]}
    let context_ = "VisaPinVerification"
    let make ~pinVerificationKeyIndex =
      fun ~verificationValue ->
        fun () -> { pinVerificationKeyIndex; verificationValue }
    let to_value x =
      structure_to_value
        [("PinVerificationKeyIndex",
           (Some
              (IntegerRangeBetween0And6.to_value x.pinVerificationKeyIndex)));
        ("VerificationValue",
          (Some (VerificationValueType.to_value x.verificationValue)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let verificationValue =
        VerificationValueType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "VerificationValue") in
      let pinVerificationKeyIndex =
        IntegerRangeBetween0And6.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinVerificationKeyIndex") in
      make ~verificationValue ~pinVerificationKeyIndex ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let verificationValue =
        field_map_exn json__ "VerificationValue"
          VerificationValueType.of_json in
      let pinVerificationKeyIndex =
        field_map_exn json__ "PinVerificationKeyIndex"
          IntegerRangeBetween0And6.of_json in
      make ~verificationValue ~pinVerificationKeyIndex ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Visa PIN."]
module KeyCheckValueAlgorithm =
  struct
    type nonrec t =
      | CMAC 
      | ANSI_X9_24 
      | HMAC 
      | SHA_1 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | CMAC -> "CMAC"
      | ANSI_X9_24 -> "ANSI_X9_24"
      | HMAC -> "HMAC"
      | SHA_1 -> "SHA_1"
      | Non_static_id s -> s
    let of_string =
      function
      | "CMAC" -> CMAC
      | "ANSI_X9_24" -> ANSI_X9_24
      | "HMAC" -> HMAC
      | "SHA_1" -> SHA_1
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration KeyCheckValueAlgorithm" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"KeyCheckValueAlgorithm" j)
    let to_json = simple_to_json to_value
  end
module WrappedKeyMaterial =
  struct
    type nonrec t =
      {
      tr31KeyBlock: Tr31WrappedKeyBlock.t option
        [@ocaml.doc "The TR-31 wrapped key block."];
      diffieHellmanSymmetricKey: EcdhDerivationAttributes.t option
        [@ocaml.doc
          "The parameter information for deriving a ECDH shared key."]}
    let make ?tr31KeyBlock =
      fun ?diffieHellmanSymmetricKey ->
        fun () -> { tr31KeyBlock; diffieHellmanSymmetricKey }
    let to_value x =
      structure_to_value
        [("Tr31KeyBlock",
           (Option.map x.tr31KeyBlock ~f:Tr31WrappedKeyBlock.to_value));
        ("DiffieHellmanSymmetricKey",
          (Option.map x.diffieHellmanSymmetricKey
             ~f:EcdhDerivationAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let diffieHellmanSymmetricKey =
        (Option.map ~f:EcdhDerivationAttributes.of_xml)
          (Xml.child xml_arg0 "DiffieHellmanSymmetricKey") in
      let tr31KeyBlock =
        (Option.map ~f:Tr31WrappedKeyBlock.of_xml)
          (Xml.child xml_arg0 "Tr31KeyBlock") in
      make ?diffieHellmanSymmetricKey ?tr31KeyBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let diffieHellmanSymmetricKey =
        field_map json__ "DiffieHellmanSymmetricKey"
          EcdhDerivationAttributes.of_json in
      let tr31KeyBlock =
        field_map json__ "Tr31KeyBlock" Tr31WrappedKeyBlock.of_json in
      make ?diffieHellmanSymmetricKey ?tr31KeyBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of a WrappedKeyBlock for encryption key exchange."]
module MacAlgorithm =
  struct
    type nonrec t =
      | ISO9797_ALGORITHM1 
      | ISO9797_ALGORITHM3 
      | CMAC 
      | HMAC 
      | HMAC_SHA224 
      | HMAC_SHA256 
      | HMAC_SHA384 
      | HMAC_SHA512 
      | AS2805_4_1 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | ISO9797_ALGORITHM1 -> "ISO9797_ALGORITHM1"
      | ISO9797_ALGORITHM3 -> "ISO9797_ALGORITHM3"
      | CMAC -> "CMAC"
      | HMAC -> "HMAC"
      | HMAC_SHA224 -> "HMAC_SHA224"
      | HMAC_SHA256 -> "HMAC_SHA256"
      | HMAC_SHA384 -> "HMAC_SHA384"
      | HMAC_SHA512 -> "HMAC_SHA512"
      | AS2805_4_1 -> "AS2805_4_1"
      | Non_static_id s -> s
    let of_string =
      function
      | "ISO9797_ALGORITHM1" -> ISO9797_ALGORITHM1
      | "ISO9797_ALGORITHM3" -> ISO9797_ALGORITHM3
      | "CMAC" -> CMAC
      | "HMAC" -> HMAC
      | "HMAC_SHA224" -> HMAC_SHA224
      | "HMAC_SHA256" -> HMAC_SHA256
      | "HMAC_SHA384" -> HMAC_SHA384
      | "HMAC_SHA512" -> HMAC_SHA512
      | "AS2805_4_1" -> AS2805_4_1
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration MacAlgorithm" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"MacAlgorithm" j)
    let to_json = simple_to_json to_value
  end
module MacAlgorithmDukpt =
  struct
    type nonrec t =
      {
      keySerialNumber: HexLength16Or20Or24.t
        [@ocaml.doc
          "The unique identifier known as Key Serial Number (KSN) that comes from an encrypting device using DUKPT encryption method. The KSN is derived from the encrypting device unique identifier and an internal transaction counter."];
      dukptKeyVariant: DukptKeyVariant.t
        [@ocaml.doc
          "The type of use of DUKPT, which can be MAC generation, MAC verification, or both."];
      dukptDerivationType: DukptDerivationType.t option
        [@ocaml.doc
          "The key type derived using DUKPT from a Base Derivation Key (BDK) and Key Serial Number (KSN). This must be less than or equal to the strength of the BDK. For example, you can't use AES_128 as a derivation type for a BDK of AES_128 or TDES_2KEY."]}
    let context_ = "MacAlgorithmDukpt"
    let make ?dukptDerivationType =
      fun ~keySerialNumber ->
        fun ~dukptKeyVariant ->
          fun () -> { dukptDerivationType; keySerialNumber; dukptKeyVariant }
    let to_value x =
      structure_to_value
        [("KeySerialNumber",
           (Some (HexLength16Or20Or24.to_value x.keySerialNumber)));
        ("DukptKeyVariant",
          (Some (DukptKeyVariant.to_value x.dukptKeyVariant)));
        ("DukptDerivationType",
          (Option.map x.dukptDerivationType ~f:DukptDerivationType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dukptDerivationType =
        (Option.map ~f:DukptDerivationType.of_xml)
          (Xml.child xml_arg0 "DukptDerivationType") in
      let dukptKeyVariant =
        DukptKeyVariant.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DukptKeyVariant") in
      let keySerialNumber =
        HexLength16Or20Or24.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeySerialNumber") in
      make ?dukptDerivationType ~dukptKeyVariant ~keySerialNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dukptDerivationType =
        field_map json__ "DukptDerivationType" DukptDerivationType.of_json in
      let dukptKeyVariant =
        field_map_exn json__ "DukptKeyVariant" DukptKeyVariant.of_json in
      let keySerialNumber =
        field_map_exn json__ "KeySerialNumber" HexLength16Or20Or24.of_json in
      make ?dukptDerivationType ~dukptKeyVariant ~keySerialNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters required for DUKPT MAC generation and verification."]
module MacAlgorithmEmv =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for EMV MAC generation or verification."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      sessionKeyDerivationMode: SessionKeyDerivationMode.t
        [@ocaml.doc
          "The method of deriving a session key for EMV MAC generation or verification."];
      sessionKeyDerivationValue: SessionKeyDerivationValue.t
        [@ocaml.doc
          "Parameters that are required to generate session key for EMV generation and verification."]}
    let context_ = "MacAlgorithmEmv"
    let make ~majorKeyDerivationMode =
      fun ~primaryAccountNumber ->
        fun ~panSequenceNumber ->
          fun ~sessionKeyDerivationMode ->
            fun ~sessionKeyDerivationValue ->
              fun () ->
                {
                  majorKeyDerivationMode;
                  primaryAccountNumber;
                  panSequenceNumber;
                  sessionKeyDerivationMode;
                  sessionKeyDerivationValue
                }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("SessionKeyDerivationMode",
          (Some
             (SessionKeyDerivationMode.to_value x.sessionKeyDerivationMode)));
        ("SessionKeyDerivationValue",
          (Some
             (SessionKeyDerivationValue.to_value x.sessionKeyDerivationValue)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let sessionKeyDerivationValue =
        SessionKeyDerivationValue.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "SessionKeyDerivationValue") in
      let sessionKeyDerivationMode =
        SessionKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "SessionKeyDerivationMode") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ~sessionKeyDerivationValue ~sessionKeyDerivationMode
        ~panSequenceNumber ~primaryAccountNumber ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let sessionKeyDerivationValue =
        field_map_exn json__ "SessionKeyDerivationValue"
          SessionKeyDerivationValue.of_json in
      let sessionKeyDerivationMode =
        field_map_exn json__ "SessionKeyDerivationMode"
          SessionKeyDerivationMode.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ~sessionKeyDerivationValue ~sessionKeyDerivationMode
        ~panSequenceNumber ~primaryAccountNumber ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for EMV MAC generation and verification."]
module AmexCardSecurityCodeVersion1 =
  struct
    type nonrec t =
      {
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."]}
    let context_ = "AmexCardSecurityCodeVersion1"
    let make ~cardExpiryDate = fun () -> { cardExpiryDate }
    let to_value x =
      structure_to_value
        [("CardExpiryDate",
           (Some (CardExpiryDateType.to_value x.cardExpiryDate)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      make ~cardExpiryDate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      make ~cardExpiryDate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to generate a Card Security Code (CSC2) for an AMEX payment card."]
module AmexCardSecurityCodeVersion2 =
  struct
    type nonrec t =
      {
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."];
      serviceCode: ServiceCodeType.t
        [@ocaml.doc
          "The service code of the AMEX payment card. This is different from the Card Security Code (CSC)."]}
    let context_ = "AmexCardSecurityCodeVersion2"
    let make ~cardExpiryDate =
      fun ~serviceCode -> fun () -> { cardExpiryDate; serviceCode }
    let to_value x =
      structure_to_value
        [("CardExpiryDate",
           (Some (CardExpiryDateType.to_value x.cardExpiryDate)));
        ("ServiceCode", (Some (ServiceCodeType.to_value x.serviceCode)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let serviceCode =
        ServiceCodeType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ServiceCode") in
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      make ~serviceCode ~cardExpiryDate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let serviceCode =
        field_map_exn json__ "ServiceCode" ServiceCodeType.of_json in
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      make ~serviceCode ~cardExpiryDate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to generate a Card Security Code (CSC2) for an AMEX payment card."]
module CardHolderVerificationValue =
  struct
    type nonrec t =
      {
      unpredictableNumber: HexLengthBetween2And8.t
        [@ocaml.doc "A random number generated by the issuer."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      applicationTransactionCounter: HexLengthBetween2And4.t
        [@ocaml.doc
          "The transaction counter value that comes from a point of sale terminal."]}
    let context_ = "CardHolderVerificationValue"
    let make ~unpredictableNumber =
      fun ~panSequenceNumber ->
        fun ~applicationTransactionCounter ->
          fun () ->
            {
              unpredictableNumber;
              panSequenceNumber;
              applicationTransactionCounter
            }
    let to_value x =
      structure_to_value
        [("UnpredictableNumber",
           (Some (HexLengthBetween2And8.to_value x.unpredictableNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some
             (HexLengthBetween2And4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthBetween2And4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let unpredictableNumber =
        HexLengthBetween2And8.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UnpredictableNumber") in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~unpredictableNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthBetween2And4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let unpredictableNumber =
        field_map_exn json__ "UnpredictableNumber"
          HexLengthBetween2And8.of_json in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~unpredictableNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to generate a cardholder verification value for the payment card."]
module CardVerificationValue1 =
  struct
    type nonrec t =
      {
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."];
      serviceCode: ServiceCodeType.t
        [@ocaml.doc
          "The service code of the payment card. This is different from Card Security Code (CSC)."]}
    let context_ = "CardVerificationValue1"
    let make ~cardExpiryDate =
      fun ~serviceCode -> fun () -> { cardExpiryDate; serviceCode }
    let to_value x =
      structure_to_value
        [("CardExpiryDate",
           (Some (CardExpiryDateType.to_value x.cardExpiryDate)));
        ("ServiceCode", (Some (ServiceCodeType.to_value x.serviceCode)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let serviceCode =
        ServiceCodeType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ServiceCode") in
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      make ~serviceCode ~cardExpiryDate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let serviceCode =
        field_map_exn json__ "ServiceCode" ServiceCodeType.of_json in
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      make ~serviceCode ~cardExpiryDate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to verify CVV (Card Verification Value) for the payment card."]
module CardVerificationValue2 =
  struct
    type nonrec t =
      {
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."]}
    let context_ = "CardVerificationValue2"
    let make ~cardExpiryDate = fun () -> { cardExpiryDate }
    let to_value x =
      structure_to_value
        [("CardExpiryDate",
           (Some (CardExpiryDateType.to_value x.cardExpiryDate)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      make ~cardExpiryDate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      make ~cardExpiryDate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to verify Card Verification Value (CVV2) for the payment card."]
module DiscoverDynamicCardVerificationCode =
  struct
    type nonrec t =
      {
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."];
      unpredictableNumber: HexLengthBetween2And8.t
        [@ocaml.doc "A random number that is generated by the issuer."];
      applicationTransactionCounter: HexLengthBetween2And4.t
        [@ocaml.doc
          "The transaction counter value that comes from the terminal."]}
    let context_ = "DiscoverDynamicCardVerificationCode"
    let make ~cardExpiryDate =
      fun ~unpredictableNumber ->
        fun ~applicationTransactionCounter ->
          fun () ->
            {
              cardExpiryDate;
              unpredictableNumber;
              applicationTransactionCounter
            }
    let to_value x =
      structure_to_value
        [("CardExpiryDate",
           (Some (CardExpiryDateType.to_value x.cardExpiryDate)));
        ("UnpredictableNumber",
          (Some (HexLengthBetween2And8.to_value x.unpredictableNumber)));
        ("ApplicationTransactionCounter",
          (Some
             (HexLengthBetween2And4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthBetween2And4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let unpredictableNumber =
        HexLengthBetween2And8.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UnpredictableNumber") in
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      make ~applicationTransactionCounter ~unpredictableNumber
        ~cardExpiryDate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthBetween2And4.of_json in
      let unpredictableNumber =
        field_map_exn json__ "UnpredictableNumber"
          HexLengthBetween2And8.of_json in
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      make ~applicationTransactionCounter ~unpredictableNumber
        ~cardExpiryDate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify dCVC (Dynamic Card Verification Code)."]
module DynamicCardVerificationCode =
  struct
    type nonrec t =
      {
      unpredictableNumber: HexLengthBetween2And8.t
        [@ocaml.doc "A random number generated by the issuer."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      applicationTransactionCounter: HexLengthBetween2And4.t
        [@ocaml.doc
          "The transaction counter value that comes from the terminal."];
      trackData: TrackDataType.t
        [@ocaml.doc
          "The data on the two tracks of magnetic cards used for financial transactions. This includes the cardholder name, PAN, expiration date, bank ID (BIN) and several other numbers the issuing bank uses to validate the data received."]}
    let context_ = "DynamicCardVerificationCode"
    let make ~unpredictableNumber =
      fun ~panSequenceNumber ->
        fun ~applicationTransactionCounter ->
          fun ~trackData ->
            fun () ->
              {
                unpredictableNumber;
                panSequenceNumber;
                applicationTransactionCounter;
                trackData
              }
    let to_value x =
      structure_to_value
        [("UnpredictableNumber",
           (Some (HexLengthBetween2And8.to_value x.unpredictableNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some
             (HexLengthBetween2And4.to_value x.applicationTransactionCounter)));
        ("TrackData", (Some (TrackDataType.to_value x.trackData)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let trackData =
        TrackDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "TrackData") in
      let applicationTransactionCounter =
        HexLengthBetween2And4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let unpredictableNumber =
        HexLengthBetween2And8.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UnpredictableNumber") in
      make ~trackData ~applicationTransactionCounter ~panSequenceNumber
        ~unpredictableNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let trackData = field_map_exn json__ "TrackData" TrackDataType.of_json in
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthBetween2And4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let unpredictableNumber =
        field_map_exn json__ "UnpredictableNumber"
          HexLengthBetween2And8.of_json in
      make ~trackData ~applicationTransactionCounter ~panSequenceNumber
        ~unpredictableNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Dynamic Card Verification Value (dCVV)."]
module DynamicCardVerificationValue =
  struct
    type nonrec t =
      {
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      cardExpiryDate: CardExpiryDateType.t
        [@ocaml.doc "The expiry date of a payment card."];
      serviceCode: ServiceCodeType.t
        [@ocaml.doc
          "The service code of the payment card. This is different from Card Security Code (CSC)."];
      applicationTransactionCounter: HexLengthBetween2And4.t
        [@ocaml.doc
          "The transaction counter value that comes from the terminal."]}
    let context_ = "DynamicCardVerificationValue"
    let make ~panSequenceNumber =
      fun ~cardExpiryDate ->
        fun ~serviceCode ->
          fun ~applicationTransactionCounter ->
            fun () ->
              {
                panSequenceNumber;
                cardExpiryDate;
                serviceCode;
                applicationTransactionCounter
              }
    let to_value x =
      structure_to_value
        [("PanSequenceNumber",
           (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("CardExpiryDate",
          (Some (CardExpiryDateType.to_value x.cardExpiryDate)));
        ("ServiceCode", (Some (ServiceCodeType.to_value x.serviceCode)));
        ("ApplicationTransactionCounter",
          (Some
             (HexLengthBetween2And4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthBetween2And4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let serviceCode =
        ServiceCodeType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ServiceCode") in
      let cardExpiryDate =
        CardExpiryDateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardExpiryDate") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      make ~applicationTransactionCounter ~serviceCode ~cardExpiryDate
        ~panSequenceNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthBetween2And4.of_json in
      let serviceCode =
        field_map_exn json__ "ServiceCode" ServiceCodeType.of_json in
      let cardExpiryDate =
        field_map_exn json__ "CardExpiryDate" CardExpiryDateType.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      make ~applicationTransactionCounter ~serviceCode ~cardExpiryDate
        ~panSequenceNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Dynamic Card Verification Value (dCVV)."]
module CryptogramVerificationArpcMethod1 =
  struct
    type nonrec t =
      {
      authResponseCode: HexLengthEquals4.t
        [@ocaml.doc
          "The auth code used to calculate APRC after ARQC verification is successful. This is the same auth code used for ARQC generation outside of Amazon Web Services Payment Cryptography."]}
    let context_ = "CryptogramVerificationArpcMethod1"
    let make ~authResponseCode = fun () -> { authResponseCode }
    let to_value x =
      structure_to_value
        [("AuthResponseCode",
           (Some (HexLengthEquals4.to_value x.authResponseCode)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let authResponseCode =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "AuthResponseCode") in
      make ~authResponseCode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let authResponseCode =
        field_map_exn json__ "AuthResponseCode" HexLengthEquals4.of_json in
      make ~authResponseCode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for ARPC response generation using method1 after ARQC verification is successful."]
module CryptogramVerificationArpcMethod2 =
  struct
    type nonrec t =
      {
      cardStatusUpdate: HexLengthEquals8.t
        [@ocaml.doc
          "The data indicating whether the issuer approves or declines an online transaction using an EMV chip card."];
      proprietaryAuthenticationData:
        ProprietaryAuthenticationDataType.t option
        [@ocaml.doc
          "The proprietary authentication data used by issuer for communication during online transaction using an EMV chip card."]}
    let context_ = "CryptogramVerificationArpcMethod2"
    let make ?proprietaryAuthenticationData =
      fun ~cardStatusUpdate ->
        fun () -> { proprietaryAuthenticationData; cardStatusUpdate }
    let to_value x =
      structure_to_value
        [("CardStatusUpdate",
           (Some (HexLengthEquals8.to_value x.cardStatusUpdate)));
        ("ProprietaryAuthenticationData",
          (Option.map x.proprietaryAuthenticationData
             ~f:ProprietaryAuthenticationDataType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let proprietaryAuthenticationData =
        (Option.map ~f:ProprietaryAuthenticationDataType.of_xml)
          (Xml.child xml_arg0 "ProprietaryAuthenticationData") in
      let cardStatusUpdate =
        HexLengthEquals8.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CardStatusUpdate") in
      make ?proprietaryAuthenticationData ~cardStatusUpdate ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let proprietaryAuthenticationData =
        field_map json__ "ProprietaryAuthenticationData"
          ProprietaryAuthenticationDataType.of_json in
      let cardStatusUpdate =
        field_map_exn json__ "CardStatusUpdate" HexLengthEquals8.of_json in
      make ?proprietaryAuthenticationData ~cardStatusUpdate ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for ARPC response generation using method2 after ARQC verification is successful."]
module SessionKeyAmex =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."]}
    let context_ = "SessionKeyAmex"
    let make ~primaryAccountNumber =
      fun ~panSequenceNumber ->
        fun () -> { primaryAccountNumber; panSequenceNumber }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~panSequenceNumber ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~panSequenceNumber ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key for an Amex payment card."]
module SessionKeyEmv2000 =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter that is provided by the terminal during transaction processing."]}
    let context_ = "SessionKeyEmv2000"
    let make ~primaryAccountNumber =
      fun ~panSequenceNumber ->
        fun ~applicationTransactionCounter ->
          fun () ->
            {
              primaryAccountNumber;
              panSequenceNumber;
              applicationTransactionCounter
            }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key for an Emv2000 payment card for ARQC verification."]
module SessionKeyEmvCommon =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter that is provided by the terminal during transaction processing."]}
    let context_ = "SessionKeyEmvCommon"
    let make ~primaryAccountNumber =
      fun ~panSequenceNumber ->
        fun ~applicationTransactionCounter ->
          fun () ->
            {
              primaryAccountNumber;
              panSequenceNumber;
              applicationTransactionCounter
            }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key for an Emv common payment card for ARQC verification."]
module SessionKeyMastercard =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter that is provided by the terminal during transaction processing."];
      unpredictableNumber: HexLengthBetween2And8.t
        [@ocaml.doc "A random number generated by the issuer."]}
    let context_ = "SessionKeyMastercard"
    let make ~primaryAccountNumber =
      fun ~panSequenceNumber ->
        fun ~applicationTransactionCounter ->
          fun ~unpredictableNumber ->
            fun () ->
              {
                primaryAccountNumber;
                panSequenceNumber;
                applicationTransactionCounter;
                unpredictableNumber
              }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)));
        ("UnpredictableNumber",
          (Some (HexLengthBetween2And8.to_value x.unpredictableNumber)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let unpredictableNumber =
        HexLengthBetween2And8.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UnpredictableNumber") in
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~unpredictableNumber ~applicationTransactionCounter
        ~panSequenceNumber ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let unpredictableNumber =
        field_map_exn json__ "UnpredictableNumber"
          HexLengthBetween2And8.of_json in
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~unpredictableNumber ~applicationTransactionCounter
        ~panSequenceNumber ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key for Mastercard payment card for ARQC verification."]
module SessionKeyVisa =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN)."]}
    let context_ = "SessionKeyVisa"
    let make ~primaryAccountNumber =
      fun ~panSequenceNumber ->
        fun () -> { primaryAccountNumber; panSequenceNumber }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~panSequenceNumber ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~panSequenceNumber ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive session key for Visa payment card for ARQC verification."]
module SystemTraceAuditNumberType =
  struct
    type nonrec t = string
    let context_ = "SystemTraceAuditNumberType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:6) >>=
             (fun () ->
                (check_string_max i ~max:6) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"SystemTraceAuditNumberType" j
    let to_json = simple_to_json to_value
  end
module TransactionAmountType =
  struct
    type nonrec t = string
    let context_ = "TransactionAmountType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:12) >>=
             (fun () ->
                (check_string_max i ~max:12) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"TransactionAmountType" j
    let to_json = simple_to_json to_value
  end
module TranslationPinDataAs2805Format0 =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."]}
    let context_ = "TranslationPinDataAs2805Format0"
    let make ~primaryAccountNumber = fun () -> { primaryAccountNumber }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for translation between AS2805 PIN format 0 translation."]
module TranslationPinDataIsoFormat034 =
  struct
    type nonrec t =
      {
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN) of the cardholder. A PAN is a unique identifier for a payment credit or debit card and associates the card to a specific account holder."]}
    let context_ = "TranslationPinDataIsoFormat034"
    let make ~primaryAccountNumber = fun () -> { primaryAccountNumber }
    let to_value x =
      structure_to_value
        [("PrimaryAccountNumber",
           (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      make ~primaryAccountNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      make ~primaryAccountNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for translation between ISO9564 PIN format 0,3,4 translation."]
module TranslationPinDataIsoFormat1 =
  struct
    type nonrec t = unit
    let make () = ()
    let of_header_and_body = ((fun (xs, pipe) -> make ())[@warning "-27"])
    let to_value _ = `Structure []
    let to_query v = to_query to_value v
    let of_xml _ = make ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json _ = make ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for ISO9564 PIN format 1 translation."]
module KeyCheckValue =
  struct
    type nonrec t = string
    let context_ = "KeyCheckValue"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"KeyCheckValue" j
    let to_json = simple_to_json to_value
  end
module KeyMaterial =
  struct
    type nonrec t = string
    let context_ = "KeyMaterial"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:16384) >>=
             (fun () -> check_string_min i ~min:32));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"KeyMaterial" j
    let to_json = simple_to_json to_value
  end
module WrappedKeyMaterialFormat =
  struct
    type nonrec t =
      | KEY_CRYPTOGRAM 
      | TR31_KEY_BLOCK 
      | TR34_KEY_BLOCK 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | KEY_CRYPTOGRAM -> "KEY_CRYPTOGRAM"
      | TR31_KEY_BLOCK -> "TR31_KEY_BLOCK"
      | TR34_KEY_BLOCK -> "TR34_KEY_BLOCK"
      | Non_static_id s -> s
    let of_string =
      function
      | "KEY_CRYPTOGRAM" -> KEY_CRYPTOGRAM
      | "TR31_KEY_BLOCK" -> TR31_KEY_BLOCK
      | "TR34_KEY_BLOCK" -> TR34_KEY_BLOCK
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration WrappedKeyMaterialFormat" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"WrappedKeyMaterialFormat" j)
    let to_json = simple_to_json to_value
  end
module IncomingDiffieHellmanTr31KeyBlock =
  struct
    type nonrec t =
      {
      privateKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc "The keyARN of the asymmetric ECC key pair."];
      certificateAuthorityPublicKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyArn of the certificate that signed the client's PublicKeyCertificate."];
      publicKeyCertificate: CertificateType.t
        [@ocaml.doc
          "The client's public key certificate in PEM format (base64 encoded) to use for ECDH key derivation."];
      deriveKeyAlgorithm: SymmetricKeyAlgorithm.t
        [@ocaml.doc "The key algorithm of the derived ECDH key."];
      keyDerivationFunction: KeyDerivationFunction.t
        [@ocaml.doc
          "The key derivation function to use for deriving a key using ECDH."];
      keyDerivationHashAlgorithm: KeyDerivationHashAlgorithm.t
        [@ocaml.doc "The hash type to use for deriving a key using ECDH."];
      derivationData: DiffieHellmanDerivationData.t ;
      wrappedKeyBlock: Tr31WrappedKeyBlock.t
        [@ocaml.doc
          "The WrappedKeyBlock containing the transaction key wrapped using an ECDH dervied key."]}
    let context_ = "IncomingDiffieHellmanTr31KeyBlock"
    let make ~privateKeyIdentifier =
      fun ~certificateAuthorityPublicKeyIdentifier ->
        fun ~publicKeyCertificate ->
          fun ~deriveKeyAlgorithm ->
            fun ~keyDerivationFunction ->
              fun ~keyDerivationHashAlgorithm ->
                fun ~derivationData ->
                  fun ~wrappedKeyBlock ->
                    fun () ->
                      {
                        privateKeyIdentifier;
                        certificateAuthorityPublicKeyIdentifier;
                        publicKeyCertificate;
                        deriveKeyAlgorithm;
                        keyDerivationFunction;
                        keyDerivationHashAlgorithm;
                        derivationData;
                        wrappedKeyBlock
                      }
    let to_value x =
      structure_to_value
        [("PrivateKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.privateKeyIdentifier)));
        ("CertificateAuthorityPublicKeyIdentifier",
          (Some
             (KeyArnOrKeyAliasType.to_value
                x.certificateAuthorityPublicKeyIdentifier)));
        ("PublicKeyCertificate",
          (Some (CertificateType.to_value x.publicKeyCertificate)));
        ("DeriveKeyAlgorithm",
          (Some (SymmetricKeyAlgorithm.to_value x.deriveKeyAlgorithm)));
        ("KeyDerivationFunction",
          (Some (KeyDerivationFunction.to_value x.keyDerivationFunction)));
        ("KeyDerivationHashAlgorithm",
          (Some
             (KeyDerivationHashAlgorithm.to_value
                x.keyDerivationHashAlgorithm)));
        ("DerivationData",
          (Some (DiffieHellmanDerivationData.to_value x.derivationData)));
        ("WrappedKeyBlock",
          (Some (Tr31WrappedKeyBlock.to_value x.wrappedKeyBlock)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappedKeyBlock =
        Tr31WrappedKeyBlock.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "WrappedKeyBlock") in
      let derivationData =
        DiffieHellmanDerivationData.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DerivationData") in
      let keyDerivationHashAlgorithm =
        KeyDerivationHashAlgorithm.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "KeyDerivationHashAlgorithm") in
      let keyDerivationFunction =
        KeyDerivationFunction.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyDerivationFunction") in
      let deriveKeyAlgorithm =
        SymmetricKeyAlgorithm.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeriveKeyAlgorithm") in
      let publicKeyCertificate =
        CertificateType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PublicKeyCertificate") in
      let certificateAuthorityPublicKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "CertificateAuthorityPublicKeyIdentifier") in
      let privateKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrivateKeyIdentifier") in
      make ~wrappedKeyBlock ~derivationData ~keyDerivationHashAlgorithm
        ~keyDerivationFunction ~deriveKeyAlgorithm ~publicKeyCertificate
        ~certificateAuthorityPublicKeyIdentifier ~privateKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappedKeyBlock =
        field_map_exn json__ "WrappedKeyBlock" Tr31WrappedKeyBlock.of_json in
      let derivationData =
        field_map_exn json__ "DerivationData"
          DiffieHellmanDerivationData.of_json in
      let keyDerivationHashAlgorithm =
        field_map_exn json__ "KeyDerivationHashAlgorithm"
          KeyDerivationHashAlgorithm.of_json in
      let keyDerivationFunction =
        field_map_exn json__ "KeyDerivationFunction"
          KeyDerivationFunction.of_json in
      let deriveKeyAlgorithm =
        field_map_exn json__ "DeriveKeyAlgorithm"
          SymmetricKeyAlgorithm.of_json in
      let publicKeyCertificate =
        field_map_exn json__ "PublicKeyCertificate" CertificateType.of_json in
      let certificateAuthorityPublicKeyIdentifier =
        field_map_exn json__ "CertificateAuthorityPublicKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let privateKeyIdentifier =
        field_map_exn json__ "PrivateKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ~wrappedKeyBlock ~derivationData ~keyDerivationHashAlgorithm
        ~keyDerivationFunction ~deriveKeyAlgorithm ~publicKeyCertificate
        ~certificateAuthorityPublicKeyIdentifier ~privateKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of a TR31KeyBlock wrapped using an ECDH derived key."]
module OutgoingTr31KeyBlock =
  struct
    type nonrec t =
      {
      wrappingKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the KEK used to wrap the transaction key."]}
    let context_ = "OutgoingTr31KeyBlock"
    let make ~wrappingKeyIdentifier = fun () -> { wrappingKeyIdentifier }
    let to_value x =
      structure_to_value
        [("WrappingKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.wrappingKeyIdentifier)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappingKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "WrappingKeyIdentifier") in
      make ~wrappingKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappingKeyIdentifier =
        field_map_exn json__ "WrappingKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ~wrappingKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of the TR31WrappedKeyBlock containing the transaction key wrapped using a KEK."]
module DukptEncryptionAttributes =
  struct
    type nonrec t =
      {
      keySerialNumber: HexLength16Or20Or24.t
        [@ocaml.doc
          "The unique identifier known as Key Serial Number (KSN) that comes from an encrypting device using DUKPT encryption method. The KSN is derived from the encrypting device unique identifier and an internal transaction counter."];
      mode: DukptEncryptionMode.t option
        [@ocaml.doc
          "The block cipher method to use for encryption. The default is CBC."];
      dukptKeyDerivationType: DukptDerivationType.t option
        [@ocaml.doc
          "The key type encrypted using DUKPT from a Base Derivation Key (BDK) and Key Serial Number (KSN). This must be less than or equal to the strength of the BDK. For example, you can't use AES_128 as a derivation type for a BDK of AES_128 or TDES_2KEY"];
      dukptKeyVariant: DukptKeyVariant.t option
        [@ocaml.doc
          "The type of use of DUKPT, which can be incoming data decryption, outgoing data encryption, or both."];
      initializationVector: InitializationVectorType.t option
        [@ocaml.doc
          "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."]}
    let context_ = "DukptEncryptionAttributes"
    let make ?mode =
      fun ?dukptKeyDerivationType ->
        fun ?dukptKeyVariant ->
          fun ?initializationVector ->
            fun ~keySerialNumber ->
              fun () ->
                {
                  mode;
                  dukptKeyDerivationType;
                  dukptKeyVariant;
                  initializationVector;
                  keySerialNumber
                }
    let to_value x =
      structure_to_value
        [("KeySerialNumber",
           (Some (HexLength16Or20Or24.to_value x.keySerialNumber)));
        ("Mode", (Option.map x.mode ~f:DukptEncryptionMode.to_value));
        ("DukptKeyDerivationType",
          (Option.map x.dukptKeyDerivationType
             ~f:DukptDerivationType.to_value));
        ("DukptKeyVariant",
          (Option.map x.dukptKeyVariant ~f:DukptKeyVariant.to_value));
        ("InitializationVector",
          (Option.map x.initializationVector
             ~f:InitializationVectorType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let initializationVector =
        (Option.map ~f:InitializationVectorType.of_xml)
          (Xml.child xml_arg0 "InitializationVector") in
      let dukptKeyVariant =
        (Option.map ~f:DukptKeyVariant.of_xml)
          (Xml.child xml_arg0 "DukptKeyVariant") in
      let dukptKeyDerivationType =
        (Option.map ~f:DukptDerivationType.of_xml)
          (Xml.child xml_arg0 "DukptKeyDerivationType") in
      let mode =
        (Option.map ~f:DukptEncryptionMode.of_xml)
          (Xml.child xml_arg0 "Mode") in
      let keySerialNumber =
        HexLength16Or20Or24.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeySerialNumber") in
      make ?initializationVector ?dukptKeyVariant ?dukptKeyDerivationType
        ?mode ~keySerialNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let initializationVector =
        field_map json__ "InitializationVector"
          InitializationVectorType.of_json in
      let dukptKeyVariant =
        field_map json__ "DukptKeyVariant" DukptKeyVariant.of_json in
      let dukptKeyDerivationType =
        field_map json__ "DukptKeyDerivationType" DukptDerivationType.of_json in
      let mode = field_map json__ "Mode" DukptEncryptionMode.of_json in
      let keySerialNumber =
        field_map_exn json__ "KeySerialNumber" HexLength16Or20Or24.of_json in
      make ?initializationVector ?dukptKeyVariant ?dukptKeyDerivationType
        ?mode ~keySerialNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to encrypt plaintext data using DUKPT."]
module SymmetricEncryptionAttributes =
  struct
    type nonrec t =
      {
      mode: EncryptionMode.t
        [@ocaml.doc "The block cipher method to use for encryption."];
      initializationVector: InitializationVectorType.t option
        [@ocaml.doc
          "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."];
      paddingType: PaddingType.t option
        [@ocaml.doc "The padding to be included with the data."]}
    let context_ = "SymmetricEncryptionAttributes"
    let make ?initializationVector =
      fun ?paddingType ->
        fun ~mode -> fun () -> { initializationVector; paddingType; mode }
    let to_value x =
      structure_to_value
        [("Mode", (Some (EncryptionMode.to_value x.mode)));
        ("InitializationVector",
          (Option.map x.initializationVector
             ~f:InitializationVectorType.to_value));
        ("PaddingType", (Option.map x.paddingType ~f:PaddingType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let paddingType =
        (Option.map ~f:PaddingType.of_xml) (Xml.child xml_arg0 "PaddingType") in
      let initializationVector =
        (Option.map ~f:InitializationVectorType.of_xml)
          (Xml.child xml_arg0 "InitializationVector") in
      let mode =
        EncryptionMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Mode") in
      make ?paddingType ?initializationVector ~mode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let paddingType = field_map json__ "PaddingType" PaddingType.of_json in
      let initializationVector =
        field_map json__ "InitializationVector"
          InitializationVectorType.of_json in
      let mode = field_map_exn json__ "Mode" EncryptionMode.of_json in
      make ?paddingType ?initializationVector ~mode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters requried to encrypt plaintext data using symmetric keys."]
module Ibm3624NaturalPin =
  struct
    type nonrec t =
      {
      decimalizationTable: DecimalizationTableType.t
        [@ocaml.doc
          "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."];
      pinValidationDataPadCharacter: HexLengthEquals1.t
        [@ocaml.doc "The padding character for validation data."];
      pinValidationData: PinValidationDataType.t
        [@ocaml.doc "The unique data for cardholder identification."]}
    let context_ = "Ibm3624NaturalPin"
    let make ~decimalizationTable =
      fun ~pinValidationDataPadCharacter ->
        fun ~pinValidationData ->
          fun () ->
            {
              decimalizationTable;
              pinValidationDataPadCharacter;
              pinValidationData
            }
    let to_value x =
      structure_to_value
        [("DecimalizationTable",
           (Some (DecimalizationTableType.to_value x.decimalizationTable)));
        ("PinValidationDataPadCharacter",
          (Some (HexLengthEquals1.to_value x.pinValidationDataPadCharacter)));
        ("PinValidationData",
          (Some (PinValidationDataType.to_value x.pinValidationData)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinValidationData =
        PinValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinValidationData") in
      let pinValidationDataPadCharacter =
        HexLengthEquals1.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "PinValidationDataPadCharacter") in
      let decimalizationTable =
        DecimalizationTableType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecimalizationTable") in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinValidationData =
        field_map_exn json__ "PinValidationData"
          PinValidationDataType.of_json in
      let pinValidationDataPadCharacter =
        field_map_exn json__ "PinValidationDataPadCharacter"
          HexLengthEquals1.of_json in
      let decimalizationTable =
        field_map_exn json__ "DecimalizationTable"
          DecimalizationTableType.of_json in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Ibm3624 natural PIN."]
module Ibm3624PinFromOffset =
  struct
    type nonrec t =
      {
      decimalizationTable: DecimalizationTableType.t
        [@ocaml.doc
          "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."];
      pinValidationDataPadCharacter: HexLengthEquals1.t
        [@ocaml.doc "The padding character for validation data."];
      pinValidationData: PinValidationDataType.t
        [@ocaml.doc "The unique data for cardholder identification."];
      pinOffset: PinOffsetType.t [@ocaml.doc "The PIN offset value."]}
    let context_ = "Ibm3624PinFromOffset"
    let make ~decimalizationTable =
      fun ~pinValidationDataPadCharacter ->
        fun ~pinValidationData ->
          fun ~pinOffset ->
            fun () ->
              {
                decimalizationTable;
                pinValidationDataPadCharacter;
                pinValidationData;
                pinOffset
              }
    let to_value x =
      structure_to_value
        [("DecimalizationTable",
           (Some (DecimalizationTableType.to_value x.decimalizationTable)));
        ("PinValidationDataPadCharacter",
          (Some (HexLengthEquals1.to_value x.pinValidationDataPadCharacter)));
        ("PinValidationData",
          (Some (PinValidationDataType.to_value x.pinValidationData)));
        ("PinOffset", (Some (PinOffsetType.to_value x.pinOffset)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinOffset =
        PinOffsetType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinOffset") in
      let pinValidationData =
        PinValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinValidationData") in
      let pinValidationDataPadCharacter =
        HexLengthEquals1.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "PinValidationDataPadCharacter") in
      let decimalizationTable =
        DecimalizationTableType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecimalizationTable") in
      make ~pinOffset ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinOffset = field_map_exn json__ "PinOffset" PinOffsetType.of_json in
      let pinValidationData =
        field_map_exn json__ "PinValidationData"
          PinValidationDataType.of_json in
      let pinValidationDataPadCharacter =
        field_map_exn json__ "PinValidationDataPadCharacter"
          HexLengthEquals1.of_json in
      let decimalizationTable =
        field_map_exn json__ "DecimalizationTable"
          DecimalizationTableType.of_json in
      make ~pinOffset ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Ibm3624 PIN from offset PIN."]
module Ibm3624PinOffset =
  struct
    type nonrec t =
      {
      encryptedPinBlock: EncryptedPinBlockType.t
        [@ocaml.doc
          "The encrypted PIN block data. According to ISO 9564 standard, a PIN Block is an encoded representation of a payment card Personal Account Number (PAN) and the cardholder Personal Identification Number (PIN)."];
      decimalizationTable: DecimalizationTableType.t
        [@ocaml.doc
          "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."];
      pinValidationDataPadCharacter: HexLengthEquals1.t
        [@ocaml.doc "The padding character for validation data."];
      pinValidationData: PinValidationDataType.t
        [@ocaml.doc "The unique data for cardholder identification."]}
    let context_ = "Ibm3624PinOffset"
    let make ~encryptedPinBlock =
      fun ~decimalizationTable ->
        fun ~pinValidationDataPadCharacter ->
          fun ~pinValidationData ->
            fun () ->
              {
                encryptedPinBlock;
                decimalizationTable;
                pinValidationDataPadCharacter;
                pinValidationData
              }
    let to_value x =
      structure_to_value
        [("EncryptedPinBlock",
           (Some (EncryptedPinBlockType.to_value x.encryptedPinBlock)));
        ("DecimalizationTable",
          (Some (DecimalizationTableType.to_value x.decimalizationTable)));
        ("PinValidationDataPadCharacter",
          (Some (HexLengthEquals1.to_value x.pinValidationDataPadCharacter)));
        ("PinValidationData",
          (Some (PinValidationDataType.to_value x.pinValidationData)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinValidationData =
        PinValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinValidationData") in
      let pinValidationDataPadCharacter =
        HexLengthEquals1.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "PinValidationDataPadCharacter") in
      let decimalizationTable =
        DecimalizationTableType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecimalizationTable") in
      let encryptedPinBlock =
        EncryptedPinBlockType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptedPinBlock") in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ~encryptedPinBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinValidationData =
        field_map_exn json__ "PinValidationData"
          PinValidationDataType.of_json in
      let pinValidationDataPadCharacter =
        field_map_exn json__ "PinValidationDataPadCharacter"
          HexLengthEquals1.of_json in
      let decimalizationTable =
        field_map_exn json__ "DecimalizationTable"
          DecimalizationTableType.of_json in
      let encryptedPinBlock =
        field_map_exn json__ "EncryptedPinBlock"
          EncryptedPinBlockType.of_json in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ~encryptedPinBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Pparameters that are required to generate or verify Ibm3624 PIN offset PIN."]
module Ibm3624RandomPin =
  struct
    type nonrec t =
      {
      decimalizationTable: DecimalizationTableType.t
        [@ocaml.doc
          "The decimalization table to use for IBM 3624 PIN algorithm. The table is used to convert the algorithm intermediate result from hexadecimal characters to decimal."];
      pinValidationDataPadCharacter: HexLengthEquals1.t
        [@ocaml.doc "The padding character for validation data."];
      pinValidationData: PinValidationDataType.t
        [@ocaml.doc "The unique data for cardholder identification."]}
    let context_ = "Ibm3624RandomPin"
    let make ~decimalizationTable =
      fun ~pinValidationDataPadCharacter ->
        fun ~pinValidationData ->
          fun () ->
            {
              decimalizationTable;
              pinValidationDataPadCharacter;
              pinValidationData
            }
    let to_value x =
      structure_to_value
        [("DecimalizationTable",
           (Some (DecimalizationTableType.to_value x.decimalizationTable)));
        ("PinValidationDataPadCharacter",
          (Some (HexLengthEquals1.to_value x.pinValidationDataPadCharacter)));
        ("PinValidationData",
          (Some (PinValidationDataType.to_value x.pinValidationData)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinValidationData =
        PinValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinValidationData") in
      let pinValidationDataPadCharacter =
        HexLengthEquals1.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "PinValidationDataPadCharacter") in
      let decimalizationTable =
        DecimalizationTableType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecimalizationTable") in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinValidationData =
        field_map_exn json__ "PinValidationData"
          PinValidationDataType.of_json in
      let pinValidationDataPadCharacter =
        field_map_exn json__ "PinValidationDataPadCharacter"
          HexLengthEquals1.of_json in
      let decimalizationTable =
        field_map_exn json__ "DecimalizationTable"
          DecimalizationTableType.of_json in
      make ~pinValidationData ~pinValidationDataPadCharacter
        ~decimalizationTable ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Ibm3624 random PIN."]
module VisaPin =
  struct
    type nonrec t =
      {
      pinVerificationKeyIndex: IntegerRangeBetween0And6.t
        [@ocaml.doc
          "The value for PIN verification index. It is used in the Visa PIN algorithm to calculate the PVV (PIN Verification Value)."]}
    let context_ = "VisaPin"
    let make ~pinVerificationKeyIndex = fun () -> { pinVerificationKeyIndex }
    let to_value x =
      structure_to_value
        [("PinVerificationKeyIndex",
           (Some
              (IntegerRangeBetween0And6.to_value x.pinVerificationKeyIndex)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinVerificationKeyIndex =
        IntegerRangeBetween0And6.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinVerificationKeyIndex") in
      make ~pinVerificationKeyIndex ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinVerificationKeyIndex =
        field_map_exn json__ "PinVerificationKeyIndex"
          IntegerRangeBetween0And6.of_json in
      make ~pinVerificationKeyIndex ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Visa PIN."]
module VisaPinVerificationValue =
  struct
    type nonrec t =
      {
      encryptedPinBlock: EncryptedPinBlockType.t
        [@ocaml.doc "The encrypted PIN block data to verify."];
      pinVerificationKeyIndex: IntegerRangeBetween0And6.t
        [@ocaml.doc
          "The value for PIN verification index. It is used in the Visa PIN algorithm to calculate the PVV (PIN Verification Value)."]}
    let context_ = "VisaPinVerificationValue"
    let make ~encryptedPinBlock =
      fun ~pinVerificationKeyIndex ->
        fun () -> { encryptedPinBlock; pinVerificationKeyIndex }
    let to_value x =
      structure_to_value
        [("EncryptedPinBlock",
           (Some (EncryptedPinBlockType.to_value x.encryptedPinBlock)));
        ("PinVerificationKeyIndex",
          (Some (IntegerRangeBetween0And6.to_value x.pinVerificationKeyIndex)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinVerificationKeyIndex =
        IntegerRangeBetween0And6.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinVerificationKeyIndex") in
      let encryptedPinBlock =
        EncryptedPinBlockType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptedPinBlock") in
      make ~pinVerificationKeyIndex ~encryptedPinBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinVerificationKeyIndex =
        field_map_exn json__ "PinVerificationKeyIndex"
          IntegerRangeBetween0And6.of_json in
      let encryptedPinBlock =
        field_map_exn json__ "EncryptedPinBlock"
          EncryptedPinBlockType.of_json in
      make ~pinVerificationKeyIndex ~encryptedPinBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate or verify Visa PVV (PIN Verification Value)."]
module KeyArn =
  struct
    type nonrec t = string
    let context_ = "KeyArn"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:70) >>=
             (fun () ->
                (check_string_max i ~max:150) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"arn:aws:payment-cryptography:[a-z]{2}-[a-z]{1,16}-[0-9]+:[0-9]{12}:key/[0-9a-zA-Z]{16,64}")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"KeyArn" j
    let to_json = simple_to_json to_value
  end
module AmexAttributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for a payment card using Amex derivation."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc "The Primary Account Number (PAN) of the cardholder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter of the current transaction that is provided by the terminal during transaction processing."];
      authorizationRequestKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card."];
      currentPinAttributes: CurrentPinAttributes.t option
        [@ocaml.doc
          "The encrypted pinblock of the old pin stored on the chip card."]}
    let context_ = "AmexAttributes"
    let make ?currentPinAttributes =
      fun ~majorKeyDerivationMode ->
        fun ~primaryAccountNumber ->
          fun ~panSequenceNumber ->
            fun ~applicationTransactionCounter ->
              fun ~authorizationRequestKeyIdentifier ->
                fun () ->
                  {
                    currentPinAttributes;
                    majorKeyDerivationMode;
                    primaryAccountNumber;
                    panSequenceNumber;
                    applicationTransactionCounter;
                    authorizationRequestKeyIdentifier
                  }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)));
        ("AuthorizationRequestKeyIdentifier",
          (Some
             (KeyArnOrKeyAliasType.to_value
                x.authorizationRequestKeyIdentifier)));
        ("CurrentPinAttributes",
          (Option.map x.currentPinAttributes ~f:CurrentPinAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let currentPinAttributes =
        (Option.map ~f:CurrentPinAttributes.of_xml)
          (Xml.child xml_arg0 "CurrentPinAttributes") in
      let authorizationRequestKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "AuthorizationRequestKeyIdentifier") in
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ?currentPinAttributes ~authorizationRequestKeyIdentifier
        ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let currentPinAttributes =
        field_map json__ "CurrentPinAttributes" CurrentPinAttributes.of_json in
      let authorizationRequestKeyIdentifier =
        field_map_exn json__ "AuthorizationRequestKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ?currentPinAttributes ~authorizationRequestKeyIdentifier
        ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the confidentiality and integrity keys for a payment card using Amex derivation method."]
module Emv2000Attributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for the payment card."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc "The Primary Account Number (PAN) of the cardholder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter of the current transaction that is provided by the terminal during transaction processing."]}
    let context_ = "Emv2000Attributes"
    let make ~majorKeyDerivationMode =
      fun ~primaryAccountNumber ->
        fun ~panSequenceNumber ->
          fun ~applicationTransactionCounter ->
            fun () ->
              {
                majorKeyDerivationMode;
                primaryAccountNumber;
                panSequenceNumber;
                applicationTransactionCounter
              }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the confidentiality and integrity keys for a payment card using EMV2000 deruv."]
module EmvCommonAttributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for the payment card."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc "The Primary Account Number (PAN) of the cardholder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      applicationCryptogram: ApplicationCryptogramType.t
        [@ocaml.doc
          "The application cryptogram for the current transaction that is provided by the terminal during transaction processing."];
      mode: EmvEncryptionMode.t
        [@ocaml.doc "The block cipher method to use for encryption."];
      pinBlockPaddingType: PinBlockPaddingType.t
        [@ocaml.doc
          "The padding to be added to the PIN block prior to encryption. Padding type should be ISO_IEC_7816_4, if PinBlockLengthPosition is set to FRONT_OF_PIN_BLOCK. No padding is required, if PinBlockLengthPosition is set to NONE."];
      pinBlockLengthPosition: PinBlockLengthPosition.t
        [@ocaml.doc
          "Specifies if PIN block length should be added to front of the pin block. If value is set to FRONT_OF_PIN_BLOCK, then PIN block padding type should be ISO_IEC_7816_4."]}
    let context_ = "EmvCommonAttributes"
    let make ~majorKeyDerivationMode =
      fun ~primaryAccountNumber ->
        fun ~panSequenceNumber ->
          fun ~applicationCryptogram ->
            fun ~mode ->
              fun ~pinBlockPaddingType ->
                fun ~pinBlockLengthPosition ->
                  fun () ->
                    {
                      majorKeyDerivationMode;
                      primaryAccountNumber;
                      panSequenceNumber;
                      applicationCryptogram;
                      mode;
                      pinBlockPaddingType;
                      pinBlockLengthPosition
                    }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationCryptogram",
          (Some (ApplicationCryptogramType.to_value x.applicationCryptogram)));
        ("Mode", (Some (EmvEncryptionMode.to_value x.mode)));
        ("PinBlockPaddingType",
          (Some (PinBlockPaddingType.to_value x.pinBlockPaddingType)));
        ("PinBlockLengthPosition",
          (Some (PinBlockLengthPosition.to_value x.pinBlockLengthPosition)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinBlockLengthPosition =
        PinBlockLengthPosition.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinBlockLengthPosition") in
      let pinBlockPaddingType =
        PinBlockPaddingType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinBlockPaddingType") in
      let mode =
        EmvEncryptionMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Mode") in
      let applicationCryptogram =
        ApplicationCryptogramType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ApplicationCryptogram") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ~pinBlockLengthPosition ~pinBlockPaddingType ~mode
        ~applicationCryptogram ~panSequenceNumber ~primaryAccountNumber
        ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinBlockLengthPosition =
        field_map_exn json__ "PinBlockLengthPosition"
          PinBlockLengthPosition.of_json in
      let pinBlockPaddingType =
        field_map_exn json__ "PinBlockPaddingType"
          PinBlockPaddingType.of_json in
      let mode = field_map_exn json__ "Mode" EmvEncryptionMode.of_json in
      let applicationCryptogram =
        field_map_exn json__ "ApplicationCryptogram"
          ApplicationCryptogramType.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ~pinBlockLengthPosition ~pinBlockPaddingType ~mode
        ~applicationCryptogram ~panSequenceNumber ~primaryAccountNumber
        ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the confidentiality and integrity keys for an Emv common payment card."]
module MasterCardAttributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for the payment card."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc "The Primary Account Number (PAN) of the cardholder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      applicationCryptogram: ApplicationCryptogramType.t
        [@ocaml.doc
          "The application cryptogram for the current transaction that is provided by the terminal during transaction processing."]}
    let context_ = "MasterCardAttributes"
    let make ~majorKeyDerivationMode =
      fun ~primaryAccountNumber ->
        fun ~panSequenceNumber ->
          fun ~applicationCryptogram ->
            fun () ->
              {
                majorKeyDerivationMode;
                primaryAccountNumber;
                panSequenceNumber;
                applicationCryptogram
              }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationCryptogram",
          (Some (ApplicationCryptogramType.to_value x.applicationCryptogram)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let applicationCryptogram =
        ApplicationCryptogramType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ApplicationCryptogram") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ~applicationCryptogram ~panSequenceNumber ~primaryAccountNumber
        ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let applicationCryptogram =
        field_map_exn json__ "ApplicationCryptogram"
          ApplicationCryptogramType.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ~applicationCryptogram ~panSequenceNumber ~primaryAccountNumber
        ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the confidentiality and integrity keys for a Mastercard payment card."]
module VisaAttributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the master key for the payment card."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc "The Primary Account Number (PAN) of the cardholder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      applicationTransactionCounter: HexLengthEquals4.t
        [@ocaml.doc
          "The transaction counter of the current transaction that is provided by the terminal during transaction processing."];
      authorizationRequestKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card."];
      currentPinAttributes: CurrentPinAttributes.t option
        [@ocaml.doc
          "The encrypted pinblock of the old pin stored on the chip card."]}
    let context_ = "VisaAttributes"
    let make ?currentPinAttributes =
      fun ~majorKeyDerivationMode ->
        fun ~primaryAccountNumber ->
          fun ~panSequenceNumber ->
            fun ~applicationTransactionCounter ->
              fun ~authorizationRequestKeyIdentifier ->
                fun () ->
                  {
                    currentPinAttributes;
                    majorKeyDerivationMode;
                    primaryAccountNumber;
                    panSequenceNumber;
                    applicationTransactionCounter;
                    authorizationRequestKeyIdentifier
                  }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("ApplicationTransactionCounter",
          (Some (HexLengthEquals4.to_value x.applicationTransactionCounter)));
        ("AuthorizationRequestKeyIdentifier",
          (Some
             (KeyArnOrKeyAliasType.to_value
                x.authorizationRequestKeyIdentifier)));
        ("CurrentPinAttributes",
          (Option.map x.currentPinAttributes ~f:CurrentPinAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let currentPinAttributes =
        (Option.map ~f:CurrentPinAttributes.of_xml)
          (Xml.child xml_arg0 "CurrentPinAttributes") in
      let authorizationRequestKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "AuthorizationRequestKeyIdentifier") in
      let applicationTransactionCounter =
        HexLengthEquals4.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ApplicationTransactionCounter") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ?currentPinAttributes ~authorizationRequestKeyIdentifier
        ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let currentPinAttributes =
        field_map json__ "CurrentPinAttributes" CurrentPinAttributes.of_json in
      let authorizationRequestKeyIdentifier =
        field_map_exn json__ "AuthorizationRequestKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let applicationTransactionCounter =
        field_map_exn json__ "ApplicationTransactionCounter"
          HexLengthEquals4.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      make ?currentPinAttributes ~authorizationRequestKeyIdentifier
        ~applicationTransactionCounter ~panSequenceNumber
        ~primaryAccountNumber ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the confidentiality and integrity keys for a Visa payment card."]
module KekValidationRequest =
  struct
    type nonrec t =
      {
      deriveKeyAlgorithm: SymmetricKeyAlgorithm.t
        [@ocaml.doc
          "The key derivation algorithm to use for generating a KEK validation request."]}
    let context_ = "KekValidationRequest"
    let make ~deriveKeyAlgorithm = fun () -> { deriveKeyAlgorithm }
    let to_value x =
      structure_to_value
        [("DeriveKeyAlgorithm",
           (Some (SymmetricKeyAlgorithm.to_value x.deriveKeyAlgorithm)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deriveKeyAlgorithm =
        SymmetricKeyAlgorithm.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeriveKeyAlgorithm") in
      make ~deriveKeyAlgorithm ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deriveKeyAlgorithm =
        field_map_exn json__ "DeriveKeyAlgorithm"
          SymmetricKeyAlgorithm.of_json in
      make ~deriveKeyAlgorithm ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information for generating a KEK validation request during node-to-node initialization."]
module KekValidationResponse =
  struct
    type nonrec t =
      {
      randomKeySend: As2805RandomKeyMaterial.t
        [@ocaml.doc
          "The random key for generating a KEK validation response."]}
    let context_ = "KekValidationResponse"
    let make ~randomKeySend = fun () -> { randomKeySend }
    let to_value x =
      structure_to_value
        [("RandomKeySend",
           (Some (As2805RandomKeyMaterial.to_value x.randomKeySend)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let randomKeySend =
        As2805RandomKeyMaterial.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "RandomKeySend") in
      make ~randomKeySend ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let randomKeySend =
        field_map_exn json__ "RandomKeySend" As2805RandomKeyMaterial.of_json in
      make ~randomKeySend ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information for generating a KEK validation response during node-to-node initialization."]
module AsymmetricEncryptionAttributes =
  struct
    type nonrec t =
      {
      paddingType: PaddingType.t option
        [@ocaml.doc "The padding to be included with the data."]}
    let make ?paddingType = fun () -> { paddingType }
    let to_value x =
      structure_to_value
        [("PaddingType", (Option.map x.paddingType ~f:PaddingType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let paddingType =
        (Option.map ~f:PaddingType.of_xml) (Xml.child xml_arg0 "PaddingType") in
      make ?paddingType ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let paddingType = field_map json__ "PaddingType" PaddingType.of_json in
      make ?paddingType ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters for plaintext encryption using asymmetric keys."]
module EmvEncryptionAttributes =
  struct
    type nonrec t =
      {
      majorKeyDerivationMode: EmvMajorKeyDerivationMode.t
        [@ocaml.doc
          "The EMV derivation mode to use for ICC master key derivation as per EMV version 4.3 book 2."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card and associates the card to a specific account holder."];
      panSequenceNumber: NumberLengthEquals2.t
        [@ocaml.doc
          "A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal."];
      sessionDerivationData: SessionDerivationDataType.t
        [@ocaml.doc
          "The derivation value used to derive the ICC session key. It is typically the application transaction counter value padded with zeros or previous ARQC value padded with zeros as per EMV version 4.3 book 2."];
      mode: EmvEncryptionMode.t option
        [@ocaml.doc "The block cipher method to use for encryption."];
      initializationVector: InitializationVectorType.t option
        [@ocaml.doc
          "An input used to provide the intial state. If no value is provided, Amazon Web Services Payment Cryptography defaults it to zero."]}
    let context_ = "EmvEncryptionAttributes"
    let make ?mode =
      fun ?initializationVector ->
        fun ~majorKeyDerivationMode ->
          fun ~primaryAccountNumber ->
            fun ~panSequenceNumber ->
              fun ~sessionDerivationData ->
                fun () ->
                  {
                    mode;
                    initializationVector;
                    majorKeyDerivationMode;
                    primaryAccountNumber;
                    panSequenceNumber;
                    sessionDerivationData
                  }
    let to_value x =
      structure_to_value
        [("MajorKeyDerivationMode",
           (Some
              (EmvMajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("PanSequenceNumber",
          (Some (NumberLengthEquals2.to_value x.panSequenceNumber)));
        ("SessionDerivationData",
          (Some (SessionDerivationDataType.to_value x.sessionDerivationData)));
        ("Mode", (Option.map x.mode ~f:EmvEncryptionMode.to_value));
        ("InitializationVector",
          (Option.map x.initializationVector
             ~f:InitializationVectorType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let initializationVector =
        (Option.map ~f:InitializationVectorType.of_xml)
          (Xml.child xml_arg0 "InitializationVector") in
      let mode =
        (Option.map ~f:EmvEncryptionMode.of_xml) (Xml.child xml_arg0 "Mode") in
      let sessionDerivationData =
        SessionDerivationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "SessionDerivationData") in
      let panSequenceNumber =
        NumberLengthEquals2.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PanSequenceNumber") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let majorKeyDerivationMode =
        EmvMajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      make ?initializationVector ?mode ~sessionDerivationData
        ~panSequenceNumber ~primaryAccountNumber ~majorKeyDerivationMode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let initializationVector =
        field_map json__ "InitializationVector"
          InitializationVectorType.of_json in
      let mode = field_map json__ "Mode" EmvEncryptionMode.of_json in
      let sessionDerivationData =
        field_map_exn json__ "SessionDerivationData"
          SessionDerivationDataType.of_json in
      let panSequenceNumber =
        field_map_exn json__ "PanSequenceNumber" NumberLengthEquals2.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          EmvMajorKeyDerivationMode.of_json in
      make ?initializationVector ?mode ~sessionDerivationData
        ~panSequenceNumber ~primaryAccountNumber ~majorKeyDerivationMode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Parameters for plaintext encryption using EMV keys."]
module AccessDeniedException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "You do not have sufficient access to perform this action."]
module InternalServerException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The request processing has failed because of an unknown error, exception, or failure."]
module ResourceNotFoundException =
  struct
    type nonrec t =
      {
      resourceId: String_.t option
        [@ocaml.doc "The resource that is missing."]}
    let make ?resourceId = fun () -> { resourceId }
    let to_value x =
      structure_to_value
        [("ResourceId", (Option.map x.resourceId ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let resourceId =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "ResourceId") in
      make ?resourceId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let resourceId = field_map json__ "ResourceId" String_.of_json in
      make ?resourceId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to an invalid resource error."]
module ThrottlingException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to request throttling."]
module ValidationException =
  struct
    type nonrec t =
      {
      message: String_.t option ;
      fieldList: ValidationExceptionFieldList.t option
        [@ocaml.doc
          "The request was denied due to an invalid request error."]}
    let make ?message = fun ?fieldList -> fun () -> { message; fieldList }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value));
        ("fieldList",
          (Option.map x.fieldList ~f:ValidationExceptionFieldList.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let fieldList =
        (Option.map ~f:ValidationExceptionFieldList.of_xml)
          (Xml.child xml_arg0 "fieldList") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?fieldList ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let fieldList =
        field_map json__ "fieldList" ValidationExceptionFieldList.of_json in
      let message = field_map json__ "message" String_.of_json in
      make ?fieldList ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to an invalid request error."]
module VerificationFailedException =
  struct
    type nonrec t =
      {
      reason: VerificationFailedReason.t option
        [@ocaml.doc "The reason for the exception."];
      message: String_.t option }
    let make ?reason = fun ?message -> fun () -> { reason; message }
    let to_value x =
      structure_to_value
        [("Reason",
           (Option.map x.reason ~f:VerificationFailedReason.to_value));
        ("Message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      let reason =
        (Option.map ~f:VerificationFailedReason.of_xml)
          (Xml.child xml_arg0 "Reason") in
      make ?message ?reason ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" String_.of_json in
      let reason = field_map json__ "Reason" VerificationFailedReason.of_json in
      make ?message ?reason ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "This request failed verification."]
module DukptAttributes =
  struct
    type nonrec t =
      {
      keySerialNumber: HexLength16Or20Or24.t
        [@ocaml.doc
          "The unique identifier known as Key Serial Number (KSN) that comes from an encrypting device using DUKPT encryption method. The KSN is derived from the encrypting device unique identifier and an internal transaction counter."];
      dukptDerivationType: DukptDerivationType.t
        [@ocaml.doc
          "The key type derived using DUKPT from a Base Derivation Key (BDK) and Key Serial Number (KSN). This must be less than or equal to the strength of the BDK. For example, you can't use AES_128 as a derivation type for a BDK of AES_128 or TDES_2KEY."]}
    let context_ = "DukptAttributes"
    let make ~keySerialNumber =
      fun ~dukptDerivationType ->
        fun () -> { keySerialNumber; dukptDerivationType }
    let to_value x =
      structure_to_value
        [("KeySerialNumber",
           (Some (HexLength16Or20Or24.to_value x.keySerialNumber)));
        ("DukptDerivationType",
          (Some (DukptDerivationType.to_value x.dukptDerivationType)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dukptDerivationType =
        DukptDerivationType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DukptDerivationType") in
      let keySerialNumber =
        HexLength16Or20Or24.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeySerialNumber") in
      make ~dukptDerivationType ~keySerialNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dukptDerivationType =
        field_map_exn json__ "DukptDerivationType"
          DukptDerivationType.of_json in
      let keySerialNumber =
        field_map_exn json__ "KeySerialNumber" HexLength16Or20Or24.of_json in
      make ~dukptDerivationType ~keySerialNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are used for Derived Unique Key Per Transaction (DUKPT) derivation algorithm."]
module IntegerRangeBetween4And12 =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:12) >>= (fun () -> check_int_min i ~min:4));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for IntegerRangeBetween4And12"
           xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module PinBlockFormatForPinData =
  struct
    type nonrec t =
      | ISO_FORMAT_0 
      | ISO_FORMAT_1 
      | ISO_FORMAT_3 
      | ISO_FORMAT_4 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | ISO_FORMAT_0 -> "ISO_FORMAT_0"
      | ISO_FORMAT_1 -> "ISO_FORMAT_1"
      | ISO_FORMAT_3 -> "ISO_FORMAT_3"
      | ISO_FORMAT_4 -> "ISO_FORMAT_4"
      | Non_static_id s -> s
    let of_string =
      function
      | "ISO_FORMAT_0" -> ISO_FORMAT_0
      | "ISO_FORMAT_1" -> ISO_FORMAT_1
      | "ISO_FORMAT_3" -> ISO_FORMAT_3
      | "ISO_FORMAT_4" -> ISO_FORMAT_4
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration PinBlockFormatForPinData" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"PinBlockFormatForPinData" j)
    let to_json = simple_to_json to_value
  end
module PinVerificationAttributes =
  struct
    type nonrec t =
      {
      visaPin: VisaPinVerification.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Visa PIN."];
      ibm3624Pin: Ibm3624PinVerification.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Ibm3624 PIN."]}
    let make ?visaPin = fun ?ibm3624Pin -> fun () -> { visaPin; ibm3624Pin }
    let to_value x =
      structure_to_value
        [("VisaPin", (Option.map x.visaPin ~f:VisaPinVerification.to_value));
        ("Ibm3624Pin",
          (Option.map x.ibm3624Pin ~f:Ibm3624PinVerification.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let ibm3624Pin =
        (Option.map ~f:Ibm3624PinVerification.of_xml)
          (Xml.child xml_arg0 "Ibm3624Pin") in
      let visaPin =
        (Option.map ~f:VisaPinVerification.of_xml)
          (Xml.child xml_arg0 "VisaPin") in
      make ?ibm3624Pin ?visaPin ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let ibm3624Pin =
        field_map json__ "Ibm3624Pin" Ibm3624PinVerification.of_json in
      let visaPin = field_map json__ "VisaPin" VisaPinVerification.of_json in
      make ?ibm3624Pin ?visaPin ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Parameters that are required for PIN data verification."]
module WrappedKey =
  struct
    type nonrec t =
      {
      wrappedKeyMaterial: WrappedKeyMaterial.t
        [@ocaml.doc
          "Parameter information of a WrappedKeyBlock for encryption key exchange."];
      keyCheckValueAlgorithm: KeyCheckValueAlgorithm.t option
        [@ocaml.doc
          "The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity. For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result."]}
    let context_ = "WrappedKey"
    let make ?keyCheckValueAlgorithm =
      fun ~wrappedKeyMaterial ->
        fun () -> { keyCheckValueAlgorithm; wrappedKeyMaterial }
    let to_value x =
      structure_to_value
        [("WrappedKeyMaterial",
           (Some (WrappedKeyMaterial.to_value x.wrappedKeyMaterial)));
        ("KeyCheckValueAlgorithm",
          (Option.map x.keyCheckValueAlgorithm
             ~f:KeyCheckValueAlgorithm.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let keyCheckValueAlgorithm =
        (Option.map ~f:KeyCheckValueAlgorithm.of_xml)
          (Xml.child xml_arg0 "KeyCheckValueAlgorithm") in
      let wrappedKeyMaterial =
        WrappedKeyMaterial.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "WrappedKeyMaterial") in
      make ?keyCheckValueAlgorithm ~wrappedKeyMaterial ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let keyCheckValueAlgorithm =
        field_map json__ "KeyCheckValueAlgorithm"
          KeyCheckValueAlgorithm.of_json in
      let wrappedKeyMaterial =
        field_map_exn json__ "WrappedKeyMaterial" WrappedKeyMaterial.of_json in
      make ?keyCheckValueAlgorithm ~wrappedKeyMaterial ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of a WrappedKeyBlock for encryption key exchange."]
module IntegerRangeBetween4And16 =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:16) >>= (fun () -> check_int_min i ~min:4));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for IntegerRangeBetween4And16"
           xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module MacAttributes =
  struct
    type nonrec t =
      {
      algorithm: MacAlgorithm.t option
        [@ocaml.doc
          "The encryption algorithm for MAC generation or verification."];
      emvMac: MacAlgorithmEmv.t option
        [@ocaml.doc
          "Parameters that are required for MAC generation or verification using EMV MAC algorithm."];
      dukptIso9797Algorithm1: MacAlgorithmDukpt.t option
        [@ocaml.doc
          "Parameters that are required for MAC generation or verification using DUKPT ISO 9797 algorithm1."];
      dukptIso9797Algorithm3: MacAlgorithmDukpt.t option
        [@ocaml.doc
          "Parameters that are required for MAC generation or verification using DUKPT ISO 9797 algorithm3."];
      dukptCmac: MacAlgorithmDukpt.t option
        [@ocaml.doc
          "Parameters that are required for MAC generation or verification using DUKPT CMAC algorithm."]}
    let make ?algorithm =
      fun ?emvMac ->
        fun ?dukptIso9797Algorithm1 ->
          fun ?dukptIso9797Algorithm3 ->
            fun ?dukptCmac ->
              fun () ->
                {
                  algorithm;
                  emvMac;
                  dukptIso9797Algorithm1;
                  dukptIso9797Algorithm3;
                  dukptCmac
                }
    let to_value x =
      structure_to_value
        [("Algorithm", (Option.map x.algorithm ~f:MacAlgorithm.to_value));
        ("EmvMac", (Option.map x.emvMac ~f:MacAlgorithmEmv.to_value));
        ("DukptIso9797Algorithm1",
          (Option.map x.dukptIso9797Algorithm1 ~f:MacAlgorithmDukpt.to_value));
        ("DukptIso9797Algorithm3",
          (Option.map x.dukptIso9797Algorithm3 ~f:MacAlgorithmDukpt.to_value));
        ("DukptCmac", (Option.map x.dukptCmac ~f:MacAlgorithmDukpt.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dukptCmac =
        (Option.map ~f:MacAlgorithmDukpt.of_xml)
          (Xml.child xml_arg0 "DukptCmac") in
      let dukptIso9797Algorithm3 =
        (Option.map ~f:MacAlgorithmDukpt.of_xml)
          (Xml.child xml_arg0 "DukptIso9797Algorithm3") in
      let dukptIso9797Algorithm1 =
        (Option.map ~f:MacAlgorithmDukpt.of_xml)
          (Xml.child xml_arg0 "DukptIso9797Algorithm1") in
      let emvMac =
        (Option.map ~f:MacAlgorithmEmv.of_xml) (Xml.child xml_arg0 "EmvMac") in
      let algorithm =
        (Option.map ~f:MacAlgorithm.of_xml) (Xml.child xml_arg0 "Algorithm") in
      make ?dukptCmac ?dukptIso9797Algorithm3 ?dukptIso9797Algorithm1 ?emvMac
        ?algorithm ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dukptCmac = field_map json__ "DukptCmac" MacAlgorithmDukpt.of_json in
      let dukptIso9797Algorithm3 =
        field_map json__ "DukptIso9797Algorithm3" MacAlgorithmDukpt.of_json in
      let dukptIso9797Algorithm1 =
        field_map json__ "DukptIso9797Algorithm1" MacAlgorithmDukpt.of_json in
      let emvMac = field_map json__ "EmvMac" MacAlgorithmEmv.of_json in
      let algorithm = field_map json__ "Algorithm" MacAlgorithm.of_json in
      make ?dukptCmac ?dukptIso9797Algorithm3 ?dukptIso9797Algorithm1 ?emvMac
        ?algorithm ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for DUKPT, HMAC, or EMV MAC generation or verification."]
module MacType =
  struct
    type nonrec t = string
    let context_ = "MacType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:128) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"MacType" j
    let to_json = simple_to_json to_value
  end
module MessageDataType =
  struct
    type nonrec t = string
    let context_ = "MessageDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:8192) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"MessageDataType" j
    let to_json = simple_to_json to_value
  end
module CardVerificationAttributes =
  struct
    type nonrec t =
      {
      amexCardSecurityCodeVersion1: AmexCardSecurityCodeVersion1.t option ;
      amexCardSecurityCodeVersion2: AmexCardSecurityCodeVersion2.t option
        [@ocaml.doc
          "Card data parameters that are required to verify a Card Security Code (CSC2) for an AMEX payment card."];
      cardVerificationValue1: CardVerificationValue1.t option
        [@ocaml.doc
          "Card data parameters that are required to verify Card Verification Value (CVV) for the payment card."];
      cardVerificationValue2: CardVerificationValue2.t option
        [@ocaml.doc
          "Card data parameters that are required to verify Card Verification Value (CVV2) for the payment card."];
      cardHolderVerificationValue: CardHolderVerificationValue.t option
        [@ocaml.doc
          "Card data parameters that are required to verify a cardholder verification value for the payment card."];
      dynamicCardVerificationCode: DynamicCardVerificationCode.t option
        [@ocaml.doc
          "Card data parameters that are required to verify CDynamic Card Verification Code (dCVC) for the payment card."];
      dynamicCardVerificationValue: DynamicCardVerificationValue.t option
        [@ocaml.doc
          "Card data parameters that are required to verify CDynamic Card Verification Value (dCVV) for the payment card."];
      discoverDynamicCardVerificationCode:
        DiscoverDynamicCardVerificationCode.t option
        [@ocaml.doc
          "Card data parameters that are required to verify CDynamic Card Verification Code (dCVC) for the payment card."]}
    let make ?amexCardSecurityCodeVersion1 =
      fun ?amexCardSecurityCodeVersion2 ->
        fun ?cardVerificationValue1 ->
          fun ?cardVerificationValue2 ->
            fun ?cardHolderVerificationValue ->
              fun ?dynamicCardVerificationCode ->
                fun ?dynamicCardVerificationValue ->
                  fun ?discoverDynamicCardVerificationCode ->
                    fun () ->
                      {
                        amexCardSecurityCodeVersion1;
                        amexCardSecurityCodeVersion2;
                        cardVerificationValue1;
                        cardVerificationValue2;
                        cardHolderVerificationValue;
                        dynamicCardVerificationCode;
                        dynamicCardVerificationValue;
                        discoverDynamicCardVerificationCode
                      }
    let to_value x =
      structure_to_value
        [("AmexCardSecurityCodeVersion1",
           (Option.map x.amexCardSecurityCodeVersion1
              ~f:AmexCardSecurityCodeVersion1.to_value));
        ("AmexCardSecurityCodeVersion2",
          (Option.map x.amexCardSecurityCodeVersion2
             ~f:AmexCardSecurityCodeVersion2.to_value));
        ("CardVerificationValue1",
          (Option.map x.cardVerificationValue1
             ~f:CardVerificationValue1.to_value));
        ("CardVerificationValue2",
          (Option.map x.cardVerificationValue2
             ~f:CardVerificationValue2.to_value));
        ("CardHolderVerificationValue",
          (Option.map x.cardHolderVerificationValue
             ~f:CardHolderVerificationValue.to_value));
        ("DynamicCardVerificationCode",
          (Option.map x.dynamicCardVerificationCode
             ~f:DynamicCardVerificationCode.to_value));
        ("DynamicCardVerificationValue",
          (Option.map x.dynamicCardVerificationValue
             ~f:DynamicCardVerificationValue.to_value));
        ("DiscoverDynamicCardVerificationCode",
          (Option.map x.discoverDynamicCardVerificationCode
             ~f:DiscoverDynamicCardVerificationCode.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let discoverDynamicCardVerificationCode =
        (Option.map ~f:DiscoverDynamicCardVerificationCode.of_xml)
          (Xml.child xml_arg0 "DiscoverDynamicCardVerificationCode") in
      let dynamicCardVerificationValue =
        (Option.map ~f:DynamicCardVerificationValue.of_xml)
          (Xml.child xml_arg0 "DynamicCardVerificationValue") in
      let dynamicCardVerificationCode =
        (Option.map ~f:DynamicCardVerificationCode.of_xml)
          (Xml.child xml_arg0 "DynamicCardVerificationCode") in
      let cardHolderVerificationValue =
        (Option.map ~f:CardHolderVerificationValue.of_xml)
          (Xml.child xml_arg0 "CardHolderVerificationValue") in
      let cardVerificationValue2 =
        (Option.map ~f:CardVerificationValue2.of_xml)
          (Xml.child xml_arg0 "CardVerificationValue2") in
      let cardVerificationValue1 =
        (Option.map ~f:CardVerificationValue1.of_xml)
          (Xml.child xml_arg0 "CardVerificationValue1") in
      let amexCardSecurityCodeVersion2 =
        (Option.map ~f:AmexCardSecurityCodeVersion2.of_xml)
          (Xml.child xml_arg0 "AmexCardSecurityCodeVersion2") in
      let amexCardSecurityCodeVersion1 =
        (Option.map ~f:AmexCardSecurityCodeVersion1.of_xml)
          (Xml.child xml_arg0 "AmexCardSecurityCodeVersion1") in
      make ?discoverDynamicCardVerificationCode ?dynamicCardVerificationValue
        ?dynamicCardVerificationCode ?cardHolderVerificationValue
        ?cardVerificationValue2 ?cardVerificationValue1
        ?amexCardSecurityCodeVersion2 ?amexCardSecurityCodeVersion1 ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let discoverDynamicCardVerificationCode =
        field_map json__ "DiscoverDynamicCardVerificationCode"
          DiscoverDynamicCardVerificationCode.of_json in
      let dynamicCardVerificationValue =
        field_map json__ "DynamicCardVerificationValue"
          DynamicCardVerificationValue.of_json in
      let dynamicCardVerificationCode =
        field_map json__ "DynamicCardVerificationCode"
          DynamicCardVerificationCode.of_json in
      let cardHolderVerificationValue =
        field_map json__ "CardHolderVerificationValue"
          CardHolderVerificationValue.of_json in
      let cardVerificationValue2 =
        field_map json__ "CardVerificationValue2"
          CardVerificationValue2.of_json in
      let cardVerificationValue1 =
        field_map json__ "CardVerificationValue1"
          CardVerificationValue1.of_json in
      let amexCardSecurityCodeVersion2 =
        field_map json__ "AmexCardSecurityCodeVersion2"
          AmexCardSecurityCodeVersion2.of_json in
      let amexCardSecurityCodeVersion1 =
        field_map json__ "AmexCardSecurityCodeVersion1"
          AmexCardSecurityCodeVersion1.of_json in
      make ?discoverDynamicCardVerificationCode ?dynamicCardVerificationValue
        ?dynamicCardVerificationCode ?cardHolderVerificationValue
        ?cardVerificationValue2 ?cardVerificationValue1
        ?amexCardSecurityCodeVersion2 ?amexCardSecurityCodeVersion1 ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are requried to verify Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2), or Card Security Codes (CSC)."]
module ValidationDataType =
  struct
    type nonrec t = string
    let context_ = "ValidationDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:3) >>=
             (fun () ->
                (check_string_max i ~max:5) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ValidationDataType" j
    let to_json = simple_to_json to_value
  end
module AuthResponseValueType =
  struct
    type nonrec t = string
    let context_ = "AuthResponseValueType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"AuthResponseValueType" j
    let to_json = simple_to_json to_value
  end
module AuthRequestCryptogramType =
  struct
    type nonrec t = string
    let context_ = "AuthRequestCryptogramType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"AuthRequestCryptogramType" j
    let to_json = simple_to_json to_value
  end
module CryptogramAuthResponse =
  struct
    type nonrec t =
      {
      arpcMethod1: CryptogramVerificationArpcMethod1.t option
        [@ocaml.doc
          "Parameters that are required for ARPC response generation using method1 after ARQC verification is successful."];
      arpcMethod2: CryptogramVerificationArpcMethod2.t option
        [@ocaml.doc
          "Parameters that are required for ARPC response generation using method2 after ARQC verification is successful."]}
    let make ?arpcMethod1 =
      fun ?arpcMethod2 -> fun () -> { arpcMethod1; arpcMethod2 }
    let to_value x =
      structure_to_value
        [("ArpcMethod1",
           (Option.map x.arpcMethod1
              ~f:CryptogramVerificationArpcMethod1.to_value));
        ("ArpcMethod2",
          (Option.map x.arpcMethod2
             ~f:CryptogramVerificationArpcMethod2.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let arpcMethod2 =
        (Option.map ~f:CryptogramVerificationArpcMethod2.of_xml)
          (Xml.child xml_arg0 "ArpcMethod2") in
      let arpcMethod1 =
        (Option.map ~f:CryptogramVerificationArpcMethod1.of_xml)
          (Xml.child xml_arg0 "ArpcMethod1") in
      make ?arpcMethod2 ?arpcMethod1 ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let arpcMethod2 =
        field_map json__ "ArpcMethod2"
          CryptogramVerificationArpcMethod2.of_json in
      let arpcMethod1 =
        field_map json__ "ArpcMethod1"
          CryptogramVerificationArpcMethod1.of_json in
      make ?arpcMethod2 ?arpcMethod1 ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for Authorization Response Cryptogram (ARPC) generation after Authorization Request Cryptogram (ARQC) verification is successful."]
module SessionKeyDerivation =
  struct
    type nonrec t =
      {
      emvCommon: SessionKeyEmvCommon.t option
        [@ocaml.doc
          "Parameters to derive session key for an Emv common payment card for ARQC verification."];
      mastercard: SessionKeyMastercard.t option
        [@ocaml.doc
          "Parameters to derive session key for a Mastercard payment card for ARQC verification."];
      emv2000: SessionKeyEmv2000.t option
        [@ocaml.doc
          "Parameters to derive session key for an Emv2000 payment card for ARQC verification."];
      amex: SessionKeyAmex.t option
        [@ocaml.doc
          "Parameters to derive session key for an Amex payment card for ARQC verification."];
      visa: SessionKeyVisa.t option
        [@ocaml.doc
          "Parameters to derive session key for a Visa payment cardfor ARQC verification."]}
    let make ?emvCommon =
      fun ?mastercard ->
        fun ?emv2000 ->
          fun ?amex ->
            fun ?visa ->
              fun () -> { emvCommon; mastercard; emv2000; amex; visa }
    let to_value x =
      structure_to_value
        [("EmvCommon",
           (Option.map x.emvCommon ~f:SessionKeyEmvCommon.to_value));
        ("Mastercard",
          (Option.map x.mastercard ~f:SessionKeyMastercard.to_value));
        ("Emv2000", (Option.map x.emv2000 ~f:SessionKeyEmv2000.to_value));
        ("Amex", (Option.map x.amex ~f:SessionKeyAmex.to_value));
        ("Visa", (Option.map x.visa ~f:SessionKeyVisa.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let visa =
        (Option.map ~f:SessionKeyVisa.of_xml) (Xml.child xml_arg0 "Visa") in
      let amex =
        (Option.map ~f:SessionKeyAmex.of_xml) (Xml.child xml_arg0 "Amex") in
      let emv2000 =
        (Option.map ~f:SessionKeyEmv2000.of_xml)
          (Xml.child xml_arg0 "Emv2000") in
      let mastercard =
        (Option.map ~f:SessionKeyMastercard.of_xml)
          (Xml.child xml_arg0 "Mastercard") in
      let emvCommon =
        (Option.map ~f:SessionKeyEmvCommon.of_xml)
          (Xml.child xml_arg0 "EmvCommon") in
      make ?visa ?amex ?emv2000 ?mastercard ?emvCommon ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let visa = field_map json__ "Visa" SessionKeyVisa.of_json in
      let amex = field_map json__ "Amex" SessionKeyAmex.of_json in
      let emv2000 = field_map json__ "Emv2000" SessionKeyEmv2000.of_json in
      let mastercard =
        field_map json__ "Mastercard" SessionKeyMastercard.of_json in
      let emvCommon =
        field_map json__ "EmvCommon" SessionKeyEmvCommon.of_json in
      make ?visa ?amex ?emv2000 ?mastercard ?emvCommon ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive a session key for Authorization Response Cryptogram (ARQC) verification."]
module TransactionDataType =
  struct
    type nonrec t = string
    let context_ = "TransactionDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:1024) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"TransactionDataType" j
    let to_json = simple_to_json to_value
  end
module As2805PekDerivationAttributes =
  struct
    type nonrec t =
      {
      systemTraceAuditNumber: SystemTraceAuditNumberType.t
        [@ocaml.doc "The system trace audit number for the transaction."];
      transactionAmount: TransactionAmountType.t
        [@ocaml.doc "The transaction amount for the transaction."]}
    let context_ = "As2805PekDerivationAttributes"
    let make ~systemTraceAuditNumber =
      fun ~transactionAmount ->
        fun () -> { systemTraceAuditNumber; transactionAmount }
    let to_value x =
      structure_to_value
        [("SystemTraceAuditNumber",
           (Some
              (SystemTraceAuditNumberType.to_value x.systemTraceAuditNumber)));
        ("TransactionAmount",
          (Some (TransactionAmountType.to_value x.transactionAmount)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let transactionAmount =
        TransactionAmountType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "TransactionAmount") in
      let systemTraceAuditNumber =
        SystemTraceAuditNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "SystemTraceAuditNumber") in
      make ~transactionAmount ~systemTraceAuditNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let transactionAmount =
        field_map_exn json__ "TransactionAmount"
          TransactionAmountType.of_json in
      let systemTraceAuditNumber =
        field_map_exn json__ "SystemTraceAuditNumber"
          SystemTraceAuditNumberType.of_json in
      make ~transactionAmount ~systemTraceAuditNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Parameter information to use a PEK derived using AS2805."]
module DukptDerivationAttributes =
  struct
    type nonrec t =
      {
      keySerialNumber: HexLength16Or20Or24.t
        [@ocaml.doc
          "The unique identifier known as Key Serial Number (KSN) that comes from an encrypting device using DUKPT encryption method. The KSN is derived from the encrypting device unique identifier and an internal transaction counter."];
      dukptKeyDerivationType: DukptDerivationType.t option
        [@ocaml.doc
          "The key type derived using DUKPT from a Base Derivation Key (BDK) and Key Serial Number (KSN). This must be less than or equal to the strength of the BDK. For example, you can't use AES_128 as a derivation type for a BDK of AES_128 or TDES_2KEY"];
      dukptKeyVariant: DukptKeyVariant.t option
        [@ocaml.doc
          "The type of use of DUKPT, which can be for incoming data decryption, outgoing data encryption, or both."]}
    let context_ = "DukptDerivationAttributes"
    let make ?dukptKeyDerivationType =
      fun ?dukptKeyVariant ->
        fun ~keySerialNumber ->
          fun () ->
            { dukptKeyDerivationType; dukptKeyVariant; keySerialNumber }
    let to_value x =
      structure_to_value
        [("KeySerialNumber",
           (Some (HexLength16Or20Or24.to_value x.keySerialNumber)));
        ("DukptKeyDerivationType",
          (Option.map x.dukptKeyDerivationType
             ~f:DukptDerivationType.to_value));
        ("DukptKeyVariant",
          (Option.map x.dukptKeyVariant ~f:DukptKeyVariant.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dukptKeyVariant =
        (Option.map ~f:DukptKeyVariant.of_xml)
          (Xml.child xml_arg0 "DukptKeyVariant") in
      let dukptKeyDerivationType =
        (Option.map ~f:DukptDerivationType.of_xml)
          (Xml.child xml_arg0 "DukptKeyDerivationType") in
      let keySerialNumber =
        HexLength16Or20Or24.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeySerialNumber") in
      make ?dukptKeyVariant ?dukptKeyDerivationType ~keySerialNumber ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dukptKeyVariant =
        field_map json__ "DukptKeyVariant" DukptKeyVariant.of_json in
      let dukptKeyDerivationType =
        field_map json__ "DukptKeyDerivationType" DukptDerivationType.of_json in
      let keySerialNumber =
        field_map_exn json__ "KeySerialNumber" HexLength16Or20Or24.of_json in
      make ?dukptKeyVariant ?dukptKeyDerivationType ~keySerialNumber ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters required for encryption or decryption of data using DUKPT."]
module HexEvenLengthBetween16And32 =
  struct
    type nonrec t = string
    let context_ = "HexEvenLengthBetween16And32"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:32) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HexEvenLengthBetween16And32" j
    let to_json = simple_to_json to_value
  end
module TranslationIsoFormats =
  struct
    type nonrec t =
      {
      isoFormat0: TranslationPinDataIsoFormat034.t option
        [@ocaml.doc
          "Parameters that are required for ISO9564 PIN format 0 translation."];
      isoFormat1: TranslationPinDataIsoFormat1.t option
        [@ocaml.doc
          "Parameters that are required for ISO9564 PIN format 1 translation."];
      isoFormat3: TranslationPinDataIsoFormat034.t option
        [@ocaml.doc
          "Parameters that are required for ISO9564 PIN format 3 translation."];
      isoFormat4: TranslationPinDataIsoFormat034.t option
        [@ocaml.doc
          "Parameters that are required for ISO9564 PIN format 4 translation."];
      as2805Format0: TranslationPinDataAs2805Format0.t option
        [@ocaml.doc
          "Parameters that are required for AS2805 PIN format 0 translation."]}
    let make ?isoFormat0 =
      fun ?isoFormat1 ->
        fun ?isoFormat3 ->
          fun ?isoFormat4 ->
            fun ?as2805Format0 ->
              fun () ->
                {
                  isoFormat0;
                  isoFormat1;
                  isoFormat3;
                  isoFormat4;
                  as2805Format0
                }
    let to_value x =
      structure_to_value
        [("IsoFormat0",
           (Option.map x.isoFormat0
              ~f:TranslationPinDataIsoFormat034.to_value));
        ("IsoFormat1",
          (Option.map x.isoFormat1 ~f:TranslationPinDataIsoFormat1.to_value));
        ("IsoFormat3",
          (Option.map x.isoFormat3 ~f:TranslationPinDataIsoFormat034.to_value));
        ("IsoFormat4",
          (Option.map x.isoFormat4 ~f:TranslationPinDataIsoFormat034.to_value));
        ("As2805Format0",
          (Option.map x.as2805Format0
             ~f:TranslationPinDataAs2805Format0.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let as2805Format0 =
        (Option.map ~f:TranslationPinDataAs2805Format0.of_xml)
          (Xml.child xml_arg0 "As2805Format0") in
      let isoFormat4 =
        (Option.map ~f:TranslationPinDataIsoFormat034.of_xml)
          (Xml.child xml_arg0 "IsoFormat4") in
      let isoFormat3 =
        (Option.map ~f:TranslationPinDataIsoFormat034.of_xml)
          (Xml.child xml_arg0 "IsoFormat3") in
      let isoFormat1 =
        (Option.map ~f:TranslationPinDataIsoFormat1.of_xml)
          (Xml.child xml_arg0 "IsoFormat1") in
      let isoFormat0 =
        (Option.map ~f:TranslationPinDataIsoFormat034.of_xml)
          (Xml.child xml_arg0 "IsoFormat0") in
      make ?as2805Format0 ?isoFormat4 ?isoFormat3 ?isoFormat1 ?isoFormat0 ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let as2805Format0 =
        field_map json__ "As2805Format0"
          TranslationPinDataAs2805Format0.of_json in
      let isoFormat4 =
        field_map json__ "IsoFormat4" TranslationPinDataIsoFormat034.of_json in
      let isoFormat3 =
        field_map json__ "IsoFormat3" TranslationPinDataIsoFormat034.of_json in
      let isoFormat1 =
        field_map json__ "IsoFormat1" TranslationPinDataIsoFormat1.of_json in
      let isoFormat0 =
        field_map json__ "IsoFormat0" TranslationPinDataIsoFormat034.of_json in
      make ?as2805Format0 ?isoFormat4 ?isoFormat3 ?isoFormat1 ?isoFormat0 ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required for translation between ISO9564 PIN block formats 0,1,3,4."]
module WrappedWorkingKey =
  struct
    type nonrec t =
      {
      wrappedKeyMaterial: KeyMaterial.t option
        [@ocaml.doc "The wrapped key block of the outgoing transaction key."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the key contained within the outgoing TR31WrappedKeyBlock. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. For more information on KCV, see KCV in the Amazon Web Services Payment Cryptography User Guide."];
      wrappedKeyMaterialFormat: WrappedKeyMaterialFormat.t option
        [@ocaml.doc "The key block format of the wrapped key."]}
    let make ?wrappedKeyMaterial =
      fun ?keyCheckValue ->
        fun ?wrappedKeyMaterialFormat ->
          fun () ->
            { wrappedKeyMaterial; keyCheckValue; wrappedKeyMaterialFormat }
    let to_value x =
      structure_to_value
        [("WrappedKeyMaterial",
           (Option.map x.wrappedKeyMaterial ~f:KeyMaterial.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("WrappedKeyMaterialFormat",
          (Option.map x.wrappedKeyMaterialFormat
             ~f:WrappedKeyMaterialFormat.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappedKeyMaterialFormat =
        (Option.map ~f:WrappedKeyMaterialFormat.of_xml)
          (Xml.child xml_arg0 "WrappedKeyMaterialFormat") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let wrappedKeyMaterial =
        (Option.map ~f:KeyMaterial.of_xml)
          (Xml.child xml_arg0 "WrappedKeyMaterial") in
      make ?wrappedKeyMaterialFormat ?keyCheckValue ?wrappedKeyMaterial ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappedKeyMaterialFormat =
        field_map json__ "WrappedKeyMaterialFormat"
          WrappedKeyMaterialFormat.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let wrappedKeyMaterial =
        field_map json__ "WrappedKeyMaterial" KeyMaterial.of_json in
      make ?wrappedKeyMaterialFormat ?keyCheckValue ?wrappedKeyMaterial ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The parameter information of the outgoing wrapped key block."]
module IncomingKeyMaterial =
  struct
    type nonrec t =
      {
      diffieHellmanTr31KeyBlock: IncomingDiffieHellmanTr31KeyBlock.t option
        [@ocaml.doc
          "Parameter information of the TR31WrappedKeyBlock containing the transaction key wrapped using an ECDH dervied key."]}
    let make ?diffieHellmanTr31KeyBlock =
      fun () -> { diffieHellmanTr31KeyBlock }
    let to_value x =
      structure_to_value
        [("DiffieHellmanTr31KeyBlock",
           (Option.map x.diffieHellmanTr31KeyBlock
              ~f:IncomingDiffieHellmanTr31KeyBlock.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let diffieHellmanTr31KeyBlock =
        (Option.map ~f:IncomingDiffieHellmanTr31KeyBlock.of_xml)
          (Xml.child xml_arg0 "DiffieHellmanTr31KeyBlock") in
      make ?diffieHellmanTr31KeyBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let diffieHellmanTr31KeyBlock =
        field_map json__ "DiffieHellmanTr31KeyBlock"
          IncomingDiffieHellmanTr31KeyBlock.of_json in
      make ?diffieHellmanTr31KeyBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of the incoming WrappedKeyBlock containing the transaction key."]
module OutgoingKeyMaterial =
  struct
    type nonrec t =
      {
      tr31KeyBlock: OutgoingTr31KeyBlock.t option
        [@ocaml.doc
          "Parameter information of the TR31WrappedKeyBlock containing the transaction key wrapped using a KEK."]}
    let make ?tr31KeyBlock = fun () -> { tr31KeyBlock }
    let to_value x =
      structure_to_value
        [("Tr31KeyBlock",
           (Option.map x.tr31KeyBlock ~f:OutgoingTr31KeyBlock.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let tr31KeyBlock =
        (Option.map ~f:OutgoingTr31KeyBlock.of_xml)
          (Xml.child xml_arg0 "Tr31KeyBlock") in
      make ?tr31KeyBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let tr31KeyBlock =
        field_map json__ "Tr31KeyBlock" OutgoingTr31KeyBlock.of_json in
      make ?tr31KeyBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information of the outgoing TR31WrappedKeyBlock containing the transaction key."]
module CipherTextType =
  struct
    type nonrec t = string
    let context_ = "CipherTextType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:4224) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"CipherTextType" j
    let to_json = simple_to_json to_value
  end
module ReEncryptionAttributes =
  struct
    type nonrec t =
      {
      symmetric: SymmetricEncryptionAttributes.t option
        [@ocaml.doc
          "Parameters that are required to encrypt data using symmetric keys."];
      dukpt: DukptEncryptionAttributes.t option }
    let make ?symmetric = fun ?dukpt -> fun () -> { symmetric; dukpt }
    let to_value x =
      structure_to_value
        [("Symmetric",
           (Option.map x.symmetric ~f:SymmetricEncryptionAttributes.to_value));
        ("Dukpt", (Option.map x.dukpt ~f:DukptEncryptionAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dukpt =
        (Option.map ~f:DukptEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Dukpt") in
      let symmetric =
        (Option.map ~f:SymmetricEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Symmetric") in
      make ?dukpt ?symmetric ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dukpt = field_map json__ "Dukpt" DukptEncryptionAttributes.of_json in
      let symmetric =
        field_map json__ "Symmetric" SymmetricEncryptionAttributes.of_json in
      make ?dukpt ?symmetric ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to perform reencryption operation."]
module PinData =
  struct
    type nonrec t =
      {
      pinOffset: PinOffsetType.t option [@ocaml.doc "The PIN offset value."];
      verificationValue: VerificationValueType.t option
        [@ocaml.doc
          "The unique data to identify a cardholder. In most cases, this is the same as cardholder's Primary Account Number (PAN). If a value is not provided, it defaults to PAN."]}
    let make ?pinOffset =
      fun ?verificationValue -> fun () -> { pinOffset; verificationValue }
    let to_value x =
      structure_to_value
        [("PinOffset", (Option.map x.pinOffset ~f:PinOffsetType.to_value));
        ("VerificationValue",
          (Option.map x.verificationValue ~f:VerificationValueType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let verificationValue =
        (Option.map ~f:VerificationValueType.of_xml)
          (Xml.child xml_arg0 "VerificationValue") in
      let pinOffset =
        (Option.map ~f:PinOffsetType.of_xml) (Xml.child xml_arg0 "PinOffset") in
      make ?verificationValue ?pinOffset ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let verificationValue =
        field_map json__ "VerificationValue" VerificationValueType.of_json in
      let pinOffset = field_map json__ "PinOffset" PinOffsetType.of_json in
      make ?verificationValue ?pinOffset ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to generate, translate, or verify PIN data."]
module PinGenerationAttributes =
  struct
    type nonrec t =
      {
      visaPin: VisaPin.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Visa PIN."];
      visaPinVerificationValue: VisaPinVerificationValue.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Visa PIN Verification Value (PVV)."];
      ibm3624PinOffset: Ibm3624PinOffset.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Ibm3624 PIN offset PIN."];
      ibm3624NaturalPin: Ibm3624NaturalPin.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Ibm3624 natural PIN."];
      ibm3624RandomPin: Ibm3624RandomPin.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Ibm3624 random PIN."];
      ibm3624PinFromOffset: Ibm3624PinFromOffset.t option
        [@ocaml.doc
          "Parameters that are required to generate or verify Ibm3624 PIN from offset PIN."]}
    let make ?visaPin =
      fun ?visaPinVerificationValue ->
        fun ?ibm3624PinOffset ->
          fun ?ibm3624NaturalPin ->
            fun ?ibm3624RandomPin ->
              fun ?ibm3624PinFromOffset ->
                fun () ->
                  {
                    visaPin;
                    visaPinVerificationValue;
                    ibm3624PinOffset;
                    ibm3624NaturalPin;
                    ibm3624RandomPin;
                    ibm3624PinFromOffset
                  }
    let to_value x =
      structure_to_value
        [("VisaPin", (Option.map x.visaPin ~f:VisaPin.to_value));
        ("VisaPinVerificationValue",
          (Option.map x.visaPinVerificationValue
             ~f:VisaPinVerificationValue.to_value));
        ("Ibm3624PinOffset",
          (Option.map x.ibm3624PinOffset ~f:Ibm3624PinOffset.to_value));
        ("Ibm3624NaturalPin",
          (Option.map x.ibm3624NaturalPin ~f:Ibm3624NaturalPin.to_value));
        ("Ibm3624RandomPin",
          (Option.map x.ibm3624RandomPin ~f:Ibm3624RandomPin.to_value));
        ("Ibm3624PinFromOffset",
          (Option.map x.ibm3624PinFromOffset ~f:Ibm3624PinFromOffset.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let ibm3624PinFromOffset =
        (Option.map ~f:Ibm3624PinFromOffset.of_xml)
          (Xml.child xml_arg0 "Ibm3624PinFromOffset") in
      let ibm3624RandomPin =
        (Option.map ~f:Ibm3624RandomPin.of_xml)
          (Xml.child xml_arg0 "Ibm3624RandomPin") in
      let ibm3624NaturalPin =
        (Option.map ~f:Ibm3624NaturalPin.of_xml)
          (Xml.child xml_arg0 "Ibm3624NaturalPin") in
      let ibm3624PinOffset =
        (Option.map ~f:Ibm3624PinOffset.of_xml)
          (Xml.child xml_arg0 "Ibm3624PinOffset") in
      let visaPinVerificationValue =
        (Option.map ~f:VisaPinVerificationValue.of_xml)
          (Xml.child xml_arg0 "VisaPinVerificationValue") in
      let visaPin =
        (Option.map ~f:VisaPin.of_xml) (Xml.child xml_arg0 "VisaPin") in
      make ?ibm3624PinFromOffset ?ibm3624RandomPin ?ibm3624NaturalPin
        ?ibm3624PinOffset ?visaPinVerificationValue ?visaPin ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let ibm3624PinFromOffset =
        field_map json__ "Ibm3624PinFromOffset" Ibm3624PinFromOffset.of_json in
      let ibm3624RandomPin =
        field_map json__ "Ibm3624RandomPin" Ibm3624RandomPin.of_json in
      let ibm3624NaturalPin =
        field_map json__ "Ibm3624NaturalPin" Ibm3624NaturalPin.of_json in
      let ibm3624PinOffset =
        field_map json__ "Ibm3624PinOffset" Ibm3624PinOffset.of_json in
      let visaPinVerificationValue =
        field_map json__ "VisaPinVerificationValue"
          VisaPinVerificationValue.of_json in
      let visaPin = field_map json__ "VisaPin" VisaPin.of_json in
      make ?ibm3624PinFromOffset ?ibm3624RandomPin ?ibm3624NaturalPin
        ?ibm3624PinOffset ?visaPinVerificationValue ?visaPin ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Parameters that are required for PIN data generation."]
module MacOutputType =
  struct
    type nonrec t = string
    let context_ = "MacOutputType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:128) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"MacOutputType" j
    let to_json = simple_to_json to_value
  end
module PinChangeMacOutputType =
  struct
    type nonrec t = string
    let context_ = "PinChangeMacOutputType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:8) >>=
             (fun () ->
                (check_string_max i ~max:16) >>=
                  (fun () -> check_pattern i ~pattern:"[0-9a-fA-F]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PinChangeMacOutputType" j
    let to_json = simple_to_json to_value
  end
module VisaAmexDerivationOutputs =
  struct
    type nonrec t =
      {
      authorizationRequestKeyArn: KeyArn.t option
        [@ocaml.doc
          "The keyArn of the issuer master key for cryptogram (IMK-AC) used by the operation."];
      authorizationRequestKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the issuer master key for cryptogram (IMK-AC) used by the operation."];
      currentPinPekArn: KeyArn.t option
        [@ocaml.doc "The keyArn of the current PIN PEK."];
      currentPinPekKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc "The key check value (KCV) of the current PIN PEK."]}
    let make ?authorizationRequestKeyArn =
      fun ?authorizationRequestKeyCheckValue ->
        fun ?currentPinPekArn ->
          fun ?currentPinPekKeyCheckValue ->
            fun () ->
              {
                authorizationRequestKeyArn;
                authorizationRequestKeyCheckValue;
                currentPinPekArn;
                currentPinPekKeyCheckValue
              }
    let to_value x =
      structure_to_value
        [("AuthorizationRequestKeyArn",
           (Option.map x.authorizationRequestKeyArn ~f:KeyArn.to_value));
        ("AuthorizationRequestKeyCheckValue",
          (Option.map x.authorizationRequestKeyCheckValue
             ~f:KeyCheckValue.to_value));
        ("CurrentPinPekArn",
          (Option.map x.currentPinPekArn ~f:KeyArn.to_value));
        ("CurrentPinPekKeyCheckValue",
          (Option.map x.currentPinPekKeyCheckValue ~f:KeyCheckValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let currentPinPekKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "CurrentPinPekKeyCheckValue") in
      let currentPinPekArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "CurrentPinPekArn") in
      let authorizationRequestKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "AuthorizationRequestKeyCheckValue") in
      let authorizationRequestKeyArn =
        (Option.map ~f:KeyArn.of_xml)
          (Xml.child xml_arg0 "AuthorizationRequestKeyArn") in
      make ?currentPinPekKeyCheckValue ?currentPinPekArn
        ?authorizationRequestKeyCheckValue ?authorizationRequestKeyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let currentPinPekKeyCheckValue =
        field_map json__ "CurrentPinPekKeyCheckValue" KeyCheckValue.of_json in
      let currentPinPekArn =
        field_map json__ "CurrentPinPekArn" KeyArn.of_json in
      let authorizationRequestKeyCheckValue =
        field_map json__ "AuthorizationRequestKeyCheckValue"
          KeyCheckValue.of_json in
      let authorizationRequestKeyArn =
        field_map json__ "AuthorizationRequestKeyArn" KeyArn.of_json in
      make ?currentPinPekKeyCheckValue ?currentPinPekArn
        ?authorizationRequestKeyCheckValue ?authorizationRequestKeyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The attributes values used for Amex and Visa derivation methods."]
module CommandMessageDataType =
  struct
    type nonrec t = string
    let context_ = "CommandMessageDataType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:16) >>=
             (fun () ->
                (check_string_max i ~max:1024) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"CommandMessageDataType" j
    let to_json = simple_to_json to_value
  end
module DerivationMethodAttributes =
  struct
    type nonrec t =
      {
      emvCommon: EmvCommonAttributes.t option
        [@ocaml.doc
          "Parameters to derive the confidentiality and integrity keys for a payment card using Emv common derivation method."];
      amex: AmexAttributes.t option
        [@ocaml.doc
          "Parameters to derive the confidentiality and integrity keys for a payment card using Amex derivation method."];
      visa: VisaAttributes.t option
        [@ocaml.doc
          "Parameters to derive the confidentiality and integrity keys for a a payment card using Visa derivation method."];
      emv2000: Emv2000Attributes.t option
        [@ocaml.doc
          "Parameters to derive the confidentiality and integrity keys for a payment card using Emv2000 derivation method."];
      mastercard: MasterCardAttributes.t option
        [@ocaml.doc
          "Parameters to derive the confidentiality and integrity keys for a payment card using Mastercard derivation method."]}
    let make ?emvCommon =
      fun ?amex ->
        fun ?visa ->
          fun ?emv2000 ->
            fun ?mastercard ->
              fun () -> { emvCommon; amex; visa; emv2000; mastercard }
    let to_value x =
      structure_to_value
        [("EmvCommon",
           (Option.map x.emvCommon ~f:EmvCommonAttributes.to_value));
        ("Amex", (Option.map x.amex ~f:AmexAttributes.to_value));
        ("Visa", (Option.map x.visa ~f:VisaAttributes.to_value));
        ("Emv2000", (Option.map x.emv2000 ~f:Emv2000Attributes.to_value));
        ("Mastercard",
          (Option.map x.mastercard ~f:MasterCardAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let mastercard =
        (Option.map ~f:MasterCardAttributes.of_xml)
          (Xml.child xml_arg0 "Mastercard") in
      let emv2000 =
        (Option.map ~f:Emv2000Attributes.of_xml)
          (Xml.child xml_arg0 "Emv2000") in
      let visa =
        (Option.map ~f:VisaAttributes.of_xml) (Xml.child xml_arg0 "Visa") in
      let amex =
        (Option.map ~f:AmexAttributes.of_xml) (Xml.child xml_arg0 "Amex") in
      let emvCommon =
        (Option.map ~f:EmvCommonAttributes.of_xml)
          (Xml.child xml_arg0 "EmvCommon") in
      make ?mastercard ?emv2000 ?visa ?amex ?emvCommon ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let mastercard =
        field_map json__ "Mastercard" MasterCardAttributes.of_json in
      let emv2000 = field_map json__ "Emv2000" Emv2000Attributes.of_json in
      let visa = field_map json__ "Visa" VisaAttributes.of_json in
      let amex = field_map json__ "Amex" AmexAttributes.of_json in
      let emvCommon =
        field_map json__ "EmvCommon" EmvCommonAttributes.of_json in
      make ?mastercard ?emv2000 ?visa ?amex ?emvCommon ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters to derive the payment card specific confidentiality and integrity keys."]
module PinBlockFormatForEmvPinChange =
  struct
    type nonrec t =
      | ISO_FORMAT_0 
      | ISO_FORMAT_1 
      | ISO_FORMAT_3 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | ISO_FORMAT_0 -> "ISO_FORMAT_0"
      | ISO_FORMAT_1 -> "ISO_FORMAT_1"
      | ISO_FORMAT_3 -> "ISO_FORMAT_3"
      | Non_static_id s -> s
    let of_string =
      function
      | "ISO_FORMAT_0" -> ISO_FORMAT_0
      | "ISO_FORMAT_1" -> ISO_FORMAT_1
      | "ISO_FORMAT_3" -> ISO_FORMAT_3
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration PinBlockFormatForEmvPinChange"
           xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"PinBlockFormatForEmvPinChange" j)
    let to_json = simple_to_json to_value
  end
module CardGenerationAttributes =
  struct
    type nonrec t =
      {
      amexCardSecurityCodeVersion1: AmexCardSecurityCodeVersion1.t option ;
      amexCardSecurityCodeVersion2: AmexCardSecurityCodeVersion2.t option
        [@ocaml.doc
          "Card data parameters that are required to generate a Card Security Code (CSC2) for an AMEX payment card."];
      cardVerificationValue1: CardVerificationValue1.t option
        [@ocaml.doc
          "Card data parameters that are required to generate Card Verification Value (CVV) for the payment card."];
      cardVerificationValue2: CardVerificationValue2.t option
        [@ocaml.doc
          "Card data parameters that are required to generate Card Verification Value (CVV2) for the payment card."];
      cardHolderVerificationValue: CardHolderVerificationValue.t option
        [@ocaml.doc
          "Card data parameters that are required to generate a cardholder verification value for the payment card."];
      dynamicCardVerificationCode: DynamicCardVerificationCode.t option
        [@ocaml.doc
          "Card data parameters that are required to generate CDynamic Card Verification Code (dCVC) for the payment card."];
      dynamicCardVerificationValue: DynamicCardVerificationValue.t option
        [@ocaml.doc
          "Card data parameters that are required to generate CDynamic Card Verification Value (dCVV) for the payment card."]}
    let make ?amexCardSecurityCodeVersion1 =
      fun ?amexCardSecurityCodeVersion2 ->
        fun ?cardVerificationValue1 ->
          fun ?cardVerificationValue2 ->
            fun ?cardHolderVerificationValue ->
              fun ?dynamicCardVerificationCode ->
                fun ?dynamicCardVerificationValue ->
                  fun () ->
                    {
                      amexCardSecurityCodeVersion1;
                      amexCardSecurityCodeVersion2;
                      cardVerificationValue1;
                      cardVerificationValue2;
                      cardHolderVerificationValue;
                      dynamicCardVerificationCode;
                      dynamicCardVerificationValue
                    }
    let to_value x =
      structure_to_value
        [("AmexCardSecurityCodeVersion1",
           (Option.map x.amexCardSecurityCodeVersion1
              ~f:AmexCardSecurityCodeVersion1.to_value));
        ("AmexCardSecurityCodeVersion2",
          (Option.map x.amexCardSecurityCodeVersion2
             ~f:AmexCardSecurityCodeVersion2.to_value));
        ("CardVerificationValue1",
          (Option.map x.cardVerificationValue1
             ~f:CardVerificationValue1.to_value));
        ("CardVerificationValue2",
          (Option.map x.cardVerificationValue2
             ~f:CardVerificationValue2.to_value));
        ("CardHolderVerificationValue",
          (Option.map x.cardHolderVerificationValue
             ~f:CardHolderVerificationValue.to_value));
        ("DynamicCardVerificationCode",
          (Option.map x.dynamicCardVerificationCode
             ~f:DynamicCardVerificationCode.to_value));
        ("DynamicCardVerificationValue",
          (Option.map x.dynamicCardVerificationValue
             ~f:DynamicCardVerificationValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dynamicCardVerificationValue =
        (Option.map ~f:DynamicCardVerificationValue.of_xml)
          (Xml.child xml_arg0 "DynamicCardVerificationValue") in
      let dynamicCardVerificationCode =
        (Option.map ~f:DynamicCardVerificationCode.of_xml)
          (Xml.child xml_arg0 "DynamicCardVerificationCode") in
      let cardHolderVerificationValue =
        (Option.map ~f:CardHolderVerificationValue.of_xml)
          (Xml.child xml_arg0 "CardHolderVerificationValue") in
      let cardVerificationValue2 =
        (Option.map ~f:CardVerificationValue2.of_xml)
          (Xml.child xml_arg0 "CardVerificationValue2") in
      let cardVerificationValue1 =
        (Option.map ~f:CardVerificationValue1.of_xml)
          (Xml.child xml_arg0 "CardVerificationValue1") in
      let amexCardSecurityCodeVersion2 =
        (Option.map ~f:AmexCardSecurityCodeVersion2.of_xml)
          (Xml.child xml_arg0 "AmexCardSecurityCodeVersion2") in
      let amexCardSecurityCodeVersion1 =
        (Option.map ~f:AmexCardSecurityCodeVersion1.of_xml)
          (Xml.child xml_arg0 "AmexCardSecurityCodeVersion1") in
      make ?dynamicCardVerificationValue ?dynamicCardVerificationCode
        ?cardHolderVerificationValue ?cardVerificationValue2
        ?cardVerificationValue1 ?amexCardSecurityCodeVersion2
        ?amexCardSecurityCodeVersion1 ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dynamicCardVerificationValue =
        field_map json__ "DynamicCardVerificationValue"
          DynamicCardVerificationValue.of_json in
      let dynamicCardVerificationCode =
        field_map json__ "DynamicCardVerificationCode"
          DynamicCardVerificationCode.of_json in
      let cardHolderVerificationValue =
        field_map json__ "CardHolderVerificationValue"
          CardHolderVerificationValue.of_json in
      let cardVerificationValue2 =
        field_map json__ "CardVerificationValue2"
          CardVerificationValue2.of_json in
      let cardVerificationValue1 =
        field_map json__ "CardVerificationValue1"
          CardVerificationValue1.of_json in
      let amexCardSecurityCodeVersion2 =
        field_map json__ "AmexCardSecurityCodeVersion2"
          AmexCardSecurityCodeVersion2.of_json in
      let amexCardSecurityCodeVersion1 =
        field_map json__ "AmexCardSecurityCodeVersion1"
          AmexCardSecurityCodeVersion1.of_json in
      make ?dynamicCardVerificationValue ?dynamicCardVerificationCode
        ?cardHolderVerificationValue ?cardVerificationValue2
        ?cardVerificationValue1 ?amexCardSecurityCodeVersion2
        ?amexCardSecurityCodeVersion1 ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Card data parameters that are required to generate Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2), or Card Security Codes (CSC)."]
module IntegerRangeBetween3And5Type =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:5) >>= (fun () -> check_int_min i ~min:3));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for IntegerRangeBetween3And5Type"
           xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module As2805KekValidationType =
  struct
    type nonrec t =
      {
      kekValidationRequest: KekValidationRequest.t option
        [@ocaml.doc
          "Parameter information for generating a KEK validation request during node-to-node initialization."];
      kekValidationResponse: KekValidationResponse.t option
        [@ocaml.doc
          "Parameter information for generating a KEK validation response during node-to-node initialization."]}
    let make ?kekValidationRequest =
      fun ?kekValidationResponse ->
        fun () -> { kekValidationRequest; kekValidationResponse }
    let to_value x =
      structure_to_value
        [("KekValidationRequest",
           (Option.map x.kekValidationRequest
              ~f:KekValidationRequest.to_value));
        ("KekValidationResponse",
          (Option.map x.kekValidationResponse
             ~f:KekValidationResponse.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let kekValidationResponse =
        (Option.map ~f:KekValidationResponse.of_xml)
          (Xml.child xml_arg0 "KekValidationResponse") in
      let kekValidationRequest =
        (Option.map ~f:KekValidationRequest.of_xml)
          (Xml.child xml_arg0 "KekValidationRequest") in
      make ?kekValidationResponse ?kekValidationRequest ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let kekValidationResponse =
        field_map json__ "KekValidationResponse"
          KekValidationResponse.of_json in
      let kekValidationRequest =
        field_map json__ "KekValidationRequest" KekValidationRequest.of_json in
      make ?kekValidationResponse ?kekValidationRequest ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameter information for generating a random key for KEK validation to perform node-to-node initialization."]
module RandomKeySendVariantMask =
  struct
    type nonrec t =
      | VARIANT_MASK_82C0 
      | VARIANT_MASK_82 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | VARIANT_MASK_82C0 -> "VARIANT_MASK_82C0"
      | VARIANT_MASK_82 -> "VARIANT_MASK_82"
      | Non_static_id s -> s
    let of_string =
      function
      | "VARIANT_MASK_82C0" -> VARIANT_MASK_82C0
      | "VARIANT_MASK_82" -> VARIANT_MASK_82
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string
        (string_of_xml ~kind:"enumeration RandomKeySendVariantMask" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"RandomKeySendVariantMask" j)
    let to_json = simple_to_json to_value
  end
module EncryptionDecryptionAttributes =
  struct
    type nonrec t =
      {
      symmetric: SymmetricEncryptionAttributes.t option
        [@ocaml.doc
          "Parameters that are required to perform encryption and decryption using symmetric keys."];
      asymmetric: AsymmetricEncryptionAttributes.t option ;
      dukpt: DukptEncryptionAttributes.t option ;
      emv: EmvEncryptionAttributes.t option
        [@ocaml.doc "Parameters for plaintext encryption using EMV keys."]}
    let make ?symmetric =
      fun ?asymmetric ->
        fun ?dukpt ->
          fun ?emv -> fun () -> { symmetric; asymmetric; dukpt; emv }
    let to_value x =
      structure_to_value
        [("Symmetric",
           (Option.map x.symmetric ~f:SymmetricEncryptionAttributes.to_value));
        ("Asymmetric",
          (Option.map x.asymmetric ~f:AsymmetricEncryptionAttributes.to_value));
        ("Dukpt", (Option.map x.dukpt ~f:DukptEncryptionAttributes.to_value));
        ("Emv", (Option.map x.emv ~f:EmvEncryptionAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let emv =
        (Option.map ~f:EmvEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Emv") in
      let dukpt =
        (Option.map ~f:DukptEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Dukpt") in
      let asymmetric =
        (Option.map ~f:AsymmetricEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Asymmetric") in
      let symmetric =
        (Option.map ~f:SymmetricEncryptionAttributes.of_xml)
          (Xml.child xml_arg0 "Symmetric") in
      make ?emv ?dukpt ?asymmetric ?symmetric ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let emv = field_map json__ "Emv" EmvEncryptionAttributes.of_json in
      let dukpt = field_map json__ "Dukpt" DukptEncryptionAttributes.of_json in
      let asymmetric =
        field_map json__ "Asymmetric" AsymmetricEncryptionAttributes.of_json in
      let symmetric =
        field_map json__ "Symmetric" SymmetricEncryptionAttributes.of_json in
      make ?emv ?dukpt ?asymmetric ?symmetric ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Parameters that are required to perform encryption and decryption operations."]
module PlainTextType =
  struct
    type nonrec t = string
    let context_ = "PlainTextType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:4096) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PlainTextType" j
    let to_json = simple_to_json to_value
  end
module PlainTextOutputType =
  struct
    type nonrec t = string
    let context_ = "PlainTextOutputType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:4224) >>=
                  (fun () ->
                     check_pattern i ~pattern:"(?:[0-9a-fA-F][0-9a-fA-F])+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"PlainTextOutputType" j
    let to_json = simple_to_json to_value
  end
module VerifyPinDataOutput =
  struct
    type nonrec t =
      {
      verificationKeyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the PIN encryption key that Amazon Web Services Payment Cryptography uses for PIN or PIN Offset verification."];
      verificationKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      encryptionKeyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation."];
      encryptionKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `VerificationFailedException of VerificationFailedException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?verificationKeyArn =
      fun ?verificationKeyCheckValue ->
        fun ?encryptionKeyArn ->
          fun ?encryptionKeyCheckValue ->
            fun () ->
              {
                verificationKeyArn;
                verificationKeyCheckValue;
                encryptionKeyArn;
                encryptionKeyCheckValue
              }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `VerificationFailedException e ->
          `Assoc
            [("error", (`String "VerificationFailedException"));
            ("details", (VerificationFailedException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("VerificationKeyArn",
           (Option.map x.verificationKeyArn ~f:KeyArn.to_value));
        ("VerificationKeyCheckValue",
          (Option.map x.verificationKeyCheckValue ~f:KeyCheckValue.to_value));
        ("EncryptionKeyArn",
          (Option.map x.encryptionKeyArn ~f:KeyArn.to_value));
        ("EncryptionKeyCheckValue",
          (Option.map x.encryptionKeyCheckValue ~f:KeyCheckValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let encryptionKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "EncryptionKeyCheckValue") in
      let encryptionKeyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "EncryptionKeyArn") in
      let verificationKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "VerificationKeyCheckValue") in
      let verificationKeyArn =
        (Option.map ~f:KeyArn.of_xml)
          (Xml.child xml_arg0 "VerificationKeyArn") in
      make ?encryptionKeyCheckValue ?encryptionKeyArn
        ?verificationKeyCheckValue ?verificationKeyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let encryptionKeyCheckValue =
        field_map json__ "EncryptionKeyCheckValue" KeyCheckValue.of_json in
      let encryptionKeyArn =
        field_map json__ "EncryptionKeyArn" KeyArn.of_json in
      let verificationKeyCheckValue =
        field_map json__ "VerificationKeyCheckValue" KeyCheckValue.of_json in
      let verificationKeyArn =
        field_map json__ "VerificationKeyArn" KeyArn.of_json in
      make ?encryptionKeyCheckValue ?encryptionKeyArn
        ?verificationKeyCheckValue ?verificationKeyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies pin-related data such as PIN and PIN Offset using algorithms including VISA PVV and IBM3624. For more information, see Verify PIN data in the Amazon Web Services Payment Cryptography User Guide. This operation verifies PIN data for user payment card. A card holder PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation uses PIN Verification Key (PVK) for PIN or PIN Offset generation and then encrypts it using PIN Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GeneratePinData TranslatePinData"]
module VerifyPinDataInput =
  struct
    type nonrec t =
      {
      verificationKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc "The keyARN of the PIN verification key."];
      encryptionKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key under which the PIN block data is encrypted. This key type can be PEK or BDK."];
      verificationAttributes: PinVerificationAttributes.t
        [@ocaml.doc "The attributes and values for PIN data verification."];
      encryptedPinBlock: EncryptedPinBlockType.t
        [@ocaml.doc
          "The encrypted PIN block data that Amazon Web Services Payment Cryptography verifies."];
      primaryAccountNumber: PrimaryAccountNumberType.t option
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder."];
      pinBlockFormat: PinBlockFormatForPinData.t
        [@ocaml.doc
          "The PIN encoding format for pin data generation as specified in ISO 9564. Amazon Web Services Payment Cryptography supports ISO_Format_0 and ISO_Format_3. The ISO_Format_0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats. It is similar to a VISA-4 PIN block format. It supports a PIN from 4 to 12 digits in length. The ISO_Format_3 PIN block format is the same as ISO_Format_0 except that the fill digits are random values from 10 to 15."];
      pinDataLength: IntegerRangeBetween4And12.t option
        [@ocaml.doc "The length of PIN being verified."];
      dukptAttributes: DukptAttributes.t option
        [@ocaml.doc
          "The attributes and values for the DUKPT encrypted PIN block data."];
      encryptionWrappedKey: WrappedKey.t option }
    let context_ = "VerifyPinDataInput"
    let make ?primaryAccountNumber =
      fun ?pinDataLength ->
        fun ?dukptAttributes ->
          fun ?encryptionWrappedKey ->
            fun ~verificationKeyIdentifier ->
              fun ~encryptionKeyIdentifier ->
                fun ~verificationAttributes ->
                  fun ~encryptedPinBlock ->
                    fun ~pinBlockFormat ->
                      fun () ->
                        {
                          primaryAccountNumber;
                          pinDataLength;
                          dukptAttributes;
                          encryptionWrappedKey;
                          verificationKeyIdentifier;
                          encryptionKeyIdentifier;
                          verificationAttributes;
                          encryptedPinBlock;
                          pinBlockFormat
                        }
    let to_value x =
      structure_to_value
        [("VerificationKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.verificationKeyIdentifier)));
        ("EncryptionKeyIdentifier",
          (Some (KeyArnOrKeyAliasType.to_value x.encryptionKeyIdentifier)));
        ("VerificationAttributes",
          (Some (PinVerificationAttributes.to_value x.verificationAttributes)));
        ("EncryptedPinBlock",
          (Some (EncryptedPinBlockType.to_value x.encryptedPinBlock)));
        ("PrimaryAccountNumber",
          (Option.map x.primaryAccountNumber
             ~f:PrimaryAccountNumberType.to_value));
        ("PinBlockFormat",
          (Some (PinBlockFormatForPinData.to_value x.pinBlockFormat)));
        ("PinDataLength",
          (Option.map x.pinDataLength ~f:IntegerRangeBetween4And12.to_value));
        ("DukptAttributes",
          (Option.map x.dukptAttributes ~f:DukptAttributes.to_value));
        ("EncryptionWrappedKey",
          (Option.map x.encryptionWrappedKey ~f:WrappedKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let encryptionWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "EncryptionWrappedKey") in
      let dukptAttributes =
        (Option.map ~f:DukptAttributes.of_xml)
          (Xml.child xml_arg0 "DukptAttributes") in
      let pinDataLength =
        (Option.map ~f:IntegerRangeBetween4And12.of_xml)
          (Xml.child xml_arg0 "PinDataLength") in
      let pinBlockFormat =
        PinBlockFormatForPinData.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinBlockFormat") in
      let primaryAccountNumber =
        (Option.map ~f:PrimaryAccountNumberType.of_xml)
          (Xml.child xml_arg0 "PrimaryAccountNumber") in
      let encryptedPinBlock =
        EncryptedPinBlockType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptedPinBlock") in
      let verificationAttributes =
        PinVerificationAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "VerificationAttributes") in
      let encryptionKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptionKeyIdentifier") in
      let verificationKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "VerificationKeyIdentifier") in
      make ?encryptionWrappedKey ?dukptAttributes ?pinDataLength
        ~pinBlockFormat ?primaryAccountNumber ~encryptedPinBlock
        ~verificationAttributes ~encryptionKeyIdentifier
        ~verificationKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let encryptionWrappedKey =
        field_map json__ "EncryptionWrappedKey" WrappedKey.of_json in
      let dukptAttributes =
        field_map json__ "DukptAttributes" DukptAttributes.of_json in
      let pinDataLength =
        field_map json__ "PinDataLength" IntegerRangeBetween4And12.of_json in
      let pinBlockFormat =
        field_map_exn json__ "PinBlockFormat"
          PinBlockFormatForPinData.of_json in
      let primaryAccountNumber =
        field_map json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let encryptedPinBlock =
        field_map_exn json__ "EncryptedPinBlock"
          EncryptedPinBlockType.of_json in
      let verificationAttributes =
        field_map_exn json__ "VerificationAttributes"
          PinVerificationAttributes.of_json in
      let encryptionKeyIdentifier =
        field_map_exn json__ "EncryptionKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let verificationKeyIdentifier =
        field_map_exn json__ "VerificationKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ?encryptionWrappedKey ?dukptAttributes ?pinDataLength
        ~pinBlockFormat ?primaryAccountNumber ~encryptedPinBlock
        ~verificationAttributes ~encryptionKeyIdentifier
        ~verificationKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies pin-related data such as PIN and PIN Offset using algorithms including VISA PVV and IBM3624. For more information, see Verify PIN data in the Amazon Web Services Payment Cryptography User Guide. This operation verifies PIN data for user payment card. A card holder PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation uses PIN Verification Key (PVK) for PIN or PIN Offset generation and then encrypts it using PIN Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GeneratePinData TranslatePinData"]
module VerifyMacOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for MAC verification."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `VerificationFailedException of VerificationFailedException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue -> fun () -> { keyArn; keyCheckValue }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `VerificationFailedException e ->
          `Assoc
            [("error", (`String "VerificationFailedException"));
            ("details", (VerificationFailedException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies a Message Authentication Code (MAC). You can use this operation to verify MAC for message data authentication such as . In this operation, you must use the same message data, secret encryption key and MAC algorithm that was used to generate MAC. You can use this operation to verify a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateMac"]
module VerifyMacInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses to verify MAC data."];
      messageData: MessageDataType.t
        [@ocaml.doc
          "The data on for which MAC is under verification. This value must be hexBinary."];
      mac: MacType.t [@ocaml.doc "The MAC being verified."];
      verificationAttributes: MacAttributes.t
        [@ocaml.doc
          "The attributes and data values to use for MAC verification within Amazon Web Services Payment Cryptography."];
      macLength: IntegerRangeBetween4And16.t option
        [@ocaml.doc "The length of the MAC."]}
    let context_ = "VerifyMacInput"
    let make ?macLength =
      fun ~keyIdentifier ->
        fun ~messageData ->
          fun ~mac ->
            fun ~verificationAttributes ->
              fun () ->
                {
                  macLength;
                  keyIdentifier;
                  messageData;
                  mac;
                  verificationAttributes
                }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("MessageData", (Some (MessageDataType.to_value x.messageData)));
        ("Mac", (Some (MacType.to_value x.mac)));
        ("VerificationAttributes",
          (Some (MacAttributes.to_value x.verificationAttributes)));
        ("MacLength",
          (Option.map x.macLength ~f:IntegerRangeBetween4And16.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let macLength =
        (Option.map ~f:IntegerRangeBetween4And16.of_xml)
          (Xml.child xml_arg0 "MacLength") in
      let verificationAttributes =
        MacAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "VerificationAttributes") in
      let mac =
        MacType.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Mac") in
      let messageData =
        MessageDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MessageData") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?macLength ~verificationAttributes ~mac ~messageData
        ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let macLength =
        field_map json__ "MacLength" IntegerRangeBetween4And16.of_json in
      let verificationAttributes =
        field_map_exn json__ "VerificationAttributes" MacAttributes.of_json in
      let mac = field_map_exn json__ "Mac" MacType.of_json in
      let messageData =
        field_map_exn json__ "MessageData" MessageDataType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?macLength ~verificationAttributes ~mac ~messageData
        ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies a Message Authentication Code (MAC). You can use this operation to verify MAC for message data authentication such as . In this operation, you must use the same message data, secret encryption key and MAC algorithm that was used to generate MAC. You can use this operation to verify a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateMac"]
module VerifyCardValidationDataOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to verify CVV or CSC."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `VerificationFailedException of VerificationFailedException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue -> fun () -> { keyArn; keyCheckValue }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `VerificationFailedException e ->
          `Assoc
            [("error", (`String "VerificationFailedException"));
            ("details", (VerificationFailedException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies card-related validation data using algorithms such as Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2) and Card Security Codes (CSC). For more information, see Verify card data in the Amazon Web Services Payment Cryptography User Guide. This operation validates the CVV or CSC codes that is printed on a payment credit or debit card during card payment transaction. The input values are typically provided as part of an inbound transaction to an issuer or supporting platform partner. Amazon Web Services Payment Cryptography uses CVV or CSC, PAN (Primary Account Number) and expiration date of the card to check its validity during transaction processing. In this operation, the CVK (Card Verification Key) encryption key for use with card data verification is same as the one in used for GenerateCardValidationData. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateCardValidationData VerifyAuthRequestCryptogram VerifyPinData"]
module VerifyCardValidationDataInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to verify card data."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder."];
      verificationAttributes: CardVerificationAttributes.t
        [@ocaml.doc
          "The algorithm to use for verification of card data within Amazon Web Services Payment Cryptography."];
      validationData: ValidationDataType.t
        [@ocaml.doc
          "The CVV or CSC value for use for card data verification within Amazon Web Services Payment Cryptography."]}
    let context_ = "VerifyCardValidationDataInput"
    let make ~keyIdentifier =
      fun ~primaryAccountNumber ->
        fun ~verificationAttributes ->
          fun ~validationData ->
            fun () ->
              {
                keyIdentifier;
                primaryAccountNumber;
                verificationAttributes;
                validationData
              }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("VerificationAttributes",
          (Some
             (CardVerificationAttributes.to_value x.verificationAttributes)));
        ("ValidationData",
          (Some (ValidationDataType.to_value x.validationData)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let validationData =
        ValidationDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ValidationData") in
      let verificationAttributes =
        CardVerificationAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "VerificationAttributes") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ~validationData ~verificationAttributes ~primaryAccountNumber
        ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let validationData =
        field_map_exn json__ "ValidationData" ValidationDataType.of_json in
      let verificationAttributes =
        field_map_exn json__ "VerificationAttributes"
          CardVerificationAttributes.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ~validationData ~verificationAttributes ~primaryAccountNumber
        ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies card-related validation data using algorithms such as Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2) and Card Security Codes (CSC). For more information, see Verify card data in the Amazon Web Services Payment Cryptography User Guide. This operation validates the CVV or CSC codes that is printed on a payment credit or debit card during card payment transaction. The input values are typically provided as part of an inbound transaction to an issuer or supporting platform partner. Amazon Web Services Payment Cryptography uses CVV or CSC, PAN (Primary Account Number) and expiration date of the card to check its validity during transaction processing. In this operation, the CVK (Card Verification Key) encryption key for use with card data verification is same as the one in used for GenerateCardValidationData. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateCardValidationData VerifyAuthRequestCryptogram VerifyPinData"]
module VerifyAuthRequestCryptogramOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the major encryption key that Amazon Web Services Payment Cryptography uses for ARQC verification."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      authResponseValue: AuthResponseValueType.t option
        [@ocaml.doc
          "The result for ARQC verification or ARPC generation within Amazon Web Services Payment Cryptography."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `VerificationFailedException of VerificationFailedException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?authResponseValue ->
          fun () -> { keyArn; keyCheckValue; authResponseValue }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | "VerificationFailedException" ->
          `VerificationFailedException
            (VerificationFailedException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `VerificationFailedException e ->
          `Assoc
            [("error", (`String "VerificationFailedException"));
            ("details", (VerificationFailedException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("AuthResponseValue",
          (Option.map x.authResponseValue ~f:AuthResponseValueType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let authResponseValue =
        (Option.map ~f:AuthResponseValueType.of_xml)
          (Xml.child xml_arg0 "AuthResponseValue") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?authResponseValue ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let authResponseValue =
        field_map json__ "AuthResponseValue" AuthResponseValueType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?authResponseValue ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies Authorization Request Cryptogram (ARQC) for a EMV chip payment card authorization. For more information, see Verify auth request cryptogram in the Amazon Web Services Payment Cryptography User Guide. ARQC generation is done outside of Amazon Web Services Payment Cryptography and is typically generated on a point of sale terminal for an EMV chip card to obtain payment authorization during transaction time. For ARQC verification, you must first import the ARQC generated outside of Amazon Web Services Payment Cryptography by calling ImportKey. This operation uses the imported ARQC and an major encryption key (DUKPT) created by calling CreateKey to either provide a boolean ARQC verification result or provide an APRC (Authorization Response Cryptogram) response using Method 1 or Method 2. The ARPC_METHOD_1 uses AuthResponseCode to generate ARPC and ARPC_METHOD_2 uses CardStatusUpdate to generate ARPC. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: VerifyCardValidationData VerifyPinData"]
module VerifyAuthRequestCryptogramInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the major encryption key that Amazon Web Services Payment Cryptography uses for ARQC verification."];
      transactionData: TransactionDataType.t
        [@ocaml.doc
          "The transaction data that Amazon Web Services Payment Cryptography uses for ARQC verification. The same transaction is used for ARQC generation outside of Amazon Web Services Payment Cryptography."];
      authRequestCryptogram: AuthRequestCryptogramType.t
        [@ocaml.doc
          "The auth request cryptogram imported into Amazon Web Services Payment Cryptography for ARQC verification using a major encryption key and transaction data."];
      majorKeyDerivationMode: MajorKeyDerivationMode.t
        [@ocaml.doc
          "The method to use when deriving the major encryption key for ARQC verification within Amazon Web Services Payment Cryptography. The same key derivation mode was used for ARQC generation outside of Amazon Web Services Payment Cryptography."];
      sessionKeyDerivationAttributes: SessionKeyDerivation.t
        [@ocaml.doc
          "The attributes and values to use for deriving a session key for ARQC verification within Amazon Web Services Payment Cryptography. The same attributes were used for ARQC generation outside of Amazon Web Services Payment Cryptography."];
      authResponseAttributes: CryptogramAuthResponse.t option
        [@ocaml.doc
          "The attributes and values for auth request cryptogram verification. These parameters are required in case using ARPC Method 1 or Method 2 for ARQC verification."]}
    let context_ = "VerifyAuthRequestCryptogramInput"
    let make ?authResponseAttributes =
      fun ~keyIdentifier ->
        fun ~transactionData ->
          fun ~authRequestCryptogram ->
            fun ~majorKeyDerivationMode ->
              fun ~sessionKeyDerivationAttributes ->
                fun () ->
                  {
                    authResponseAttributes;
                    keyIdentifier;
                    transactionData;
                    authRequestCryptogram;
                    majorKeyDerivationMode;
                    sessionKeyDerivationAttributes
                  }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("TransactionData",
          (Some (TransactionDataType.to_value x.transactionData)));
        ("AuthRequestCryptogram",
          (Some (AuthRequestCryptogramType.to_value x.authRequestCryptogram)));
        ("MajorKeyDerivationMode",
          (Some (MajorKeyDerivationMode.to_value x.majorKeyDerivationMode)));
        ("SessionKeyDerivationAttributes",
          (Some
             (SessionKeyDerivation.to_value x.sessionKeyDerivationAttributes)));
        ("AuthResponseAttributes",
          (Option.map x.authResponseAttributes
             ~f:CryptogramAuthResponse.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let authResponseAttributes =
        (Option.map ~f:CryptogramAuthResponse.of_xml)
          (Xml.child xml_arg0 "AuthResponseAttributes") in
      let sessionKeyDerivationAttributes =
        SessionKeyDerivation.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "SessionKeyDerivationAttributes") in
      let majorKeyDerivationMode =
        MajorKeyDerivationMode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MajorKeyDerivationMode") in
      let authRequestCryptogram =
        AuthRequestCryptogramType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "AuthRequestCryptogram") in
      let transactionData =
        TransactionDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "TransactionData") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?authResponseAttributes ~sessionKeyDerivationAttributes
        ~majorKeyDerivationMode ~authRequestCryptogram ~transactionData
        ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let authResponseAttributes =
        field_map json__ "AuthResponseAttributes"
          CryptogramAuthResponse.of_json in
      let sessionKeyDerivationAttributes =
        field_map_exn json__ "SessionKeyDerivationAttributes"
          SessionKeyDerivation.of_json in
      let majorKeyDerivationMode =
        field_map_exn json__ "MajorKeyDerivationMode"
          MajorKeyDerivationMode.of_json in
      let authRequestCryptogram =
        field_map_exn json__ "AuthRequestCryptogram"
          AuthRequestCryptogramType.of_json in
      let transactionData =
        field_map_exn json__ "TransactionData" TransactionDataType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?authResponseAttributes ~sessionKeyDerivationAttributes
        ~majorKeyDerivationMode ~authRequestCryptogram ~transactionData
        ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Verifies Authorization Request Cryptogram (ARQC) for a EMV chip payment card authorization. For more information, see Verify auth request cryptogram in the Amazon Web Services Payment Cryptography User Guide. ARQC generation is done outside of Amazon Web Services Payment Cryptography and is typically generated on a point of sale terminal for an EMV chip card to obtain payment authorization during transaction time. For ARQC verification, you must first import the ARQC generated outside of Amazon Web Services Payment Cryptography by calling ImportKey. This operation uses the imported ARQC and an major encryption key (DUKPT) created by calling CreateKey to either provide a boolean ARQC verification result or provide an APRC (Authorization Response Cryptogram) response using Method 1 or Method 2. The ARPC_METHOD_1 uses AuthResponseCode to generate ARPC and ARPC_METHOD_2 uses CardStatusUpdate to generate ARPC. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: VerifyCardValidationData VerifyPinData"]
module TranslatePinDataOutput =
  struct
    type nonrec t =
      {
      pinBlock: EncryptedPinBlockType.t option
        [@ocaml.doc
          "The outgoing encrypted PIN block data after translation."];
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses to encrypt outgoing PIN block data after translation."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?pinBlock =
      fun ?keyArn ->
        fun ?keyCheckValue -> fun () -> { pinBlock; keyArn; keyCheckValue }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("PinBlock",
           (Option.map x.pinBlock ~f:EncryptedPinBlockType.to_value));
        ("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      let pinBlock =
        (Option.map ~f:EncryptedPinBlockType.of_xml)
          (Xml.child xml_arg0 "PinBlock") in
      make ?keyCheckValue ?keyArn ?pinBlock ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      let pinBlock =
        field_map json__ "PinBlock" EncryptedPinBlockType.of_json in
      make ?keyCheckValue ?keyArn ?pinBlock ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see Translate PIN data in the Amazon Web Services Payment Cryptography User Guide. PIN block translation involves changing a PIN block from one encryption key to another and optionally change its format. PIN block translation occurs entirely within the HSM boundary and PIN data never enters or leaves Amazon Web Services Payment Cryptography in clear text. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK. Amazon Web Services Payment Cryptography also supports use of dynamic keys and ECDH (Elliptic Curve Diffie-Hellman) based key exchange for this operation. Dynamic keys allow you to pass a PEK as a TR-31 WrappedKeyBlock. They can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block, which is translated to a PEK encrypted PIN block for use within the service. You can also use ECDH for reveal PIN, wherein the service translates the PIN block from PEK to a ECDH derived encryption key. For more information on establishing ECDH derived keys, see the Creating keys in the Amazon Web Services Payment Cryptography User Guide. The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Amazon Web Services Payment Cryptography currently supports ISO PIN block 4 translation for PIN block built using legacy PAN length. That is, PAN is the right most 12 digits excluding the check digits. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GeneratePinData VerifyPinData"]
module TranslatePinDataInput =
  struct
    type nonrec t =
      {
      incomingKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key under which incoming PIN block data is encrypted. This key type can be PEK or BDK. For dynamic keys, it is the keyARN of KEK of the TR-31 wrapped PEK. For ECDH, it is the keyARN of the asymmetric ECC key."];
      outgoingKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK. For ECDH, it is the keyARN of the asymmetric ECC key."];
      incomingTranslationAttributes: TranslationIsoFormats.t
        [@ocaml.doc
          "The format of the incoming PIN block data for translation within Amazon Web Services Payment Cryptography."];
      outgoingTranslationAttributes: TranslationIsoFormats.t
        [@ocaml.doc
          "The format of the outgoing PIN block data after translation by Amazon Web Services Payment Cryptography."];
      encryptedPinBlock: HexEvenLengthBetween16And32.t
        [@ocaml.doc
          "The encrypted PIN block data that Amazon Web Services Payment Cryptography translates."];
      incomingDukptAttributes: DukptDerivationAttributes.t option
        [@ocaml.doc
          "The attributes and values to use for incoming DUKPT encryption key for PIN block translation."];
      outgoingDukptAttributes: DukptDerivationAttributes.t option
        [@ocaml.doc
          "The attributes and values to use for outgoing DUKPT encryption key after PIN block translation."];
      incomingWrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key under which incoming PIN block data is encrypted."];
      outgoingWrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key for encrypting outgoing PIN block data."];
      incomingAs2805Attributes: As2805PekDerivationAttributes.t option
        [@ocaml.doc
          "The attributes and values to use for incoming AS2805 encryption key for PIN block translation."]}
    let context_ = "TranslatePinDataInput"
    let make ?incomingDukptAttributes =
      fun ?outgoingDukptAttributes ->
        fun ?incomingWrappedKey ->
          fun ?outgoingWrappedKey ->
            fun ?incomingAs2805Attributes ->
              fun ~incomingKeyIdentifier ->
                fun ~outgoingKeyIdentifier ->
                  fun ~incomingTranslationAttributes ->
                    fun ~outgoingTranslationAttributes ->
                      fun ~encryptedPinBlock ->
                        fun () ->
                          {
                            incomingDukptAttributes;
                            outgoingDukptAttributes;
                            incomingWrappedKey;
                            outgoingWrappedKey;
                            incomingAs2805Attributes;
                            incomingKeyIdentifier;
                            outgoingKeyIdentifier;
                            incomingTranslationAttributes;
                            outgoingTranslationAttributes;
                            encryptedPinBlock
                          }
    let to_value x =
      structure_to_value
        [("IncomingKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.incomingKeyIdentifier)));
        ("OutgoingKeyIdentifier",
          (Some (KeyArnOrKeyAliasType.to_value x.outgoingKeyIdentifier)));
        ("IncomingTranslationAttributes",
          (Some
             (TranslationIsoFormats.to_value x.incomingTranslationAttributes)));
        ("OutgoingTranslationAttributes",
          (Some
             (TranslationIsoFormats.to_value x.outgoingTranslationAttributes)));
        ("EncryptedPinBlock",
          (Some (HexEvenLengthBetween16And32.to_value x.encryptedPinBlock)));
        ("IncomingDukptAttributes",
          (Option.map x.incomingDukptAttributes
             ~f:DukptDerivationAttributes.to_value));
        ("OutgoingDukptAttributes",
          (Option.map x.outgoingDukptAttributes
             ~f:DukptDerivationAttributes.to_value));
        ("IncomingWrappedKey",
          (Option.map x.incomingWrappedKey ~f:WrappedKey.to_value));
        ("OutgoingWrappedKey",
          (Option.map x.outgoingWrappedKey ~f:WrappedKey.to_value));
        ("IncomingAs2805Attributes",
          (Option.map x.incomingAs2805Attributes
             ~f:As2805PekDerivationAttributes.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let incomingAs2805Attributes =
        (Option.map ~f:As2805PekDerivationAttributes.of_xml)
          (Xml.child xml_arg0 "IncomingAs2805Attributes") in
      let outgoingWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "OutgoingWrappedKey") in
      let incomingWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "IncomingWrappedKey") in
      let outgoingDukptAttributes =
        (Option.map ~f:DukptDerivationAttributes.of_xml)
          (Xml.child xml_arg0 "OutgoingDukptAttributes") in
      let incomingDukptAttributes =
        (Option.map ~f:DukptDerivationAttributes.of_xml)
          (Xml.child xml_arg0 "IncomingDukptAttributes") in
      let encryptedPinBlock =
        HexEvenLengthBetween16And32.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptedPinBlock") in
      let outgoingTranslationAttributes =
        TranslationIsoFormats.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "OutgoingTranslationAttributes") in
      let incomingTranslationAttributes =
        TranslationIsoFormats.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "IncomingTranslationAttributes") in
      let outgoingKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "OutgoingKeyIdentifier") in
      let incomingKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "IncomingKeyIdentifier") in
      make ?incomingAs2805Attributes ?outgoingWrappedKey ?incomingWrappedKey
        ?outgoingDukptAttributes ?incomingDukptAttributes ~encryptedPinBlock
        ~outgoingTranslationAttributes ~incomingTranslationAttributes
        ~outgoingKeyIdentifier ~incomingKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let incomingAs2805Attributes =
        field_map json__ "IncomingAs2805Attributes"
          As2805PekDerivationAttributes.of_json in
      let outgoingWrappedKey =
        field_map json__ "OutgoingWrappedKey" WrappedKey.of_json in
      let incomingWrappedKey =
        field_map json__ "IncomingWrappedKey" WrappedKey.of_json in
      let outgoingDukptAttributes =
        field_map json__ "OutgoingDukptAttributes"
          DukptDerivationAttributes.of_json in
      let incomingDukptAttributes =
        field_map json__ "IncomingDukptAttributes"
          DukptDerivationAttributes.of_json in
      let encryptedPinBlock =
        field_map_exn json__ "EncryptedPinBlock"
          HexEvenLengthBetween16And32.of_json in
      let outgoingTranslationAttributes =
        field_map_exn json__ "OutgoingTranslationAttributes"
          TranslationIsoFormats.of_json in
      let incomingTranslationAttributes =
        field_map_exn json__ "IncomingTranslationAttributes"
          TranslationIsoFormats.of_json in
      let outgoingKeyIdentifier =
        field_map_exn json__ "OutgoingKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let incomingKeyIdentifier =
        field_map_exn json__ "IncomingKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ?incomingAs2805Attributes ?outgoingWrappedKey ?incomingWrappedKey
        ?outgoingDukptAttributes ?incomingDukptAttributes ~encryptedPinBlock
        ~outgoingTranslationAttributes ~incomingTranslationAttributes
        ~outgoingKeyIdentifier ~incomingKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see Translate PIN data in the Amazon Web Services Payment Cryptography User Guide. PIN block translation involves changing a PIN block from one encryption key to another and optionally change its format. PIN block translation occurs entirely within the HSM boundary and PIN data never enters or leaves Amazon Web Services Payment Cryptography in clear text. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK. Amazon Web Services Payment Cryptography also supports use of dynamic keys and ECDH (Elliptic Curve Diffie-Hellman) based key exchange for this operation. Dynamic keys allow you to pass a PEK as a TR-31 WrappedKeyBlock. They can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block, which is translated to a PEK encrypted PIN block for use within the service. You can also use ECDH for reveal PIN, wherein the service translates the PIN block from PEK to a ECDH derived encryption key. For more information on establishing ECDH derived keys, see the Creating keys in the Amazon Web Services Payment Cryptography User Guide. The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Amazon Web Services Payment Cryptography currently supports ISO PIN block 4 translation for PIN block built using legacy PAN length. That is, PAN is the right most 12 digits excluding the check digits. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GeneratePinData VerifyPinData"]
module TranslateKeyMaterialOutput =
  struct
    type nonrec t =
      {
      wrappedKey: WrappedWorkingKey.t option
        [@ocaml.doc "The outgoing KEK wrapped TR31WrappedKeyBlock."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?wrappedKey = fun () -> { wrappedKey }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("WrappedKey",
           (Option.map x.wrappedKey ~f:WrappedWorkingKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappedKey =
        (Option.map ~f:WrappedWorkingKey.of_xml)
          (Xml.child xml_arg0 "WrappedKey") in
      make ?wrappedKey ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappedKey =
        field_map json__ "WrappedKey" WrappedWorkingKey.of_json in
      make ?wrappedKey ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Translates an cryptographic key between different wrapping keys without importing the key into Amazon Web Services Payment Cryptography. This operation can be used when key material is frequently rotated, such as during every card transaction, and there is a need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. It translates short-lived transaction keys such as PEK generated for each transaction and wrapped with an ECDH derived wrapping key to another KEK wrapping key. Before using this operation, you must first request the public key certificate of the ECC key pair generated within Amazon Web Services Payment Cryptography to establish an ECDH key agreement. In TranslateKeyData, the service uses its own ECC key pair, public certificate of receiving ECC key pair, and the key derivation parameters to generate a derived key. The service uses this derived key to unwrap the incoming transaction key received as a TR31WrappedKeyBlock and re-wrap using a user provided KEK to generate an outgoing Tr31WrappedKeyBlock. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: CreateKey GetPublicCertificate ImportKey"]
module TranslateKeyMaterialInput =
  struct
    type nonrec t =
      {
      incomingKeyMaterial: IncomingKeyMaterial.t
        [@ocaml.doc
          "Parameter information of the TR31WrappedKeyBlock containing the transaction key."];
      outgoingKeyMaterial: OutgoingKeyMaterial.t
        [@ocaml.doc
          "Parameter information of the wrapping key used to wrap the transaction key in the outgoing TR31WrappedKeyBlock."];
      keyCheckValueAlgorithm: KeyCheckValueAlgorithm.t option
        [@ocaml.doc
          "The key check value (KCV) algorithm used for calculating the KCV of the derived key."]}
    let context_ = "TranslateKeyMaterialInput"
    let make ?keyCheckValueAlgorithm =
      fun ~incomingKeyMaterial ->
        fun ~outgoingKeyMaterial ->
          fun () ->
            {
              keyCheckValueAlgorithm;
              incomingKeyMaterial;
              outgoingKeyMaterial
            }
    let to_value x =
      structure_to_value
        [("IncomingKeyMaterial",
           (Some (IncomingKeyMaterial.to_value x.incomingKeyMaterial)));
        ("OutgoingKeyMaterial",
          (Some (OutgoingKeyMaterial.to_value x.outgoingKeyMaterial)));
        ("KeyCheckValueAlgorithm",
          (Option.map x.keyCheckValueAlgorithm
             ~f:KeyCheckValueAlgorithm.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let keyCheckValueAlgorithm =
        (Option.map ~f:KeyCheckValueAlgorithm.of_xml)
          (Xml.child xml_arg0 "KeyCheckValueAlgorithm") in
      let outgoingKeyMaterial =
        OutgoingKeyMaterial.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "OutgoingKeyMaterial") in
      let incomingKeyMaterial =
        IncomingKeyMaterial.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "IncomingKeyMaterial") in
      make ?keyCheckValueAlgorithm ~outgoingKeyMaterial ~incomingKeyMaterial
        ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let keyCheckValueAlgorithm =
        field_map json__ "KeyCheckValueAlgorithm"
          KeyCheckValueAlgorithm.of_json in
      let outgoingKeyMaterial =
        field_map_exn json__ "OutgoingKeyMaterial"
          OutgoingKeyMaterial.of_json in
      let incomingKeyMaterial =
        field_map_exn json__ "IncomingKeyMaterial"
          IncomingKeyMaterial.of_json in
      make ?keyCheckValueAlgorithm ~outgoingKeyMaterial ~incomingKeyMaterial
        ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Translates an cryptographic key between different wrapping keys without importing the key into Amazon Web Services Payment Cryptography. This operation can be used when key material is frequently rotated, such as during every card transaction, and there is a need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. It translates short-lived transaction keys such as PEK generated for each transaction and wrapped with an ECDH derived wrapping key to another KEK wrapping key. Before using this operation, you must first request the public key certificate of the ECC key pair generated within Amazon Web Services Payment Cryptography to establish an ECDH key agreement. In TranslateKeyData, the service uses its own ECC key pair, public certificate of receiving ECC key pair, and the key derivation parameters to generate a derived key. The service uses this derived key to unwrap the incoming transaction key received as a TR31WrappedKeyBlock and re-wrap using a user provided KEK to generate an outgoing Tr31WrappedKeyBlock. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: CreateKey GetPublicCertificate ImportKey"]
module ReEncryptDataOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN (Amazon Resource Name) of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      cipherText: CipherTextType.t option
        [@ocaml.doc "The encrypted ciphertext."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?cipherText -> fun () -> { keyArn; keyCheckValue; cipherText }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("CipherText", (Option.map x.cipherText ~f:CipherTextType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let cipherText =
        (Option.map ~f:CipherTextType.of_xml)
          (Xml.child xml_arg0 "CipherText") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?cipherText ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let cipherText = field_map json__ "CipherText" CipherTextType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?cipherText ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Re-encrypt ciphertext using DUKPT or Symmetric data encryption keys. You can either generate an encryption key within Amazon Web Services Payment Cryptography by calling CreateKey or import your own encryption key by calling ImportKey. The KeyArn for use with this operation must be in a compatible key state with KeyModesOfUse set to Encrypt. This operation also supports dynamic keys, allowing you to pass a dynamic encryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To re-encrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped encryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT encryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. To encrypt using DUKPT, a DUKPT key must already exist within your account with KeyModesOfUse set to DeriveKey or a new DUKPT can be generated by calling CreateKey. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: DecryptData EncryptData GetPublicCertificate ImportKey"]
module ReEncryptDataInput =
  struct
    type nonrec t =
      {
      incomingKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key of incoming ciphertext data. When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation."];
      outgoingKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography."];
      cipherText: CipherTextType.t
        [@ocaml.doc
          "Ciphertext to be encrypted. The minimum allowed length is 16 bytes and maximum allowed length is 4096 bytes."];
      incomingEncryptionAttributes: ReEncryptionAttributes.t
        [@ocaml.doc "The attributes and values for incoming ciphertext."];
      outgoingEncryptionAttributes: ReEncryptionAttributes.t
        [@ocaml.doc
          "The attributes and values for outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography."];
      incomingWrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key of incoming ciphertext data."];
      outgoingWrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography."]}
    let context_ = "ReEncryptDataInput"
    let make ?incomingWrappedKey =
      fun ?outgoingWrappedKey ->
        fun ~incomingKeyIdentifier ->
          fun ~outgoingKeyIdentifier ->
            fun ~cipherText ->
              fun ~incomingEncryptionAttributes ->
                fun ~outgoingEncryptionAttributes ->
                  fun () ->
                    {
                      incomingWrappedKey;
                      outgoingWrappedKey;
                      incomingKeyIdentifier;
                      outgoingKeyIdentifier;
                      cipherText;
                      incomingEncryptionAttributes;
                      outgoingEncryptionAttributes
                    }
    let to_value x =
      structure_to_value
        [("IncomingKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.incomingKeyIdentifier)));
        ("OutgoingKeyIdentifier",
          (Some (KeyArnOrKeyAliasType.to_value x.outgoingKeyIdentifier)));
        ("CipherText", (Some (CipherTextType.to_value x.cipherText)));
        ("IncomingEncryptionAttributes",
          (Some
             (ReEncryptionAttributes.to_value x.incomingEncryptionAttributes)));
        ("OutgoingEncryptionAttributes",
          (Some
             (ReEncryptionAttributes.to_value x.outgoingEncryptionAttributes)));
        ("IncomingWrappedKey",
          (Option.map x.incomingWrappedKey ~f:WrappedKey.to_value));
        ("OutgoingWrappedKey",
          (Option.map x.outgoingWrappedKey ~f:WrappedKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let outgoingWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "OutgoingWrappedKey") in
      let incomingWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "IncomingWrappedKey") in
      let outgoingEncryptionAttributes =
        ReEncryptionAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "OutgoingEncryptionAttributes") in
      let incomingEncryptionAttributes =
        ReEncryptionAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "IncomingEncryptionAttributes") in
      let cipherText =
        CipherTextType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CipherText") in
      let outgoingKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "OutgoingKeyIdentifier") in
      let incomingKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "IncomingKeyIdentifier") in
      make ?outgoingWrappedKey ?incomingWrappedKey
        ~outgoingEncryptionAttributes ~incomingEncryptionAttributes
        ~cipherText ~outgoingKeyIdentifier ~incomingKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let outgoingWrappedKey =
        field_map json__ "OutgoingWrappedKey" WrappedKey.of_json in
      let incomingWrappedKey =
        field_map json__ "IncomingWrappedKey" WrappedKey.of_json in
      let outgoingEncryptionAttributes =
        field_map_exn json__ "OutgoingEncryptionAttributes"
          ReEncryptionAttributes.of_json in
      let incomingEncryptionAttributes =
        field_map_exn json__ "IncomingEncryptionAttributes"
          ReEncryptionAttributes.of_json in
      let cipherText =
        field_map_exn json__ "CipherText" CipherTextType.of_json in
      let outgoingKeyIdentifier =
        field_map_exn json__ "OutgoingKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let incomingKeyIdentifier =
        field_map_exn json__ "IncomingKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ?outgoingWrappedKey ?incomingWrappedKey
        ~outgoingEncryptionAttributes ~incomingEncryptionAttributes
        ~cipherText ~outgoingKeyIdentifier ~incomingKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Re-encrypt ciphertext using DUKPT or Symmetric data encryption keys. You can either generate an encryption key within Amazon Web Services Payment Cryptography by calling CreateKey or import your own encryption key by calling ImportKey. The KeyArn for use with this operation must be in a compatible key state with KeyModesOfUse set to Encrypt. This operation also supports dynamic keys, allowing you to pass a dynamic encryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To re-encrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped encryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT encryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. To encrypt using DUKPT, a DUKPT key must already exist within your account with KeyModesOfUse set to DeriveKey or a new DUKPT can be generated by calling CreateKey. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: DecryptData EncryptData GetPublicCertificate ImportKey"]
module GeneratePinDataOutput =
  struct
    type nonrec t =
      {
      generationKeyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the pin data generation key that Amazon Web Services Payment Cryptography uses for PIN, PVV or PIN Offset generation."];
      generationKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      encryptionKeyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation. For ECDH, it is the keyARN of the asymmetric ECC key."];
      encryptionKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      encryptedPinBlock: EncryptedPinBlockType.t option
        [@ocaml.doc
          "The PIN block encrypted under PEK from Amazon Web Services Payment Cryptography. The encrypted PIN block is a composite of PAN (Primary Account Number) and PIN (Personal Identification Number), generated in accordance with ISO 9564 standard."];
      pinData: PinData.t option
        [@ocaml.doc
          "The attributes and values Amazon Web Services Payment Cryptography uses for pin data generation."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?generationKeyArn =
      fun ?generationKeyCheckValue ->
        fun ?encryptionKeyArn ->
          fun ?encryptionKeyCheckValue ->
            fun ?encryptedPinBlock ->
              fun ?pinData ->
                fun () ->
                  {
                    generationKeyArn;
                    generationKeyCheckValue;
                    encryptionKeyArn;
                    encryptionKeyCheckValue;
                    encryptedPinBlock;
                    pinData
                  }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("GenerationKeyArn",
           (Option.map x.generationKeyArn ~f:KeyArn.to_value));
        ("GenerationKeyCheckValue",
          (Option.map x.generationKeyCheckValue ~f:KeyCheckValue.to_value));
        ("EncryptionKeyArn",
          (Option.map x.encryptionKeyArn ~f:KeyArn.to_value));
        ("EncryptionKeyCheckValue",
          (Option.map x.encryptionKeyCheckValue ~f:KeyCheckValue.to_value));
        ("EncryptedPinBlock",
          (Option.map x.encryptedPinBlock ~f:EncryptedPinBlockType.to_value));
        ("PinData", (Option.map x.pinData ~f:PinData.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let pinData =
        (Option.map ~f:PinData.of_xml) (Xml.child xml_arg0 "PinData") in
      let encryptedPinBlock =
        (Option.map ~f:EncryptedPinBlockType.of_xml)
          (Xml.child xml_arg0 "EncryptedPinBlock") in
      let encryptionKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "EncryptionKeyCheckValue") in
      let encryptionKeyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "EncryptionKeyArn") in
      let generationKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "GenerationKeyCheckValue") in
      let generationKeyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "GenerationKeyArn") in
      make ?pinData ?encryptedPinBlock ?encryptionKeyCheckValue
        ?encryptionKeyArn ?generationKeyCheckValue ?generationKeyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let pinData = field_map json__ "PinData" PinData.of_json in
      let encryptedPinBlock =
        field_map json__ "EncryptedPinBlock" EncryptedPinBlockType.of_json in
      let encryptionKeyCheckValue =
        field_map json__ "EncryptionKeyCheckValue" KeyCheckValue.of_json in
      let encryptionKeyArn =
        field_map json__ "EncryptionKeyArn" KeyArn.of_json in
      let generationKeyCheckValue =
        field_map json__ "GenerationKeyCheckValue" KeyCheckValue.of_json in
      let generationKeyArn =
        field_map json__ "GenerationKeyArn" KeyArn.of_json in
      make ?pinData ?encryptedPinBlock ?encryptionKeyCheckValue
        ?encryptionKeyArn ?generationKeyCheckValue ?generationKeyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates pin-related data such as PIN, PIN Verification Value (PVV), PIN Block, and PIN Offset during new card issuance or reissuance. For more information, see Generate PIN data in the Amazon Web Services Payment Cryptography User Guide. PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation generates PIN, PVV, or PIN Offset and then encrypts it using Pin Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. This operation uses a separate Pin Verification Key (PVK) for VISA PVV generation. Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block. You can also use it for reveal PIN, wherein the generated PIN block is protected by the ECDH derived key before transmission from Amazon Web Services Payment Cryptography. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateCardValidationData TranslatePinData VerifyPinData"]
module GeneratePinDataInput =
  struct
    type nonrec t =
      {
      generationKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for pin data generation."];
      encryptionKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block. For ECDH, it is the keyARN of the asymmetric ECC key."];
      generationAttributes: PinGenerationAttributes.t
        [@ocaml.doc
          "The attributes and values to use for PIN, PVV, or PIN Offset generation."];
      pinDataLength: IntegerRangeBetween4And12.t option
        [@ocaml.doc "The length of PIN under generation."];
      primaryAccountNumber: PrimaryAccountNumberType.t option
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder."];
      pinBlockFormat: PinBlockFormatForPinData.t
        [@ocaml.doc
          "The PIN encoding format for pin data generation as specified in ISO 9564. Amazon Web Services Payment Cryptography supports ISO_Format_0, ISO_Format_3 and ISO_Format_4. The ISO_Format_0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats. It is similar to a VISA-4 PIN block format. It supports a PIN from 4 to 12 digits in length. The ISO_Format_3 PIN block format is the same as ISO_Format_0 except that the fill digits are random values from 10 to 15. The ISO_Format_4 PIN block format is the only one supporting AES encryption."];
      encryptionWrappedKey: WrappedKey.t option }
    let context_ = "GeneratePinDataInput"
    let make ?pinDataLength =
      fun ?primaryAccountNumber ->
        fun ?encryptionWrappedKey ->
          fun ~generationKeyIdentifier ->
            fun ~encryptionKeyIdentifier ->
              fun ~generationAttributes ->
                fun ~pinBlockFormat ->
                  fun () ->
                    {
                      pinDataLength;
                      primaryAccountNumber;
                      encryptionWrappedKey;
                      generationKeyIdentifier;
                      encryptionKeyIdentifier;
                      generationAttributes;
                      pinBlockFormat
                    }
    let to_value x =
      structure_to_value
        [("GenerationKeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.generationKeyIdentifier)));
        ("EncryptionKeyIdentifier",
          (Some (KeyArnOrKeyAliasType.to_value x.encryptionKeyIdentifier)));
        ("GenerationAttributes",
          (Some (PinGenerationAttributes.to_value x.generationAttributes)));
        ("PinDataLength",
          (Option.map x.pinDataLength ~f:IntegerRangeBetween4And12.to_value));
        ("PrimaryAccountNumber",
          (Option.map x.primaryAccountNumber
             ~f:PrimaryAccountNumberType.to_value));
        ("PinBlockFormat",
          (Some (PinBlockFormatForPinData.to_value x.pinBlockFormat)));
        ("EncryptionWrappedKey",
          (Option.map x.encryptionWrappedKey ~f:WrappedKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let encryptionWrappedKey =
        (Option.map ~f:WrappedKey.of_xml)
          (Xml.child xml_arg0 "EncryptionWrappedKey") in
      let pinBlockFormat =
        PinBlockFormatForPinData.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinBlockFormat") in
      let primaryAccountNumber =
        (Option.map ~f:PrimaryAccountNumberType.of_xml)
          (Xml.child xml_arg0 "PrimaryAccountNumber") in
      let pinDataLength =
        (Option.map ~f:IntegerRangeBetween4And12.of_xml)
          (Xml.child xml_arg0 "PinDataLength") in
      let generationAttributes =
        PinGenerationAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "GenerationAttributes") in
      let encryptionKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptionKeyIdentifier") in
      let generationKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "GenerationKeyIdentifier") in
      make ?encryptionWrappedKey ~pinBlockFormat ?primaryAccountNumber
        ?pinDataLength ~generationAttributes ~encryptionKeyIdentifier
        ~generationKeyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let encryptionWrappedKey =
        field_map json__ "EncryptionWrappedKey" WrappedKey.of_json in
      let pinBlockFormat =
        field_map_exn json__ "PinBlockFormat"
          PinBlockFormatForPinData.of_json in
      let primaryAccountNumber =
        field_map json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let pinDataLength =
        field_map json__ "PinDataLength" IntegerRangeBetween4And12.of_json in
      let generationAttributes =
        field_map_exn json__ "GenerationAttributes"
          PinGenerationAttributes.of_json in
      let encryptionKeyIdentifier =
        field_map_exn json__ "EncryptionKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let generationKeyIdentifier =
        field_map_exn json__ "GenerationKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ?encryptionWrappedKey ~pinBlockFormat ?primaryAccountNumber
        ?pinDataLength ~generationAttributes ~encryptionKeyIdentifier
        ~generationKeyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates pin-related data such as PIN, PIN Verification Value (PVV), PIN Block, and PIN Offset during new card issuance or reissuance. For more information, see Generate PIN data in the Amazon Web Services Payment Cryptography User Guide. PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation generates PIN, PVV, or PIN Offset and then encrypts it using Pin Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. This operation uses a separate Pin Verification Key (PVK) for VISA PVV generation. Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block. You can also use it for reveal PIN, wherein the generated PIN block is protected by the ECDH derived key before transmission from Amazon Web Services Payment Cryptography. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: GenerateCardValidationData TranslatePinData VerifyPinData"]
module GenerateMacOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for MAC generation."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      mac: MacOutputType.t option
        [@ocaml.doc
          "The MAC cryptogram generated within Amazon Web Services Payment Cryptography."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?mac -> fun () -> { keyArn; keyCheckValue; mac }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("Mac", (Option.map x.mac ~f:MacOutputType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let mac =
        (Option.map ~f:MacOutputType.of_xml) (Xml.child xml_arg0 "Mac") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?mac ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let mac = field_map json__ "Mac" MacOutputType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?mac ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates a Message Authentication Code (MAC) cryptogram within Amazon Web Services Payment Cryptography. You can use this operation to authenticate card-related data by using known data values to generate MAC for data validation between the sending and receiving parties. This operation uses message data, a secret encryption key and MAC algorithm to generate a unique MAC value for transmission. The receiving party of the MAC must use the same message data, secret encryption key and MAC algorithm to reproduce another MAC value for comparision. You can use this operation to generate a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values. The MAC generation encryption key must have valid values for KeyUsage such as TR31_M7_HMAC_KEY for HMAC generation, and the key must have KeyModesOfUse set to Generate. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: VerifyMac"]
module GenerateMacInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc "The keyARN of the MAC generation encryption key."];
      messageData: MessageDataType.t
        [@ocaml.doc
          "The data for which a MAC is under generation. This value must be hexBinary."];
      generationAttributes: MacAttributes.t
        [@ocaml.doc
          "The attributes and data values to use for MAC generation within Amazon Web Services Payment Cryptography."];
      macLength: IntegerRangeBetween4And16.t option
        [@ocaml.doc "The length of a MAC under generation."]}
    let context_ = "GenerateMacInput"
    let make ?macLength =
      fun ~keyIdentifier ->
        fun ~messageData ->
          fun ~generationAttributes ->
            fun () ->
              { macLength; keyIdentifier; messageData; generationAttributes }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("MessageData", (Some (MessageDataType.to_value x.messageData)));
        ("GenerationAttributes",
          (Some (MacAttributes.to_value x.generationAttributes)));
        ("MacLength",
          (Option.map x.macLength ~f:IntegerRangeBetween4And16.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let macLength =
        (Option.map ~f:IntegerRangeBetween4And16.of_xml)
          (Xml.child xml_arg0 "MacLength") in
      let generationAttributes =
        MacAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "GenerationAttributes") in
      let messageData =
        MessageDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MessageData") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?macLength ~generationAttributes ~messageData ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let macLength =
        field_map json__ "MacLength" IntegerRangeBetween4And16.of_json in
      let generationAttributes =
        field_map_exn json__ "GenerationAttributes" MacAttributes.of_json in
      let messageData =
        field_map_exn json__ "MessageData" MessageDataType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?macLength ~generationAttributes ~messageData ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates a Message Authentication Code (MAC) cryptogram within Amazon Web Services Payment Cryptography. You can use this operation to authenticate card-related data by using known data values to generate MAC for data validation between the sending and receiving parties. This operation uses message data, a secret encryption key and MAC algorithm to generate a unique MAC value for transmission. The receiving party of the MAC must use the same message data, secret encryption key and MAC algorithm to reproduce another MAC value for comparision. You can use this operation to generate a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values. The MAC generation encryption key must have valid values for KeyUsage such as TR31_M7_HMAC_KEY for HMAC generation, and the key must have KeyModesOfUse set to Generate. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: VerifyMac"]
module GenerateMacEmvPinChangeOutput =
  struct
    type nonrec t =
      {
      newPinPekArn: KeyArn.t option
        [@ocaml.doc
          "Returns the keyArn of the PEK protecting the incoming new encrypted PIN block."];
      secureMessagingIntegrityKeyArn: KeyArn.t option
        [@ocaml.doc
          "Returns the keyArn of the IMK-SMI used by the operation."];
      secureMessagingConfidentialityKeyArn: KeyArn.t option
        [@ocaml.doc
          "Returns the keyArn of the IMK-SMC used by the operation."];
      mac: PinChangeMacOutputType.t option
        [@ocaml.doc
          "Returns the mac of the issuer script containing message data and appended target encrypted pin block in ISO2 format."];
      encryptedPinBlock: EncryptedPinBlockType.t option
        [@ocaml.doc "Returns the incoming new encrpted PIN block."];
      newPinPekKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the PEK uprotecting the incoming new encrypted PIN block."];
      secureMessagingIntegrityKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the SMI issuer master key used by the operation."];
      secureMessagingConfidentialityKeyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the SMC issuer master key used by the operation."];
      visaAmexDerivationOutputs: VisaAmexDerivationOutputs.t option
        [@ocaml.doc
          "The attribute values used for Amex and Visa derivation methods."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?newPinPekArn =
      fun ?secureMessagingIntegrityKeyArn ->
        fun ?secureMessagingConfidentialityKeyArn ->
          fun ?mac ->
            fun ?encryptedPinBlock ->
              fun ?newPinPekKeyCheckValue ->
                fun ?secureMessagingIntegrityKeyCheckValue ->
                  fun ?secureMessagingConfidentialityKeyCheckValue ->
                    fun ?visaAmexDerivationOutputs ->
                      fun () ->
                        {
                          newPinPekArn;
                          secureMessagingIntegrityKeyArn;
                          secureMessagingConfidentialityKeyArn;
                          mac;
                          encryptedPinBlock;
                          newPinPekKeyCheckValue;
                          secureMessagingIntegrityKeyCheckValue;
                          secureMessagingConfidentialityKeyCheckValue;
                          visaAmexDerivationOutputs
                        }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("NewPinPekArn", (Option.map x.newPinPekArn ~f:KeyArn.to_value));
        ("SecureMessagingIntegrityKeyArn",
          (Option.map x.secureMessagingIntegrityKeyArn ~f:KeyArn.to_value));
        ("SecureMessagingConfidentialityKeyArn",
          (Option.map x.secureMessagingConfidentialityKeyArn
             ~f:KeyArn.to_value));
        ("Mac", (Option.map x.mac ~f:PinChangeMacOutputType.to_value));
        ("EncryptedPinBlock",
          (Option.map x.encryptedPinBlock ~f:EncryptedPinBlockType.to_value));
        ("NewPinPekKeyCheckValue",
          (Option.map x.newPinPekKeyCheckValue ~f:KeyCheckValue.to_value));
        ("SecureMessagingIntegrityKeyCheckValue",
          (Option.map x.secureMessagingIntegrityKeyCheckValue
             ~f:KeyCheckValue.to_value));
        ("SecureMessagingConfidentialityKeyCheckValue",
          (Option.map x.secureMessagingConfidentialityKeyCheckValue
             ~f:KeyCheckValue.to_value));
        ("VisaAmexDerivationOutputs",
          (Option.map x.visaAmexDerivationOutputs
             ~f:VisaAmexDerivationOutputs.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let visaAmexDerivationOutputs =
        (Option.map ~f:VisaAmexDerivationOutputs.of_xml)
          (Xml.child xml_arg0 "VisaAmexDerivationOutputs") in
      let secureMessagingConfidentialityKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "SecureMessagingConfidentialityKeyCheckValue") in
      let secureMessagingIntegrityKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "SecureMessagingIntegrityKeyCheckValue") in
      let newPinPekKeyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "NewPinPekKeyCheckValue") in
      let encryptedPinBlock =
        (Option.map ~f:EncryptedPinBlockType.of_xml)
          (Xml.child xml_arg0 "EncryptedPinBlock") in
      let mac =
        (Option.map ~f:PinChangeMacOutputType.of_xml)
          (Xml.child xml_arg0 "Mac") in
      let secureMessagingConfidentialityKeyArn =
        (Option.map ~f:KeyArn.of_xml)
          (Xml.child xml_arg0 "SecureMessagingConfidentialityKeyArn") in
      let secureMessagingIntegrityKeyArn =
        (Option.map ~f:KeyArn.of_xml)
          (Xml.child xml_arg0 "SecureMessagingIntegrityKeyArn") in
      let newPinPekArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "NewPinPekArn") in
      make ?visaAmexDerivationOutputs
        ?secureMessagingConfidentialityKeyCheckValue
        ?secureMessagingIntegrityKeyCheckValue ?newPinPekKeyCheckValue
        ?encryptedPinBlock ?mac ?secureMessagingConfidentialityKeyArn
        ?secureMessagingIntegrityKeyArn ?newPinPekArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let visaAmexDerivationOutputs =
        field_map json__ "VisaAmexDerivationOutputs"
          VisaAmexDerivationOutputs.of_json in
      let secureMessagingConfidentialityKeyCheckValue =
        field_map json__ "SecureMessagingConfidentialityKeyCheckValue"
          KeyCheckValue.of_json in
      let secureMessagingIntegrityKeyCheckValue =
        field_map json__ "SecureMessagingIntegrityKeyCheckValue"
          KeyCheckValue.of_json in
      let newPinPekKeyCheckValue =
        field_map json__ "NewPinPekKeyCheckValue" KeyCheckValue.of_json in
      let encryptedPinBlock =
        field_map json__ "EncryptedPinBlock" EncryptedPinBlockType.of_json in
      let mac = field_map json__ "Mac" PinChangeMacOutputType.of_json in
      let secureMessagingConfidentialityKeyArn =
        field_map json__ "SecureMessagingConfidentialityKeyArn"
          KeyArn.of_json in
      let secureMessagingIntegrityKeyArn =
        field_map json__ "SecureMessagingIntegrityKeyArn" KeyArn.of_json in
      let newPinPekArn = field_map json__ "NewPinPekArn" KeyArn.of_json in
      make ?visaAmexDerivationOutputs
        ?secureMessagingConfidentialityKeyCheckValue
        ?secureMessagingIntegrityKeyCheckValue ?newPinPekKeyCheckValue
        ?encryptedPinBlock ?mac ?secureMessagingConfidentialityKeyArn
        ?secureMessagingIntegrityKeyArn ?newPinPekArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates an issuer script mac for EMV payment cards that use offline PINs as the cardholder verification method (CVM). This operation generates an authenticated issuer script response by appending the incoming message data (APDU command) with the target encrypted PIN block in ISO2 format. The command structure and method to send the issuer script update to the card is not defined by this operation and is typically determined by the applicable payment card scheme. The primary inputs to this operation include the incoming new encrypted pinblock, PIN encryption key (PEK), issuer master key (IMK), primary account number (PAN), and the payment card derivation method. The operation uses two issuer master keys - secure messaging for confidentiality (IMK-SMC) and secure messaging for integrity (IMK-SMI). The SMC key is used to internally derive a key to secure the pin, while SMI key is used to internally derive a key to authenticate the script reponse as per the EMV 4.4 - Book 2 - Security and Key Management specification. This operation supports Amex, EMV2000, EMVCommon, Mastercard and Visa derivation methods, each requiring specific input parameters. Users must follow the specific derivation method and input parameters defined by the respective payment card scheme. Use GenerateMac operation when sending a script update to an EMV card that does not involve PIN change. When assigning IAM permissions, it is important to understand that EncryptData using EMV keys and GenerateMac perform similar functions to this command. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: EncryptData GenerateMac"]
module GenerateMacEmvPinChangeInput =
  struct
    type nonrec t =
      {
      newPinPekIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the PEK protecting the incoming new encrypted PIN block."];
      newEncryptedPinBlock: PinBlockLengthEquals16.t
        [@ocaml.doc
          "The incoming new encrypted PIN block data for offline pin change on an EMV card."];
      pinBlockFormat: PinBlockFormatForEmvPinChange.t
        [@ocaml.doc
          "The PIN encoding format of the incoming new encrypted PIN block as specified in ISO 9564."];
      secureMessagingIntegrityKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the issuer master key (IMK-SMI) used to authenticate the issuer script response."];
      secureMessagingConfidentialityKeyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the issuer master key (IMK-SMC) used to protect the PIN block data in the issuer script response."];
      messageData: CommandMessageDataType.t
        [@ocaml.doc
          "The message data is the APDU command from the card reader or terminal. The target encrypted PIN block, after translation to ISO2 format, is appended to this message data to generate an issuer script response."];
      derivationMethodAttributes: DerivationMethodAttributes.t
        [@ocaml.doc
          "The attributes and data values to derive payment card specific confidentiality and integrity keys."]}
    let context_ = "GenerateMacEmvPinChangeInput"
    let make ~newPinPekIdentifier =
      fun ~newEncryptedPinBlock ->
        fun ~pinBlockFormat ->
          fun ~secureMessagingIntegrityKeyIdentifier ->
            fun ~secureMessagingConfidentialityKeyIdentifier ->
              fun ~messageData ->
                fun ~derivationMethodAttributes ->
                  fun () ->
                    {
                      newPinPekIdentifier;
                      newEncryptedPinBlock;
                      pinBlockFormat;
                      secureMessagingIntegrityKeyIdentifier;
                      secureMessagingConfidentialityKeyIdentifier;
                      messageData;
                      derivationMethodAttributes
                    }
    let to_value x =
      structure_to_value
        [("NewPinPekIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.newPinPekIdentifier)));
        ("NewEncryptedPinBlock",
          (Some (PinBlockLengthEquals16.to_value x.newEncryptedPinBlock)));
        ("PinBlockFormat",
          (Some (PinBlockFormatForEmvPinChange.to_value x.pinBlockFormat)));
        ("SecureMessagingIntegrityKeyIdentifier",
          (Some
             (KeyArnOrKeyAliasType.to_value
                x.secureMessagingIntegrityKeyIdentifier)));
        ("SecureMessagingConfidentialityKeyIdentifier",
          (Some
             (KeyArnOrKeyAliasType.to_value
                x.secureMessagingConfidentialityKeyIdentifier)));
        ("MessageData",
          (Some (CommandMessageDataType.to_value x.messageData)));
        ("DerivationMethodAttributes",
          (Some
             (DerivationMethodAttributes.to_value
                x.derivationMethodAttributes)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let derivationMethodAttributes =
        DerivationMethodAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "DerivationMethodAttributes") in
      let messageData =
        CommandMessageDataType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "MessageData") in
      let secureMessagingConfidentialityKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "SecureMessagingConfidentialityKeyIdentifier") in
      let secureMessagingIntegrityKeyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "SecureMessagingIntegrityKeyIdentifier") in
      let pinBlockFormat =
        PinBlockFormatForEmvPinChange.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PinBlockFormat") in
      let newEncryptedPinBlock =
        PinBlockLengthEquals16.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "NewEncryptedPinBlock") in
      let newPinPekIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "NewPinPekIdentifier") in
      make ~derivationMethodAttributes ~messageData
        ~secureMessagingConfidentialityKeyIdentifier
        ~secureMessagingIntegrityKeyIdentifier ~pinBlockFormat
        ~newEncryptedPinBlock ~newPinPekIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let derivationMethodAttributes =
        field_map_exn json__ "DerivationMethodAttributes"
          DerivationMethodAttributes.of_json in
      let messageData =
        field_map_exn json__ "MessageData" CommandMessageDataType.of_json in
      let secureMessagingConfidentialityKeyIdentifier =
        field_map_exn json__ "SecureMessagingConfidentialityKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let secureMessagingIntegrityKeyIdentifier =
        field_map_exn json__ "SecureMessagingIntegrityKeyIdentifier"
          KeyArnOrKeyAliasType.of_json in
      let pinBlockFormat =
        field_map_exn json__ "PinBlockFormat"
          PinBlockFormatForEmvPinChange.of_json in
      let newEncryptedPinBlock =
        field_map_exn json__ "NewEncryptedPinBlock"
          PinBlockLengthEquals16.of_json in
      let newPinPekIdentifier =
        field_map_exn json__ "NewPinPekIdentifier"
          KeyArnOrKeyAliasType.of_json in
      make ~derivationMethodAttributes ~messageData
        ~secureMessagingConfidentialityKeyIdentifier
        ~secureMessagingIntegrityKeyIdentifier ~pinBlockFormat
        ~newEncryptedPinBlock ~newPinPekIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates an issuer script mac for EMV payment cards that use offline PINs as the cardholder verification method (CVM). This operation generates an authenticated issuer script response by appending the incoming message data (APDU command) with the target encrypted PIN block in ISO2 format. The command structure and method to send the issuer script update to the card is not defined by this operation and is typically determined by the applicable payment card scheme. The primary inputs to this operation include the incoming new encrypted pinblock, PIN encryption key (PEK), issuer master key (IMK), primary account number (PAN), and the payment card derivation method. The operation uses two issuer master keys - secure messaging for confidentiality (IMK-SMC) and secure messaging for integrity (IMK-SMI). The SMC key is used to internally derive a key to secure the pin, while SMI key is used to internally derive a key to authenticate the script reponse as per the EMV 4.4 - Book 2 - Security and Key Management specification. This operation supports Amex, EMV2000, EMVCommon, Mastercard and Visa derivation methods, each requiring specific input parameters. Users must follow the specific derivation method and input parameters defined by the respective payment card scheme. Use GenerateMac operation when sending a script update to an EMV card that does not involve PIN change. When assigning IAM permissions, it is important to understand that EncryptData using EMV keys and GenerateMac perform similar functions to this command. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: EncryptData GenerateMac"]
module GenerateCardValidationDataOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate CVV or CSC."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      validationData: ValidationDataType.t option
        [@ocaml.doc
          "The CVV or CSC value that Amazon Web Services Payment Cryptography generates for the card."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?validationData ->
          fun () -> { keyArn; keyCheckValue; validationData }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("ValidationData",
          (Option.map x.validationData ~f:ValidationDataType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let validationData =
        (Option.map ~f:ValidationDataType.of_xml)
          (Xml.child xml_arg0 "ValidationData") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?validationData ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let validationData =
        field_map json__ "ValidationData" ValidationDataType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?validationData ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates card-related validation data using algorithms such as Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2), or Card Security Codes (CSC). For more information, see Generate card data in the Amazon Web Services Payment Cryptography User Guide. This operation generates a CVV or CSC value that is printed on a payment credit or debit card during card production. The CVV or CSC, PAN (Primary Account Number) and expiration date of the card are required to check its validity during transaction processing. To begin this operation, a CVK (Card Verification Key) encryption key is required. You can use CreateKey or ImportKey to establish a CVK within Amazon Web Services Payment Cryptography. The KeyModesOfUse should be set to Generate and Verify for a CVK encryption key. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: ImportKey VerifyCardValidationData"]
module GenerateCardValidationDataInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate card data."];
      primaryAccountNumber: PrimaryAccountNumberType.t
        [@ocaml.doc
          "The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder."];
      generationAttributes: CardGenerationAttributes.t
        [@ocaml.doc
          "The algorithm for generating CVV or CSC values for the card within Amazon Web Services Payment Cryptography."];
      validationDataLength: IntegerRangeBetween3And5Type.t option
        [@ocaml.doc
          "The length of the CVV or CSC to be generated. The default value is 3."]}
    let context_ = "GenerateCardValidationDataInput"
    let make ?validationDataLength =
      fun ~keyIdentifier ->
        fun ~primaryAccountNumber ->
          fun ~generationAttributes ->
            fun () ->
              {
                validationDataLength;
                keyIdentifier;
                primaryAccountNumber;
                generationAttributes
              }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("PrimaryAccountNumber",
          (Some (PrimaryAccountNumberType.to_value x.primaryAccountNumber)));
        ("GenerationAttributes",
          (Some (CardGenerationAttributes.to_value x.generationAttributes)));
        ("ValidationDataLength",
          (Option.map x.validationDataLength
             ~f:IntegerRangeBetween3And5Type.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let validationDataLength =
        (Option.map ~f:IntegerRangeBetween3And5Type.of_xml)
          (Xml.child xml_arg0 "ValidationDataLength") in
      let generationAttributes =
        CardGenerationAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "GenerationAttributes") in
      let primaryAccountNumber =
        PrimaryAccountNumberType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PrimaryAccountNumber") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?validationDataLength ~generationAttributes ~primaryAccountNumber
        ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let validationDataLength =
        field_map json__ "ValidationDataLength"
          IntegerRangeBetween3And5Type.of_json in
      let generationAttributes =
        field_map_exn json__ "GenerationAttributes"
          CardGenerationAttributes.of_json in
      let primaryAccountNumber =
        field_map_exn json__ "PrimaryAccountNumber"
          PrimaryAccountNumberType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?validationDataLength ~generationAttributes ~primaryAccountNumber
        ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates card-related validation data using algorithms such as Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2), or Card Security Codes (CSC). For more information, see Generate card data in the Amazon Web Services Payment Cryptography User Guide. This operation generates a CVV or CSC value that is printed on a payment credit or debit card during card production. The CVV or CSC, PAN (Primary Account Number) and expiration date of the card are required to check its validity during transaction processing. To begin this operation, a CVK (Card Verification Key) encryption key is required. You can use CreateKey or ImportKey to establish a CVK within Amazon Web Services Payment Cryptography. The KeyModesOfUse should be set to Generate and Verify for a CVK encryption key. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: ImportKey VerifyCardValidationData"]
module GenerateAs2805KekValidationOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of sending KEK that Amazon Web Services Payment Cryptography validates for node-to-node initialization"];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the sending KEK that Amazon Web Services Payment Cryptography validates for node-to-node initialization."];
      randomKeySend: As2805RandomKeyMaterial.t option
        [@ocaml.doc "The random key generated for sending KEK validation."];
      randomKeyReceive: As2805RandomKeyMaterial.t option
        [@ocaml.doc
          "The random key generated for receiving KEK validation. The initiating node sends this key to its partner node for validation."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?randomKeySend ->
          fun ?randomKeyReceive ->
            fun () ->
              { keyArn; keyCheckValue; randomKeySend; randomKeyReceive }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("RandomKeySend",
          (Option.map x.randomKeySend ~f:As2805RandomKeyMaterial.to_value));
        ("RandomKeyReceive",
          (Option.map x.randomKeyReceive ~f:As2805RandomKeyMaterial.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let randomKeyReceive =
        (Option.map ~f:As2805RandomKeyMaterial.of_xml)
          (Xml.child xml_arg0 "RandomKeyReceive") in
      let randomKeySend =
        (Option.map ~f:As2805RandomKeyMaterial.of_xml)
          (Xml.child xml_arg0 "RandomKeySend") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?randomKeyReceive ?randomKeySend ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let randomKeyReceive =
        field_map json__ "RandomKeyReceive" As2805RandomKeyMaterial.of_json in
      let randomKeySend =
        field_map json__ "RandomKeySend" As2805RandomKeyMaterial.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?randomKeyReceive ?randomKeySend ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Establishes node-to-node initialization between payment processing nodes such as an acquirer, issuer or payment network using Australian Standard 2805 (AS2805). During node-to-node initialization, both communicating nodes must validate that they possess the correct Key Encrypting Keys (KEKs) before proceeding with session key exchange. In AS2805, the sending KEK (KEKs) of one node corresponds to the receiving KEK (KEKr) of its partner node. Each node uses its KEK to encrypt and decrypt session keys exchanged between the nodes. A KEK can be created or imported into Amazon Web Services Payment Cryptography using either the CreateKey or ImportKey operations. The node initiating communication can use GenerateAS2805KekValidation to generate a combined KEK validation request and KEK validation response to send to the partnering node for validation. When invoked, the API internally generates a random sending key encrypted under KEKs and provides a receiving key encrypted under KEKr as response. The initiating node sends the response returned by this API to its partner for validation. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts."]
module GenerateAs2805KekValidationInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of sending KEK that Amazon Web Services Payment Cryptography uses for node-to-node initialization"];
      kekValidationType: As2805KekValidationType.t
        [@ocaml.doc
          "Parameter information for generating a random key for KEK validation to perform node-to-node initialization."];
      randomKeySendVariantMask: RandomKeySendVariantMask.t
        [@ocaml.doc
          "The key variant to use for generating a random key for KEK validation during node-to-node initialization."]}
    let context_ = "GenerateAs2805KekValidationInput"
    let make ~keyIdentifier =
      fun ~kekValidationType ->
        fun ~randomKeySendVariantMask ->
          fun () ->
            { keyIdentifier; kekValidationType; randomKeySendVariantMask }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("KekValidationType",
          (Some (As2805KekValidationType.to_value x.kekValidationType)));
        ("RandomKeySendVariantMask",
          (Some
             (RandomKeySendVariantMask.to_value x.randomKeySendVariantMask)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let randomKeySendVariantMask =
        RandomKeySendVariantMask.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "RandomKeySendVariantMask") in
      let kekValidationType =
        As2805KekValidationType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KekValidationType") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ~randomKeySendVariantMask ~kekValidationType ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let randomKeySendVariantMask =
        field_map_exn json__ "RandomKeySendVariantMask"
          RandomKeySendVariantMask.of_json in
      let kekValidationType =
        field_map_exn json__ "KekValidationType"
          As2805KekValidationType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ~randomKeySendVariantMask ~kekValidationType ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Establishes node-to-node initialization between payment processing nodes such as an acquirer, issuer or payment network using Australian Standard 2805 (AS2805). During node-to-node initialization, both communicating nodes must validate that they possess the correct Key Encrypting Keys (KEKs) before proceeding with session key exchange. In AS2805, the sending KEK (KEKs) of one node corresponds to the receiving KEK (KEKr) of its partner node. Each node uses its KEK to encrypt and decrypt session keys exchanged between the nodes. A KEK can be created or imported into Amazon Web Services Payment Cryptography using either the CreateKey or ImportKey operations. The node initiating communication can use GenerateAS2805KekValidation to generate a combined KEK validation request and KEK validation response to send to the partnering node for validation. When invoked, the API internally generates a random sending key encrypted under KEKs and provides a receiving key encrypted under KEKr as response. The initiating node sends the response returned by this API to its partner for validation. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts."]
module EncryptDataOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      cipherText: CipherTextType.t option
        [@ocaml.doc "The encrypted ciphertext."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?cipherText -> fun () -> { keyArn; keyCheckValue; cipherText }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("CipherText", (Option.map x.cipherText ~f:CipherTextType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let cipherText =
        (Option.map ~f:CipherTextType.of_xml)
          (Xml.child xml_arg0 "CipherText") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?cipherText ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let cipherText = field_map json__ "CipherText" CipherTextType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?cipherText ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Encrypts plaintext data to ciphertext using a symmetric (TDES, AES), asymmetric (RSA), or derived (DUKPT or EMV) encryption key scheme. For more information, see Encrypt data in the Amazon Web Services Payment Cryptography User Guide. You can generate an encryption key within Amazon Web Services Payment Cryptography by calling CreateKey. You can import your own encryption key by calling ImportKey. For this operation, the key must have KeyModesOfUse set to Encrypt. In asymmetric encryption, plaintext is encrypted using public component. You can import the public component of an asymmetric key pair created outside Amazon Web Services Payment Cryptography by calling ImportKey. This operation also supports dynamic keys, allowing you to pass a dynamic encryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To encrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped encryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT encryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. For EMV encryption, Amazon Web Services Payment Cryptography supports TDES algorithms.For asymmetric encryption, Amazon Web Services Payment Cryptography supports RSA. When you use TDES or TDES DUKPT, the plaintext data length must be a multiple of 8 bytes. For AES or AES DUKPT, the plaintext data length must be a multiple of 16 bytes. For RSA, it sould be equal to the key size unless padding is enabled. To encrypt using DUKPT, you must already have a BDK (Base Derivation Key) key in your account with KeyModesOfUse set to DeriveKey, or you can generate a new DUKPT key by calling CreateKey. To encrypt using EMV, you must already have an IMK (Issuer Master Key) key in your account with KeyModesOfUse set to DeriveKey. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: DecryptData GetPublicCertificate ImportKey ReEncryptData"]
module EncryptDataInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption. When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation."];
      plainText: PlainTextType.t
        [@ocaml.doc
          "The plaintext to be encrypted. For encryption using asymmetric keys, plaintext data length is constrained by encryption key strength that you define in KeyAlgorithm and padding type that you define in AsymmetricEncryptionAttributes. For more information, see Encrypt data in the Amazon Web Services Payment Cryptography User Guide."];
      encryptionAttributes: EncryptionDecryptionAttributes.t
        [@ocaml.doc
          "The encryption key type and attributes for plaintext encryption."];
      wrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key for plaintext encryption."]}
    let context_ = "EncryptDataInput"
    let make ?wrappedKey =
      fun ~keyIdentifier ->
        fun ~plainText ->
          fun ~encryptionAttributes ->
            fun () ->
              { wrappedKey; keyIdentifier; plainText; encryptionAttributes }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("PlainText", (Some (PlainTextType.to_value x.plainText)));
        ("EncryptionAttributes",
          (Some
             (EncryptionDecryptionAttributes.to_value x.encryptionAttributes)));
        ("WrappedKey", (Option.map x.wrappedKey ~f:WrappedKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappedKey =
        (Option.map ~f:WrappedKey.of_xml) (Xml.child xml_arg0 "WrappedKey") in
      let encryptionAttributes =
        EncryptionDecryptionAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EncryptionAttributes") in
      let plainText =
        PlainTextType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PlainText") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?wrappedKey ~encryptionAttributes ~plainText ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappedKey = field_map json__ "WrappedKey" WrappedKey.of_json in
      let encryptionAttributes =
        field_map_exn json__ "EncryptionAttributes"
          EncryptionDecryptionAttributes.of_json in
      let plainText = field_map_exn json__ "PlainText" PlainTextType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?wrappedKey ~encryptionAttributes ~plainText ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Encrypts plaintext data to ciphertext using a symmetric (TDES, AES), asymmetric (RSA), or derived (DUKPT or EMV) encryption key scheme. For more information, see Encrypt data in the Amazon Web Services Payment Cryptography User Guide. You can generate an encryption key within Amazon Web Services Payment Cryptography by calling CreateKey. You can import your own encryption key by calling ImportKey. For this operation, the key must have KeyModesOfUse set to Encrypt. In asymmetric encryption, plaintext is encrypted using public component. You can import the public component of an asymmetric key pair created outside Amazon Web Services Payment Cryptography by calling ImportKey. This operation also supports dynamic keys, allowing you to pass a dynamic encryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To encrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped encryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT encryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. For EMV encryption, Amazon Web Services Payment Cryptography supports TDES algorithms.For asymmetric encryption, Amazon Web Services Payment Cryptography supports RSA. When you use TDES or TDES DUKPT, the plaintext data length must be a multiple of 8 bytes. For AES or AES DUKPT, the plaintext data length must be a multiple of 16 bytes. For RSA, it sould be equal to the key size unless padding is enabled. To encrypt using DUKPT, you must already have a BDK (Base Derivation Key) key in your account with KeyModesOfUse set to DeriveKey, or you can generate a new DUKPT key by calling CreateKey. To encrypt using EMV, you must already have an IMK (Issuer Master Key) key in your account with KeyModesOfUse set to DeriveKey. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: DecryptData GetPublicCertificate ImportKey ReEncryptData"]
module DecryptDataOutput =
  struct
    type nonrec t =
      {
      keyArn: KeyArn.t option
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for ciphertext decryption."];
      keyCheckValue: KeyCheckValue.t option
        [@ocaml.doc
          "The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed. Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification."];
      plainText: PlainTextOutputType.t option
        [@ocaml.doc "The decrypted plaintext data in hexBinary format."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?keyArn =
      fun ?keyCheckValue ->
        fun ?plainText -> fun () -> { keyArn; keyCheckValue; plainText }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("KeyArn", (Option.map x.keyArn ~f:KeyArn.to_value));
        ("KeyCheckValue",
          (Option.map x.keyCheckValue ~f:KeyCheckValue.to_value));
        ("PlainText",
          (Option.map x.plainText ~f:PlainTextOutputType.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let plainText =
        (Option.map ~f:PlainTextOutputType.of_xml)
          (Xml.child xml_arg0 "PlainText") in
      let keyCheckValue =
        (Option.map ~f:KeyCheckValue.of_xml)
          (Xml.child xml_arg0 "KeyCheckValue") in
      let keyArn =
        (Option.map ~f:KeyArn.of_xml) (Xml.child xml_arg0 "KeyArn") in
      make ?plainText ?keyCheckValue ?keyArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let plainText =
        field_map json__ "PlainText" PlainTextOutputType.of_json in
      let keyCheckValue =
        field_map json__ "KeyCheckValue" KeyCheckValue.of_json in
      let keyArn = field_map json__ "KeyArn" KeyArn.of_json in
      make ?plainText ?keyCheckValue ?keyArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Decrypts ciphertext data to plaintext using a symmetric (TDES, AES), asymmetric (RSA), or derived (DUKPT or EMV) encryption key scheme. For more information, see Decrypt data in the Amazon Web Services Payment Cryptography User Guide. You can use an decryption key generated within Amazon Web Services Payment Cryptography, or you can import your own decryption key by calling ImportKey. For this operation, the key must have KeyModesOfUse set to Decrypt. In asymmetric decryption, Amazon Web Services Payment Cryptography decrypts the ciphertext using the private component of the asymmetric encryption key pair. For data encryption outside of Amazon Web Services Payment Cryptography, you can export the public component of the asymmetric key pair by calling GetPublicCertificate. This operation also supports dynamic keys, allowing you to pass a dynamic decryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To decrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped decryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT decryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. For EMV decryption, Amazon Web Services Payment Cryptography supports TDES algorithms. For asymmetric decryption, Amazon Web Services Payment Cryptography supports RSA. When you use TDES or TDES DUKPT, the ciphertext data length must be a multiple of 8 bytes. For AES or AES DUKPT, the ciphertext data length must be a multiple of 16 bytes. For RSA, it sould be equal to the key size unless padding is enabled. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: EncryptData GetPublicCertificate ImportKey"]
module DecryptDataInput =
  struct
    type nonrec t =
      {
      keyIdentifier: KeyArnOrKeyAliasType.t
        [@ocaml.doc
          "The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses for ciphertext decryption. When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation."];
      cipherText: CipherTextType.t [@ocaml.doc "The ciphertext to decrypt."];
      decryptionAttributes: EncryptionDecryptionAttributes.t
        [@ocaml.doc
          "The encryption key type and attributes for ciphertext decryption."];
      wrappedKey: WrappedKey.t option
        [@ocaml.doc
          "The WrappedKeyBlock containing the encryption key for ciphertext decryption."]}
    let context_ = "DecryptDataInput"
    let make ?wrappedKey =
      fun ~keyIdentifier ->
        fun ~cipherText ->
          fun ~decryptionAttributes ->
            fun () ->
              { wrappedKey; keyIdentifier; cipherText; decryptionAttributes }
    let to_value x =
      structure_to_value
        [("KeyIdentifier",
           (Some (KeyArnOrKeyAliasType.to_value x.keyIdentifier)));
        ("CipherText", (Some (CipherTextType.to_value x.cipherText)));
        ("DecryptionAttributes",
          (Some
             (EncryptionDecryptionAttributes.to_value x.decryptionAttributes)));
        ("WrappedKey", (Option.map x.wrappedKey ~f:WrappedKey.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let wrappedKey =
        (Option.map ~f:WrappedKey.of_xml) (Xml.child xml_arg0 "WrappedKey") in
      let decryptionAttributes =
        EncryptionDecryptionAttributes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DecryptionAttributes") in
      let cipherText =
        CipherTextType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "CipherText") in
      let keyIdentifier =
        KeyArnOrKeyAliasType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "KeyIdentifier") in
      make ?wrappedKey ~decryptionAttributes ~cipherText ~keyIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let wrappedKey = field_map json__ "WrappedKey" WrappedKey.of_json in
      let decryptionAttributes =
        field_map_exn json__ "DecryptionAttributes"
          EncryptionDecryptionAttributes.of_json in
      let cipherText =
        field_map_exn json__ "CipherText" CipherTextType.of_json in
      let keyIdentifier =
        field_map_exn json__ "KeyIdentifier" KeyArnOrKeyAliasType.of_json in
      make ?wrappedKey ~decryptionAttributes ~cipherText ~keyIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Decrypts ciphertext data to plaintext using a symmetric (TDES, AES), asymmetric (RSA), or derived (DUKPT or EMV) encryption key scheme. For more information, see Decrypt data in the Amazon Web Services Payment Cryptography User Guide. You can use an decryption key generated within Amazon Web Services Payment Cryptography, or you can import your own decryption key by calling ImportKey. For this operation, the key must have KeyModesOfUse set to Decrypt. In asymmetric decryption, Amazon Web Services Payment Cryptography decrypts the ciphertext using the private component of the asymmetric encryption key pair. For data encryption outside of Amazon Web Services Payment Cryptography, you can export the public component of the asymmetric key pair by calling GetPublicCertificate. This operation also supports dynamic keys, allowing you to pass a dynamic decryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To decrypt using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped decryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide. For symmetric and DUKPT decryption, Amazon Web Services Payment Cryptography supports TDES and AES algorithms. For EMV decryption, Amazon Web Services Payment Cryptography supports TDES algorithms. For asymmetric decryption, Amazon Web Services Payment Cryptography supports RSA. When you use TDES or TDES DUKPT, the ciphertext data length must be a multiple of 8 bytes. For AES or AES DUKPT, the ciphertext data length must be a multiple of 16 bytes. For RSA, it sould be equal to the key size unless padding is enabled. For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide. Cross-account use: This operation can't be used across different Amazon Web Services accounts. Related operations: EncryptData GetPublicCertificate ImportKey"]