Skip to content

Commit

Permalink
Merge pull request #7 from alegraio/dev-fix
Browse files Browse the repository at this point in the history
refactored
  • Loading branch information
cansozeri authored Nov 26, 2020
2 parents e8bfac0 + 303fa51 commit c0c365b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Omnipay Garanti(Gvp) Test Suite">
<testsuite name="Omnipay NestPay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
Expand Down
11 changes: 11 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ public function getName(): string
return 'NestPay';
}

public function getDefaultParameters(): array
{
return [
'bank' => '',
'clientId' => '',
'username' => '',
'storeKey' => '',
'password' => ''
];
}

/**
* @return string
*/
Expand Down
33 changes: 12 additions & 21 deletions src/Messages/RequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@ trait RequestTrait
{

public $baseUrls = [
'asseco' => ['baseUrl' => 'https://entegrasyon.asseco-see.com.tr'],
'isbank' => ['baseUrl' => 'https://spos.isbank.com.tr'],
'akbank' => ['baseUrl' => 'https://www.sanalakpos.com'],
'finansbank' => ['baseUrl' => 'https://www.fbwebpos.com'],
'denizbank' => ['baseUrl' => 'https://denizbank.est.com.tr'],
'kuveytturk' => ['baseUrl' => 'https://kuveytturk.est.com.tr'],
'halkbank' => ['baseUrl' => 'https://sanalpos.halkbank.com.tr'],
'anadolubank' => ['baseUrl' => 'https://anadolusanalpos.est.com.tr'],
'hsbc' => ['baseUrl' => 'https://vpos.advantage.com.tr'],
'ziraatbank' => ['baseUrl' => 'https://sanalpos2.ziraatbank.com.tr'],
'test' => [
'purchase' => [
'baseUrl' => 'https://entegrasyon.asseco-see.com.tr'
],
'3d' => [
'baseUrl' => 'https://entegrasyon.asseco-see.com.tr'
]
]
'isbank' => 'https://spos.isbank.com.tr',
'akbank' => 'https://www.sanalakpos.com',
'finansbank' => 'https://www.fbwebpos.com',
'denizbank' => 'https://denizbank.est.com.tr',
'kuveytturk' => 'https://kuveytturk.est.com.tr',
'halkbank' => 'https://sanalpos.halkbank.com.tr',
'anadolubank' => 'https://anadolusanalpos.est.com.tr',
'hsbc' => 'https://vpos.advantage.com.tr',
'ziraatbank' => 'https://sanalpos2.ziraatbank.com.tr',
'test' => 'https://entegrasyon.asseco-see.com.tr'
];

protected $allowedCardBrands = [
Expand Down Expand Up @@ -59,11 +51,10 @@ public function getEndpoint(): string
public function getBaseUrl(): string
{
$bank = $this->getBank();
$action = $this->getAction();
if ($this->getTestMode()) {
return $this->baseUrls['test'][$action]['baseUrl'] ?? $this->baseUrls['test']['purchase']['baseUrl'];
return $this->baseUrls['test'];
}
return $this->baseUrls[$bank]['baseUrl'];
return $this->baseUrls[$bank];
}

public function getRnd(): string
Expand Down
4 changes: 2 additions & 2 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function setUp(): void
/** @var Gateway gateway */
$this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());
/*$this->gateway->setBank('akbank');
$this->gateway->setUserName('akalegra');
$this->gateway->setUserName('xxxxx');
$this->gateway->setClientId('100100000');
$this->gateway->setPassword('ALG*3466');
$this->gateway->setPassword('xxxxxx');
$this->gateway->setStoreKey('123456');
$this->gateway->setTestMode(true);*/
}
Expand Down

0 comments on commit c0c365b

Please sign in to comment.