| @@ 14-31 (lines=18) @@ | ||
| 11 | * @author Vuong Minh <[email protected]> |
|
| 12 | * @since 1.0.0 |
|
| 13 | */ |
|
| 14 | abstract class AbstractHashRequest extends AbstractRequest |
|
| 15 | { |
|
| 16 | use Concerns\RequestHash; |
|
| 17 | use Concerns\RequestEndpoint; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * {@inheritdoc} |
|
| 21 | */ |
|
| 22 | public function getData(): array |
|
| 23 | { |
|
| 24 | $parameters = $this->getParameters(); |
|
| 25 | call_user_func_array([$this, 'validate'], $this->getHashParameters()); |
|
| 26 | $parameters['hash'] = $this->generateHash(); |
|
| 27 | unset($parameters['testMode'], $parameters['publicKey'], $parameters['secretKey']); |
|
| 28 | ||
| 29 | return $parameters; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 14-34 (lines=21) @@ | ||
| 11 | * @author Vuong Minh <[email protected]> |
|
| 12 | * @since 1.0.0 |
|
| 13 | */ |
|
| 14 | abstract class AbstractSignatureRequest extends AbstractRequest |
|
| 15 | { |
|
| 16 | use Concerns\RequestEndpoint; |
|
| 17 | use Concerns\RequestSignature; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * {@inheritdoc} |
|
| 21 | */ |
|
| 22 | public function getData(): array |
|
| 23 | { |
|
| 24 | $parameters = $this->getParameters(); |
|
| 25 | call_user_func_array( |
|
| 26 | [$this, 'validate'], |
|
| 27 | $this->getSignatureParameters() |
|
| 28 | ); |
|
| 29 | $parameters['signature'] = $this->generateSignature(); |
|
| 30 | unset($parameters['secretKey'], $parameters['testMode'], $parameters['publicKey']); |
|
| 31 | ||
| 32 | return $parameters; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||