Fix type fields

This commit is contained in:
oscar alvarez 2023-10-12 12:32:38 -05:00
parent d11260b173
commit 7f62258f95
1 changed files with 10 additions and 10 deletions

20
siat.py
View File

@ -37,7 +37,7 @@ def send_siat(company, guest, folio, token):
city = guest.city.rec_name if guest.city else ''
nationality = guest.nationality.rec_name if guest.nationality else ''
country = guest.country.rec_name if guest.country else ""
rooms = len(folio.booking.lines)
rooms = str(len(folio.booking.lines))
first_name = guest.first_name or ''
second_name = guest.second_name or ''
first_family_name = guest.first_family_name or ''
@ -47,7 +47,7 @@ def send_siat(company, guest, folio, token):
num_acom = len(folio.guests) - 1
if num_acom <= 0:
num_acom = 0
main_guest = {
guest = {
"nombre_establecimiento": company.party.name,
"nit_establecimiento": company.party.id_number,
"rnt_establecimiento": company.rnt_code,
@ -55,7 +55,7 @@ def send_siat(company, guest, folio, token):
"tipo_identificacion": TYPE_DOC[guest.type_document],
"nombres": first_name + second_name,
"apellidos": first_family_name + second_family_name,
"lugar_nacimiento": guest.nationality,
"lugar_nacimiento": nationality,
"fecha_nacimiento": str(guest.birthday or ''),
"genero": SEX[guest.sex],
"nacionalidad": nationality,
@ -70,15 +70,15 @@ def send_siat(company, guest, folio, token):
"cuidad_procedencia": city,
"check_in": str(folio.arrival_date),
"check_out": str(folio.departure_date),
"costo": int(folio.total_amount),
"numero_acompanantes": num_acom,
"medio_pago": None,
"costo": str(int(folio.total_amount)),
"numero_acompanantes": str(num_acom),
"medio_pago": '',
"medio_reserva": "Ninguno",
"tipo_acomodacion": folio.product.name,
"numero_habitacion": folio.room.code,
}
print(main_guest)
res = requests.post(URL_GUEST, data=main_guest, headers=HEADERS, auth=True)
print(guest)
res = requests.post(URL_GUEST, data=guest, headers=HEADERS)
guests = []
for guest in folio.guests:
@ -109,9 +109,9 @@ def send_siat(company, guest, folio, token):
"check_in": str(folio.arrival_date),
"check_out": str(folio.departure_date),
"numero_habitacion": folio.room.code,
"padre": res['id'],
"padre": str(res['id']),
})
requests.post(URL_OTHERS, data=guests, headers=HEADERS, auth=True)
requests.post(URL_OTHERS, data=guests, headers=HEADERS)
class SiatSyncStart(ModelView):