예제 #1
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
예제 #2
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