diff --git a/src/Message/Checkout/PurchaseRequest.php b/src/Message/Checkout/PurchaseRequest.php index d3d2386d..0887ae27 100644 --- a/src/Message/Checkout/PurchaseRequest.php +++ b/src/Message/Checkout/PurchaseRequest.php @@ -14,6 +14,19 @@ */ class PurchaseRequest extends AbstractRequest { + /** + * Create response + * + * @param string $data + * @param array $headers + * + * @return Response + */ + protected function createResponse($data, $headers = []) + { + return $this->response = new Response($this, $data, $headers); + } + /** * Set the success url * diff --git a/src/Message/Checkout/Response.php b/src/Message/Checkout/Response.php new file mode 100644 index 00000000..ed135920 --- /dev/null +++ b/src/Message/Checkout/Response.php @@ -0,0 +1,33 @@ +getRedirectUrl() !== null; + } + + /** + * @return mixed + */ + public function getRedirectUrl() + { + if (isset($this->data['object']) && 'checkout.session' !== $this->data['object']) { + return null; + } + + return !empty($this->data['url']) ? $this->data['url'] : null; + } +}