クラス
Middleware
ソース ソース
ファイル: src/Admin/API/Middleware.php
class Middleware
{
/**
* AmazonPay module object
*
* @var AmazonPay
*/
private $module;
/**
* Sets `$module` member var with dependency injection.
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param AmazonPay $module
* @return void
*/
public function __construct(AmazonPay $module) {
$this->module = $module;
}
/**
* Returns a `GenericError` if the orderId is not associated with an Amazon Pay purchase
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @return Closure&#Function#65df7dd6
*/
public function isOrderAssociated() {
return function ($args) {
$orderId = (int)$args['orderId'];
if (!$this->module->isOrderAssociated($orderId)) {
return $this->module->errors->getErrorResponse(
GenericErrorStore::AMAZON_PAY_ORDER_NOT_FOUND,
[$orderId]
);
}
};
}
}
- __construct — Sets `$module` member var with dependency injection.
- isOrderAssociated — Returns a `GenericError` if the orderId is not associated with an Amazon Pay purchase