-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
fe90cba
commit 634b2fa
Showing
4 changed files
with
71 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
namespace Dfe\IPay88; | ||
/** | ||
* 2017-04-10 | ||
* @see \Dfe\IPay88\Signer\Request | ||
* @see \Dfe\IPay88\Signer\Response | ||
* @method Settings s() | ||
*/ | ||
abstract class Signer extends \Df\PaypalClone\Signer { | ||
/** | ||
* 2017-04-10 | ||
* @used-by sign() | ||
* @see \Dfe\IPay88\Signer\Request::values() | ||
* @see \Dfe\IPay88\Signer\Response::values() | ||
* @return string[] | ||
*/ | ||
abstract protected function values(); | ||
|
||
/** | ||
* 2017-04-10 | ||
* @override | ||
* @see \Df\PaypalClone\Signer::adjust() | ||
* @used-by \Df\PaypalClone\Signer::_sign() | ||
* @see \Dfe\IPay88\Signer::adjust() | ||
* @param array(string => mixed) $v | ||
* @return array(string => mixed) | ||
*/ | ||
final protected function adjust(array $v) {return | ||
['Amount' => df_string_clean($v['Amount'], '.', ',')] + $v | ||
;} | ||
|
||
/** | ||
* 2017-04-10 | ||
* @override | ||
* @see \Df\PaypalClone\Signer::sign() | ||
* @return string | ||
*/ | ||
final protected function sign() {return sha1(df_cc('', | ||
$this->s()->privateKey(), $this->v('MerchantCode'), $this->values() | ||
));} | ||
} |
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,13 @@ | ||
<?php | ||
namespace Dfe\IPay88\Signer; | ||
// 2017-04-10 | ||
final class Request extends \Dfe\IPay88\Signer { | ||
/** | ||
* 2017-04-10 | ||
* @override | ||
* @see \Dfe\IPay88\Signer::values() | ||
* @used-by \Dfe\IPay88\Signer::sign() | ||
* @return string[] | ||
*/ | ||
protected function values() {return dfa_select_ordered($this->v(), ['RefNo', 'Amount', 'Currency']);} | ||
} |
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,15 @@ | ||
<?php | ||
namespace Dfe\IPay88\Signer; | ||
// 2017-04-10 | ||
final class Response extends \Dfe\IPay88\Signer { | ||
/** | ||
* 2017-04-10 | ||
* @override | ||
* @see \Dfe\IPay88\Signer::values() | ||
* @used-by \Dfe\IPay88\Signer::sign() | ||
* @return string[] | ||
*/ | ||
protected function values() {return dfa_select_ordered($this->v(), [ | ||
'PaymentId', 'RefNo', 'Amount', 'Currency', 'Status' | ||
]);} | ||
} |
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