Process Credit Card body<= {'r'}; my $cart = $GET{'c'}; my $cartobj = LJ::Pay::load_cart($cart); return BML::redirect("$LJ::SITEROOT/pay/") unless $cartobj; # cart tied to user? if ($cartobj->{'userid'}) { my $remote = LJ::get_remote(); return "You must be logged in as this cart's owner to proceed with checkout." unless $remote; return "You do not own this cart. If you'd like to start a new cart, please click " . "here." unless $cartobj->{'userid'} == $remote->{'userid'}; } # if there is no userid, then we know it's clean because we checked # each individual item for email blocks when they were added to the cart # is merchant gateway down? return "" . "" if $LJ::AUTHNET_DOWN; my $needs_shipping = LJ::Pay::cart_needs_shipping($cartobj); my $has_coppa = LJ::Pay::cart_contains_coppa($cartobj); my $amt_total = $cartobj->{amount}; if ($amt_total <= 0 && $has_coppa) { $amt_total = '0.01'; } my $amt_charge = sprintf("%0.02f", $amt_total); my $amt_pretty = "\$${amt_charge} USD"; my $ret; $ret .= " 1 }); $ret .= " p?>"; if ($cartobj->{'mailed'} ne "C") { $ret .= ""; return $ret; } if ($needs_shipping && ! $POST{'confirm_address'}) { my %payvar; my $dbh = LJ::get_db_writer(); my $sth = $dbh->prepare("SELECT pkey, pval FROM payvars WHERE payid=? AND pkey LIKE 'ship%'"); $sth->execute($cartobj->{'payid'}); while (my ($k, $v)= $sth->fetchrow_array) { $payvar{$k} = $v; } my %country; LJ::load_codes({ "country" => \%country }); $ret .= ""; $ret .= "back to your order and check out again, correcting the shipping address. p?>
"; $ret .= "$payvar{'ship_name'}
"; $ret .= "$payvar{'ship_addr1'}
"; $ret .= "$payvar{'ship_addr2'}
" if $payvar{'ship_addr2'}; $ret .= "$payvar{'ship_city'}, $payvar{'ship_state'} $payvar{'ship_zip'}
"; my $ctry = uc($payvar{'ship_country'}); if ($ctry ne "US") { $ret .= $country{$ctry}; } $ret .= "
"; } unless (LJ::Pay::is_valid_cart($cartobj)) { return "The given cart contains items that are no longer valid. This could be caused by conflicts with other " . "carts created during the same time. Please try again with a new cart."; } # if the amount is free then it was probably free before, but needed shipping # so we had to get to this point before deciding whether to charge them anything # or not. dont' need to collect credit card information if ($cartobj->{'amount'} <= 0 && $needs_shipping && !$has_coppa) { unless ($POST{'confirm_address'}) { $ret .= "
"; $ret .= LJ::html_submit('confirm_address', "Complete Order"); $ret .= "
"; return $ret; } # set this cart as ready to be processed, and 'free' method my $dbh = LJ::get_db_writer(); $dbh->do("UPDATE payments SET used='N', mailed='N', ". "method='free', daterecv=NOW() WHERE payid=?", undef, $cartobj->{'payid'}); $ret .= ""; $ret .= ""; return $ret; } # tab index my $tidx = 0; $ret .= "
"; # coppa stuff if cart contains age verification if ($has_coppa) { $ret .= ""; $ret .= ""; $ret .= ""; $ret .= "
"; $ret .= "Parent or Guardian's Email Address: "; $ret .= LJ::html_text({ name => 'paremail', size => '30', maxlength => '255', tabindex => ++$tidx }); $ret .= "
"; } $ret .= ""; if ($has_coppa && $cartobj->{amount} <= 0) { $ret .= "Danga Interactive, "; $ret .= "which is the legal name of the company that runs LiveJournal.com. Some banks do "; $ret .= "not show authorization requests on billing statements. p?>"; $ret .= "COPPA Age Verification item, "; $ret .= "we will attempt verify that the information you have entered is correct and that at least $amt_pretty "; $ret .= "is available on your card. However, you will not be charged. p?>"; } else { $ret .= "Danga Interactive, which is the legal name of the company that runs LiveJournal.com. p?>"; } $ret .= LJ::html_hidden("cart", $cart); $ret .= LJ::html_hidden("amt_charge", $amt_charge); $ret .= "
"; $ret .= "\n"; $ret .= ""; $ret .= ""; $ret .= ""; if ($LJ::USE_CARD_CODE) { $ret .= ""; } $ret .= "\n"; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; my %countries; LJ::load_codes({ "country" => \%countries }); $ret .= ""; $ret .= "\n"; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= "
Card Info
Name on card:"; $ret .= LJ::html_text({ name => 'cardname', size => '30', maxlength => '40', tabindex => ++$tidx}) . "
Card Number:"; $ret .= LJ::html_text({ name => 'cardnum', size => '22', maxlength => '22', tabindex => ++$tidx }) . "
Expiration Date:"; $ret .= LJ::html_text({ name => 'expdate_mm', size => '3', maxlength => '2', tabindex => ++$tidx }) . " / "; $ret .= LJ::html_text({ name => 'expdate_yy', size => '4', maxlength => '4', tabindex => ++$tidx }) . " (mm/yy)
Card Verification Number:"; $ret .= LJ::html_text({ name => 'cardcode', size => '4', maxlength => '4', tabindex => ++$tidx }) . "
Billing Address (for card verification)
Address:"; $ret .= LJ::html_text({ name => 'bill_addr', size => '30', maxlength => '40', tabindex => ++$tidx }) . "
City:"; $ret .= LJ::html_text({ name => 'bill_city', size => '30', maxlength => '40', tabindex => ++$tidx }) . "
State:"; $ret .= LJ::html_text({ name => 'bill_state', size => '20', maxlength => '40', tabindex => ++$tidx }) . " (code or full name)
Zip/Postal Code:"; $ret .= LJ::html_text({ name => 'bill_zip', size => '9', maxlength => '10', tabindex => ++$tidx }) . "
Country:"; $ret .= LJ::html_select({ name => 'bill_country', tabindex => ++$tidx }, map { $_, $countries{$_} } ("US", sort { $countries{$a} cmp $countries{$b} } keys %countries)); $ret .= "
Other Info
Optional Receipt Email:"; $ret .= LJ::html_text({ name => 'email', size => '30', maxlength => '50', tabindex => ++$tidx }) . "
Amount:$amt_pretty
"; if ($has_coppa && $cartobj->{amount} <= 0) { $ret .= LJ::html_submit(undef, 'Perform Authorization (No Charge)', { tabindex => ++$tidx }); } else { $ret .= LJ::html_submit(undef, 'Make Payment', { tabindex => ++$tidx }); } $ret .= "
(Click once and wait)
"; $ret .= ""; return $ret; } _code?> <=body page?>