Business-OnlinePayment-DLocal
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/DLocal.pm view on Meta::CPAN
sub _paystatus {
my ($self,$content) = @_;
my $config = {
url => 'https://'.$self->server.'/api_curl/query/paystatus',
control => [], # not used
post_data => ['x_login','x_trans_key','x_version','x_invoice','x_document','type'],
};
# query api uses different credentials
local $content->{'login'} = $content->{'reports_login'};
local $content->{'password'} = $content->{'reports_key'};
my $res = $self->_send_request($config,$content);
$self->error_message( $res->{'desc'} );
$self->result_code( $res->{'error_code'} );
$self->is_success( defined $res->{'result'} ); # any result is a positive think for a query call
$self->order_number( $res->{'x_document'} );
$res;
}
lib/Business/OnlinePayment/DLocal.pm view on Meta::CPAN
sub _refundstatus {
my ($self,$content) = @_;
my $config = {
url => 'https://'.$self->server.'/api_curl/query/refundstatus',
control => [], # not used
post_data => ['x_login','x_trans_key','x_version','x_refund','type'],
};
# query api uses different credentials
local $content->{'login'} = $content->{'reports_login'};
local $content->{'password'} = $content->{'reports_key'};
my $res = $self->_send_request($config,$content);
$self->error_message( $res->{'desc'} );
$self->result_code( $res->{'error_code'} );
$self->is_success( defined $res->{'result'} ); # any result is a positive think for a query call
$self->order_number( $res->{'x_document'} );
$res;
}
lib/Business/OnlinePayment/DLocal.pm view on Meta::CPAN
sub _currencyexchange {
my ($self,$content) = @_;
my $config = {
url => 'https://'.$self->server.'/api_curl/query/currencyexchange',
control => [], # not used
post_data => ['x_login','x_trans_key','x_country','type'],
};
# query api uses different credentials
local $content->{'login'} = $content->{'reports_login'};
local $content->{'password'} = $content->{'reports_key'};
my $res = $self->_send_request($config,$content);
if ($res =~ /^\d+(:?\.\d+)$/ && $res > 0 ) {
$self->is_success( 1 );
$self->order_number( $res );
} else {
$self->is_success( 0 );
$self->order_number( undef );
t/01-sale.t view on Meta::CPAN
diag 'export PERL_BUSINESS_DLOCAL_SECRET=your_test_secret';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_USERNAME=your_reports_user';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_KEY=your_reports_key';
diag '';
diag '';
}
if ( $username ne 'mocked' && $password ne 'mocked') {
plan tests => 20;
} else {
plan skip_all => 'No credentials set in the environment.'
. ' Set PERL_BUSINESS_DLOCAL_USERNAME and '
. ' PERL_BUSINESS_DLOCAL_SECRET and '
. 'PERL_BUSINESS_DLOCAL_PASSWORD to run this test.'
}
my $client = new_ok( use_module('Business::OnlinePayment'), ['DLocal'] );
$client->test_transaction(1); # test, dont really charge
my @test_cards = (
'6363687851866592',
t/02-auth-capture.t view on Meta::CPAN
diag 'export PERL_BUSINESS_DLOCAL_SECRET=your_test_secret';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_USERNAME=your_reports_user';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_KEY=your_reports_key';
diag '';
diag '';
}
if ( $username ne 'mocked' && $password ne 'mocked') {
plan tests => 3;
} else {
plan skip_all => 'No credentials set in the environment.'
. ' Set PERL_BUSINESS_DLOCAL_USERNAME and '
. ' PERL_BUSINESS_DLOCAL_SECRET and '
. 'PERL_BUSINESS_DLOCAL_PASSWORD to run this test.'
}
my $client = new_ok( use_module('Business::OnlinePayment'), ['DLocal'] );
$client->test_transaction(1); # test, dont really charge
my $data = {
login => $username,
t/04-refund_status.t view on Meta::CPAN
diag 'export PERL_BUSINESS_DLOCAL_SECRET=your_test_secret';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_USERNAME=your_reports_user';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_KEY=your_reports_key';
diag '';
diag '';
}
if ( $username ne 'mocked' && $password ne 'mocked') {
plan tests => 6;
} else {
plan skip_all => 'No credentials set in the environment.'
. ' Set PERL_BUSINESS_DLOCAL_USERNAME and '
. ' PERL_BUSINESS_DLOCAL_SECRET and '
. 'PERL_BUSINESS_DLOCAL_PASSWORD to run this test.'
}
my $client = new_ok( use_module('Business::OnlinePayment'), ['DLocal'] );
$client->test_transaction(1); # test, dont really charge
my $data = {
login => $username,
password => $password,
t/05-currency_exchange.t view on Meta::CPAN
diag 'export PERL_BUSINESS_DLOCAL_SECRET=your_test_secret';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_USERNAME=your_reports_user';
diag 'export PERL_BUSINESS_DLOCAL_REPORTS_KEY=your_reports_key';
diag '';
diag '';
}
if ( $username ne 'mocked' && $password ne 'mocked') {
plan tests => 3;
} else {
plan skip_all => 'No credentials set in the environment.'
. ' Set PERL_BUSINESS_DLOCAL_USERNAME and '
. ' PERL_BUSINESS_DLOCAL_SECRET and '
. 'PERL_BUSINESS_DLOCAL_PASSWORD to run this test.'
}
my $client = new_ok( use_module('Business::OnlinePayment'), ['DLocal'] );
$client->test_transaction(1); # test, dont really charge
my $data = {
login => $username,
( run in 0.261 second using v1.01-cache-2.11-cpan-4d50c553e7e )