VirtueMart 1.1.x [ Old version - no longer supported ] > PayPal / PayPal Pro VM 1.1
Paypal Integral evolution : how sending the shipment variable??
lejeannotfr:
hi, i've discovered that paypal doesn't protect merchants if the payment form doesn't send the shipment customer address. >:(
The default form send the billing address but if paypal doesn't receive the shipment variable, you're not protected in case of fraud. :o
Then, these motherfuckers of paypal support just answer "find the code to send us the following variables":
first_name (??it's already in the code)
last_name (??it's already in the code)
address1
address2
city
country
zip
These 5 last variables, how are they named in virtuemart please? can anyone tell? :'(
lejeannotfr:
Nobody cares about this problem?? :o
I just look for the name i must use to qualify these variable in the html code...
Hutson:
I use this:-
//Query used to find whether to use Bill Address or Ship to address
$dboui = new ps_DB;
$q_oui = "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);
$oui_id = $dboui->f("order_info_id");
if($oui_id == $order_id){
$first_name = $dbb->f("first_name");
$last_name = $dbb->f("last_name");
$address1 = $dbb->f("address_1");
$address2 = $dbb->f("address_2");
$city = $dbb->f("city");
$state = $dbb->f("state");
$address_country = $dbbt->f("country");
$zip = $dbb->f("zip");
$H_PhoneNumber = $dbb->f("phone_1");
}
else {
$first_name = $dboui->f("first_name");
$last_name = $dboui->f("last_name");
$address1 = $dboui->f("address_1");
$address2 = $dboui->f("address_2");
$city = $dboui->f("city");
$state = $dboui->f("state");
$address_country = $dboui->f("country");
$zip = $dboui->f("zip");
$H_PhoneNumber = $dboui->f("phone_1");
}
lejeannotfr:
hi and thanks a lot for your help but i don't really understand where i should use the code you give me :-[
here is my usual code for the payment paypal integral evolution :
--- Code: ---<?php
$url = "https://securepayments.paypal.com/acquiringweb";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
$dbb = new ps_DB;
$q = "SELECT * FROM jos_vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_hosted-payment",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"subtotal" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],
"address_override" => "1",
"buyer_email" => $dbb->f("user_email"),
"billing_first_name" => $dbb->f("first_name"),
"billing_last_name" => $dbb->f("last_name"),
"billing_address1" => $dbb->f("address_1"),
"billing_address2" => $dbb->f("address_2"),
"billing_city" => $dbb->f("city"),
"billing_country" => $dbb->f("country"),
"billing_state" => $dbb->f("state"),
"billing_zip" => $dbb->f("zip"),
"night_phone_b" => $dbb->f("phone_1"),
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.paypal-cancel-2010.php&order_id=".$db->f("order_id")."&invoice=".$db->f("order_number"),
"undefined_quantity" => "0",
"test_ipn" => PAYPAL_DEBUG,
"pal" => "XXXXXXXXXXXXX",
"no_shipping" => "1",
"no_note" => "1"
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
} else {
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="XXXXXXXXXXXXXXXXXXXXXXXXX" alt="xxxxxxxxxxxxxxxxx" />';
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>
--- End code ---
Hutson:
Sorry for the delay I have been away for a while:-
Here is the modified code base on what you posted. Just reapply your xxxxx blanked detail.
--- Code: ---<?php
$url = "https://securepayments.paypal.com/acquiringweb";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
$dbb = new ps_DB;
$dbb->setQuery($q);
$dbb->query();
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
[color=red]// buyer e-mail
$buyer_email = $dbbt->f("user_email");
//Query used to find whether to use Bill Address or Ship to address and country
$db1 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);
$dboui = new ps_DB;
$q_oui = "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);
$oui_id = $dboui->f("order_info_id");
if($oui_id == $order_id){
$first_name = $dbb->f("first_name");
$last_name = $dbb->f("last_name");
$address1 = $dbb->f("address_1");
$address2 = $dbb->f("address_2");
$city = $dbb->f("city");
$state = $dbb->f("state");
$country = $db1->f('country_2_code');
$zip = $dbb->f("zip");
$night_phone_b = $dbb->f("phone_1");
}
else {
$first_name = $dboui->f("first_name");
$last_name = $dboui->f("last_name");
$address1 = $dboui->f("address_1");
$address2 = $dboui->f("address_2");
$city = $dboui->f("city");
$state = $dboui->f("state");
$country = $db1->f('country_2_code');
$zip = $dboui->f("zip");
$night_phone_b = $dboui->f("phone_1");
}
// end address query
[/color]
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_hosted-payment",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"subtotal" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],
"address_override" => "1",
[color=red]"first_name" => $first_name,
"last_name" => $last_name,
"address1" => $address1,
"address2" => $address2,
"city" => $city,
"state" => $state,
"country" => $country,
"zip" => $zip,
"night_phone_b" => $night_phone_b,
"buyer_email" => $buyer_email,
[/color]
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.paypal-cancel-2010.php&order_id=".$db->f("order_id")."&invoice=".$db->f("order_number"),
"undefined_quantity" => "0",
"test_ipn" => PAYPAL_DEBUG,
"pal" => "XXXXXXXXXXXXX",
"no_shipping" => "1",
"no_note" => "1"
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
} else {
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="XXXXXXXXXXXXXXXXXXXXXXXXX" alt="xxxxxxxxxxxxxxxxx" />';
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version