Skip to content

Commit

Permalink
Merge pull request #10 from tmconsulting/develop
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
roquie authored May 8, 2018
2 parents 714bf51 + 51099cf commit 2aeef37
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 10 deletions.
27 changes: 27 additions & 0 deletions onelya_sdk/aeroexpress/reservation/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ def __init__(self, document_number: str, document_type: DocumentType, first_name
self.birth_place = birth_place
self.birthday = birthday

self.json_data = {
'type': self.type,
'document_number': self.document_number,
'document_type': self.document_type,
'first_name': self.first_name,
'last_name': self.last_name,
'sex': self.sex,
'index': self.index,
'middle_name': self.middle_name,
'document_valid_till': self.document_valid_till,
'citizenship_code': self.citizenship_code,
'birth_place': self.birth_place,
'birthday': self.birthday
}


class AeroexpressReservationRequest(object):
def __init__(self, tariff_id: str, departure_date: datetime, passengers: 'list of int', index: int,
Expand All @@ -42,6 +57,18 @@ def __init__(self, tariff_id: str, departure_date: datetime, passengers: 'list o
self.agent_reference_id = agent_reference_id
self.agent_payment_id = agent_payment_id

self.json_data = {
'type': self.type,
'tariff_id': self.tariff_id,
'departure_date': self.departure_date,
'passengers': [item.order_customer_index for item in self.passengers],
'index': self.index,
'schedule_id': self.schedule_id,
'provider_payment_form': self.provider_payment_form,
'agent_reference_id': self.agent_reference_id,
'agent_payment_id': self.agent_payment_id
}


class OrderCustomerDocuments(object):
def __init__(self, order_customer_id: int=None, document_number: str=None, document_type: DocumentType=None,
Expand Down
49 changes: 49 additions & 0 deletions onelya_sdk/railway/reservation/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ def __init__(self, category: RailwayPassengerCategory, order_customer_index: int
self.railway_bonus_cards = railway_bonus_cards
self.is_invalid = is_invalid

self.json_data = {
'category': self.category,
'order_customer_index': self.order_customer_index,
'preferred_adult_tariff_type': self.preferred_adult_tariff_type,
'railway_bonus_cards': self.railway_bonus_cards,
'is_invalid': self.is_invalid
}


class RailwayBonusCardInfo(object):
def __init__(self, card_number: str, car_type: RzhdCardTypes=None):
Expand All @@ -38,6 +46,21 @@ def __init__(self, document_number: str, document_type: DocumentType, first_name
self.birth_place = birth_place
self.birthday = birthday

self.json_data = {
'type': self.type,
'document_number': self.document_number,
'document_type': self.document_type,
'first_name': self.first_name,
'last_name': self.last_name,
'sex': self.sex,
'index': self.index,
'middle_name': self.middle_name,
'document_valid_till': self.document_valid_till,
'citizenship_code': self.citizenship_code,
'birth_place': self.birth_place,
'birthday': self.birthday
}


class RailwayReservationRequest(object):
def __init__(self, origin_code: str, destination_code: str, departure_date: datetime, train_number: str,
Expand Down Expand Up @@ -72,6 +95,32 @@ def __init__(self, origin_code: str, destination_code: str, departure_date: date
self.agent_reference_id = agent_reference_id
self.agent_payment_id = agent_payment_id

self.json_data = {
'type': self.type,
'origin_code': self.origin_code,
'destination_code': self.destination_code,
'departure_date': self.departure_date,
'train_number': self.train_number,
'car_type': self.car_type,
'passengers': [item.json_data for item in self.passengers],
'index': self.index,
'car_number': self.car_number,
'lower_place_quantity': self.lower_place_quantity,
'upper_place_quantity': self.upper_place_quantity,
'cabin_gender_kind': self.cabin_gender_kind,
'car_storey': self.car_storey,
'place_range': self.place_range,
'cabin_place_demands': self.cabin_place_demands,
'set_electronic_registration': self.set_electronic_registration,
'bedding': self.bedding,
'service_class': self.service_class,
'international_service_class': self.international_service_class,
'additional_place_requirements': self.additional_place_requirements,
'provider_payment_form': self.provider_payment_form,
'agent_reference_id': self.agent_reference_id,
'agent_payment_id': self.agent_payment_id
}


class OrderCustomerDocuments(object):
def __init__(self, order_customer_id: int=None, document_number: str=None, document_type: DocumentType=None,
Expand Down
11 changes: 2 additions & 9 deletions onelya_sdk/wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ def __init__(self, json_data):

class StationClarifying(object):
def __init__(self, json_data):
self.station_type = StationType(json_data.get('StationType'))

self.json_data = json_data


class StationType(object):
def __init__(self, json_data):
self.origin = json_data.get('Origin')
self.destination = [StationInfo(station_info) for station_info in json_data.get('Destination')]
self.station_type = json_data.get('StationType')
self.station_options = get_array(json_data.get('StationOptions'), StationInfo)

self.json_data = json_data

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '1.2.2'
__version__ = '1.2.4'

setup(
version=__version__,
Expand Down

0 comments on commit 2aeef37

Please sign in to comment.