| 1 | package Business::OnlinePayment::Exact; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006001; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use SOAP::Lite; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Business::OnlinePayment; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our @ISA = qw(Business::OnlinePayment); | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | our @EXPORT_OK = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our @EXPORT = qw(); | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | sub set_defaults { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_defaults: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | $self->build_subs(qw(proxy on_action uri tns types process encodingstyle | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | order_number)); | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | $self->proxy('https://secure2.e-xact.com/vpos/process/vpos.asmx'); | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | $self->on_action('http://secure2.e-xact.com/vpos/process/Process'); | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | $self->uri('http://secure2.e-xact.com/vpos/process/'); | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | $self->tns('http://secure2.e-xact.com/vpos/process/'); | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | $self->types('http://secure2.e-xact.com/vpos/process/encodedTypes'); | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | $self->process('http://secure2.e-xact.com/vpos/process/Request'); | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | $self->encodingstyle('http://schemas.xmlsoap.org/soap/encoding/'); | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | sub map_fields { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_fields: called CC=8 SCAR=26.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | my %actions = ('normal authorization' => '00', | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 'authorization only' => '01', | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'credit' => '04', | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 'post authorization' => '02', | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 'void' => '13', | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | $content{'action'} = $actions{lc($content{'action'})}; | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | $content{'name'} = $content{'first_name'}.' '.$content{'last_name'} || | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | $content{'name'} if $content{'first_name'} and $content{'last_name'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$content{"first_name"} and $content{"last_name"}
$content{'first_name'} . ' ' . $content{'last_name'} || $content{'name'}
MC/DC0%0/2
$content{"first_name"} and $content{"last_name"}
$content{"first_name"}
$content{"last_name"}
MC/DC0%0/2
$content{'first_name'} . ' ' . $content{'last_name'} || $content{'name'}
$content{'first_name'} . ' ' . $content{'last_name'}
$content{'name'}
Truth table33%1/3
A and B
A= $content{"first_name"}B= $content{"last_name"}
Truth table0%0/3
A || B
A= $content{'first_name'} . ' ' . $content{'last_name'}B= $content{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | $content{'expiration'} =~ /(\d\d)\D*(\d\d)/ if $content{'expiration'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | $content{'expiration_month'} = $1 || $content{'expiration_month'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$1 || $content{'expiration_month'}
MC/DC0%0/2
$1 || $content{'expiration_month'}
$1
$content{'expiration_month'}
Truth table33%1/3
A || B
A= $1B= $content{'expiration_month'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | $content{'expiration_year'} = $2 || $content{'expiration_year'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$2 || $content{'expiration_year'}
MC/DC0%0/2
$2 || $content{'expiration_year'}
$2
$content{'expiration_year'}
Truth table33%1/3
A || B
A= $2B= $content{'expiration_year'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | $content{'expiration'} = $content{'expiration_month'}. | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | $content{'expiration_year'} || $content{'expiration'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$content{'expiration_month'} . $content{'expiration_year'} || $content{'expiration'}
MC/DC0%0/2
$content{'expiration_month'} . $content{'expiration_year'} || $content{'expiration'}
$content{'expiration_month'} . $content{'expiration_year'}
$content{'expiration'}
Truth table33%1/3
A || B
A= $content{'expiration_month'} . $content{'expiration_year'}B= $content{'expiration'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | $self->content(%content); | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | sub remap_fields { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remap_fields: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | my($self,%map) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | foreach(keys %map) { | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 12 | $content{$map{$_}} = $content{$_}; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | $self->content(%content); | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | sub submit { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit: called CC=6 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | $self->map_fields; | |||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | $self->remap_fields( | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | login => 'ExactID', | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | action => 'Transaction_Type', | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | amount => 'DollarAmount', | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | customer_ip => 'Client_IP', | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | order_number => 'Reference_No', | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | name => 'CardHoldersName', | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | address => 'VerificationStr1', | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | email => 'Client_Email', | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | card_number => 'Card_Number', | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | expiration => 'Expiry_Date', | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | referer => 'Customer_Ref', | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | #make data here | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | my @data; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | foreach (keys %content) { | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | 22 | push @data, SOAP::Data->name($_ => $content{$_})->type('string'); | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | my $data = | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | SOAP::Data->attr({'xsi:type' => 'types:Transaction'}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ->name('Transaction')->value(\SOAP::Data->value(@data)); | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | #figure out action | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | #make request | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | my $s = SOAP::Lite | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ->proxy($self->proxy) | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | ▶ | ->on_action(sub{return $self->on_action}) | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ->uri($self->uri) | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | ->readable(1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | $s->serializer->register_ns($self->tns => 'tns'); | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | $s->serializer->register_ns($self->types => 'types'); | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | my $m = SOAP::Data->name('q1:Process') | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | ->attr({'xmlns:q1' => $self->process, | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 'soap:encodingStyle' => $self->encodingstyle}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my $result = $s->call($m => $data); | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | #get result | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | if ($result->fault) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | $self->is_success(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $self->error_message($result->faultstring); | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ($result->valueof('//TransactionResult/Transaction_Approved') | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$result->valueof("//TransactionResult/Transaction_Approved") eq 1 and $result->valueof("//TransactionResult/EXact_Resp_Code") eq "00" and $result->valueof("//TransactionResult/Transaction_Error") eq 0
$result->valueof("//TransactionResult/Transaction_Approved") eq 1 and $result->valueof("//TransactionResult/EXact_Resp_Code") eq "00"
MC/DC0%0/3
$result->valueof("//TransactionResult/Transaction_Approved") eq 1 and $result->valueof("//TransactionResult/EXact_Resp_Code") eq "00" and $result->valueof("//TransactionResult/Transaction_Error") eq 0
$result->valueof("//TransactionResult/Transaction_Approved") eq 1
$result->valueof("//TransactionResult/EXact_Resp_Code") eq "00"
$result->valueof("//TransactionResult/Transaction_Error") eq 0
Truth table0%0/4
A and B and C
A= $result->valueof("//TransactionResult/Transaction_Approved") eq 1B= $result->valueof("//TransactionResult/EXact_Resp_Code") eq "00"C= $result->valueof("//TransactionResult/Transaction_Error") eq 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | eq '1' and $result->valueof('//TransactionResult/EXact_Resp_Code') | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | eq '00' and $result->valueof('//TransactionResult/Transaction_Error') | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | eq '0') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $self->is_success(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->error_message( | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | $result->valueof('//TransactionResult/EXact_Message')); | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->authorization( | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | $result->valueof('//TransactionResult/Authorization_Num')); | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $self->order_number( | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | $result->valueof('//TransactionResult/SequenceNo')); | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $self->is_success(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->error_message( | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | $result->valueof('//TransactionResult/EXact_Message')); | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||