Skip to content

Commit

Permalink
some reffactoring, removed unnecessary attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
avorontsov committed Feb 13, 2020
1 parent 3273eeb commit 4b0b2a2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 46 deletions.
17 changes: 2 additions & 15 deletions src/IpsPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,24 @@

namespace SchGroup\IpsPayment;

use GuzzleHttp\Exception\GuzzleException;
use Psr\Log\{NullLogger, LoggerInterface};
use GuzzleHttp\ClientInterface;

class IpsPayment
{
/**
* @var NullLogger
*/
private $logger;

const API_URL = "https://wws.ips-payment.com";
/**
* @var string
*/
private $apiKey;

/**
* @var ClientInterface
*/
private $client;

/**
* IpsPayment constructor.
* @param string $apiKey
* @param ClientInterface $client
*/
public function __construct(string $apiKey, ClientInterface $client, LoggerInterface $logger)
public function __construct(ClientInterface $client)
{
$this->apiKey = $apiKey;
$this->client = $client;
$this->logger = $logger;
}


Expand Down
24 changes: 12 additions & 12 deletions src/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ class Order
/**
* @var string
*/
public $Subscribe_Period;
public $subscribePeriod;
/**
* @var string
*/
public $RefOrder;
public $refOrder;
/**
* @var string
*/
public $Subscribe;
public $subscribe;

/**
* Order constructor.
* @param string $RefOrder
* @param string $refOrder
* @param float $amount
* @param string|null $Subscribe
* @param string|null $Subscribe_Period
* @param string|null $subscribe
* @param string|null $subscribePeriod
*/
public function __construct(
string $RefOrder,
string $refOrder,
float $amount,
?string $Subscribe = null,
?string $Subscribe_Period = null
?string $subscribe = null,
?string $subscribePeriod = null
) {
$this->RefOrder = $RefOrder;
$this->Subscribe = $Subscribe;
$this->Subscribe_Period = $Subscribe_Period;
$this->refOrder = $refOrder;
$this->subscribe = $subscribe;
$this->subscribePeriod = $subscribePeriod;
$this->amount = $amount;
}
}
25 changes: 8 additions & 17 deletions src/ShopSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,31 @@

class ShopSettings
{
/**
* @var string
*/
public $urlIPN;

/**
* @var string
*/
public $Integrated;

/**
* @var string
*/
public $urlOK;
public $lang;
/**
* @var string
*/
public $lang;
public $merchantKey;

/**
* ShopSettings constructor.
* @param string $urlIPN
* @param string $urlOK
* @param string $merchantKey
* @param string|null $Integrated
* @param string $lang
*/
public function __construct(
string $urlIPN,
string $urlOK,
?string $Integrated = null,
string $lang = 'en'
) {
$this->urlIPN = $urlIPN;
$this->urlOK = $urlOK;
public function __construct(string $merchantKey, string $Integrated = "NO", string $lang = 'en')
{
$this->merchantKey = $merchantKey;
$this->Integrated = $Integrated;

$this->lang = $lang;
}
}
4 changes: 2 additions & 2 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function __construct(
public function toArray(): array
{
return [
"MerchantKey"=> '8545e3aa27ba62e0API5e3aa27ba62e1',
"RefOrder" => $this->order->RefOrder,
"MerchantKey"=> $this->shopSettings->merchantKey,
"RefOrder" => $this->order->refOrder,
"amount" => $this->order->amount,
"Customer_Name" => $this->customer->customerName,
"Customer_Email" => $this->customer->customerEmail,
Expand Down

0 comments on commit 4b0b2a2

Please sign in to comment.