@@ -3,10 +3,10 @@ const { v4: uuidv4 } = require('uuid');
3
3
4
4
/* Mapping for Guest Counts */
5
5
const mapGuestCount = OTA_GuestCount => {
6
- if ( OTA_GuestCount . Count = 0 ) return '' ;
6
+ if ( OTA_GuestCount . Count == 0 ) return '' ;
7
7
let guestCount = '' ;
8
- guestCount += ` AgeQualifyingCode="${ OTA_GuestCount . AgeQualifyingCode } ` ;
9
- guestCount += ` Count="${ OTA_GuestCount . Count } ` ;
8
+ guestCount += ` AgeQualifyingCode="${ OTA_GuestCount . AgeQualifyingCode } " ` ;
9
+ guestCount += ` Count="${ OTA_GuestCount . Count } " ` ;
10
10
return `<GuestCount${ guestCount } />` ;
11
11
}
12
12
@@ -49,7 +49,9 @@ const mapRoomRate = OTA_RoomRate => `
49
49
50
50
/* Mapping for Guarantee */
51
51
const mapPaymentCard = OTA_PaymentCard => {
52
- let paymentCard = '' ;
52
+ let paymentCard = '<PaymentCard' ;
53
+
54
+ // Add Payment Card attributes
53
55
paymentCard += ` CardCode="${ OTA_PaymentCard . CardCode } "` ;
54
56
paymentCard += ` CardNumber="${ OTA_PaymentCard . CardNumber } "` ;
55
57
paymentCard += ` CardType="${ OTA_PaymentCard . CardType } "` ;
@@ -58,8 +60,19 @@ const mapPaymentCard = OTA_PaymentCard => {
58
60
if ( OTA_PaymentCard . SeriesCode !== undefined ) {
59
61
paymentCard += ` SeriesCode="${ OTA_PaymentCard . SeriesCode } "` ;
60
62
}
63
+ paymentCard += '>'
64
+
65
+ // Cardholder name is mandatory
66
+ if ( OTA_PaymentCard . CardHolderName !== undefined ) {
67
+ paymentCard += `<CardHolderName>${ OTA_PaymentCard . CardHolderName } </CardHolderName>` ;
68
+ } else {
69
+ paymentCard += '<CardHolderName/>' ;
70
+ }
71
+
72
+ // Finish the object
73
+ paymentCard += '</PaymentCard>'
61
74
62
- return `<PaymentCard ${ paymentCard } />` ;
75
+ return paymentCard ;
63
76
}
64
77
65
78
const mapGuarantee = OTA_Guarantee => `
@@ -97,13 +110,24 @@ const mapRoomStay = OTA_RoomStay => `
97
110
<Total
98
111
AmountAfterTax="${ OTA_RoomStay . Total . AmountAfterTax } "
99
112
CurrencyCode="${ OTA_RoomStay . Total . CurrencyCode } ">
113
+ <Taxes Amount="00.00" CurrencyCode="EUR">
114
+ <Tax Type="Exclusive" Amount="00.00" CurrencyCode="EUR"/>
115
+ </Taxes>
100
116
</Total>
101
117
<BasicPropertyInfo
102
118
HotelCode="${ OTA_RoomStay . BasicPropertyInfo . HotelCode } "/>
103
119
<ResGuestRPHs>
104
120
<ResGuestRPH
105
121
RPH="${ OTA_RoomStay . ResGuestRPHs . ResGuestRPH . RPH } "/>
106
122
</ResGuestRPHs>
123
+ <Comments>
124
+ <Comment GuestViewable="0">
125
+ <Text>Booked via Winding Tree</Text>
126
+ </Comment>
127
+ </Comments>
128
+ <SpecialRequests>
129
+ <SpecialRequest RequestCode="" CodeContext=""/>
130
+ </SpecialRequests>
107
131
</RoomStay>
108
132
` . trim ( ) ;
109
133
@@ -125,7 +149,7 @@ const mapPOS = OTA_POS => `
125
149
` . trim ( ) ;
126
150
127
151
const mapAddress = OTA_Address => {
128
- if ( OTA_Address == undefined ) return '' ;
152
+ if ( OTA_Address == undefined ) return '<Address Type="1"><AddressLine/><CityName/><PostalCode/><StateProv StateCode=""/><CountryName Code=""/></Address> ' ;
129
153
return `
130
154
<Address Type="${ OTA_Address . Type } ">
131
155
<AddressLine>${ OTA_Address . AddressLines [ 0 ] } </AddressLine>
@@ -251,15 +275,14 @@ const mapSoapHeader = uuid => `
251
275
</soap:Header>
252
276
` . trim ( ) ;
253
277
254
- const mapHotelResNotifSoap = ( { OTA_HotelResNotifRQ} ) => `
255
- <?xml version="1.0" ?>
278
+ const mapHotelResNotifSoap = ( { OTA_HotelResNotifRQ} ) =>
279
+ ` <?xml version="1.0" ?>
256
280
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
257
281
${ mapSoapHeader ( uuidv4 ( ) ) }
258
282
<soap:Body>
259
283
${ mapHotelResNotif ( OTA_HotelResNotifRQ ) }
260
284
</soap:Body>
261
- </soap:Envelope>
262
- `
285
+ </soap:Envelope>`
263
286
. replace ( / > \n / g, '>' )
264
287
. replace ( / \n / g, ' ' )
265
288
. replace ( / ( \s { 4 } ) / g, '' )
0 commit comments