Exemplo n.º 1
0
 def __init__(self, three_ds_method_xml):
     self.three_ds_mtd_url = get_tag_value(
         three_ds_method_xml, TagConstants.getThreeDSMtdUrlTag())
     self.three_ds_method_data = get_tag_value(
         three_ds_method_xml, TagConstants.getThreeDSMtdDataTag())
     self.three_ds_tran_id = get_tag_value(
         three_ds_method_xml, TagConstants.getThreeDSTransactionIDTag())
Exemplo n.º 2
0
 def __init__(self, three_ds_challenge):
     self.acs_url = get_tag_value(three_ds_challenge,
                                  TagConstants.getACSUrlTag())
     self.creq = get_tag_value(three_ds_challenge,
                               TagConstants.getCreqTag())
     self.three_ds_tran_id = get_tag_value(
         three_ds_challenge, TagConstants.getThreeDSTransactionIDTag())
Exemplo n.º 3
0
 def __init__(self, pan_alias_xml):
     self.pan_alias = get_tag_value(pan_alias_xml,
                                    TagConstants.getCreatePanAliasTag())
     self.pan_alias_rev = get_tag_value(pan_alias_xml,
                                        TagConstants.getPanAliasRevTag())
     self.pan_alias_exp_date = get_tag_value(
         pan_alias_xml, TagConstants.getPanExpiryDateTag())
     self.pan_alias_tail = get_tag_value(pan_alias_xml,
                                         TagConstants.getPanTailTag())
Exemplo n.º 4
0
def getThreeDSMtdStringForMac(three_ds_mtd_xml):
    stringForMac = three_ds_mtd_xml.find(
        TagConstants.getThreeDSTransactionIDTag()).text
    stringForMac = append_field_for_verification(
        stringForMac,
        three_ds_mtd_xml.find(TagConstants.getThreeDSMtdDataTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        three_ds_mtd_xml.find(TagConstants.getThreeDSMtdUrlTag()).text)
    return stringForMac
def map_order_status_response(response):
    response_xml = Utils.stringToXML(response)
    response_status = OrderStatusResponse()
    response_status.timestamp = get_tag_value(response_xml,
                                              TagConstants.getTimestampTag())

    response_status.result = get_tag_value(response_xml,
                                           TagConstants.getResultTag())

    data = response_xml.find(TagConstants.getDataTag())
    if (data is not None) and (data.find(TagConstants.getAuthorizationTag())
                               is not None):
        for auth_xml in data.findall(TagConstants.getAuthorizationTag()):
            auth_dto = Authorization(auth_xml)
            response_status.auth_list.append(auth_dto)

    if (data is not None) and (data.find(TagConstants.getPanAliasDataTag())
                               is not None):
        pan_alias_xml = PanAliasData(
            data.find(TagConstants.getPanAliasDataTag()))
        response_status.pan_alias_data = pan_alias_xml

    if (data is not None) and (data.find(TagConstants.getCardHolderDataTag())
                               is not None):
        card_holder_data_xml = CardHolderData(
            data.find(TagConstants.getCardHolderDataTag()))
        response_status.card_holder_info = card_holder_data_xml

    return response_status
def map_three_ds_authorize1(response):
    response_xml = Utils.stringToXML(response)
    response = ThreeDSAuthorize1Response()
    response.timestamp = get_tag_value(response_xml,
                                       TagConstants.getTimestampTag())
    response.result = get_tag_value(response_xml, TagConstants.getResultTag())
    data = response_xml.find(TagConstants.getDataTag())

    if (data is not None) and (data.find(TagConstants.getAuthorizationTag())
                               is not None):
        operation_xml = data.find(TagConstants.getAuthorizationTag())
        operation = Authorization(operation_xml)
        response.operation = operation

    if (data is not None) and (data.find(TagConstants.getPanAliasDataTag())
                               is not None):
        pan_alias_xml = PanAliasData(
            data.find(TagConstants.getPanAliasDataTag()))
        response.pan_alias_data = pan_alias_xml

    if (data is not None) and (data.find(TagConstants.getThreeDSChallengeTag())
                               is not None):
        three_ds_challenge_xml = ThreeDSChallenge(
            data.find(TagConstants.getThreeDSChallengeTag()))
        response.three_DS_Challenge = three_ds_challenge_xml

    return response
Exemplo n.º 7
0
def getChallengeStringForMac(challengeXml):
    stringForMac = challengeXml.find(
        TagConstants.getThreeDSTransactionIDTag()).text
    stringForMac = append_field_for_verification(
        stringForMac,
        challengeXml.find(TagConstants.getCreqTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        challengeXml.find(TagConstants.getACSUrlTag()).text)

    return stringForMac
def map_operation_response(response_operation):
    response_xml = Utils.stringToXML(response_operation)
    response_operation = OperationResponse()
    response_operation.timestamp = get_tag_value(
        response_xml, TagConstants.getTimestampTag())
    response_operation.result = get_tag_value(response_xml,
                                              TagConstants.getResultTag())
    data = response_xml.find(TagConstants.getDataTag())

    if (data is not None) and (data.find(TagConstants.getOperationTag())
                               is not None):
        operation_xml = data.find(TagConstants.getOperationTag())
        operation = Operation(operation_xml)
        response_operation.operation = operation

    return response_operation
Exemplo n.º 9
0
def getPanAliasDataStringForMac(pan_alias_xml):
    tail = pan_alias_xml.find(TagConstants.getPanAliasRevTag())

    if tail is None:
        stringForMac = "&"
    else:
        stringForMac = tail.text
    stringForMac = append_field_for_verification(
        stringForMac,
        pan_alias_xml.find(TagConstants.getPanAliasTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        pan_alias_xml.find(TagConstants.getPanExpiryDateTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        pan_alias_xml.find(TagConstants.getPanAliasTailTag()).text)
    return stringForMac
Exemplo n.º 10
0
 def __init__(self, operation_xml):
     self.transaction_id = get_tag_value(operation_xml,
                                         TagConstants.getTransactionIDTag())
     self.timestamp_req = get_tag_value(operation_xml,
                                        TagConstants.getTimestampReqTag())
     self.timestamp_elab = get_tag_value(operation_xml,
                                         TagConstants.getTimestampElabTag())
     self.src_type = get_tag_value(operation_xml,
                                   TagConstants.getSrcTypeTag())
     self.amount = get_tag_value(operation_xml, TagConstants.getAmountTag())
     self.result = get_tag_value(operation_xml, TagConstants.getResultTag())
     self.status = get_tag_value(operation_xml, TagConstants.getStatusTag())
     self.op_descr = get_tag_value(operation_xml,
                                   TagConstants.getOpDescrTag())
     self.operation = get_tag_value(operation_xml,
                                    TagConstants.getOperationTag())
     auth = operation_xml.find(TagConstants.getAuthorizationTag())
     if auth is not None:
         self.authorization = Authorization(auth)
Exemplo n.º 11
0
 def __init__(self, card_holder_info_xml):
     self.card_holder_name = get_tag_value(
         card_holder_info_xml, TagConstants.getCardHolderNameTag())
     self.card_holder_email = get_tag_value(
         card_holder_info_xml, TagConstants.getCardHolderEmailTag())
     self.billing_address_postal_code = get_tag_value(
         card_holder_info_xml,
         TagConstants.getBillingAddressPostalcodeTag())
     self.billing_address_city = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressCityTag())
     self.billing_address_line_1 = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressLine1Tag())
     self.billing_address_line_2 = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressLine2Tag())
     self.billing_address_line_3 = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressLine3Tag())
     self.billing_address_state = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressStateTag())
     self.billing_address_country = get_tag_value(
         card_holder_info_xml, TagConstants.getBillingAddressCountryTag())
Exemplo n.º 12
0
    def build_request(self, api_result_key, digest_mode):
        request = self.get_request_base_xml(
            self._operation, TagConstants.getThreeDSAuthorizationRequest1Tag())
        authorization3DS = request.find(TagConstants.getDataTag()).find(
            TagConstants.getThreeDSAuthorizationRequest1Tag())

        Utils.addChild(authorization3DS,
                       TagConstants.getThreeDSTransactionIDTag(),
                       self._three_DS_trans_id)
        Utils.addChild(authorization3DS,
                       TagConstants.getThreeDSMtdComplIndTag(),
                       self._three_DS_Mtd_compl_ind)
        mac = request.find(TagConstants.getRequestTag()).find(
            TagConstants.getMACTag())
        mac.text = Encoder.get_mac(self._string_for_mac(), api_result_key,
                                   digest_mode)
        return ET.tostring(request, "utf-8", method='xml')
Exemplo n.º 13
0
    def build_request(self, api_result_key, digest_mode):
        request = self.get_request_base_xml(self._operation,
                                            TagConstants.getOrderStatusTag())
        # set order_id <order_id>
        orderStatus = request.find(TagConstants.getDataTag()).find(
            TagConstants.getOrderStatusTag())
        Utils.addChild(orderStatus, TagConstants.getOrderIDTag(),
                       self._order_id)
        # set optional field if present
        if self._product_ref is not None:
            Utils.addChild(orderStatus, TagConstants.getProductRefTag(),
                           self._product_ref)
        if self._options is not None:
            Utils.addChild(orderStatus, TagConstants.getOptionsTag(),
                           self._options)

        # Calculate and set Mac
        mac = request.find(TagConstants.getRequestTag()).find(
            TagConstants.getMACTag())
        mac.text = Encoder.get_mac(self._string_for_mac(), api_result_key,
                                   digest_mode)
        return ET.tostring(request, "utf-8", method='xml')
Exemplo n.º 14
0
def getOperationStringForMac(operationXml):
    stringForMac = operationXml.find(TagConstants.getTransactionIDTag()).text
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getTimestampReqTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getTimestampElabTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getSrcTypeTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getAmountTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getResultTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        operationXml.find(TagConstants.getStatusTag()).text)
    return append_optional_field_for_verification(
        stringForMac, operationXml.find(TagConstants.getOpDescrTag()))
def map_authorize_response(response):
    response_xml = Utils.stringToXML(response)
    response_authorize = AuthorizeResponse()
    response_authorize.timestamp = get_tag_value(
        response_xml, TagConstants.getTimestampTag())
    response_authorize.result = get_tag_value(response_xml,
                                              TagConstants.getResultTag())
    data = response_xml.find(TagConstants.getDataTag())
    if (data is not None) and (data.find(TagConstants.getAuthorizationTag())
                               is not None):
        auth_dto = Authorization(data.find(TagConstants.getAuthorizationTag()))
        response_authorize.authorization = auth_dto

    if (data is not None) and (data.find(TagConstants.getPanAliasDataTag())
                               is not None):
        pan_alias_xml = PanAliasData(
            data.find(TagConstants.getPanAliasDataTag()))
        response_authorize.pan_alias_data = pan_alias_xml

    return response_authorize
def map_three_ds_authorize2(response_ThreeDS):
    response_xml = Utils.stringToXML(response_ThreeDS)
    response_ThreeDS = ThreeDSAuthorize2Response()
    response_ThreeDS.timestamp = get_tag_value(response_xml,
                                               TagConstants.getTimestampTag())
    response_ThreeDS.result = get_tag_value(response_xml,
                                            TagConstants.getResultTag())
    data = response_xml.find(TagConstants.getDataTag())

    if (data is not None) and (data.find(TagConstants.getAuthorizationTag())
                               is not None):
        operation_xml = data.find(TagConstants.getAuthorizationTag())
        operation = Authorization(operation_xml)
        response_ThreeDS.operation = operation

    if (data is not None) and (data.find(TagConstants.getPanAliasDataTag())
                               is not None):
        pan_alias_xml = PanAliasData(
            data.find(TagConstants.getPanAliasDataTag()))
        response_ThreeDS.pan_alias_data = pan_alias_xml

    return response_ThreeDS
Exemplo n.º 17
0
 def __init__(self, authorization_xml):
     self.payment_type = get_tag_value(authorization_xml,
                                       TagConstants.getPaymentTypeTag())
     self.authorization_type = get_tag_value(
         authorization_xml, TagConstants.getAuthorizationTypeTag())
     self.transaction_ID = get_tag_value(authorization_xml,
                                         TagConstants.getTransactionIDTag())
     self.network = get_tag_value(authorization_xml,
                                  TagConstants.getNetworkTag())
     self.order_ID = get_tag_value(authorization_xml,
                                   TagConstants.getOrderIDTag())
     self.transaction_amount = get_tag_value(
         authorization_xml, TagConstants.getTransactionAmountTag())
     self.authorized_amount = get_tag_value(
         authorization_xml, TagConstants.getAuthorizedAmountTag())
     self.refunded_amount = get_tag_value(
         authorization_xml, TagConstants.getRefundedAmountTag())
     self.transaction_result = get_tag_value(
         authorization_xml, TagConstants.getTransactionResultTag())
     self.timestamp = get_tag_value(authorization_xml,
                                    TagConstants.getTimestampTag())
     self.authorization_number = get_tag_value(
         authorization_xml, TagConstants.getAuthorizationNumberTag())
     self.acquire_BIN = get_tag_value(authorization_xml,
                                      TagConstants.getAcquirerBinTag())
     self.merchant_ID = get_tag_value(authorization_xml,
                                      TagConstants.getMerchantIdTag())
     self.transaction_status = get_tag_value(
         authorization_xml, TagConstants.getTransactionStatusTag())
     self.response_code_ISO = get_tag_value(
         authorization_xml, TagConstants.getResponseCodeIsoTag())
     self.pan_tail = get_tag_value(authorization_xml,
                                   TagConstants.getPanTailTag())
     self.pan_expiry_date = get_tag_value(
         authorization_xml, TagConstants.getPanExpiryDateTag())
     self.payment_type_PP = get_tag_value(
         authorization_xml, TagConstants.getPaymentTypePPTag())
     self.rRN = get_tag_value(authorization_xml, TagConstants.getRRNTag())
     self.card_type = get_tag_value(authorization_xml,
                                    TagConstants.getCardType())
     self.card_holder_info = get_tag_value(
         authorization_xml, TagConstants.getCardHolderInfoTag())
     self.installments_number = get_tag_value(
         authorization_xml, TagConstants.getInstallmentsNumberTag())
     self.tickler_merchant_code = get_tag_value(
         authorization_xml, TagConstants.getTicklerMerchantCodeTag())
     self.tickler_plan_code = get_tag_value(
         authorization_xml, TagConstants.getTicklerPlanCodeTag())
     self.tickler_subscription_code = get_tag_value(
         authorization_xml, TagConstants.getTicklerSubscriptionCodeTag())
Exemplo n.º 18
0
def getAuthorizationStringForMac(authorizationXml):
    stringForMac = authorizationXml.find(
        TagConstants.getAuthorizationTypeTag()).text
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTransactionIDTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getNetworkTag()).text)

    if authorizationXml.find(TagConstants.getOrderIDTag()) is not None:
        stringForMac = append_field_for_verification(
            stringForMac,
            authorizationXml.find(TagConstants.getOrderIDTag()).text)
    else:
        stringForMac = append_field_for_verification(
            stringForMac,
            authorizationXml.find(TagConstants.getOrderIdTag()).text)

    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTransactionAmountTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getAuthorizedAmountTag()).text)

    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getCurrencyTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getAccountedAmountTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getRefundedAmountTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTransactionResultTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTimestampTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getAuthorizationNumberTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getAcquirerBinTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getMerchantIdTag()).text)
    stringForMac = append_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTransactionStatusTag()).text)
    # OPTIONAL
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getResponseCodeIsoTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac, authorizationXml.find(TagConstants.getPanTailTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getPanExpiryDateTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getPaymentTypePPTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac, authorizationXml.find(TagConstants.getRRNTag()))

    stringForMac = append_optional_field_for_verification(
        stringForMac, authorizationXml.find(TagConstants.getCardType()))

    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getCardHolderInfoTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getInstallmentsNumberTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTicklerMerchantCodeTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTicklerPlanCodeTag()))
    stringForMac = append_optional_field_for_verification(
        stringForMac,
        authorizationXml.find(TagConstants.getTicklerSubscriptionCodeTag()))

    return stringForMac
Exemplo n.º 19
0
def geResultStringForMac(responseXml):
    return responseXml.find(
        TagConstants.getTimestampTag()).text + '&' + responseXml.find(
            TagConstants.getResultTag()).text
Exemplo n.º 20
0
    def build_request(self, api_result_key, digest_mode):
        request = self.get_request_base_xml(
            self._operation, TagConstants.getAuthorizationRequestTag())
        authorization = request.find(TagConstants.getDataTag()).find(
            TagConstants.getAuthorizationRequestTag())

        Utils.addChild(authorization, TagConstants.getOrderIDTag(),
                       self._order_id)
        Utils.addChild(authorization, TagConstants.getPanTag(), self._pan)
        Utils.addChild(authorization, TagConstants.getExpDateTag(),
                       self._exp_date)
        Utils.addChild(authorization, TagConstants.getAmountTag(),
                       self._amount)
        Utils.addChild(authorization, TagConstants.getCurrencyTag(),
                       self._currency)
        Utils.addOptionalChild(authorization, TagConstants.getExponentTag(),
                               self._exponent)
        Utils.addChild(authorization, TagConstants.getAccountingModeTag(),
                       self._accounting_mode)
        Utils.addChild(authorization, TagConstants.getNetworkTag(),
                       self._network)

        # OPTIONAL CHILD
        Utils.addOptionalChild(authorization, TagConstants.getCVV2Tag(),
                               self._cvv2)
        Utils.addOptionalChild(authorization, TagConstants.getEmailCHTag(),
                               self._email_ch)
        Utils.addOptionalChild(authorization, TagConstants.getUseridTag(),
                               self._user_id)
        Utils.addOptionalChild(authorization, TagConstants.getAcquirerTag(),
                               self._acquirer)
        Utils.addOptionalChild(authorization, TagConstants.getIpAddressTag(),
                               self._ip_address)
        Utils.addOptionalChild(authorization,
                               TagConstants.getUserAuthFlagTag(),
                               self._usr_auth_flag)

        Utils.addOptionalChild(authorization, TagConstants.getOpDescrTag(),
                               self._op_descr)
        Utils.addOptionalChild(authorization, TagConstants.getOptionsTag(),
                               self._options)
        Utils.addOptionalChild(authorization, TagConstants.getAntiFraudTag(),
                               self._anti_fraud)
        Utils.addOptionalChild(authorization, TagConstants.getProductRefTag(),
                               self._product_ref)
        Utils.addOptionalChild(authorization, TagConstants.getNameTag(),
                               self._name)
        Utils.addOptionalChild(authorization, TagConstants.getSurnameTag(),
                               self._surname)

        Utils.addOptionalChild(authorization, TagConstants.getTaxIDTag(),
                               self._tax_id)
        Utils.addOptionalChild(authorization, TagConstants.getTRecurrTag(),
                               self._tRecurr)
        Utils.addOptionalChild(authorization, TagConstants.getCRecurrTag(),
                               self._cRecurr)
        Utils.addOptionalChild(authorization,
                               TagConstants.getInstallmentsNumberTag(),
                               self._installments_number)

        Utils.addOptionalChild(authorization,
                               TagConstants.getCreatePanAliasTag(),
                               self._create_pan_alias)

        mac = request.find(TagConstants.getRequestTag()).find(
            TagConstants.getMACTag())
        mac.text = Encoder.get_mac(self._string_for_mac(), api_result_key,
                                   digest_mode)
        return ET.tostring(request, "utf-8", method='xml')
Exemplo n.º 21
0
 def build_request(self, api_result_key, digest_mode):
     request = self.get_request_base_xml(self._operation,
                                         TagConstants.getRefundRequestTag())
     refundRequest = request.find(TagConstants.getDataTag()).find(
         TagConstants.getRefundRequestTag())
     Utils.addChild(refundRequest, TagConstants.getTransactionIDTag(),
                    self._transaction_id)
     Utils.addChild(refundRequest, TagConstants.getOrderIDTag(),
                    self._order_id)
     Utils.addChild(refundRequest, TagConstants.getAmountTag(),
                    self._amount)
     Utils.addChild(refundRequest, TagConstants.getCurrencyTag(),
                    self._currency)
     if self._exponent is not None:
         Utils.addChild(refundRequest, TagConstants.getExponentTag(),
                        self._exponent)
     if self._op_descr is not None:
         Utils.addChild(refundRequest, TagConstants.getOpDescrTag(),
                        self._op_descr)
     if self._options is not None:
         Utils.addChild(refundRequest, TagConstants.getOptionsTag(),
                        self._options)
     mac = request.find(TagConstants.getRequestTag()).find(
         TagConstants.getMACTag())
     mac.text = Encoder.get_mac(self._string_for_mac(), api_result_key,
                                digest_mode)
     return ET.tostring(request, "utf-8", method='xml')
Exemplo n.º 22
0
 def get_request_base_xml(self, operation, operation_Tag):
     requestDict = OrderedDict()
     requestDict[TagConstants.getReleaseTag()] = Constants.getRelease()
     requestDict[TagConstants.getRequestTag()] = ""
     requestDict[TagConstants.getDataTag()] = ""
     request = Utils.dict_to_xml(TagConstants.getBPWXmlRequestTag(),
                                 requestDict)
     # Request <Request>
     Utils.addChild(request.find(TagConstants.getRequestTag()),
                    TagConstants.getOperationTag(), operation)
     Utils.addChild(request.find(TagConstants.getRequestTag()),
                    TagConstants.getTimestampTag(), self._timestamp)
     mac = Utils.addChild(request.find(TagConstants.getRequestTag()),
                          TagConstants.getMACTag(), None)
     # Data <Data>
     operation = Utils.addChild(request.find(TagConstants.getDataTag()),
                                operation_Tag, None)
     # OrderStatus
     header = Utils.addChild(operation, TagConstants.getHeaderTag(), None)
     # Header
     Utils.addChild(header, TagConstants.getShopIDTag(), self._shop_id)
     Utils.addChild(header, TagConstants.getOperatorIDTag(),
                    self._operator_id)
     Utils.addChild(header, TagConstants.getReqRefNumTag(), self._reqRefNum)
     return request
def map_three_ds_authorize0(response_threeDS):
    response_xml = Utils.stringToXML(response_threeDS)
    response_threeDS = ThreeDSAuthorize0Response()
    response_threeDS.timestamp = get_tag_value(response_xml,
                                               TagConstants.getTimestampTag())
    response_threeDS.result = get_tag_value(response_xml,
                                            TagConstants.getResultTag())
    data = response_xml.find(TagConstants.getDataTag())

    if (data is not None) and (data.find(TagConstants.getAuthorizationTag())
                               is not None):
        authorization_xml = data.find(TagConstants.getAuthorizationTag())
        authorization = Authorization(authorization_xml)
        response_threeDS.authorization = authorization

    if (data is not None) and (data.find(TagConstants.getPanAliasDataTag())
                               is not None):
        pan_alias_xml = PanAliasData(
            data.find(TagConstants.getPanAliasDataTag()))
        response_threeDS.pan_alias_data = pan_alias_xml

    if (data is not None) and (data.find(TagConstants.getThreeDSMtdTag())
                               is not None):
        three_ds_mtd_xml = ThreeDSMethod(
            data.find(TagConstants.getThreeDSMtdTag()))
        response_threeDS.three_DS_Method = three_ds_mtd_xml

    if (data is not None) and (data.find(TagConstants.getThreeDSChallengeTag())
                               is not None):
        three_ds_challenge_xml = ThreeDSChallenge(
            data.find(TagConstants.getThreeDSChallengeTag()))
        response_threeDS.three_DS_Challenge = three_ds_challenge_xml

    return response_threeDS