LINE —
Interchange 5.7.0:
Source: lib/Vend/Payment/GoogleCheckout.pm
Line 490 (context shows lines 480-494 in googlecheckout():399)
if ($gcorequest eq 'post') {
undef $gcorequest;
my $salestax = $::Values->{tax} || Vend::Interpolate::salestax() || '0.00';
my $shipmode = $::Values->{mv_shipmode} || charge_param('default_shipmode') || 'upsg';
my $shipping = $::Session->{final_shipping} || Vend::Ship::shipping($shipmode) \
|| charge_param('default_shipping') || '0.00';
my $handling = $::Values->{handlingtotal} || Vend::Ship::tag_handling() || '';
$shipping += $handling;
my $shipmsg = $::Session->{ship_message};
my $subtotal = $::Values->{amount} || Vend::Interpolate::subtotal();
my $ordertotal = charge_param('amount') || Vend::Interpolate::total_cost();
print "GCO".__LINE__.": tax=$salestax; shipping=$shipping, $::Values->{mv_shipping}; \
shipmode=$shipmode\n";
my $defaultcountry = charge_param('defaultcountry');
my $defaultstate = charge_param('defaultstate');
my $country = uc($actual->{country});
$country = $defaultcountry unless $country;
Source: lib/Vend/Payment/GoogleCheckout.pm
Line 504 (context shows lines 494-508 in googlecheckout():399)
$country = $defaultcountry unless $country;
my $state = uc($actual->{state});
$state = $defaultstate unless $state;
my $zip_pattern = $actual->{zip} || $::Values->{zip};
$zip_pattern =~ /(\S\S\S).*/;
$zip_pattern = "$1"."*";
my $taxshipping = 'false';
$taxshipping = 'true' if (($country =~ /$::Variable->{TAXSHIPPING}/) \
\
\
or ($state =~ /$::Variable->{TAXSHIPPING}/) or ($alwaystaxshipping == '1'));
::logDebug(":GCO:".__LINE__.": shipping=$::Session->{final_shipping}, $shipping; \
\
\
handling=$handling; taxshipping=$::Variable->{TAXSHIPPING}; \
\
\
country=$country; tx=$taxshipping");
my $stax = Vend::Interpolate::salestax();
print "GCO:".__LINE__.": stax=$stax; mvst=$::Values->{mv_salestax}, $::Values->{salestax}\n";
if ($salestax == '0') {
$taxrate = '0.00';
}
elsif ($taxshipping eq 'true') {
Source: lib/Vend/Payment/GoogleCheckout.pm
Line 517 (context shows lines 507-521 in googlecheckout():399)
}
elsif ($taxshipping eq 'true') {
$taxrate = ($salestax / ($subtotal + $shipping) || '0');
}
elsif ($calculate_included_tax == '1') {
$taxrate = $default_taxrate;
}
else {
$taxrate = ($salestax / $subtotal || '0');
}
::logDebug(":GCO:".__LINE__.": subtotal=$subtotal; taxrate=$taxrate");
### Check that the currency sent to GCO is the one registered with them, or return to the checkout
my $user_currency = $::Scratch->{iso_currency_code} || $::Values->{iso_currency_code} || $currency;
#::logDebug(" ".__LINE__.": user currency = $user_currency, $::Scratch->{iso_currency_code}, \
$::Values->{iso_currency_code}; currency=$currency");
Source: lib/Vend/Payment/GoogleCheckout.pm
Line 921 (context shows lines 911-925 in googlecheckout():399)
$cart = eval ($cart);
my $dbi = dbref('inventory') or die errmsg("cannot open inventory table");
my $dbhi = $dbi->dbh() or die errmsg("cannot get handle for tbl 'inventory'");
my ($sthi, $itm, $qty);
foreach my $items (@{$cart}) {
$itm = $items->{'code'};
$qty = $items->{'quantity'};
$sthi = $dbh->prepare("UPDATE inventory SET quantity = quantity \
-'$qty' WHERE sku = '$itm'");
$sthi->execute() or die errmsg("Cannot update table inventory");
::logDebug(":GCO:".__LINE__.": Decremented inventory for $itm by $qty");
}
}
}
else {
Source: lib/Vend/Payment/GoogleCheckout.pm
Line 1338 (context shows lines 1328-1342 in sendxml():1326)
my $xmlOut = shift;
my $agent = LWP::UserAgent->new;
my $data = "$merchantid:$merchantkey";
my $signature = encode_base64($data, "");
$header = HTTP::Headers->new;
$header->header('Authorization' => "Basic " . $signature);
$header->header('Content-Type' => "application/xml; charset=UTF-8");
$header->header('Accept' => "application/xml");
my $request = HTTP::Request->new(POST => $gcourl, $header, $xmlOut);
my $response = $agent->request($request);
::logDebug(":GCO:".__LINE__.": sendxml: gcourl=$gcourl\nxmlOut=$xmlOut");
return $response->content;
}
1;
Source: lib/Vend/Payment/SagePay.pm
Line 781 (context shows lines 771-785 in sagepay():576)
my $customerEmail = $actual->{email};
$customerEmail =~ s/[^a-zA-Z0-9.\@\-_]//gi;
my $contactFax = $::Values->{fax} || '';
$contactFax =~ s/[\(\)]/ /g;
$contactFax =~ s/[^0-9-+ ]//gi;
my $giftAidPayment = $::Values->{giftaidpayment} || charge_param('giftaidpayment') || '0';
my $authCode = $::Values->{authcode} || '';
my $clientIPAddress = $CGI::remote_addr if $CGI::remote_addr;
$::Values->{authcode} = '';
::logDebug("SP".__LINE__.": bCity=$billingCity; mvccType=$cardType; start=$mvccStartDate; \
issue=$issue;");
# ISO currency code sent to SagePay, from the page or fall back to config files.
my $currency = $::Values->{iso_currency_code} || $::Values->{currency_code} \
|| $Vend::Cfg->{Locale}{iso_currency_code} ||
charge_param('currency') || $::Variable->{MV_PAYMENT_CURRENCY} || 'GBP';
Source: lib/Vend/Payment/SagePay.pm
Line 991 (context shows lines 981-995 in sagepay():576)
push @query, "$key=$query{$key}";
}
my $string = join '&', @query; # replicates the string as actually sent: \
useful to quote this for debugging
#::logDebug("SP".__LINE__.": string to SagePay: $string");
$post = post_data($opt, \%query);
$response = $post->{status_line};
$page = $post->{result_page};
::logDebug("SP".__LINE__.": response page:\n-------------------------\n$page \
\n---------------------------\nend of SagePay results page\n\n");
$result{TxType} = $txtype;
$result{Currency} = $currency;
$result{CardRef} = $::Session->{sagepay}{CardRef};
Source: lib/Vend/Payment/SagePay.pm
Line 1070 (context shows lines 1060-1074 in sagepay():576)
$result{'Status'} = 'OK';
$::Scratch->{mstatus} = 'success';
$::Scratch->{order_id} = $result{'order-id'};
$::Values->{mv_payment} = "Real-time card $result{CardInfo}";
$::Values->{psp} = charge_param('psp') || 'SagePay';
$::CGI::values{mv_todo} = 'submit';
if ($result{SecureStatus} =~ /OK|ATTEMPTONLY/i) {
$::Scratch->{tds} = 'yes' ;
$Vend::Session->{payment_result} = \%result;
::logDebug("SP".__LINE__.": secureStatus=$result{SecureStatus} so now to \
run routes; result hash=".::uneval(\%result));
Vend::Dispatch::do_process();
}
}
Source: lib/Vend/Payment/SagePay.pm
Line 1195 (context shows lines 1185-1199 in sagepay():576)
$::Values->{mv_payment} = "Processing card $result{CardInfo}";
$CGI::values{mv_todo} = 'submit';
#::logDebug("SP".__LINE__.": request=$request; tds=$::Scratch->{tds}");
}
undef $request;
$::Values->{request} = '';
::logDebug("SP".__LINE__.":result=".::uneval(\%result));
# Now extra logging for backup order and/or log of events
if ($logorder =~ /y|1/) {
#--- write the full basket and address to failsafe file
Source: lib/Vend/Payment/Worldpay.pm
Line 422 (context shows lines 412-426 in worldpay():397)
my $testMode = charge_param('testmode') || '0';
my $callbackurl = charge_param('callbackurl') || ''; #URL on your server WP will callback
my $callpw = charge_param('callpw') || 'password'; #Must be same as Worldpay \
admin panel callback password
my $desc = charge_param('desc') || ''; #Transaction description
my $fixcontact = charge_param('fixcontact') || '0'; #0=details editable \
at WP 1=details fixed as sent
my $affsubtotal = $Tag->subtotal({noformat => 1,});# This is used to \
send subtotal as as MC_ parameter to read back for affilate sales calculations
$affsubtotal =~ s/^\D*//g;
$affsubtotal =~ s/\,//g;
$affsubtotal = sprintf '%.2f', $affsubtotal;
::logDebug("WP:".__LINE__.": Session = $::Session->{id} Host = $host instid \
= $instId currency = $currency testmode = $testMode callbackurl \
= $callbackurl pw = $callpw desc = $desc fix = $fixcontact affsubtotal=$affsubtotal");
if ($testMode > '0') { # send to test url not live
$host = $testhost;
}
Source: lib/Vend/Payment/Worldpay.pm
Line 434 (context shows lines 424-438 in worldpay():397)
if ($testMode > '0') { # send to test url not live
$host = $testhost;
}
my $ordernumber = charge_param('ordernumber') || 'etc/order.number';
my $wpcounter = charge_param('wpcounter') || 'etc/username.counter';
$worldpayrequest = charge_param('worldpayrequest') || $::Values->{worldpayrequest} || 'post';
$opt = {};
::logDebug("WP:".__LINE__.": Request = $worldpayrequest");
##-----------Post Information and send customer to Worldpay------------##
if ($worldpayrequest eq 'post') {
::logDebug("WP:".__LINE__.": Sending customer to Worldpay");
Source: lib/Vend/Payment/Worldpay.pm
Line 438 (context shows lines 428-442 in worldpay():397)
my $ordernumber = charge_param('ordernumber') || 'etc/order.number';
my $wpcounter = charge_param('wpcounter') || 'etc/username.counter';
$worldpayrequest = charge_param('worldpayrequest') || $::Values->{worldpayrequest} || 'post';
$opt = {};
::logDebug("WP:".__LINE__.": Request = $worldpayrequest");
##-----------Post Information and send customer to Worldpay------------##
if ($worldpayrequest eq 'post') {
::logDebug("WP:".__LINE__.": Sending customer to Worldpay");
::logDebug("WP:".__LINE__.": TestMode = $testMode : Host = $host");
my $separator = ' ';
my $name = "$::Values->{b_fname} $::Values->{b_lname}";
Source: lib/Vend/Payment/Worldpay.pm
Line 479 (context shows lines 469-483 in worldpay():397)
#go to worldpay
my $redirecturl = "$host?instId=$instId¤cy=$currency&testMode=$testMode \
&amount=$amount&cartId=$cartId&desc=$desc&name=$name&address=$address";
$redirecturl .= "&postcode=$postcode&country=$country&email=$email&tel=$tel \
&MC_mv_order_number=$cartId&MC_callback=$callbackurl&MC_affsubtotal=$affsubtotal";
$redirecturl .= "&fixContact" if ($fixcontact == 1);
$redirecturl = Vend::Util::header_data_scrub($redirecturl);
::logDebug("WP:".__LINE__.": URL = $redirecturl");
$::Tag->tag({ op => 'header', body => <<EOB });
Status: 302 moved
Location: $redirecturl
Source: lib/Vend/Payment/Worldpay.pm
Line 501 (context shows lines 491-505 in worldpay():397)
return %result;
}
####----------------Handle the callback from Worldpay--------------####
elsif ($worldpayrequest eq 'callback'){
my $newsess = $::Session->{id};
::logDebug("WP:".__LINE__.": Processing Callback Session = $newsess");
my $reporttitle = charge_param('reporttitle') || '0';
my $update_status = charge_param('update_status') || 'pending';
my $dec_inventory = charge_param('dec_inventory') || '0';
Source: lib/Vend/Payment/Worldpay.pm
Line 523 (context shows lines 513-527 in worldpay():397)
my $authcurrency = $::CGI->{authCurrency}; #Currency of authorisation
my $rawauthmessage = $::CGI->{rawAuthMessade}; #Raw auth message
my $callbackpw = $::CGI->{callbackPW}; #Callback password as set in admin panel
my $cardtype = $::CGI->{cardType}; #Card type used
my $countrymatch = $::CGI->{countryMatch}; #Y=Match N=No match B=Not \
available I=Country not supplied S=Country issue not available
my $avs = $::CGI->{AVS}; #AVS Results
my $wafmerchmessage = $::CGI->{wafMerchMessage}; #Risk result
my $authentication = $::CGI->{authentication}; #VbyV or Mastercard \
Securecode authentication type
my $ipaddress = $::CGI->{ipAdress}; #Shopper IP address
::logDebug("WP:".__LINE__.": transid=$transid testmode=$check_testmode \
transstatus=$transstatus authamount=$authamount transtime=$transtime \
authcurrency=$authcurrency rawauthmessage=$rawauthmessage");
::logDebug("WP:".__LINE__.": callbackpw=$callbackpw cardtype=$cardtype \
countrymatch=$countrymatch avs=$avs wafmerchmessage=$wafmerchmessage \
authentication=$authentication ipaddress=$ipaddress");
my $wp_order_number = $::CGI->{MC_mv_order_number};
Source: lib/Vend/Payment/Worldpay.pm
Line 533 (context shows lines 523-537 in worldpay():397)
::logDebug("WP:".__LINE__.": transid=$transid testmode=$check_testmode \
\
\
transstatus=$transstatus authamount=$authamount transtime=$transtime \
\
\
authcurrency=$authcurrency rawauthmessage=$rawauthmessage");
::logDebug("WP:".__LINE__.": callbackpw=$callbackpw cardtype=$cardtype \
\
\
countrymatch=$countrymatch avs=$avs wafmerchmessage=$wafmerchmessage \
\
\
authentication=$authentication ipaddress=$ipaddress");
my $wp_order_number = $::CGI->{MC_mv_order_number};
my $db = dbref('transactions') or die errmsg("cannot open transactions table");
my $dbh = $db->dbh() or die errmsg("cannot get handle for tbl 'transactions'");
my $sth;
my $stho;
::logDebug("WP:".__LINE__.": Callback order number = $wp_order_number");
#if success
Source: lib/Vend/Payment/Worldpay.pm
Line 539 (context shows lines 529-543 in worldpay():397)
my $dbh = $db->dbh() or die errmsg("cannot get handle for tbl 'transactions'");
my $sth;
my $stho;
::logDebug("WP:".__LINE__.": Callback order number = $wp_order_number");
#if success
if (($transstatus eq 'Y') and ($callbackpw eq $callpw)) {
::logDebug("WP:".__LINE__.": Transaction Suucessful");
$sth = $dbh->prepare("SELECT total_cost,email,txtype,order_number \
FROM transactions WHERE order_number='$wp_order_number'") or die errmsg \
("Cannot select from transactions tbl for $wp_order_number");
$sth->execute() or die errmsg("Cannot get data from transactions tbl");
my @d = $sth->fetchrow_array;
Source: lib/Vend/Payment/Worldpay.pm
Line 556 (context shows lines 546-560 in worldpay():397)
my $txtype = $d[2];
my $old_tid = $d[3];
my $new_order_no = $::Values->{mv_order_number} = Vend::Interpolate::tag_counter \
("$ordernumber") ; #generate the IC Order Number
my $charged = 'WP Charged';
#Check if transaction was in test mode
if ($check_testmode > '0') { # Transaction was in test mode
$update_status = $update_status .'-TEST'; #Append Test to end of order \
status to show order was made in test mode
$charged = $charged .'-TEST'; #Variable we write to txtype
}
::logDebug("WP:".__LINE__.": Check testmode = $check_testmode Update Status \
= $update_status Set txtype = $charged");
#Replace temporary order number with IC order number
::logDebug("WP:".__LINE__.": Replacing order number: Old TID = $old_tid \
with New Order No = $new_order_no");
$sth = $dbh->prepare("UPDATE transactions SET code='$new_order_no', \
order_number='$new_order_no', txtype='$charged' WHERE order_number='$wp_order_number'");
Source: lib/Vend/Payment/Worldpay.pm
Line 566 (context shows lines 556-570 in worldpay():397)
::logDebug("WP:".__LINE__.": Check testmode = $check_testmode Update Status \
\
\
= $update_status Set txtype = $charged");
#Replace temporary order number with IC order number
::logDebug("WP:".__LINE__.": Replacing order number: Old TID = $old_tid \
\
\
with New Order No = $new_order_no");
$sth = $dbh->prepare("UPDATE transactions SET code='$new_order_no', \
\
\
order_number='$new_order_no', txtype='$charged' WHERE order_number='$wp_order_number'");
$stho = $dbh->prepare("UPDATE orderline SET code=replace(code, '$old_tid', \
\
'$new_order_no'), order_number='$new_order_no' WHERE order_number='$old_tid'");
$stho->execute() or die errmsg("Cannot update transactions tbl for WP '$wp_order_number'");
$sth->execute() or die errmsg("Cannot update transactions tbl for WP '$wp_order_number'");
#Log transaction information & change order status
::logDebug("WP:".__LINE__.": Logging transaction details to tbl for order $new_order_no");
$sth = $dbh->prepare("UPDATE transactions SET status='$update_status', \
order_id='$transid', wp_transtime='$transtime', wp_cardtype='$cardtype', \
wp_countrymatch='$countrymatch', wp_avs='$avs', wp_risk='$wafmerchmessage', \
wp_authentication='$authentication', wp_authamount='$authamount' \
WHERE order_number='$new_order_no'");
$stho = $dbh->prepare("UPDATE orderline SET status='$update_status' \
WHERE order_number='$new_order_no'");
$stho->execute() or die errmsg("Cannot update orderline tbl for worldpay \
order '$new_order_no'");
$sth->execute() or die errmsg("Cannot update transactions tbl for worldpay \
order '$new_order_no'");
Source: lib/Vend/Payment/Worldpay.pm
Line 626 (context shows lines 616-630 in worldpay():397)
$Tag->assign( { salestax => $salestax, } );
$::Values->{mv_handling} = 1;
$Tag->assign( { handling => $handling, } );
my (@cart, $acart);
$cart =~ s/\"/\'/g;
$cart =~ s/\\//;
@cart = eval($cart);
$acart = eval ($cart);
::logDebug("WP:".__LINE__.": cart=$cart Email=$email");
$::Values->{mv_payment} = 'Worldpay';
$::Values->{wp_order_number} = $wp_order_number;
$::Session->{values}->{iso_currency_code} = $currency;
Source: lib/Vend/Payment/Worldpay.pm
Line 634 (context shows lines 624-638 in worldpay():397)
@cart = eval($cart);
$acart = eval ($cart);
::logDebug("WP:".__LINE__.": cart=$cart Email=$email");
$::Values->{mv_payment} = 'Worldpay';
$::Values->{wp_order_number} = $wp_order_number;
$::Session->{values}->{iso_currency_code} = $currency;
$::Session->{scratch}->{mv_locale} = $mv_locale;
$::Session->{scratch}->{mv_currency} = $mv_currency;
::logDebug("WP:".__LINE__.": Shipmode = $shipmode Shipping = $shipping \
Tax = $salestax Handling = $handling");
#Set new report title with final order number and WP transaction ID
if ($reporttitle == '1') {