def get_signature(payment_request):
    """
    Returns the signature for the transaction.

    To compute the signature, first you have to get the value of all
    the fields that starts by 'vads_', ordering them alphabetically.
    All the values are separated by the '+' character. Then you add
    the value of the payzen certificate.
    Finaly you hash the string using sha1."""

    vads_args = {}
    for field in payment_request._meta.fields:
        if field.name[:5] == 'vads_':
            field_value = field.value_from_object(payment_request)
            if field_value:
                vads_args.update({
                    field.name: field_value
                })
    base_str = ''
    for key in sorted(vads_args):
        base_str += str(vads_args[key]) + '+'
    base_str += app_settings.VADS_CERTIFICATE
    return hashlib.sha1(base_str.encode("utf-8")).hexdigest()
def get_signature ( payment_request ) : vads_args = { } for field in payment_request . _meta . fields : if field . name [ : 5 ] == 'vads_' : field_value = field . value_from_object ( payment_request ) if field_value : vads_args . update ( { field . name : field_value } ) base_str = '' for key in sorted ( vads_args ) : base_str += str ( vads_args [ key ] ) + '+' base_str += app_settings . VADS_CERTIFICATE return hashlib . sha1 ( base_str . encode ( "utf-8" ) ) . hexdigest ( )
Returns the signature for the transaction.

    To compute the signature, first you have to get the value of all
    the fields that starts by 'vads_', ordering them alphabetically.
    All the values are separated by the '+' character. Then you add
    the value of the payzen certificate.
    Finaly you hash the string using sha1.