package II5117351e1a4f1d07d1c88690b7a75168::mod_linkpoint; use strict; use LWP::UserAgent; use II85c65ba7e286d29307cdb0d3ce685d3c; sub checkPGateSettings { my $class = shift; my $settings = shift; my @errors; push @errors, 'check.empty_storename' unless $settings->{storename}; push @errors, 'check.empty_certfile' unless $settings->{certfile}; push @errors, 'check.certfile_not_found' if $settings->{certfile} && ! -f $settings->{certfile}; @errors; } sub checkProductSettings { my $class = shift; my ($product) = @_; my @errors; if (my $recur = $product->getRecurPayplan) { push @errors, 'check.big_numinst' if $recur->{numinst} > 99; push @errors, 'check.trial' if $recur->{trial_l}; } @errors; } sub getOrderProcessFormAddon { my $class = shift; my ($config, $settings, $singleProduct) = @_; my $sysURI = Zen::ScriptSys->getURI; my $msg_cardnumber = $config->{addons}{cardnumber}; my $msg_expiration = $config->{addons}{expiration}; my $msg_verification_code = $config->{addons}{verification_code}; my $this_year = II8dae0e141ee45f5daba6a74e4a7c3b6f::lllIlIIIIlIIlIll($II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlIIllllIIIlI{$IIb39071a48a82a07eeb9256f406abebc5::IllIlIIllIlIIIll},1010,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlIIllllIIIlI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlllIllIIIIIllIl})->new->format('%Y'); my $cardexpmonth = qq(<select name="cardexpmonth">); $cardexpmonth .= qq(<option value="$_"> ) . IIb39071a48a82a07eeb9256f406abebc5::llllIIIIllllllIl($II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIlIIIIIIlIIII{$II720d6e18aa34327713eb014408fc9144::llIlIlIIIIIlIIlI},1010,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIlIIIIIIlIIII{$II720d6e18aa34327713eb014408fc9144::llIlIIIIIIlIIIIl})->new("$this_year-" . sprintf("%02u", $_) . "-01")->format('%b') for 1..12; $cardexpmonth .= qq(</select>); my $cardexpyear = qq(<select name="cardexpyear">); $cardexpyear .= qq(<option value="$_"> $_) for map { $this_year + $_ } 0..15; $cardexpyear .= qq(</select>); my $code = <<END;
<div style="margin-bottom: 5px;">
<span style="display: table-cell; width: 130px">$msg_cardnumber</span> <span style="display: table-cell"> <input type="text" name="cardnumber" size="30"> </span>
</div>
<div style="margin-bottom: 5px;">
<span style="display: table-cell; width: 130px">$msg_expiration</span> <span style="display: table-cell"> $cardexpmonth / $cardexpyear </span>
</div>
<div style="margin-bottom: 5px;">
<span style="display: table-cell; width: 130px">$msg_verification_code</span> <span style="display: table-cell"> <input type="text" name="cardcvc" size="5"> &nbsp;<a href="#" onClick="window.open('$sysURI/help/cvn.html','','toolbar=no,location=no,directories=no,top=+30,left=+40,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500'); return false;">[?]</a> </span>
</div>
END
$code; } sub go { my $class = shift; my $pgtxn = shift; my $in = Zen->getRequest->getInput; return 'go.no_carddata' unless $in->{cardnumber}; my $settings = $pgtxn->getPGateSettings; my $order = $pgtxn->getOrder; my $cardnumber = $in->{cardnumber}; my $cardexpmonth = $in->{cardexpmonth}; $cardexpmonth =~ s/^0//; my $cardexpyear = $in->{cardexpyear}; $cardexpyear =~ s/^\d\d//; my $cardcvc = $in->{cardcvc}; my $addrnum = $order->{user_address}; $addrnum =~ s/\S//g; my $data = { host => "secure.linkpt.net", port => "1129", keyfile => "$settings->{certfile}", configfile => "$settings->{storename}", ordertype => "SALE", chargetotal => $pgtxn->getAmount, cardnumber => "$cardnumber", cardexpmonth => "$cardexpmonth", cardexpyear => "$cardexpyear", cvmvalue => "$cardcvc", cvmindicator => "provided", oid => $pgtxn->getInvoiceNumber, addrnum => "$addrnum", zip => "$order->{user_zipcode}", }; if ($pgtxn->getIsRecur) { my $recur = $pgtxn->getRecurSettings; $data->{action} = "SUBMIT"; $data->{installments} = $recur->{numinst} + 0; $data->{periodicity} = $recur->{period_u} eq 'w' ? 'd' . (7 * $recur->{period_l}) : $recur->{period_u} . $recur->{period_l}; $data->{startdate} = "immediate"; $data->{threshold} = 3; } $pgtxn->logg('REQ', { map { $_ => ( $_ eq 'cardnumber' ? ('*' x 12) . substr($data->{$_}, 12, 4) : $_ eq 'cvmvalue' ? ('*' x (length($data->{$_}))) : "$data->{$_}" ) } keys %$data }); my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->post(II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIllIIllIlIIll($II720d6e18aa34327713eb014408fc9144::IIlllIIllllIlIll{$IIb39071a48a82a07eeb9256f406abebc5::lIIIlIllllIIlIll},47,$II720d6e18aa34327713eb014408fc9144::IIlllIIllllIlIll{$IIb39071a48a82a07eeb9256f406abebc5::llIIIllIIlIIIIIl})->getURI . "/lpgo.php", $data); my $resp; my %respdata; if ($response->is_success) { $resp = $response->content; for (split /\r?\n/, $resp) { my ($k, $v) = split '=', $_, 2; $respdata{$k} = $v; } $pgtxn->logg('RSP', \%respdata); return ['go.internal_processing_error', $resp] unless $respdata{OK}; } else { return ['go.internal_processing_error', $response->status_line]; } return ['go.payment_failed', $respdata{r_error}] unless $respdata{r_approved} eq 'APPROVED'; $pgtxn->txnPayment('LINKPOINT-' . $pgtxn->getInvoiceNumber); $pgtxn->redirectToReturnPage; } 1; 