Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Jun 24, 2024
1 parent 5c8b91c commit f0398d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions src/Services/PayPal.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ public function __construct(array $config = [])
protected function setOptions(array $credentials): void
{
// Setting API Endpoints
$this->config['api_url'] = 'https://api-m.paypal.com';
$sandbox = ($this->mode === 'sandbox') ? '.sandbox' : '';
$this->config['api_url'] = "https://api-m{$sandbox}.paypal.com";

$this->config['gateway_url'] = 'https://www.paypal.com';
$this->config['ipn_url'] = 'https://ipnpb.paypal.com/cgi-bin/webscr';

if ($this->mode === 'sandbox') {
$this->config['api_url'] = 'https://api-m.sandbox.paypal.com';

$this->config['gateway_url'] = 'https://www.sandbox.paypal.com';
$this->config['ipn_url'] = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
}
$this->config['gateway_url'] = "https://www{$sandbox}.paypal.com";
$this->config['ipn_url'] = "https://ipnpb{$sandbox}.paypal.com/cgi-bin/webscr";

// Adding params outside sandbox / live array
$this->config['payment_action'] = $credentials['payment_action'];
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/PayPalAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function setCurrentPage(int $page): PayPalClient
*/
public function showTotals(bool $totals): PayPalClient
{
$this->show_totals = $totals ? "true" : "false";
$this->show_totals = $totals ? 'true' : 'false';

return $this;
}
Expand Down

0 comments on commit f0398d6

Please sign in to comment.