VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Payment VM 1.1 => PayPal / PayPal Pro VM 1.1 => Topic started by: spyderwoman on May 17, 2010, 18:24:19 PM

Title: Cannot set to test mode
Post by: spyderwoman on May 17, 2010, 18:24:19 PM
I am trying to test my ipn but am unable to set my test mode to yes in the Payment Method Form for PayPal.
When I change it to yes and save, it does not save  (although it says it does) and displays this error:
Warning: fopen() has been disabled for security reasons in /*******/administrator/components/com_virtuemart/classes/payment/ps_paypal.php on line 185

This file seems file and has not been edited either.
Title: Re: Cannot set to test mode
Post by: beachy on May 17, 2010, 21:20:38 PM
When you are in the PayPal configuration tab do you have the message

/administrator/components/com_virtuemart/classes/payment/ps_paypal.cfg.php :: Writeable

at the top? If not you need to change the file permissions so that you can save the changes to enter into test mode.
Title: Re: Cannot set to test mode
Post by: stinga on May 18, 2010, 08:42:43 AM
G'day,

I never got the PP sandbox to work, it seems far to different to the real world.
I ended up just using the real PP account, you don't need to actually pay to see if the data you are getting is correct.
Once I had the data to PP correct, I created a 0.01 product and purchased that to test the IPN process, once you have an IPN you can keep sending the same one.
Title: Re: Cannot set to test mode
Post by: spyderwoman on May 18, 2010, 21:54:37 PM
Thanks beachy, and yes. the Writable message appears but i still get that error when  I save.
Title: Re: Cannot set to test mode
Post by: beachy on May 18, 2010, 22:22:39 PM
Can you tell me the file permissions you have got for ps_paypal.php & ps_paypal.cfg.php

In addition can you post the contents of ps_paypal.cfg.php
Title: Re: Cannot set to test mode
Post by: spyderwoman on May 18, 2010, 23:07:28 PM
Thanks for the help.
Both are 644 (code is below... i removed the paypal address)

<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 

define ('PAYPAL_DEBUG''0');
define ('PAYPAL_EMAIL''xxx@xxx.com');
define ('PAYPAL_VERIFIED_ONLY''0');
define ('PAYPAL_VERIFIED_STATUS''C');
define ('PAYPAL_PENDING_STATUS''P');
define ('PAYPAL_INVALID_STATUS''X');
?>
Title: Re: Cannot set to test mode
Post by: beachy on May 18, 2010, 23:21:01 PM
Nothing looks wrong at all. It may be worth manually editing the file to put paypal into test mode. To do this change the 0 in the first line to a 1.

ONce you have finshed tested just revert the 1 back to a 0.

Although its not a true fix it should give you the answer you are looking for!
Title: Re: Cannot set to test mode
Post by: stinga on May 19, 2010, 00:14:24 AM
can you post the extra payment info as well please.
Title: Re: Cannot set to test mode
Post by: spyderwoman on May 19, 2010, 03:08:30 AM
Yes thank you, where do I find the extra payment info?
Title: Re: Cannot set to test mode
Post by: stinga on May 19, 2010, 09:25:49 AM
in the VM setup of paypal
Title: Re: Cannot set to test mode
Post by: spyderwoman on May 19, 2010, 14:07:45 PM
thank you.
<?php
$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);

$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"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"),
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,

"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",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"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="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>