Beispiel #1
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')
Beispiel #2
0
    def getParametersMap(self, redirect_key, api_result_key, digest_mode):
        map = OrderedDict()
        map[Constants.getUrlMsName()] = self._url_ms
        map[Constants.getUrlDoneName()] = self._url_done
        map[Constants.getOrderIdName()] = self._order_id
        map[Constants.getShopIdName()] = self._shop_id
        map[Constants.getAmountName()] = self._amount
        map[Constants.getCurrencyName()] = self._currency
        map[Constants.getExponentName()] = self._exponent
        map[Constants.getAccountingModeName()] = self._accounting_mode
        map[Constants.getAuthorModeName()] = self._author_mode

        # NOT COMPULSORY FIELDS
        map[Constants.getOptionsName()] = self._options
        map[Constants.getNameName()] = self._name
        map[Constants.getSurnameName()] = self._surname
        map[Constants.getTaxIdName()] = self._tax_id
        map[Constants.getLockCardName()] = self._lock_card
        map[Constants.getCommisName()] = self._commis
        map[Constants.getOrdDescrName()] = self._ord_descr
        map[Constants.getVSIDName()] = self._VSID

        map[Constants.getOpDescrName()] = self._op_descr
        map[Constants.getRemainingDurationName()] = self._remaining_duration
        map[Constants.getUserIdName()] = self._userId
        map[Constants.getBBPostepayName()] = self._bb_poste_pay
        map[Constants.getBPCardsName()] = self._bp_cards

        map[Constants.getPhoneNumberName()] = self._phone_number
        map[Constants.getCausationName()] = self._causation
        map[Constants.getUserName()] = self._user
        map[Constants.getProductRefName()] = self._product_ref
        map[Constants.getAntiFraudName()] = self._anti_fraud

        if self._data_3DS_json is not None:
            map[Constants.get3DSJsonDataName()] = AES.AES_encrypt(
                self._data_3DS_json, api_result_key)

        map[Constants.getTrecurrName()] = self._t_recurr
        map[Constants.getCrecurrName()] = self._c_recurr
        map[Constants.getInstallmentsNumberName()] = self._installments_number
        map[Constants.getTokenName()] = self._token
        map[Constants.getExpDateName()] = self._exp_date
        map[Constants.getNetworkName()] = self._network
        map[Constants.getIBANName()] = self._iban

        map[Constants.getMacName()] = Encoder.get_mac(
            self._string_for_mac(api_result_key), redirect_key, digest_mode)

        map[Constants.getUrlBackName()] = self._url_back
        map[Constants.getLangName()] = self._lang
        map[Constants.getShopEmailName()] = self._shop_email
        map[Constants.getEmailName()] = self._email
        map[Constants.getNameCHName()] = self._name_ch
        map[Constants.getSurnameCHName()] = self._surname_ch
        return map
Beispiel #3
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')
Beispiel #4
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')
Beispiel #5
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')