File Coverage

blib/lib/WebService/MES.pm
Criterion Covered Total %
statement 9 14 64.2
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 19 63.1


line stmt bran cond sub pod time code
1             package WebService::MES;
2              
3             our $VERSION = '0.01';
4              
5 1     1   30043 use Moo;
  1         29759  
  1         5  
6 1     1   3034 use LWP::UserAgent;
  1         55064  
  1         55  
7 1     1   13 use URI;
  1         2  
  1         412  
8              
9             has 'url' => (
10             is => 'ro',
11             default => 'https://cert.merchante-solutions.com/mess-api/tridentApi',
12             );
13              
14             has 'profile_id' => ( is => 'rw', );
15              
16             has 'profile_key' => ( is => 'rw' );
17              
18             has 'transaction_type' => (
19             is => 'rw',
20             default => 'D',
21             );
22              
23             has 'card_number' => ( is => 'rw', );
24              
25             has 'card_exp_date' => ( is => 'rw' );
26              
27             has 'transaction_amount' => ( is => 'rw' );
28              
29             has 'cardholder_street_address' => ( is => 'rw' );
30              
31             has 'cardholder_zip' => ( is => 'rw' );
32              
33             has 'invoice_number' => ( is => 'rw' );
34              
35             has 'tax_amount' => ( is => 'rw' );
36              
37             has 'ua' => (
38             is => 'ro',
39             default => sub {
40             LWP::UserAgent->new(
41             agent => __PACKAGE__ . '_' . $VERSION,
42             keep_alive => 1,
43             );
44             }
45             );
46              
47             sub make_request {
48 0     0 0   my $self = shift;
49              
50 0           my $url = URI->new( $self->url );
51 0           $url->query_form(
52             profile_id => $self->profile_id,
53             profile_key => $self->profile_key,
54             transaction_type => $self->transaction_type,
55             card_number => $self->card_number,
56             card_exp_date => $self->card_exp_date,
57             transaction_amount => $self->transaction_amount,
58             cardholder_street_address => $self->cardholder_street_address,
59             cardholder_zip => $self->cardholder_zip,
60             invoice_number => $self->invoice_number,
61             tax_amount => $self->tax_amount,
62             );
63              
64 0           my $res = $self->ua->get($url);
65              
66 0           return $res;
67             }
68              
69             1;
70              
71             =head1 NAME
72              
73             WebService::MES - Perl client for the Merchant e-Solutions Payment Gateway
74              
75             =head1 SYNOPSIS
76              
77             use WebService::MES;
78              
79             =head1 DESCRIPTION
80              
81              
82              
83             =head1 SEE ALSO
84              
85             =head1 AUTHOR
86              
87             Fred Moyer, Efred@redhotpenguin.comE
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             Copyright (C) 2013 by Fred Moyer
92              
93             This library is free software; you can redistribute it and/or modify
94             it under the same terms as Perl itself, either Perl version 5.16.2 or,
95             at your option, any later version of Perl 5 you may have available.
96              
97              
98             =cut