-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from gitkv/master
*fix bug callback signature verify, change verifying action
- Loading branch information
Showing
10 changed files
with
321 additions
and
24 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
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
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,137 @@ | ||
<?php | ||
/** | ||
* Created by gitkv. | ||
* E-mail: [email protected] | ||
* GitHub: gitkv | ||
*/ | ||
|
||
namespace Tmconsulting\Uniteller\Signature; | ||
|
||
|
||
/** | ||
* Class SignatureCallback | ||
* @package Tmconsulting\Uniteller\Signature | ||
*/ | ||
final class SignatureCallback extends AbstractSignature | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $orderId; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $status; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fields = []; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $password; | ||
|
||
/** | ||
* @param $orderId | ||
* @return SignatureCallback | ||
*/ | ||
public function setOrderId($orderId) | ||
{ | ||
$this->orderId = $orderId; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param $status | ||
* @return SignatureCallback | ||
*/ | ||
public function setStatus($status) | ||
{ | ||
$this->status = $status; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param array $fields | ||
* @return SignatureCallback | ||
*/ | ||
public function setFields($fields) | ||
{ | ||
$this->fields = $fields; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param string $password | ||
* @return SignatureCallback | ||
*/ | ||
public function setPassword($password) | ||
{ | ||
$this->password = $password; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOrderId() | ||
{ | ||
return $this->orderId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getStatus() | ||
{ | ||
return $this->status; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getFields() | ||
{ | ||
return $this->fields; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPassword() | ||
{ | ||
return $this->password; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function toArray() | ||
{ | ||
$array = []; | ||
$array['Order_ID'] = $this->getOrderId(); | ||
$array['Status'] = $this->getStatus(); | ||
$array = array_merge($array, $this->getFields()); | ||
$array['Password'] = $this->getPassword(); | ||
|
||
return $array; | ||
} | ||
|
||
/** | ||
* Create signature | ||
* | ||
* @return string | ||
*/ | ||
public function create() | ||
{ | ||
return strtoupper(md5(join('', $this->toArray()))); | ||
} | ||
} |
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
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
Oops, something went wrong.