NAME

Business::GoCardless::Utils

DESCRIPTION

A role containing gocardless utilities.

METHODS

sign_params

Signs the passed params hash using the app secret

my $signature = $self->sign_params( \%params,$app_secret );

signature_valid

Checks the signature is valid for the given params hash with the app secret

if ( ! $self->signature_valid( \%params,$app_secret ) ) {
    # throw an error
}

generate_nonce

Generates a random nonce for use with a gocardless request, it being a base64 encoded concatination of the current seconds since epoch + | + rand(256)

my $nonce = $self->generate_nonce;

flatten_params

Flattens a hash as specified by the gocardless API. see https://developer.gocardless.com/#constructing-the-parameter-array

my $flat_params = $self->flatten_params( \%params );

normalize_params

Normalizes the passed params hash into a string for use in queries to the gocardless API. Includes param flattening and RFC5849 encoding

my $query_string = $self->normalize_params( \%params );

AUTHOR

Lee Johnson - leejo@cpan.org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. If you would like to contribute documentation, features, bug fixes, or anything else then please raise an issue / pull request:

https://github.com/Humanstate/business-gocardless