Skip to content

Commit 6d2a4b2

Browse files
authored
TNR-2093: Add discount_id to reservations endpoint (#33)
1 parent 34cd577 commit 6d2a4b2

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='VacasaConnect',
5-
version='0.6.3',
5+
version='0.6.5',
66
description='A Python 3.6 SDK for the connect.vacasa.com API.',
77
packages=['vacasa.connect'],
88
url='https://github.com/Vacasa/python-vacasa-connect-sdk',

vacasa/connect/connect.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ def create_reservation(self,
663663
pets: int = 0,
664664
trip_protection: Optional[bool] = None,
665665
source: Optional[str] = None,
666+
discount_id: Optional[int] = None,
666667
) -> dict:
667668
""" Reserve a given unit
668669
@@ -693,6 +694,7 @@ def create_reservation(self,
693694
exp_mmyy: Credit card expiry in `mmyy` format
694695
cvv: Card verification value on credit card
695696
source: A Vacasa-issued code identifying the source of this request
697+
discount_id: Must match value from `quote_id`
696698
697699
Returns: dict
698700
@@ -730,27 +732,31 @@ def create_reservation(self,
730732
if cvv:
731733
payload['cvv'] = str(cvv)
732734

735+
# The discount_id is optional. Add it if we've got it.
736+
if discount_id:
737+
payload['discount_id'] = discount_id
738+
733739
return self._post(url, json={'data': {'attributes': payload}}, headers=headers).json()
734740

735741
def create_cancelled_reservation(self,
736-
unit_id: int,
737-
arrival: str,
738-
departure: str,
739-
adults: int,
740-
children: int,
741-
pets: int,
742-
trip_protection: bool,
743-
discount_id: str,
744-
first_name: str,
745-
last_name: str,
746-
phone: str,
747-
rent: int,
748-
fee_amount: int,
749-
cleaning_fees: int,
750-
trip_protection_fee: int,
751-
total: int,
752-
tax_amount: int,
753-
) -> dict:
742+
unit_id: int,
743+
arrival: str,
744+
departure: str,
745+
adults: int,
746+
children: int,
747+
pets: int,
748+
trip_protection: bool,
749+
discount_id: str,
750+
first_name: str,
751+
last_name: str,
752+
phone: str,
753+
rent: int,
754+
fee_amount: int,
755+
cleaning_fees: int,
756+
trip_protection_fee: int,
757+
total: int,
758+
tax_amount: int,
759+
) -> dict:
754760
"""
755761
Args:
756762
unit_id: A Vacasa Unit ID
@@ -859,7 +865,6 @@ def get_blocklist_entries(self, page_number=0) -> dict:
859865

860866
return self._get(url, headers=headers).json()
861867

862-
863868
def add_reservation_guests(self,
864869
reservation_id: int,
865870
first_name: str,

0 commit comments

Comments
 (0)