Source code for worldline.acquiring.sdk.v1.domain.get_dcc_rate_request

# -*- coding: utf-8 -*-
#
# This file was automatically generated.
#
from datetime import date
from typing import Optional

from .card_data_for_dcc import CardDataForDcc
from .point_of_sale_data_for_dcc import PointOfSaleDataForDcc
from .transaction_data_for_dcc import TransactionDataForDcc

from worldline.acquiring.sdk.domain.data_object import DataObject


[docs] class GetDccRateRequest(DataObject): __card_payment_data: Optional[CardDataForDcc] = None __operation_id: Optional[str] = None __original_payment_date: Optional[date] = None __point_of_sale_data: Optional[PointOfSaleDataForDcc] = None __rate_reference_id: Optional[str] = None __target_currency: Optional[str] = None __transaction: Optional[TransactionDataForDcc] = None @property def card_payment_data(self) -> Optional[CardDataForDcc]: """ Type: :class:`worldline.acquiring.sdk.v1.domain.card_data_for_dcc.CardDataForDcc` """ return self.__card_payment_data @card_payment_data.setter def card_payment_data(self, value: Optional[CardDataForDcc]) -> None: self.__card_payment_data = value @property def operation_id(self) -> Optional[str]: """ | A globally unique identifier of the operation, generated by you. | We advise you to submit a UUID or an identifier composed of an arbitrary string and a UUID/URL-safe Base64 UUID (RFC 4648 ยง5). | It's used to detect duplicate requests or to reference an operation in technical reversals. Type: str """ return self.__operation_id @operation_id.setter def operation_id(self, value: Optional[str]) -> None: self.__operation_id = value @property def original_payment_date(self) -> Optional[date]: """ | The date of the original payment. Our system will try to return the original rate associated with the provided ``originalPaymentDate``, but it may not always be possible to retrieve the exact original rate. If possible you should use ``rateReferenceId`` instead. Type: date """ return self.__original_payment_date @original_payment_date.setter def original_payment_date(self, value: Optional[date]) -> None: self.__original_payment_date = value @property def point_of_sale_data(self) -> Optional[PointOfSaleDataForDcc]: """ Type: :class:`worldline.acquiring.sdk.v1.domain.point_of_sale_data_for_dcc.PointOfSaleDataForDcc` """ return self.__point_of_sale_data @point_of_sale_data.setter def point_of_sale_data(self, value: Optional[PointOfSaleDataForDcc]) -> None: self.__point_of_sale_data = value @property def rate_reference_id(self) -> Optional[str]: """ | The reference of a previously used rate | This can be used in case of any follow-up action for which you want to reference the original rate. Our system will try to return the original rate associated with the provided ``rateReferenceId``. | | Alternatively you can provide ``originalPaymentDate`` to reference the date of the original payment. Our system will try to return the original rate associated with the provided ``originalPaymentDate``, but it may not always be possible to retrieve the exact original rate. If possible you should use ``rateReferenceId`` instead. Type: str """ return self.__rate_reference_id @rate_reference_id.setter def rate_reference_id(self, value: Optional[str]) -> None: self.__rate_reference_id = value @property def target_currency(self) -> Optional[str]: """ | The currency to convert to Type: str """ return self.__target_currency @target_currency.setter def target_currency(self, value: Optional[str]) -> None: self.__target_currency = value @property def transaction(self) -> Optional[TransactionDataForDcc]: """ Type: :class:`worldline.acquiring.sdk.v1.domain.transaction_data_for_dcc.TransactionDataForDcc` """ return self.__transaction @transaction.setter def transaction(self, value: Optional[TransactionDataForDcc]) -> None: self.__transaction = value
[docs] def to_dictionary(self) -> dict: dictionary = super(GetDccRateRequest, self).to_dictionary() if self.card_payment_data is not None: dictionary['cardPaymentData'] = self.card_payment_data.to_dictionary() if self.operation_id is not None: dictionary['operationId'] = self.operation_id if self.original_payment_date is not None: dictionary['originalPaymentDate'] = DataObject.format_date(self.original_payment_date) if self.point_of_sale_data is not None: dictionary['pointOfSaleData'] = self.point_of_sale_data.to_dictionary() if self.rate_reference_id is not None: dictionary['rateReferenceId'] = self.rate_reference_id if self.target_currency is not None: dictionary['targetCurrency'] = self.target_currency if self.transaction is not None: dictionary['transaction'] = self.transaction.to_dictionary() return dictionary
[docs] def from_dictionary(self, dictionary: dict) -> 'GetDccRateRequest': super(GetDccRateRequest, self).from_dictionary(dictionary) if 'cardPaymentData' in dictionary: if not isinstance(dictionary['cardPaymentData'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['cardPaymentData'])) value = CardDataForDcc() self.card_payment_data = value.from_dictionary(dictionary['cardPaymentData']) if 'operationId' in dictionary: self.operation_id = dictionary['operationId'] if 'originalPaymentDate' in dictionary: self.original_payment_date = DataObject.parse_date(dictionary['originalPaymentDate']) if 'pointOfSaleData' in dictionary: if not isinstance(dictionary['pointOfSaleData'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['pointOfSaleData'])) value = PointOfSaleDataForDcc() self.point_of_sale_data = value.from_dictionary(dictionary['pointOfSaleData']) if 'rateReferenceId' in dictionary: self.rate_reference_id = dictionary['rateReferenceId'] if 'targetCurrency' in dictionary: self.target_currency = dictionary['targetCurrency'] if 'transaction' in dictionary: if not isinstance(dictionary['transaction'], dict): raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['transaction'])) value = TransactionDataForDcc() self.transaction = value.from_dictionary(dictionary['transaction']) return self