Source code for worldline.acquiring.sdk.v1.domain.api_refund_response
# -*- coding: utf-8 -*-
#
# This file was automatically generated.
#
from datetime import datetime
from typing import List, Optional
from .additional_response_data import AdditionalResponseData
from .amount_data import AmountData
from .api_references_for_responses import ApiReferencesForResponses
from .card_payment_data_for_response import CardPaymentDataForResponse
from .emv_data_item import EmvDataItem
from worldline.acquiring.sdk.domain.data_object import DataObject
[docs]
class ApiRefundResponse(DataObject):
    __additional_response_data: Optional[AdditionalResponseData] = None
    __authorization_code: Optional[str] = None
    __card_payment_data: Optional[CardPaymentDataForResponse] = None
    __emv_data: Optional[List[EmvDataItem]] = None
    __operation_id: Optional[str] = None
    __referenced_payment_id: Optional[str] = None
    __references: Optional[ApiReferencesForResponses] = None
    __refund_id: Optional[str] = None
    __responder: Optional[str] = None
    __response_code: Optional[str] = None
    __response_code_category: Optional[str] = None
    __response_code_description: Optional[str] = None
    __status: Optional[str] = None
    __status_timestamp: Optional[datetime] = None
    __total_authorized_amount: Optional[AmountData] = None
    @property
    def additional_response_data(self) -> Optional[AdditionalResponseData]:
        """
        | Additional response data
        Type: :class:`worldline.acquiring.sdk.v1.domain.additional_response_data.AdditionalResponseData`
        """
        return self.__additional_response_data
    @additional_response_data.setter
    def additional_response_data(self, value: Optional[AdditionalResponseData]) -> None:
        self.__additional_response_data = value
    @property
    def authorization_code(self) -> Optional[str]:
        """
        | Authorization approval code
        Type: str
        """
        return self.__authorization_code
    @authorization_code.setter
    def authorization_code(self, value: Optional[str]) -> None:
        self.__authorization_code = value
    @property
    def card_payment_data(self) -> Optional[CardPaymentDataForResponse]:
        """
        Type: :class:`worldline.acquiring.sdk.v1.domain.card_payment_data_for_response.CardPaymentDataForResponse`
        """
        return self.__card_payment_data
    @card_payment_data.setter
    def card_payment_data(self, value: Optional[CardPaymentDataForResponse]) -> None:
        self.__card_payment_data = value
    @property
    def emv_data(self) -> Optional[List[EmvDataItem]]:
        """
        | EMV data of the card as tag/value pairs. It is needed when cardEntryMode is CHIP or CONTACTLESS.
        Type: list[:class:`worldline.acquiring.sdk.v1.domain.emv_data_item.EmvDataItem`]
        """
        return self.__emv_data
    @emv_data.setter
    def emv_data(self, value: Optional[List[EmvDataItem]]) -> None:
        self.__emv_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 referenced_payment_id(self) -> Optional[str]:
        """
        | The identifier of the payment referenced by this refund.
        Type: str
        """
        return self.__referenced_payment_id
    @referenced_payment_id.setter
    def referenced_payment_id(self, value: Optional[str]) -> None:
        self.__referenced_payment_id = value
    @property
    def references(self) -> Optional[ApiReferencesForResponses]:
        """
        | A set of references returned in responses
        Type: :class:`worldline.acquiring.sdk.v1.domain.api_references_for_responses.ApiReferencesForResponses`
        """
        return self.__references
    @references.setter
    def references(self, value: Optional[ApiReferencesForResponses]) -> None:
        self.__references = value
    @property
    def refund_id(self) -> Optional[str]:
        """
        | the ID of the refund
        Type: str
        """
        return self.__refund_id
    @refund_id.setter
    def refund_id(self, value: Optional[str]) -> None:
        self.__refund_id = value
    @property
    def responder(self) -> Optional[str]:
        """
        | The party that originated the response Possible values are:
        
        * WORLDLINE
        * ISSUER
        * SCHEME
        * PARTNER
        Type: str
        """
        return self.__responder
    @responder.setter
    def responder(self, value: Optional[str]) -> None:
        self.__responder = value
    @property
    def response_code(self) -> Optional[str]:
        """
        | Numeric response code, e.g. 0, 5
        Type: str
        """
        return self.__response_code
    @response_code.setter
    def response_code(self, value: Optional[str]) -> None:
        self.__response_code = value
    @property
    def response_code_category(self) -> Optional[str]:
        """
        | Category of response code.
        | Possible values are:
        
        * APPROVED
        * PARTIALLY_APPROVED
        * DECLINED
        Type: str
        """
        return self.__response_code_category
    @response_code_category.setter
    def response_code_category(self, value: Optional[str]) -> None:
        self.__response_code_category = value
    @property
    def response_code_description(self) -> Optional[str]:
        """
        | Description of the response code
        Type: str
        """
        return self.__response_code_description
    @response_code_description.setter
    def response_code_description(self, value: Optional[str]) -> None:
        self.__response_code_description = value
    @property
    def status(self) -> Optional[str]:
        """
        | The status of the payment, refund or credit transfer
        | Possible values are:
        
        * AUTHORIZED
        * NOT_AUTHORIZED
        * PENDING
        * PENDING_CAPTURE
        * CONFIRMED
        * REVERSED
        * CANCELLED
        Type: str
        """
        return self.__status
    @status.setter
    def status(self, value: Optional[str]) -> None:
        self.__status = value
    @property
    def status_timestamp(self) -> Optional[datetime]:
        """
        | Timestamp of the status in format yyyy-MM-ddTHH:mm:ssZ
        Type: datetime
        """
        return self.__status_timestamp
    @status_timestamp.setter
    def status_timestamp(self, value: Optional[datetime]) -> None:
        self.__status_timestamp = value
    @property
    def total_authorized_amount(self) -> Optional[AmountData]:
        """
        | Amount for the operation.
        Type: :class:`worldline.acquiring.sdk.v1.domain.amount_data.AmountData`
        """
        return self.__total_authorized_amount
    @total_authorized_amount.setter
    def total_authorized_amount(self, value: Optional[AmountData]) -> None:
        self.__total_authorized_amount = value
[docs]
    def to_dictionary(self) -> dict:
        dictionary = super(ApiRefundResponse, self).to_dictionary()
        if self.additional_response_data is not None:
            dictionary['additionalResponseData'] = self.additional_response_data.to_dictionary()
        if self.authorization_code is not None:
            dictionary['authorizationCode'] = self.authorization_code
        if self.card_payment_data is not None:
            dictionary['cardPaymentData'] = self.card_payment_data.to_dictionary()
        if self.emv_data is not None:
            dictionary['emvData'] = []
            for element in self.emv_data:
                if element is not None:
                    dictionary['emvData'].append(element.to_dictionary())
        if self.operation_id is not None:
            dictionary['operationId'] = self.operation_id
        if self.referenced_payment_id is not None:
            dictionary['referencedPaymentId'] = self.referenced_payment_id
        if self.references is not None:
            dictionary['references'] = self.references.to_dictionary()
        if self.refund_id is not None:
            dictionary['refundId'] = self.refund_id
        if self.responder is not None:
            dictionary['responder'] = self.responder
        if self.response_code is not None:
            dictionary['responseCode'] = self.response_code
        if self.response_code_category is not None:
            dictionary['responseCodeCategory'] = self.response_code_category
        if self.response_code_description is not None:
            dictionary['responseCodeDescription'] = self.response_code_description
        if self.status is not None:
            dictionary['status'] = self.status
        if self.status_timestamp is not None:
            dictionary['statusTimestamp'] = DataObject.format_datetime(self.status_timestamp)
        if self.total_authorized_amount is not None:
            dictionary['totalAuthorizedAmount'] = self.total_authorized_amount.to_dictionary()
        return dictionary 
[docs]
    def from_dictionary(self, dictionary: dict) -> 'ApiRefundResponse':
        super(ApiRefundResponse, self).from_dictionary(dictionary)
        if 'additionalResponseData' in dictionary:
            if not isinstance(dictionary['additionalResponseData'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['additionalResponseData']))
            value = AdditionalResponseData()
            self.additional_response_data = value.from_dictionary(dictionary['additionalResponseData'])
        if 'authorizationCode' in dictionary:
            self.authorization_code = dictionary['authorizationCode']
        if 'cardPaymentData' in dictionary:
            if not isinstance(dictionary['cardPaymentData'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['cardPaymentData']))
            value = CardPaymentDataForResponse()
            self.card_payment_data = value.from_dictionary(dictionary['cardPaymentData'])
        if 'emvData' in dictionary:
            if not isinstance(dictionary['emvData'], list):
                raise TypeError('value \'{}\' is not a list'.format(dictionary['emvData']))
            self.emv_data = []
            for element in dictionary['emvData']:
                value = EmvDataItem()
                self.emv_data.append(value.from_dictionary(element))
        if 'operationId' in dictionary:
            self.operation_id = dictionary['operationId']
        if 'referencedPaymentId' in dictionary:
            self.referenced_payment_id = dictionary['referencedPaymentId']
        if 'references' in dictionary:
            if not isinstance(dictionary['references'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['references']))
            value = ApiReferencesForResponses()
            self.references = value.from_dictionary(dictionary['references'])
        if 'refundId' in dictionary:
            self.refund_id = dictionary['refundId']
        if 'responder' in dictionary:
            self.responder = dictionary['responder']
        if 'responseCode' in dictionary:
            self.response_code = dictionary['responseCode']
        if 'responseCodeCategory' in dictionary:
            self.response_code_category = dictionary['responseCodeCategory']
        if 'responseCodeDescription' in dictionary:
            self.response_code_description = dictionary['responseCodeDescription']
        if 'status' in dictionary:
            self.status = dictionary['status']
        if 'statusTimestamp' in dictionary:
            self.status_timestamp = DataObject.parse_datetime(dictionary['statusTimestamp'])
        if 'totalAuthorizedAmount' in dictionary:
            if not isinstance(dictionary['totalAuthorizedAmount'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['totalAuthorizedAmount']))
            value = AmountData()
            self.total_authorized_amount = value.from_dictionary(dictionary['totalAuthorizedAmount'])
        return self