Skip to content

Commit

Permalink
Update PayPal URI
Browse files Browse the repository at this point in the history
  • Loading branch information
Skouat committed Sep 15, 2018
1 parent 77d4868 commit 1668ccf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions controller/ipn_listener.php
Expand Up @@ -179,8 +179,8 @@ private function validate_transaction()

$this->set_args_return_uri();

// Get PayPal or Sandbox URL
$this->u_paypal = $this->ppde_controller_main->get_paypal_url((bool) $this->transaction_data['test_ipn']);
// Get PayPal or Sandbox URI
$this->u_paypal = $this->ppde_controller_main->get_paypal_uri((bool) $this->transaction_data['test_ipn']);

// Initiate PayPal connection
$this->ppde_ipn_remote->set_u_paypal($this->u_paypal);
Expand Down
11 changes: 8 additions & 3 deletions controller/main_controller.php
Expand Up @@ -14,7 +14,12 @@

class main_controller
{
/** Extension name */
const EXT_NAME = 'skouat/ppde';
/** Production Postback URL */
const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr';
/** Sandbox Postback URL */
const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';

protected $auth;
protected $config;
Expand Down Expand Up @@ -153,17 +158,17 @@ public function build_currency_select_menu($config_value = 0)
}

/**
* Get PayPal URL
* Get PayPal URI
* Used in form and in IPN process
*
* @param bool $is_test_ipn
*
* @return string
* @access public
*/
public function get_paypal_url($is_test_ipn = false)
public function get_paypal_uri($is_test_ipn = false)
{
return ($is_test_ipn || $this->use_sandbox()) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr';
return ($is_test_ipn || $this->use_sandbox()) ? self::SANDBOX_VERIFY_URI : self::VERIFY_URI;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion controller/main_donate.php
Expand Up @@ -68,7 +68,7 @@ public function handle()
'PPDE_LIST_VALUE' => $this->build_currency_value_select_menu($this->config['ppde_default_value']),

'S_HIDDEN_FIELDS' => $this->paypal_hidden_fields(),
'S_PPDE_FORM_ACTION' => $this->get_paypal_url(),
'S_PPDE_FORM_ACTION' => $this->get_paypal_uri(),
'S_RETURN_ARGS' => $this->return_args_url,
'S_SANDBOX' => $this->use_sandbox(),
));
Expand Down

0 comments on commit 1668ccf

Please sign in to comment.