diff --git a/composer.json b/composer.json index 09892ae..d1d6e1f 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "3davinci/sberbank-gateway", - "version": "0.2.3", + "version": "0.2.4", "description": "Sberbank REST client", "type": "library", "license": "MIT", diff --git a/src/Sberbank/Message/GooglePaymentRequest.php b/src/Sberbank/Message/GooglePaymentRequest.php index 9347af1..bb4e3c9 100644 --- a/src/Sberbank/Message/GooglePaymentRequest.php +++ b/src/Sberbank/Message/GooglePaymentRequest.php @@ -188,7 +188,19 @@ public function send(): ResponseInterface $httpResponse = $this->sberbankClient->post( $this->getUrl(), ['Content-type' => 'application/json'], - json_encode($this->getParameters(['orderBundle'])) + json_encode($this->getParameters([ + 'merchant', + 'orderNumber', + 'paymentToken', + 'amount', + 'orderBundle', + 'returnUrl', + 'failUrl', + 'description', + 'phone', + 'email', + 'clientId' + ])) ); $body = $httpResponse->getBody(); diff --git a/src/Sberbank/Message/GooglePaymentResponse.php b/src/Sberbank/Message/GooglePaymentResponse.php index 51da8f1..17bd562 100644 --- a/src/Sberbank/Message/GooglePaymentResponse.php +++ b/src/Sberbank/Message/GooglePaymentResponse.php @@ -17,6 +17,33 @@ class GooglePaymentResponse extends RestResponse */ public function getOrderId(): ?string { - return $this->data['orderId'] ?? null; + return $this->data['data']['orderId'] ?? null; + } + + /** + * @return int|null + */ + public function getErrorCode(): ?int + { + if (isset($this->data['error']['code'])) { + + return (int) $this->data['error']['code']; + } + + return null; + + } + + /** + * @return string + */ + public function getErrorMessage(): string + { + if (isset($this->data['error']['message'])) { + + return $this->data['error']['message']; + } + + return ''; } } \ No newline at end of file