authorizenet 0.2.0

A typed Authorize.Net API client with async and blocking support.
Documentation
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
// @generated by `cargo xtask codegen` from schema/AnetApiSchema.xsd and
// schema/overrides.toml. Do not edit by hand.

use bon::Builder;
use crate::Decimal;
use crate::types::{RawXml, XmlDate, XmlDateTime};
use crate::xml::AnetXml;
#[allow(unused_imports)]
use super::*;

/// XSD: `creditCardTrackType`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum CreditCardTrack {
    #[anet(sensitive)]
    Track1(String),
    #[anet(sensitive)]
    Track2(String),
}

/// XSD: `paymentSimpleType`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum PaymentSimple {
    CreditCard(CreditCardSimple),
    BankAccount(BankAccount),
}

/// XSD: `Payment choice`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum PaymentInstrument {
    CreditCard(CreditCard),
    BankAccount(BankAccount),
    TrackData(CreditCardTrack),
    EncryptedTrackData(EncryptedTrackData),
    PayPal(PayPal),
    OpaqueData(OpaqueData),
    Emv(PaymentEmv),
}

/// XSD: `paymentMaskedType`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum PaymentMasked {
    CreditCard(CreditCardMasked),
    BankAccount(BankAccountMasked),
    TokenInformation(TokenMasked),
}

/// XSD: `MerchantAuthentication choice`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum MerchantCredential {
    #[anet(sensitive, max_length = 16)]
    TransactionKey(String),
    #[anet(sensitive)]
    SessionToken(String),
    #[anet(sensitive, max_length = 40)]
    Password(String),
    ImpersonationAuthentication(ImpersonationAuthentication),
    FingerPrint(FingerPrint),
    ClientKey(String),
    #[anet(sensitive)]
    AccessToken(String),
    #[anet(sensitive)]
    ActivationCode(String),
}

/// XSD: `profileTransactionType`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum ProfileTransaction {
    ProfileTransAuthCapture(ProfileTransAuthCapture),
    ProfileTransAuthOnly(ProfileTransAuthOnly),
    ProfileTransPriorAuthCapture(ProfileTransPriorAuthCapture),
    ProfileTransCaptureOnly(ProfileTransCaptureOnly),
    ProfileTransRefund(ProfileTransRefund),
    ProfileTransVoid(ProfileTransVoid),
}

/// XSD: `ListOfAuDetails choice`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum AuDetail {
    AuUpdate(AuUpdate),
    AuDelete(AuDelete),
}

/// XSD: `GetTransactionDetailsRequest choice`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum TransactionReference {
    #[anet(pattern = "[0-9]+")]
    TransId(String),
    #[anet(max_length = 50)]
    TransrefId(String),
}

/// XSD: `CreateTransactionRequest choice`
#[derive(Clone, PartialEq, AnetXml)]
#[non_exhaustive]
pub enum CreateTransactionPayload {
    TransactionRequest(TransactionRequest),
    TransactionRequestEnc(String),
}

/// XSD: `ArrayOfSetting`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct ArrayOfSetting {
    #[builder(default)]
    pub setting: Vec<Setting>,
}

/// XSD: `driversLicenseType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct DriversLicense {
    #[anet(min_length = 5, max_length = 20)]
    pub number: String,
    #[anet(min_length = 2, max_length = 2)]
    pub state: String,
    #[anet(min_length = 8, max_length = 10)]
    pub date_of_birth: String,
}

/// XSD: `driversLicenseMaskedType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct DriversLicenseMasked {
    #[anet(length = 8)]
    pub number: String,
    #[anet(min_length = 2, max_length = 2)]
    pub state: String,
    #[anet(min_length = 8, max_length = 10)]
    pub date_of_birth: String,
}

/// XSD: `nameAndAddressType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct NameAndAddress {
    #[anet(max_length = 50)]
    pub first_name: Option<String>,
    #[anet(max_length = 50)]
    pub last_name: Option<String>,
    #[anet(max_length = 50)]
    pub company: Option<String>,
    #[anet(max_length = 60)]
    pub address: Option<String>,
    #[anet(max_length = 40)]
    pub city: Option<String>,
    #[anet(max_length = 40)]
    pub state: Option<String>,
    #[anet(max_length = 20)]
    pub zip: Option<String>,
    #[anet(max_length = 60)]
    pub country: Option<String>,
}

/// XSD: `merchantContactType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct MerchantContact {
    pub merchant_name: Option<String>,
    pub merchant_address: Option<String>,
    pub merchant_city: Option<String>,
    pub merchant_state: Option<String>,
    pub merchant_zip: Option<String>,
    #[anet(max_length = 20)]
    pub merchant_phone: Option<String>,
}

/// XSD: `acceptanceDevicesAccountType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AcceptanceDevicesAccount {
    #[anet(rename = "acceptanceDevicesID")]
    pub acceptance_devices_id: Option<String>,
    pub acceptance_devices_key: Option<String>,
    #[anet(rename = "acceptanceDevicesSN")]
    pub acceptance_devices_sn: Option<String>,
}

/// XSD: `transRetailInfoType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransRetailInfo {
    pub market_type: Option<String>,
    pub device_type: Option<String>,
    pub customer_signature: Option<String>,
    pub terminal_number: Option<String>,
}

/// XSD: `creditCardSimpleType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CreditCardSimple {
    #[anet(sensitive, min_length = 4, max_length = 16)]
    pub card_number: String,
    #[anet(min_length = 4, max_length = 7)]
    pub expiration_date: String,
}

/// XSD: `creditCardType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CreditCard {
    #[anet(flatten)]
    pub credit_card_simple: CreditCardSimple,
    #[anet(sensitive, min_length = 3, max_length = 4, pattern = "[0-9]+")]
    pub card_code: Option<String>,
    pub is_payment_token: Option<bool>,
    pub cryptogram: Option<String>,
    pub token_requestor_name: Option<String>,
    pub token_requestor_id: Option<String>,
    pub token_requestor_eci: Option<String>,
}

/// XSD: `creditCardMaskedType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CreditCardMasked {
    #[anet(sensitive, length = 8)]
    pub card_number: String,
    #[anet(min_length = 4, max_length = 7)]
    pub expiration_date: String,
    pub card_type: Option<String>,
    pub card_art: Option<CardArt>,
    #[anet(length = 6)]
    pub issuer_number: Option<String>,
    pub is_payment_token: Option<bool>,
}

/// XSD: `ccAuthenticationType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CcAuthentication {
    pub authentication_indicator: String,
    pub cardholder_authentication_value: String,
}

/// XSD: `bankAccountType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct BankAccount {
    pub account_type: Option<BankAccountType>,
    #[anet(sensitive, max_length = 9)]
    pub routing_number: String,
    #[anet(sensitive, max_length = 17)]
    pub account_number: String,
    #[anet(max_length = 22)]
    pub name_on_account: String,
    pub echeck_type: Option<EcheckType>,
    #[anet(max_length = 50)]
    pub bank_name: Option<String>,
    #[anet(max_length = 15)]
    pub check_number: Option<String>,
}

/// XSD: `bankAccountMaskedType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct BankAccountMasked {
    pub account_type: Option<BankAccountType>,
    #[anet(sensitive, length = 8)]
    pub routing_number: String,
    #[anet(sensitive, length = 8)]
    pub account_number: String,
    #[anet(max_length = 22)]
    pub name_on_account: String,
    pub echeck_type: Option<EcheckType>,
    #[anet(max_length = 50)]
    pub bank_name: Option<String>,
}

/// XSD: `opaqueDataType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct OpaqueData {
    pub data_descriptor: String,
    #[anet(sensitive)]
    pub data_value: String,
    pub data_key: Option<String>,
    pub expiration_time_stamp: Option<XmlDateTime>,
}

/// XSD: `paymentType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Payment {
    #[anet(choice)]
    pub instrument: PaymentInstrument,
    pub data_source: Option<String>,
}

/// XSD: `tokenMaskedType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TokenMasked {
    pub token_source: Option<String>,
    pub token_number: String,
    #[anet(min_length = 4, max_length = 7)]
    pub expiration_date: String,
    pub token_requestor_id: Option<String>,
}

/// XSD: `orderType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Order {
    #[anet(max_length = 20)]
    pub invoice_number: Option<String>,
    #[anet(max_length = 255)]
    pub description: Option<String>,
    pub discount_amount: Option<Decimal>,
    pub tax_is_after_discount: Option<bool>,
    #[anet(max_length = 3)]
    pub total_tax_type_code: Option<String>,
    #[anet(rename = "purchaserVATRegistrationNumber", max_length = 21)]
    pub purchaser_vat_registration_number: Option<String>,
    #[anet(rename = "merchantVATRegistrationNumber", max_length = 21)]
    pub merchant_vat_registration_number: Option<String>,
    #[anet(max_length = 15)]
    pub vat_invoice_reference_number: Option<String>,
    #[anet(max_length = 17)]
    pub purchaser_code: Option<String>,
    #[anet(max_length = 4)]
    pub summary_commodity_code: Option<String>,
    #[anet(rename = "purchaseOrderDateUTC")]
    pub purchase_order_date_utc: Option<XmlDate>,
    #[anet(max_length = 25)]
    pub supplier_order_reference: Option<String>,
    #[anet(max_length = 36)]
    pub authorized_contact_name: Option<String>,
    #[anet(max_length = 25)]
    pub card_acceptor_ref_number: Option<String>,
    #[anet(rename = "amexDataTAA1", max_length = 40)]
    pub amex_data_taa1: Option<String>,
    #[anet(rename = "amexDataTAA2", max_length = 40)]
    pub amex_data_taa2: Option<String>,
    #[anet(rename = "amexDataTAA3", max_length = 40)]
    pub amex_data_taa3: Option<String>,
    #[anet(rename = "amexDataTAA4", max_length = 40)]
    pub amex_data_taa4: Option<String>,
}

/// XSD: `orderExType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct OrderEx {
    #[anet(flatten)]
    #[builder(default)]
    pub order: Order,
    #[anet(max_length = 25)]
    pub purchase_order_number: Option<String>,
}

/// XSD: `customerType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Customer {
    pub r#type: Option<CustomerType>,
    #[anet(max_length = 20)]
    pub id: Option<String>,
    #[anet(max_length = 255)]
    pub email: Option<String>,
    #[anet(max_length = 25)]
    pub phone_number: Option<String>,
    #[anet(max_length = 25)]
    pub fax_number: Option<String>,
    pub drivers_license: Option<DriversLicense>,
    #[anet(min_length = 9, max_length = 9, pattern = "[0-9]+")]
    pub tax_id: Option<String>,
}

/// XSD: `customerDataType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerData {
    pub r#type: Option<CustomerType>,
    #[anet(max_length = 20)]
    pub id: Option<String>,
    #[anet(max_length = 255)]
    pub email: Option<String>,
    pub drivers_license: Option<DriversLicense>,
    #[anet(min_length = 8, max_length = 9)]
    pub tax_id: Option<String>,
}

/// XSD: `merchantAuthenticationType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct MerchantAuthentication {
    #[anet(max_length = 25)]
    pub name: Option<String>,
    #[anet(choice)]
    pub credential: Option<MerchantCredential>,
    #[anet(max_length = 60)]
    pub mobile_device_id: Option<String>,
    #[anet(sensitive)]
    pub enc_password: Option<String>,
    pub enc_mobile_device_id: Option<String>,
}

/// XSD: `fingerPrintType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct FingerPrint {
    pub hash_value: String,
    pub sequence: Option<String>,
    pub timestamp: String,
    pub currency_code: Option<String>,
    pub amount: Option<String>,
}

/// XSD: `cardArt`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CardArt {
    pub card_brand: Option<String>,
    pub card_image_height: Option<String>,
    pub card_image_url: Option<String>,
    pub card_image_width: Option<String>,
    pub card_type: Option<String>,
}

/// XSD: `paymentDetails`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct PaymentDetails {
    pub currency: Option<String>,
    pub promo_code: Option<String>,
    pub misc: Option<String>,
    pub gift_wrap: Option<String>,
    pub discount: Option<String>,
    pub tax: Option<String>,
    pub shipping_handling: Option<String>,
    pub sub_total: Option<String>,
    #[anet(rename = "orderID")]
    pub order_id: Option<String>,
    pub amount: Option<String>,
}

/// XSD: `webCheckOutDataType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct WebCheckOutData {
    pub r#type: WebCheckOutType,
    #[anet(min_length = 1, max_length = 64)]
    pub id: String,
    pub token: Option<WebCheckOutDataTypeToken>,
    pub bank_token: Option<BankAccount>,
}

/// XSD: `securePaymentContainerErrorType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct SecurePaymentContainerError {
    pub code: String,
    pub description: String,
}

/// XSD: `impersonationAuthenticationType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ImpersonationAuthentication {
    #[anet(max_length = 25)]
    pub partner_login_id: String,
    #[anet(max_length = 16)]
    pub partner_transaction_key: String,
}

/// XSD: `PaymentScheduleInterval`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct PaymentScheduleInterval {
    #[anet(min = "1", max = "32000")]
    pub length: i16,
    pub unit: ArbSubscriptionUnit,
}

/// XSD: `paymentScheduleType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct PaymentSchedule {
    pub interval: Option<PaymentScheduleInterval>,
    pub start_date: Option<XmlDate>,
    #[anet(min = "1", max = "32000")]
    pub total_occurrences: Option<i16>,
    #[anet(min = "0", max = "32000")]
    pub trial_occurrences: Option<i16>,
}

/// XSD: `ARBSubscriptionType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ArbSubscription {
    #[anet(max_length = 50)]
    pub name: Option<String>,
    pub payment_schedule: Option<PaymentSchedule>,
    #[anet(min = "0.01", fraction_digits = 4)]
    pub amount: Option<Decimal>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub trial_amount: Option<Decimal>,
    pub payment: Option<Payment>,
    pub order: Option<Order>,
    pub customer: Option<Customer>,
    pub bill_to: Option<NameAndAddress>,
    pub ship_to: Option<NameAndAddress>,
    pub profile: Option<CustomerProfileId>,
}

/// XSD: `ARBSubscriptionMaskedType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ArbSubscriptionMasked {
    #[anet(max_length = 50)]
    pub name: Option<String>,
    pub payment_schedule: Option<PaymentSchedule>,
    #[anet(min = "0.01", fraction_digits = 4)]
    pub amount: Option<Decimal>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub trial_amount: Option<Decimal>,
    pub status: Option<ArbSubscriptionStatus>,
    pub profile: Option<SubscriptionCustomerProfile>,
    pub order: Option<Order>,
    #[anet(wrapper, item = "arbTransaction")]
    #[builder(default)]
    pub arb_transactions: Vec<ArbTransaction>,
}

/// XSD: `subscriptionCustomerProfileType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct SubscriptionCustomerProfile {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_profile_ex: CustomerProfileEx,
    pub payment_profile: Option<CustomerPaymentProfileMasked>,
    pub shipping_profile: Option<CustomerAddressEx>,
}

/// XSD: `subscriptionPaymentType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct SubscriptionPayment {
    #[anet(min = "0")]
    pub id: i32,
    #[anet(min = "0")]
    pub pay_num: i32,
}

/// XSD: `fraudInformationType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct FraudInformation {
    #[anet(wrapper, item = "fraudFilter", keep_empty, min_occurs = 1, max_occurs = 1000)]
    #[builder(default)]
    pub fraud_filter_list: Vec<String>,
    pub fraud_action: String,
}

/// XSD: `mobileDeviceType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct MobileDevice {
    #[anet(max_length = 60)]
    pub mobile_device_id: String,
    #[anet(max_length = 60)]
    pub description: Option<String>,
    #[anet(max_length = 20)]
    pub phone_number: Option<String>,
    #[anet(max_length = 255)]
    pub device_platform: Option<String>,
    pub device_activation: Option<DeviceActivation>,
}

/// XSD: `subMerchantType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct SubMerchant {
    #[anet(max_length = 40)]
    pub identifier: String,
    #[anet(max_length = 50)]
    pub doing_business_as: Option<String>,
    #[anet(max_length = 40)]
    pub payment_service_provider_name: Option<String>,
    #[anet(max_length = 20)]
    pub payment_service_facilitator: Option<String>,
    #[anet(max_length = 40)]
    pub street_address: Option<String>,
    #[anet(max_length = 20)]
    pub phone: Option<String>,
    #[anet(max_length = 40)]
    pub email: Option<String>,
    #[anet(max_length = 20)]
    pub postal_code: Option<String>,
    #[anet(max_length = 30)]
    pub city: Option<String>,
    #[anet(max_length = 10)]
    pub region_code: Option<String>,
    #[anet(max_length = 10)]
    pub country_code: Option<String>,
}

/// XSD: `transactionRequestType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionRequest {
    pub transaction_type: TransactionType,
    pub amount: Option<Decimal>,
    pub currency_code: Option<String>,
    pub payment: Option<Payment>,
    pub profile: Option<CustomerProfilePayment>,
    pub solution: Option<Solution>,
    pub call_id: Option<String>,
    pub terminal_number: Option<String>,
    pub auth_code: Option<String>,
    pub ref_trans_id: Option<String>,
    pub split_tender_id: Option<String>,
    pub order: Option<Order>,
    #[anet(wrapper, item = "lineItem")]
    #[builder(default)]
    pub line_items: Vec<LineItem>,
    pub tax: Option<ExtendedAmount>,
    pub duty: Option<ExtendedAmount>,
    pub shipping: Option<ExtendedAmount>,
    pub tax_exempt: Option<bool>,
    pub po_number: Option<String>,
    pub customer: Option<CustomerData>,
    pub bill_to: Option<CustomerAddress>,
    pub ship_to: Option<NameAndAddress>,
    #[anet(rename = "customerIP")]
    pub customer_ip: Option<String>,
    pub cardholder_authentication: Option<CcAuthentication>,
    pub retail: Option<TransRetailInfo>,
    pub employee_id: Option<String>,
    /// Allowed values for settingName are: emailCustomer, merchantEmail, allowPartialAuth, headerEmailReceipt, footerEmailReceipt, recurringBilling, duplicateWindow, testRequest.
    pub transaction_settings: Option<ArrayOfSetting>,
    #[anet(wrapper, item = "userField", max_occurs = 20)]
    #[builder(default)]
    pub user_fields: Vec<UserField>,
    pub surcharge: Option<ExtendedAmount>,
    pub merchant_descriptor: Option<String>,
    pub sub_merchant: Option<SubMerchant>,
    pub tip: Option<ExtendedAmount>,
    pub processing_options: Option<ProcessingOptions>,
    pub subsequent_auth_information: Option<SubsequentAuthInformation>,
    pub other_tax: Option<OtherTax>,
    pub ship_from: Option<NameAndAddress>,
    pub authorization_indicator_type: Option<AuthorizationIndicator>,
    pub tap_to_phone: Option<bool>,
    pub debt_repayment_indicator: Option<bool>,
    #[anet(max_length = 1)]
    pub purchase_level: Option<String>,
    pub aft_information: Option<AftInfoBasic>,
    pub discount: Option<ExtendedAmount>,
}

/// XSD: `KeyManagementSchemeDukptMode`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct KeyManagementSchemeDukptMode {
    #[anet(rename = "PIN")]
    pub pin: Option<String>,
    #[anet(rename = "Data")]
    pub data: Option<String>,
}

/// XSD: `KeyManagementSchemeDukptDeviceInfo`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct KeyManagementSchemeDukptDeviceInfo {
    #[anet(rename = "Description")]
    pub description: String,
}

/// XSD: `KeyManagementSchemeDukptEncryptedData`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct KeyManagementSchemeDukptEncryptedData {
    #[anet(rename = "Value")]
    pub value: String,
}

/// XSD: `KeyManagementSchemeDukpt`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct KeyManagementSchemeDukpt {
    #[anet(rename = "Operation")]
    pub operation: Operation,
    #[anet(rename = "Mode")]
    pub mode: KeyManagementSchemeDukptMode,
    #[anet(rename = "DeviceInfo")]
    pub device_info: KeyManagementSchemeDukptDeviceInfo,
    #[anet(rename = "EncryptedData")]
    pub encrypted_data: KeyManagementSchemeDukptEncryptedData,
}

/// XSD: `KeyManagementScheme`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct KeyManagementScheme {
    #[anet(rename = "DUKPT")]
    pub dukpt: KeyManagementSchemeDukpt,
}

/// XSD: `KeyValue`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct KeyValue {
    #[anet(rename = "Encoding")]
    pub encoding: Encoding,
    #[anet(rename = "EncryptionAlgorithm")]
    pub encryption_algorithm: EncryptionAlgorithm,
    #[anet(rename = "Scheme")]
    pub scheme: KeyManagementScheme,
}

/// XSD: `KeyBlock`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct KeyBlock {
    #[anet(rename = "Value")]
    pub value: KeyValue,
}

/// XSD: `encryptedTrackDataType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct EncryptedTrackData {
    #[anet(rename = "FormOfPayment")]
    pub form_of_payment: KeyBlock,
}

/// XSD: `settingType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Setting {
    pub setting_name: Option<SettingName>,
    pub setting_value: Option<String>,
}

/// XSD: `permissionType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Permission {
    pub permission_name: Option<String>,
}

/// XSD: `userField`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct UserField {
    pub name: Option<String>,
    pub value: Option<String>,
}

/// XSD: `emvTag`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct EmvTag {
    pub name: Option<String>,
    pub value: Option<String>,
    pub formatted: Option<String>,
}

/// XSD: `customerPaymentProfileBaseType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct CustomerPaymentProfileBase {
    pub customer_type: Option<CustomerType>,
    pub bill_to: Option<CustomerAddress>,
}

/// XSD: `customerPaymentProfileType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerPaymentProfile {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_payment_profile_base: CustomerPaymentProfileBase,
    pub payment: Option<Payment>,
    pub drivers_license: Option<DriversLicense>,
    #[anet(min_length = 8, max_length = 9)]
    pub tax_id: Option<String>,
    pub default_payment_profile: Option<bool>,
    pub subsequent_auth_information: Option<SubsequentAuthInformation>,
    pub exclude_from_account_updater: Option<bool>,
}

/// XSD: `customerPaymentProfileExType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerPaymentProfileEx {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_payment_profile: CustomerPaymentProfile,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: Option<String>,
}

/// XSD: `customerPaymentProfileMaskedType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerPaymentProfileMasked {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_payment_profile_base: CustomerPaymentProfileBase,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: String,
    pub default_payment_profile: Option<bool>,
    pub payment: Option<PaymentMasked>,
    pub drivers_license: Option<DriversLicenseMasked>,
    #[anet(length = 8)]
    pub tax_id: Option<String>,
    #[anet(wrapper, item = "subscriptionId", pattern = "[0-9]+")]
    #[builder(default)]
    pub subscription_ids: Vec<String>,
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub original_network_trans_id: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub original_auth_amount: Option<Decimal>,
    pub exclude_from_account_updater: Option<bool>,
}

/// XSD: `customerProfileBaseType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerProfileBase {
    #[anet(max_length = 20)]
    pub merchant_customer_id: Option<String>,
    #[anet(max_length = 255)]
    pub description: Option<String>,
    #[anet(max_length = 255)]
    pub email: Option<String>,
}

/// XSD: `customerProfileType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct CustomerProfile {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_profile_base: CustomerProfileBase,
    #[builder(default)]
    pub payment_profiles: Vec<CustomerPaymentProfile>,
    #[builder(default)]
    pub ship_to_list: Vec<CustomerAddress>,
    pub profile_type: Option<CustomerProfileType>,
}

/// XSD: `paymentEmvType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct PaymentEmv {
    pub emv_data: RawXml,
    pub emv_descriptor: RawXml,
    pub emv_version: RawXml,
}

/// XSD: `customerProfileExType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerProfileEx {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_profile_base: CustomerProfileBase,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
}

/// XSD: `customerProfileInfoExType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct CustomerProfileInfoEx {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_profile_ex: CustomerProfileEx,
    pub profile_type: Option<CustomerProfileType>,
}

/// XSD: `customerProfileMaskedType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct CustomerProfileMasked {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_profile_ex: CustomerProfileEx,
    #[builder(default)]
    pub payment_profiles: Vec<CustomerPaymentProfileMasked>,
    #[builder(default)]
    pub ship_to_list: Vec<CustomerAddressEx>,
    pub profile_type: Option<CustomerProfileType>,
}

/// XSD: `customerAddressType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerAddress {
    #[anet(flatten)]
    #[builder(default)]
    pub name_and_address: NameAndAddress,
    #[anet(max_length = 25)]
    pub phone_number: Option<String>,
    #[anet(max_length = 25)]
    pub fax_number: Option<String>,
    pub email: Option<String>,
}

/// XSD: `customerAddressExType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerAddressEx {
    #[anet(flatten)]
    #[builder(default)]
    pub customer_address: CustomerAddress,
    #[anet(pattern = "[0-9]+")]
    pub customer_address_id: Option<String>,
}

/// XSD: `extendedAmountType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ExtendedAmount {
    #[anet(min = "0.00", fraction_digits = 4)]
    pub amount: Decimal,
    #[anet(max_length = 31)]
    pub name: Option<String>,
    #[anet(max_length = 255)]
    pub description: Option<String>,
}

/// XSD: `otherTaxType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct OtherTax {
    pub national_tax_amount: Option<Decimal>,
    pub local_tax_amount: Option<Decimal>,
    pub alternate_tax_amount: Option<Decimal>,
    #[anet(max_length = 15)]
    pub alternate_tax_id: Option<String>,
    #[anet(total_digits = 5, fraction_digits = 5)]
    pub vat_tax_rate: Option<Decimal>,
    pub vat_tax_amount: Option<Decimal>,
}

/// XSD: `lineItemType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct LineItem {
    #[anet(min_length = 1, max_length = 31)]
    pub item_id: String,
    #[anet(min_length = 1, max_length = 31)]
    pub name: String,
    #[anet(max_length = 255)]
    pub description: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub quantity: Decimal,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub unit_price: Decimal,
    pub taxable: Option<bool>,
    #[anet(max_length = 12)]
    pub unit_of_measure: Option<String>,
    #[anet(max_length = 2)]
    pub type_of_supply: Option<String>,
    #[anet(total_digits = 5, fraction_digits = 5)]
    pub tax_rate: Option<Decimal>,
    #[anet(fraction_digits = 4)]
    pub tax_amount: Option<Decimal>,
    pub national_tax: Option<Decimal>,
    pub local_tax: Option<Decimal>,
    #[anet(total_digits = 5, fraction_digits = 5)]
    pub vat_rate: Option<Decimal>,
    #[anet(max_length = 20)]
    pub alternate_tax_id: Option<String>,
    #[anet(max_length = 4)]
    pub alternate_tax_type: Option<String>,
    #[anet(max_length = 4)]
    pub alternate_tax_type_applied: Option<String>,
    #[anet(total_digits = 5, fraction_digits = 5)]
    pub alternate_tax_rate: Option<Decimal>,
    pub alternate_tax_amount: Option<Decimal>,
    #[anet(fraction_digits = 4)]
    pub total_amount: Option<Decimal>,
    #[anet(max_length = 12)]
    pub commodity_code: Option<String>,
    #[anet(max_length = 255)]
    pub product_code: Option<String>,
    #[anet(rename = "productSKU", max_length = 255)]
    pub product_sku: Option<String>,
    #[anet(total_digits = 5, fraction_digits = 5)]
    pub discount_rate: Option<Decimal>,
    #[anet(fraction_digits = 4)]
    pub discount_amount: Option<Decimal>,
    pub tax_included_in_total: Option<bool>,
    pub tax_is_after_discount: Option<bool>,
}

/// XSD: `profileTransAmountType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct ProfileTransAmount {
    #[anet(min = "0.01", fraction_digits = 4)]
    pub amount: Decimal,
    pub tax: Option<ExtendedAmount>,
    pub shipping: Option<ExtendedAmount>,
    pub duty: Option<ExtendedAmount>,
    #[anet(max_occurs = 30)]
    #[builder(default)]
    pub line_items: Vec<LineItem>,
}

/// XSD: `profileTransOrderType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ProfileTransOrder {
    #[anet(flatten)]
    pub profile_trans_amount: ProfileTransAmount,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: String,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: String,
    #[anet(pattern = "[0-9]+")]
    pub customer_shipping_address_id: Option<String>,
    pub order: Option<OrderEx>,
    pub tax_exempt: Option<bool>,
    pub recurring_billing: Option<bool>,
    #[anet(sensitive, min_length = 3, max_length = 4, pattern = "[0-9]+")]
    pub card_code: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub split_tender_id: Option<String>,
    pub processing_options: Option<ProcessingOptions>,
    pub subsequent_auth_information: Option<SubsequentAuthInformation>,
    pub authorization_indicator_type: Option<AuthorizationIndicator>,
}

/// XSD: `profileTransAuthCaptureType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct ProfileTransAuthCapture {
    #[anet(flatten)]
    pub profile_trans_order: ProfileTransOrder,
}

/// XSD: `profileTransAuthOnlyType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct ProfileTransAuthOnly {
    #[anet(flatten)]
    pub profile_trans_order: ProfileTransOrder,
}

/// XSD: `profileTransPriorAuthCaptureType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ProfileTransPriorAuthCapture {
    #[anet(flatten)]
    pub profile_trans_amount: ProfileTransAmount,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_shipping_address_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub trans_id: String,
}

/// XSD: `profileTransCaptureOnlyType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ProfileTransCaptureOnly {
    #[anet(flatten)]
    pub profile_trans_order: ProfileTransOrder,
    #[anet(max_length = 6)]
    pub approval_code: String,
}

/// XSD: `profileTransRefundType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ProfileTransRefund {
    #[anet(flatten)]
    pub profile_trans_amount: ProfileTransAmount,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_shipping_address_id: Option<String>,
    #[anet(min_length = 8, max_length = 8)]
    pub credit_card_number_masked: Option<String>,
    #[anet(min_length = 8, max_length = 8)]
    pub bank_routing_number_masked: Option<String>,
    #[anet(min_length = 8, max_length = 8)]
    pub bank_account_number_masked: Option<String>,
    pub order: Option<OrderEx>,
    #[anet(pattern = "[0-9]+")]
    pub trans_id: Option<String>,
}

/// XSD: `profileTransVoidType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ProfileTransVoid {
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_shipping_address_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub trans_id: String,
}

/// XSD: `transactionSummaryType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionSummary {
    #[anet(pattern = "[0-9]+")]
    pub trans_id: String,
    #[anet(rename = "submitTimeUTC")]
    pub submit_time_utc: XmlDateTime,
    pub submit_time_local: XmlDateTime,
    pub transaction_status: TransactionStatus,
    pub invoice_number: Option<String>,
    pub first_name: Option<String>,
    pub last_name: Option<String>,
    pub account_type: String,
    #[anet(sensitive)]
    pub account_number: String,
    pub settle_amount: Decimal,
    pub market_type: Option<String>,
    pub product: Option<String>,
    pub mobile_device_id: Option<String>,
    pub subscription: Option<SubscriptionPayment>,
    pub has_returned_items: Option<bool>,
    pub fraud_information: Option<FraudInformation>,
    pub profile: Option<CustomerProfileId>,
}

/// Lightweight transaction summary with only 15 essential fields
///
/// XSD: `getTransactionSummary`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct GetTransactionSummary {
    #[anet(pattern = "[0-9]+")]
    pub trans_id: String,
    #[anet(rename = "submitTimeUTC")]
    pub submit_time_utc: XmlDateTime,
    pub transaction_status: String,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub settle_amount: Decimal,
    pub response_code: i32,
    pub response_reason_code: i32,
    pub response_reason_description: String,
    pub batch: Option<BatchDetails>,
}

/// XSD: `arbTransaction`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ArbTransaction {
    #[anet(pattern = "[0-9]+")]
    pub trans_id: Option<String>,
    pub response: Option<String>,
    #[anet(rename = "submitTimeUTC")]
    pub submit_time_utc: Option<XmlDateTime>,
    pub pay_num: Option<i32>,
    pub attempt_num: Option<i32>,
}

/// XSD: `TransactionDetailsTag`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionDetailsTag {
    pub tag_id: String,
    pub data: String,
}

/// XSD: `transactionDetailsType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionDetails {
    #[anet(pattern = "[0-9]+")]
    pub trans_id: String,
    #[anet(pattern = "[0-9]+")]
    pub ref_trans_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub split_tender_id: Option<String>,
    #[anet(rename = "submitTimeUTC")]
    pub submit_time_utc: XmlDateTime,
    pub submit_time_local: XmlDateTime,
    pub transaction_type: TransactionType,
    pub transaction_status: TransactionStatus,
    pub response_code: i32,
    pub response_reason_code: i32,
    pub subscription: Option<SubscriptionPayment>,
    pub response_reason_description: String,
    #[anet(max_length = 6)]
    pub auth_code: Option<String>,
    #[anet(rename = "AVSResponse", max_length = 1)]
    pub avs_response: Option<String>,
    #[anet(max_length = 1)]
    pub card_code_response: Option<String>,
    #[anet(rename = "CAVVResponse", max_length = 1)]
    pub cavv_response: Option<String>,
    #[anet(rename = "FDSFilterAction")]
    pub fds_filter_action: Option<String>,
    #[anet(wrapper, item = "FDSFilter", rename = "FDSFilters")]
    #[builder(default)]
    pub fds_filters: Vec<FdsFilter>,
    pub batch: Option<BatchDetails>,
    pub order: Option<OrderEx>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub requested_amount: Option<Decimal>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub auth_amount: Decimal,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub settle_amount: Decimal,
    pub tax: Option<ExtendedAmount>,
    pub shipping: Option<ExtendedAmount>,
    pub duty: Option<ExtendedAmount>,
    #[anet(wrapper, item = "lineItem")]
    #[builder(default)]
    pub line_items: Vec<LineItem>,
    #[anet(fraction_digits = 4)]
    pub prepaid_balance_remaining: Option<Decimal>,
    pub tax_exempt: Option<bool>,
    pub payment: PaymentMasked,
    pub customer: Option<CustomerData>,
    pub bill_to: Option<CustomerAddress>,
    pub ship_to: Option<NameAndAddress>,
    pub recurring_billing: Option<bool>,
    #[anet(rename = "customerIP")]
    pub customer_ip: Option<String>,
    pub product: Option<String>,
    pub entry_mode: Option<String>,
    pub market_type: Option<String>,
    pub mobile_device_id: Option<String>,
    pub customer_signature: Option<String>,
    #[anet(wrapper, item = "returnedItem")]
    #[builder(default)]
    pub returned_items: Vec<ReturnedItem>,
    pub solution: Option<Solution>,
    #[anet(wrapper, item = "tag", min_occurs = 1)]
    #[builder(default)]
    pub emv_details: Vec<TransactionDetailsTag>,
    pub profile: Option<CustomerProfileId>,
    pub surcharge: Option<ExtendedAmount>,
    pub employee_id: Option<String>,
    pub tip: Option<ExtendedAmount>,
    pub other_tax: Option<OtherTax>,
    pub ship_from: Option<NameAndAddress>,
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub network_trans_id: Option<String>,
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub original_network_trans_id: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub original_auth_amount: Option<Decimal>,
    pub authorization_indicator: Option<String>,
    pub merchant_advice: Option<MerchantAdvice>,
    pub tap_to_phone: Option<bool>,
    pub debt_repayment_indicator: Option<bool>,
    #[anet(max_length = 1)]
    pub purchase_level: Option<String>,
    pub aft_information: Option<AftInfoBasic>,
    pub discount: Option<ExtendedAmount>,
}

/// XSD: `solutionType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Solution {
    pub id: String,
    pub name: Option<String>,
    pub vendor_name: Option<String>,
}

/// XSD: `returnedItemType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ReturnedItem {
    #[anet(pattern = "[0-9]+")]
    pub id: String,
    #[anet(rename = "dateUTC")]
    pub date_utc: XmlDateTime,
    pub date_local: XmlDateTime,
    pub code: String,
    pub description: String,
}

/// XSD: `FDSFilterType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct FdsFilter {
    pub name: String,
    pub action: String,
}

/// XSD: `batchDetailsType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct BatchDetails {
    #[anet(pattern = "[0-9]+")]
    pub batch_id: String,
    #[anet(rename = "settlementTimeUTC")]
    pub settlement_time_utc: Option<XmlDateTime>,
    pub settlement_time_local: Option<XmlDateTime>,
    pub settlement_state: SettlementState,
    pub payment_method: Option<String>,
    pub market_type: Option<String>,
    pub product: Option<String>,
    #[anet(wrapper, item = "statistic")]
    #[builder(default)]
    pub statistics: Vec<BatchStatistic>,
}

/// XSD: `batchStatisticType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct BatchStatistic {
    pub account_type: String,
    pub charge_amount: Decimal,
    pub charge_count: i32,
    pub refund_amount: Decimal,
    pub refund_count: i32,
    pub void_count: i32,
    pub decline_count: i32,
    pub error_count: i32,
    pub returned_item_amount: Option<Decimal>,
    pub returned_item_count: Option<i32>,
    pub chargeback_amount: Option<Decimal>,
    pub chargeback_count: Option<i32>,
    pub correction_notice_count: Option<i32>,
    pub charge_charge_back_amount: Option<Decimal>,
    pub charge_charge_back_count: Option<i32>,
    pub refund_charge_back_amount: Option<Decimal>,
    pub refund_charge_back_count: Option<i32>,
    pub charge_returned_items_amount: Option<Decimal>,
    pub charge_returned_items_count: Option<i32>,
    pub refund_returned_items_amount: Option<Decimal>,
    pub refund_returned_items_count: Option<i32>,
}

/// XSD: `TransactionResponsePrePaidCard`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponsePrePaidCard {
    pub requested_amount: Option<String>,
    pub approved_amount: Option<String>,
    pub balance_on_card: Option<String>,
}

/// XSD: `TransactionResponseMessage`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponseMessage {
    pub code: Option<String>,
    pub description: Option<String>,
}

/// XSD: `TransactionResponseError`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponseError {
    pub error_code: Option<String>,
    pub error_text: Option<String>,
}

/// XSD: `TransactionResponseSplitTenderPayment`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponseSplitTenderPayment {
    pub trans_id: Option<String>,
    pub response_code: Option<String>,
    pub response_to_customer: Option<String>,
    pub auth_code: Option<String>,
    #[anet(sensitive)]
    pub account_number: Option<String>,
    pub account_type: Option<String>,
    pub requested_amount: Option<String>,
    pub approved_amount: Option<String>,
    pub balance_on_card: Option<String>,
}

/// XSD: `TransactionResponseSecureAcceptance`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponseSecureAcceptance {
    #[anet(rename = "SecureAcceptanceUrl")]
    pub secure_acceptance_url: Option<String>,
    #[anet(rename = "PayerID")]
    pub payer_id: Option<String>,
    #[anet(rename = "PayerEmail")]
    pub payer_email: Option<String>,
}

/// XSD: `TransactionResponseEmvResponse`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponseEmvResponse {
    pub tlv_data: Option<String>,
    #[anet(wrapper, item = "tag", min_occurs = 1)]
    #[builder(default)]
    pub tags: Vec<EmvTag>,
}

/// XSD: `transactionResponse`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct TransactionResponse {
    pub response_code: Option<String>,
    pub raw_response_code: Option<String>,
    pub auth_code: Option<String>,
    pub avs_result_code: Option<String>,
    pub cvv_result_code: Option<String>,
    pub cavv_result_code: Option<String>,
    pub trans_id: Option<String>,
    #[anet(rename = "refTransID")]
    pub ref_trans_id: Option<String>,
    pub trans_hash: Option<String>,
    pub test_request: Option<String>,
    #[anet(sensitive)]
    pub account_number: Option<String>,
    pub entry_mode: Option<String>,
    pub account_type: Option<String>,
    pub split_tender_id: Option<String>,
    pub pre_paid_card: Option<TransactionResponsePrePaidCard>,
    #[anet(wrapper, item = "message")]
    #[builder(default)]
    pub messages: Vec<TransactionResponseMessage>,
    /// Not in the XSD, but sent by the API.
    pub message: Option<TransactionResponseMessage>,
    #[anet(wrapper, item = "error")]
    #[builder(default)]
    pub errors: Vec<TransactionResponseError>,
    #[anet(wrapper, item = "splitTenderPayment")]
    #[builder(default)]
    pub split_tender_payments: Vec<TransactionResponseSplitTenderPayment>,
    #[anet(wrapper, item = "userField", max_occurs = 20)]
    #[builder(default)]
    pub user_fields: Vec<UserField>,
    pub ship_to: Option<NameAndAddress>,
    pub secure_acceptance: Option<TransactionResponseSecureAcceptance>,
    pub emv_response: Option<TransactionResponseEmvResponse>,
    pub trans_hash_sha2: Option<String>,
    pub profile: Option<CustomerProfileId>,
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub network_trans_id: Option<String>,
    pub merchant_advice: Option<MerchantAdvice>,
}

/// XSD: `ContactDetailType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct ContactDetail {
    #[anet(max_length = 255)]
    pub email: Option<String>,
    #[anet(max_length = 50)]
    pub first_name: Option<String>,
    #[anet(max_length = 50)]
    pub last_name: Option<String>,
}

/// XSD: `pinDeliveryRequestType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct PinDeliveryRequest {
    pub delivery_method: DeliveryMethod,
    #[anet(sensitive)]
    pub activation_code: String,
}

/// XSD: `pinVerifyRequestType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct PinVerifyRequest {
    pub pin: String,
    pub biometrics_public_key: Option<String>,
    #[anet(sensitive)]
    pub activation_code: String,
}

/// Allowed values for settingName are: headerEmailReceipt and footerEmailReceipt
///
/// XSD: `emailSettingsType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct EmailSettings {
    #[anet(flatten)]
    #[builder(default)]
    pub array_of_setting: ArrayOfSetting,
    #[anet(attribute)]
    pub version: Option<i64>,
}

/// XSD: `Message`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Message {
    pub code: String,
    pub text: String,
}

/// XSD: `messagesType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct Messages {
    pub result_code: MessageType,
    #[anet(min_occurs = 1)]
    #[builder(default)]
    pub message: Vec<Message>,
}

/// XSD: `createProfileResponse`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CreateProfileResponse {
    pub messages: Messages,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    #[anet(wrapper, item = "numericString", pattern = "[0-9]+")]
    #[builder(default)]
    pub customer_payment_profile_id_list: Vec<String>,
    #[anet(wrapper, item = "numericString", pattern = "[0-9]+")]
    #[builder(default)]
    pub customer_shipping_address_id_list: Vec<String>,
}

/// XSD: `heldTransactionRequestType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct HeldTransactionRequest {
    pub action: AfdsTransaction,
    pub ref_trans_id: String,
}

/// XSD: `TransactionListSorting`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct TransactionListSorting {
    pub order_by: TransactionListOrderField,
    pub order_descending: bool,
}

/// XSD: `payPalType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct PayPal {
    #[anet(max_length = 2048)]
    pub success_url: Option<String>,
    #[anet(max_length = 2048)]
    pub cancel_url: Option<String>,
    #[anet(max_length = 2)]
    pub paypal_lc: Option<String>,
    #[anet(max_length = 127)]
    pub paypal_hdr_img: Option<String>,
    #[anet(max_length = 6)]
    pub paypal_payflowcolor: Option<String>,
    #[anet(rename = "payerID", max_length = 255)]
    pub payer_id: Option<String>,
}

/// XSD: `Paging`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct Paging {
    #[anet(min = "1", max = "1000")]
    pub limit: i32,
    #[anet(min = "1", max = "100000")]
    pub offset: i32,
}

/// XSD: `ARBGetSubscriptionListSorting`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct ArbGetSubscriptionListSorting {
    pub order_by: ArbGetSubscriptionListOrderField,
    pub order_descending: bool,
}

/// XSD: `SubscriptionDetail`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct SubscriptionDetail {
    pub id: i32,
    pub name: Option<String>,
    pub status: ArbSubscriptionStatus,
    #[anet(rename = "createTimeStampUTC")]
    pub create_time_stamp_utc: XmlDateTime,
    pub first_name: Option<String>,
    pub last_name: Option<String>,
    pub total_occurrences: i32,
    pub past_occurrences: i32,
    pub payment_method: PaymentMethod,
    #[anet(sensitive)]
    pub account_number: Option<String>,
    pub invoice: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub amount: Decimal,
    pub currency_code: Option<String>,
    pub customer_profile_id: i32,
    pub customer_payment_profile_id: i32,
    pub customer_shipping_profile_id: Option<i32>,
}

/// XSD: `customerProfileSummaryType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerProfileSummary {
    pub customer_profile_id: Option<String>,
    pub description: Option<String>,
    pub merchant_customer_id: String,
    pub email: Option<String>,
    pub created_date: XmlDateTime,
}

/// XSD: `customerProfilePaymentType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerProfilePayment {
    pub create_profile: Option<bool>,
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: Option<String>,
    pub payment_profile: Option<PaymentProfile>,
    #[anet(pattern = "[0-9]+")]
    pub shipping_profile_id: Option<String>,
}

/// XSD: `paymentProfile`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct PaymentProfile {
    #[anet(pattern = "[0-9]+")]
    pub payment_profile_id: String,
    #[anet(sensitive, min_length = 3, max_length = 4, pattern = "[0-9]+")]
    pub card_code: Option<String>,
}

/// XSD: `CustomerPaymentProfileSorting`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct CustomerPaymentProfileSorting {
    pub order_by: CustomerPaymentProfileOrderField,
    pub order_descending: bool,
}

/// XSD: `customerPaymentProfileListItemType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerPaymentProfileListItem {
    pub default_payment_profile: Option<bool>,
    pub customer_payment_profile_id: i32,
    pub customer_profile_id: i32,
    pub bill_to: CustomerAddress,
    pub payment: PaymentMasked,
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub original_network_trans_id: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub original_auth_amount: Option<Decimal>,
    pub exclude_from_account_updater: Option<bool>,
}

/// XSD: `customerProfileIdType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct CustomerProfileId {
    #[anet(pattern = "[0-9]+")]
    pub customer_profile_id: String,
    #[anet(pattern = "[0-9]+")]
    pub customer_payment_profile_id: Option<String>,
    #[anet(pattern = "[0-9]+")]
    pub customer_address_id: Option<String>,
}

/// XSD: `auResponseType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AuResponse {
    pub au_reason_code: String,
    pub profile_count: i64,
    pub reason_description: String,
}

/// XSD: `ListOfAUDetailsType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct ListOfAuDetails {
    #[anet(choice)]
    #[builder(default)]
    pub details: Vec<AuDetail>,
}

/// XSD: `auUpdateType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct AuUpdate {
    #[anet(flatten)]
    pub au_details: AuDetails,
    pub new_credit_card: CreditCardMasked,
    pub old_credit_card: CreditCardMasked,
}

/// XSD: `auDeleteType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[non_exhaustive]
pub struct AuDelete {
    #[anet(flatten)]
    pub au_details: AuDetails,
    pub credit_card: CreditCardMasked,
}

/// XSD: `auDetailsType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AuDetails {
    #[anet(rename = "customerProfileID")]
    pub customer_profile_id: i64,
    #[anet(rename = "customerPaymentProfileID")]
    pub customer_payment_profile_id: i64,
    pub first_name: Option<String>,
    pub last_name: Option<String>,
    #[anet(rename = "updateTimeUTC")]
    pub update_time_utc: String,
    pub au_reason_code: String,
    pub reason_description: String,
}

/// XSD: `processingOptions`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct ProcessingOptions {
    pub is_first_recurring_payment: Option<bool>,
    pub is_first_subsequent_auth: Option<bool>,
    pub is_subsequent_auth: Option<bool>,
    pub is_stored_credentials: Option<bool>,
}

/// XSD: `authorizationIndicatorType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[non_exhaustive]
pub struct AuthorizationIndicator {
    pub authorization_indicator: Option<AuthIndicator>,
}

/// XSD: `subsequentAuthInformation`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct SubsequentAuthInformation {
    #[anet(max_length = 255, pattern = "[0-9a-zA-Z\\s]+")]
    pub original_network_trans_id: Option<String>,
    #[anet(min = "0.00", fraction_digits = 4)]
    pub original_auth_amount: Option<Decimal>,
    pub reason: Option<MerchantInitTransReason>,
}

/// XSD: `merchantAdviceType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct MerchantAdvice {
    #[anet(pattern = "[0-9a-zA-Z\\s]+")]
    pub code: String,
    pub description: Option<String>,
}

/// XSD: `processorType`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct Processor {
    #[anet(max_length = 255)]
    pub name: String,
    pub id: i32,
    #[anet(wrapper, item = "cardType", max_occurs = 30)]
    #[builder(default)]
    pub card_types: Vec<String>,
}

/// XSD: `webCheckOutDataTypeToken`
#[derive(Clone, PartialEq, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct WebCheckOutDataTypeToken {
    #[anet(sensitive, min_length = 4, max_length = 16)]
    pub card_number: String,
    #[anet(min_length = 4, max_length = 7)]
    pub expiration_date: String,
    #[anet(sensitive, min_length = 3, max_length = 4, pattern = "[0-9]+")]
    pub card_code: Option<String>,
    #[anet(min_length = 1, max_length = 20)]
    pub zip: Option<String>,
    #[anet(min_length = 1, max_length = 64)]
    pub full_name: Option<String>,
}

/// XSD: `aftInfoBasicType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AftInfoBasic {
    pub aft_indicator: Option<bool>,
    #[anet(max_length = 2)]
    pub business_application_id: Option<String>,
    pub recipient_information: Option<AftRecipientInformation>,
    pub sender_information: Option<AftSenderInformation>,
}

/// XSD: `aftRecipientInformationType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AftRecipientInformation {
    #[anet(max_length = 35)]
    pub first_name: Option<String>,
    #[anet(max_length = 35)]
    pub middle_name: Option<String>,
    #[anet(max_length = 35)]
    pub last_name: Option<String>,
    #[anet(max_length = 50)]
    pub address: Option<String>,
    #[anet(max_length = 25)]
    pub city: Option<String>,
    #[anet(max_length = 2)]
    pub state: Option<String>,
    #[anet(max_length = 10)]
    pub zip: Option<String>,
    #[anet(max_length = 2)]
    pub country: Option<String>,
    #[anet(max_length = 10)]
    pub account_id: Option<String>,
    #[anet(max_length = 2)]
    pub account_type: Option<String>,
}

/// XSD: `aftSenderInformationType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AftSenderInformation {
    #[anet(max_length = 35)]
    pub first_name: Option<String>,
    #[anet(max_length = 35)]
    pub middle_name: Option<String>,
    #[anet(max_length = 35)]
    pub last_name: Option<String>,
    #[anet(max_length = 50)]
    pub name: Option<String>,
    #[anet(max_length = 50)]
    pub address: Option<String>,
    #[anet(max_length = 25)]
    pub city: Option<String>,
    #[anet(max_length = 2)]
    pub state: Option<String>,
    #[anet(max_length = 10)]
    pub zip: Option<String>,
    #[anet(max_length = 2)]
    pub country: Option<String>,
    #[anet(max_length = 25)]
    pub phone_number: Option<String>,
    #[anet(max_length = 1)]
    pub r#type: Option<String>,
    pub account: Option<AftSenderAccountInformation>,
    #[anet(min_length = 8, max_length = 10)]
    pub date_of_birth: Option<String>,
    #[anet(max_length = 2)]
    pub identification_number: Option<String>,
    #[anet(max_length = 4)]
    pub personal_id_type: Option<String>,
    #[anet(max_length = 19)]
    pub reference_number: Option<String>,
}

/// XSD: `aftSenderAccountInformationType`
#[derive(Clone, PartialEq, Default, AnetXml, Builder)]
#[builder(on(String, into))]
#[non_exhaustive]
pub struct AftSenderAccountInformation {
    #[anet(max_length = 2)]
    pub funds_source: Option<String>,
    #[anet(max_length = 20)]
    pub number: Option<String>,
    #[anet(max_length = 2)]
    pub r#type: Option<String>,
}