Beispiel #1
0
    def _create_token(self, params):
        self.config.assert_has_client_credentials()
        response = self.config.http().post("/oauth/access_tokens",
                                           {"credentials": params})

        if "credentials" in response:
            return SuccessfulResult({
                "credentials":
                OAuthCredentials(self.gateway, response["credentials"])
            })
        else:
            return ErrorResult(self.gateway, response["api_error_response"])
    def __create_merchant(self, params={}):
        response = self.config.http().post("/merchants/create_via_api",
                                           {"merchant": params})

        if "response" in response and "merchant" in response["response"]:
            return SuccessfulResult({
                "merchant":
                Merchant(self.gateway, response["response"]["merchant"]),
                "credentials":
                OAuthCredentials(self.gateway,
                                 response["response"]["credentials"])
            })
        else:
            return ErrorResult(self.gateway, response["api_error_response"])