Exemple #1
0
    def instance_url(self):
        token = util.utf8(self.id)
        extn = quote_plus(token)
        if hasattr(self, "customer"):
            customer = util.utf8(self.customer)

            base = Customer.class_url()
            owner_extn = quote_plus(customer)
            class_base = "sources"

        elif hasattr(self, "recipient"):
            recipient = util.utf8(self.recipient)

            base = Recipient.class_url()
            owner_extn = quote_plus(recipient)
            class_base = "cards"

        elif hasattr(self, "account"):
            account = util.utf8(self.account)

            base = Account.class_url()
            owner_extn = quote_plus(account)
            class_base = "external_accounts"

        else:
            raise error.InvalidRequestError(
                "Could not determine whether card_id %s is "
                "attached to a customer, recipient, or "
                "account." % token,
                "id",
            )

        return "%s/%s/%s/%s" % (base, owner_extn, class_base, extn)
Exemple #2
0
    def instance_url(self):
        token = util.utf8(self.id)
        extn = quote_plus(token)
        if hasattr(self, 'customer'):
            customer = util.utf8(self.customer)

            base = Customer.class_url()
            owner_extn = quote_plus(customer)
            class_base = "sources"

        elif hasattr(self, 'recipient'):
            recipient = util.utf8(self.recipient)

            base = Recipient.class_url()
            owner_extn = quote_plus(recipient)
            class_base = "cards"

        elif hasattr(self, 'account'):
            account = util.utf8(self.account)

            base = Account.class_url()
            owner_extn = quote_plus(account)
            class_base = "external_accounts"

        else:
            raise error.InvalidRequestError(
                "Could not determine whether card_id %s is "
                "attached to a customer, recipient, or "
                "account." % token, 'id')

        return "%s/%s/%s/%s" % (base, owner_extn, class_base, extn)
 def instance_url(self):
     token = util.utf8(self.id)
     account = util.utf8(self.account)
     base = Account.class_url()
     acct_extn = quote_plus(account)
     extn = quote_plus(token)
     return "%s/%s/persons/%s" % (base, acct_extn, extn)
Exemple #4
0
    def instance_url(self):
        token = util.utf8(self.id)
        extn = quote_plus(token)
        if hasattr(self, "customer"):
            customer = util.utf8(self.customer)

            base = Customer.class_url()
            owner_extn = quote_plus(customer)
            class_base = "sources"

        elif hasattr(self, "account"):
            account = util.utf8(self.account)

            base = Account.class_url()
            owner_extn = quote_plus(account)
            class_base = "external_accounts"

        else:
            raise error.InvalidRequestError(
                "Could not determine whether bank_account_id %s is "
                "attached to a customer or an account." % token,
                "id",
            )

        return "%s/%s/%s/%s" % (base, owner_extn, class_base, extn)
Exemple #5
0
 def instance_url(self):
     token = util.utf8(self.id)
     account = util.utf8(self.account)
     base = Account.class_url()
     acct_extn = quote_plus(account)
     extn = quote_plus(token)
     return "%s/%s/persons/%s" % (base, acct_extn, extn)
Exemple #6
0
    def instance_url(self):
        token = util.utf8(self.id)
        extn = urllib.parse.quote_plus(token)
        if hasattr(self, 'customer'):
            customer = util.utf8(self.customer)

            base = Customer.class_url()
            owner_extn = urllib.parse.quote_plus(customer)
            class_base = "sources"

        elif hasattr(self, 'account'):
            account = util.utf8(self.account)

            base = Account.class_url()
            owner_extn = urllib.parse.quote_plus(account)
            class_base = "external_accounts"

        else:
            raise error.InvalidRequestError(
                "Could not determine whether bank_account_id %s is "
                "attached to a customer or an account." % token, 'id')

        return "%s/%s/%s/%s" % (base, owner_extn, class_base, extn)