関数
IPN::register( array $args, array $payload )
パラメータ パラメータ
- $args
(配列) (必須)
- $payload
(配列) (必須)
ファイル: src/Admin/API/IPN.php
public function register($args, $payload) {
$url = $payload['ipnEndpoint'];
if (empty($url)) {
return $this->getErrorResponse(self::URL_EMPTY);
}
$response = (new EndpointSetter($this->module))->set($url);
if ((int)$response['ResponseStatus'] !== 200) {
if (isset($response['Error']['Code'])) {
if ($response['Error']['Code'] === 'InvalidArgumentsClientError') {
return $this->getErrorResponse(self::URL_INVALID, [$response['Error']['Message']]);
}
}
return $this->getErrorResponse(self::INTERNAL_SERVER_ERROR);
}
$opts = $this->module->getActingOpts();
$opts['ipn_endpoint'] = $url;
$opts['ipn_registered'] = true;
$this->module->updateActingOpts($opts);
return 'success';
}