Пример #1
0
    def build_request(self, api_result_key, digest_mode):
        request = self.get_request_base_xml(
            self._operation, TagConstants.getThreeDSAuthorizationRequest2Tag())
        authorization3DS = request.find(TagConstants.getDataTag()).find(
            TagConstants.getThreeDSAuthorizationRequest2Tag())

        Utils.addChild(authorization3DS,
                       TagConstants.getThreeDSTransactionIDTag(),
                       self._three_DS_trans_id)
        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')
Пример #2
0
 def _string_for_mac(self):
     macString = Constants.getOperationName() + "=" + str(self._operation)
     macString = Utils.appendField(macString, Constants.getTimestampName(),
                                   self._timestamp)
     macString = Utils.appendField(macString, Constants.getShopIdName(),
                                   self._shop_id)
     macString = Utils.appendField(macString, Constants.getOperatorIdName(),
                                   self._operator_id)
     macString = Utils.appendField(macString, Constants.getReqRefNumName(),
                                   self._reqRefNum)
     macString = Utils.appendField(macString,
                                   Constants.getThreeDSTransIdName(),
                                   self._three_DS_trans_id)
     return macString
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
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_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
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
Пример #7
0
 def _string_for_mac(self):
     macString = str()
     macString = Constants.getOperationName() + "=" + str(self._operation)
     macString = Utils.appendField(macString, Constants.getTimestampName(),
                                   self._timestamp)
     macString = Utils.appendField(macString, Constants.getShopIdName(),
                                   self._shop_id)
     macString = Utils.appendField(macString, Constants.getOperatorIdName(),
                                   self._operator_id)
     macString = Utils.appendField(macString, Constants.getReqRefNumName(),
                                   self._reqRefNum)
     macString = Utils.appendField(macString, Constants.getOrderIdName(),
                                   self._order_id)
     macString = Utils.appendField(macString, Constants.getOptionsName(),
                                   self._options)
     macString = Utils.appendField(macString, Constants.getProductRefName(),
                                   self._product_ref)
     return macString
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
Пример #10
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')
Пример #11
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')
Пример #12
0
    def _string_for_mac(self, apiKey):
        macString = Constants.getUrlMsName() + "=" + self._url_ms
        macString = Utils.appendField(macString, Constants.getUrlDoneName(),
                                      self._url_done)
        macString = Utils.appendField(macString, Constants.getOrderIdName(),
                                      self._order_id)
        macString = Utils.appendField(macString, Constants.getShopIdName(),
                                      self._shop_id)
        macString = Utils.appendField(macString, Constants.getAmountName(),
                                      self._amount)
        macString = Utils.appendField(macString, Constants.getCurrencyName(),
                                      self._currency)
        macString = Utils.appendField(macString, Constants.getExponentName(),
                                      self._exponent)
        macString = Utils.appendField(macString,
                                      Constants.getAccountingModeName(),
                                      self._accounting_mode)
        macString = Utils.appendField(macString, Constants.getAuthorModeName(),
                                      self._author_mode)
        macString = Utils.appendField(macString, Constants.getOptionsName(),
                                      self._options)

        if self._options is not None and "B" in self._options:
            macString = Utils.appendField(macString, Constants.getNameName(),
                                          self._name)
            macString = Utils.appendField(macString,
                                          Constants.getSurnameName(),
                                          self._surname)

        macString = Utils.appendField(macString, Constants.getTaxIdName(),
                                      self._tax_id)
        macString = Utils.appendField(macString, Constants.getLockCardName(),
                                      self._lock_card)

        if self._options is not None and "F" in self._options:
            macString = Utils.appendField(macString, Constants.getCommisName(),
                                          self._commis)

        if self._options is not None and ("O" in self._options
                                          or "V" in self._options):
            macString = Utils.appendField(macString,
                                          Constants.getOrdDescrName(),
                                          self._ord_descr)

        macString = Utils.appendField(macString, Constants.getVSIDName(),
                                      self._VSID)
        macString = Utils.appendField(macString, Constants.getOpDescrName(),
                                      self._op_descr)

        if self._options is not None and "D" in self._options:
            macString = Utils.appendField(macString,
                                          Constants.getRemainingDurationName(),
                                          self._remaining_duration)

        macString = Utils.appendField(macString, Constants.getUserIdName(),
                                      self._userId)
        macString = Utils.appendField(macString, Constants.getBBPostepayName(),
                                      self._bb_poste_pay)
        macString = Utils.appendField(macString, Constants.getBPCardsName(),
                                      self._bp_cards)

        if self._network is not None and "91" in self._network:
            macString = Utils.appendField(macString,
                                          Constants.getPhoneNumberName(),
                                          self._phone_number)
            macString = Utils.appendField(macString,
                                          Constants.getCausationName(),
                                          self._causation)
            macString = Utils.appendField(macString, Constants.getUserName(),
                                          self._user)

        macString = Utils.appendField(macString, Constants.getProductRefName(),
                                      self._product_ref)
        macString = Utils.appendField(macString, Constants.getAntiFraudName(),
                                      self._anti_fraud)

        if self._data_3DS_json is not None:
            macString = Utils.appendField(
                macString, Constants.get3DSJsonDataName(),
                AES.AES_encrypt(self._data_3DS_json, apiKey))

        macString = Utils.appendField(macString, Constants.getTrecurrName(),
                                      self._t_recurr)
        macString = Utils.appendField(macString, Constants.getCrecurrName(),
                                      self._c_recurr)
        macString = Utils.appendField(macString,
                                      Constants.getInstallmentsNumberName(),
                                      self._installments_number)

        macString = Utils.appendField(macString, Constants.getTokenName(),
                                      self._token)
        macString = Utils.appendField(macString, Constants.getExpDateName(),
                                      self._exp_date)
        macString = Utils.appendField(macString, Constants.getNetworkName(),
                                      self._network)
        macString = Utils.appendField(macString, Constants.getIBANName(),
                                      self._iban)
        return macString
Пример #13
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')
Пример #14
0
    def _string_for_mac(self, api_result_key):
        macString = Constants.getOperationName() + "=" + str(self._operation)
        macString = Utils.appendField(macString, Constants.getTimestampName(),
                                      self._timestamp)
        macString = Utils.appendField(macString, Constants.getShopIdName(),
                                      self._shop_id)
        macString = Utils.appendField(macString, Constants.getOrderIdName(),
                                      self._order_id)
        macString = Utils.appendField(macString, Constants.getOperatorIdName(),
                                      self._operator_id)
        macString = Utils.appendField(macString, Constants.getReqRefNumName(),
                                      self._reqRefNum)
        macString = Utils.appendField(macString, Constants.getPanName(),
                                      self._pan)
        macString = Utils.appendField(macString, Constants.getCvv2Name(),
                                      self._cvv2)
        macString = Utils.appendField(macString, Constants.getExpDateName(),
                                      self._exp_date)

        macString = Utils.appendField(macString, Constants.getAmountName(),
                                      self._amount)
        macString = Utils.appendField(macString, Constants.getCurrencyName(),
                                      self._currency)
        macString = Utils.appendField(macString, Constants.getExponentName(),
                                      self._exponent)
        macString = Utils.appendField(macString,
                                      Constants.getAccountingModeName(),
                                      self._accounting_mode)

        macString = Utils.appendField(macString, Constants.getNetworkName(),
                                      self._network)
        macString = Utils.appendField(macString, Constants.getEmailChName(),
                                      self._email_ch)
        macString = Utils.appendField(macString, Constants.getUserIdName(),
                                      self._user_id)
        macString = Utils.appendField(macString, Constants.getAcquirerName(),
                                      self._acquirer)
        macString = Utils.appendField(macString, Constants.getIpAddressName(),
                                      self._ip_address)
        macString = Utils.appendField(macString, Constants.getOpDescrName(),
                                      self._op_descr)
        macString = Utils.appendField(macString,
                                      Constants.getUsrAuthFlagName(),
                                      self._usr_auth_flag)
        macString = Utils.appendField(macString, Constants.getOptionsName(),
                                      self._options)
        macString = Utils.appendField(macString, Constants.getAntiFraudName(),
                                      self._anti_fraud)

        macString = Utils.appendField(macString, Constants.getProductRefName(),
                                      self._product_ref)
        macString = Utils.appendField(macString, Constants.getNameName(),
                                      self._name)
        macString = Utils.appendField(macString, Constants.getSurnameName(),
                                      self._surname)
        macString = Utils.appendField(macString, Constants.getTaxIdName(),
                                      self._tax_id)

        macString = Utils.appendField(
            macString, Constants.getThreeDSDataName(),
            AES.AES_encrypt(self._three_ds_data, api_result_key))
        macString = Utils.appendField(macString, Constants.getNameCHName(),
                                      self._name_ch)
        macString = Utils.appendField(macString, Constants.getNotifUrl(),
                                      self._notify_url)
        macString = Utils.appendField(macString,
                                      Constants.getThreeDSMtdNotifUrlName(),
                                      self._three_ds_mtd_notify_url)
        macString = Utils.appendField(macString,
                                      Constants.getChallengeWinSizeName(),
                                      self._challenge_win_size)
        macString = Utils.appendField(macString, Constants.getTrecurrName(),
                                      self._tRecurr)
        macString = Utils.appendField(macString, Constants.getCrecurrName(),
                                      self._cRecurr)
        macString = Utils.appendField(macString,
                                      Constants.getInstallmentsNumberName(),
                                      self._installments_number)
        return macString
Пример #15
0
 def __init__(self, shop_id, operator_id, options=None):
     self._timestamp = Utils.getTimestamp()
     self._shop_id = shop_id
     self._operator_id = operator_id
     self._options = options
     self._reqRefNum = Utils.genReqRefNum()
Пример #16
0
    def _string_for_mac(self):
        macString = Constants.getOperationName() + "=" + str(self._operation)
        macString = Utils.appendField(macString, Constants.getTimestampName(),
                                      self._timestamp)
        macString = Utils.appendField(macString, Constants.getShopIdName(),
                                      self._shop_id)
        macString = Utils.appendField(macString, Constants.getOrderIdName(),
                                      self._order_id)
        macString = Utils.appendField(macString, Constants.getOperatorIdName(),
                                      self._operator_id)
        macString = Utils.appendField(macString, Constants.getReqRefNumName(),
                                      self._reqRefNum)
        macString = Utils.appendField(macString, Constants.getPanName(),
                                      self._pan)
        macString = Utils.appendField(macString, Constants.getCvv2Name(),
                                      self._cvv2)
        macString = Utils.appendField(macString, Constants.getExpDateName(),
                                      self._exp_date)
        macString = Utils.appendField(macString, Constants.getAmountName(),
                                      self._amount)
        macString = Utils.appendField(macString, Constants.getCurrencyName(),
                                      self._currency)
        macString = Utils.appendField(macString, Constants.getExponentName(),
                                      self._exponent)
        macString = Utils.appendField(macString,
                                      Constants.getAccountingModeName(),
                                      self._accounting_mode)

        macString = Utils.appendField(macString, Constants.getNetworkName(),
                                      self._network)
        macString = Utils.appendField(macString, Constants.getEmailChName(),
                                      self._email_ch)
        macString = Utils.appendField(macString, Constants.getUserIdName(),
                                      self._user_id)
        macString = Utils.appendField(macString, Constants.getAcquirerName(),
                                      self._acquirer)
        macString = Utils.appendField(macString, Constants.getIpAddressName(),
                                      self._ip_address)
        macString = Utils.appendField(macString, Constants.getOpDescrName(),
                                      self._op_descr)
        macString = Utils.appendField(macString,
                                      Constants.getUsrAuthFlagName(),
                                      self._usr_auth_flag)
        macString = Utils.appendField(macString, Constants.getOptionsName(),
                                      self._options)
        macString = Utils.appendField(macString, Constants.getAntiFraudName(),
                                      self._anti_fraud)

        macString = Utils.appendField(macString, Constants.getProductRefName(),
                                      self._product_ref)
        macString = Utils.appendField(macString, Constants.getNameName(),
                                      self._name)
        macString = Utils.appendField(macString, Constants.getSurnameName(),
                                      self._surname)
        macString = Utils.appendField(macString, Constants.getTaxIdName(),
                                      self._tax_id)

        macString = Utils.appendField(macString, Constants.getTrecurrName(),
                                      self._tRecurr)
        macString = Utils.appendField(macString, Constants.getCrecurrName(),
                                      self._cRecurr)
        macString = Utils.appendField(macString,
                                      Constants.getInstallmentsNumberName(),
                                      self._installments_number)
        return macString
Пример #17
0
 def _string_for_mac(self):
     macString = Constants.getOperationName() + "=" + str(self._operation)
     macString = Utils.appendField(macString, Constants.getTimestampName(),
                                   self._timestamp)
     macString = Utils.appendField(macString, Constants.getShopIdName(),
                                   self._shop_id)
     macString = Utils.appendField(macString, Constants.getOperatorIdName(),
                                   self._operator_id)
     macString = Utils.appendField(macString, Constants.getReqRefNumName(),
                                   self._reqRefNum)
     macString = Utils.appendField(macString,
                                   Constants.getTransactionIdName(),
                                   self._transaction_id)
     macString = Utils.appendField(macString, Constants.getOrderIdName(),
                                   self._order_id)
     macString = Utils.appendField(macString, Constants.getAmountName(),
                                   self._amount)
     macString = Utils.appendField(macString, Constants.getCurrencyName(),
                                   self._currency)
     macString = Utils.appendField(macString, Constants.getExponentName(),
                                   self._exponent)
     macString = Utils.appendField(macString, Constants.getOpDescrName(),
                                   self._op_descr)
     macString = Utils.appendField(macString, Constants.getOptionsName(),
                                   self._options)
     return macString
Пример #18
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