def make_url(self, returnURL, paymentReason, pipelineName,
                 transactionAmount, **params):
        """
        Generate the URL with the signature required for a transaction
        """
        # use the sandbox authorization endpoint if we're using the
        #  sandbox for API calls.
        endpoint_host = 'authorize.payments.amazon.com'
        if 'sandbox' in self.host:
            endpoint_host = 'authorize.payments-sandbox.amazon.com'
        base = "/cobranded-ui/actions/start"

        params['callerKey'] = str(self.aws_access_key_id)
        params['returnURL'] = str(returnURL)
        params['paymentReason'] = str(paymentReason)
        params['pipelineName'] = pipelineName
        params['transactionAmount'] = transactionAmount
        params["signatureMethod"] = 'HmacSHA256'
        params["signatureVersion"] = '2'
        
        if(not params.has_key('callerReference')):
            params['callerReference'] = str(uuid.uuid4())

        parts = ''
        for k in sorted(params.keys()):
            parts += "&%s=%s" % (k, urllib.quote(params[k], '~'))

        canonical = '\n'.join(['GET',
                               str(endpoint_host).lower(),
                               base,
                               parts[1:]])

        signature = self._auth_handler.sign_string(canonical)
        params["signature"] = signature

        urlsuffix = ''
        for k in sorted(params.keys()):
            urlsuffix += "&%s=%s" % (k, urllib.quote(params[k], '~'))
        urlsuffix = urlsuffix[1:] # strip the first &
        
        fmt = "https://%(endpoint_host)s%(base)s?%(urlsuffix)s"
        final = fmt % vars()
        return final
def make_url ( self , returnURL , paymentReason , pipelineName , transactionAmount , ** params ) : endpoint_host = 'authorize.payments.amazon.com' if 'sandbox' in self . host : endpoint_host = 'authorize.payments-sandbox.amazon.com' base = "/cobranded-ui/actions/start" params [ 'callerKey' ] = str ( self . aws_access_key_id ) params [ 'returnURL' ] = str ( returnURL ) params [ 'paymentReason' ] = str ( paymentReason ) params [ 'pipelineName' ] = pipelineName params [ 'transactionAmount' ] = transactionAmount params [ "signatureMethod" ] = 'HmacSHA256' params [ "signatureVersion" ] = '2' if ( not params . has_key ( 'callerReference' ) ) : params [ 'callerReference' ] = str ( uuid . uuid4 ( ) ) parts = '' for k in sorted ( params . keys ( ) ) : parts += "&%s=%s" % ( k , urllib . quote ( params [ k ] , '~' ) ) canonical = '\n' . join ( [ 'GET' , str ( endpoint_host ) . lower ( ) , base , parts [ 1 : ] ] ) signature = self . _auth_handler . sign_string ( canonical ) params [ "signature" ] = signature urlsuffix = '' for k in sorted ( params . keys ( ) ) : urlsuffix += "&%s=%s" % ( k , urllib . quote ( params [ k ] , '~' ) ) urlsuffix = urlsuffix [ 1 : ] fmt = "https://%(endpoint_host)s%(base)s?%(urlsuffix)s" final = fmt % vars ( ) return final
Generate the URL with the signature required for a transaction