-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: jam | ||
* Date: 20.8.15 | ||
* Time: 17:24 | ||
*/ | ||
|
||
namespace Trejjam\ThePay\Helper; | ||
|
||
use Tp; | ||
|
||
interface IRadioMerchant | ||
{ | ||
/** | ||
* @return Tp\Helper\RadioMerchant | ||
*/ | ||
function create(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: jam | ||
* Date: 20.8.15 | ||
* Time: 11:48 | ||
*/ | ||
|
||
namespace Trejjam\ThePay; | ||
|
||
|
||
interface IPermanentPayment | ||
{ | ||
/** | ||
* @return PermanentPayment | ||
*/ | ||
function create(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: jam | ||
* Date: 20.8.15 | ||
* Time: 11:16 | ||
*/ | ||
|
||
namespace Trejjam\ThePay; | ||
|
||
|
||
use Nette, | ||
Tp, | ||
Trejjam; | ||
|
||
class PermanentPayment extends Tp\PermanentPayment | ||
{ | ||
/** | ||
* @var Nette\Application\LinkGenerator | ||
*/ | ||
protected $linkGenerator; | ||
|
||
public function __construct(Tp\MerchantConfig $config, Nette\Application\LinkGenerator $linkGenerator) | ||
{ | ||
parent::__construct($config, NULL, NULL, NULL); | ||
|
||
$this->linkGenerator = $linkGenerator; | ||
} | ||
|
||
public function getMerchantData() | ||
{ | ||
if (is_null($this->merchantData)) { | ||
throw new PermanentPaymentException('Property merchantData was not set', PermanentPaymentException::UNDEFINED_PROPERTY); | ||
} | ||
|
||
return parent::getMerchantData(); | ||
} | ||
|
||
public function getDescription() | ||
{ | ||
if (is_null($this->description)) { | ||
throw new PermanentPaymentException('Property description was not set', PermanentPaymentException::UNDEFINED_PROPERTY); | ||
} | ||
|
||
return parent::getDescription(); | ||
} | ||
|
||
public function getReturnUrl() | ||
{ | ||
if (is_null($this->returnUrl)) { | ||
throw new PermanentPaymentException('Property returnUrl was not set', PermanentPaymentException::UNDEFINED_PROPERTY); | ||
} | ||
|
||
return parent::getReturnUrl(); | ||
} | ||
|
||
public function setReturnUrl($returnUrl, $params = []) | ||
{ | ||
if (preg_match('~^([\w:]+):(\w*+)(#.*)?()\z~', $returnUrl)) { | ||
$returnUrl = $this->linkGenerator->link($returnUrl, $params); | ||
} | ||
|
||
parent::setReturnUrl($returnUrl); | ||
} | ||
|
||
public function getSignature() | ||
{ | ||
$this->getMerchantData(); | ||
$this->getDescription(); | ||
$this->getReturnUrl(); | ||
|
||
return parent::getSignature(); | ||
} | ||
public function getSignatureLite() | ||
{ | ||
$this->getMerchantData(); | ||
|
||
return parent::getSignatureLite(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters