/**
  * @param array $parameters
  * @return CopyAndPayWidget|null
  */
 public function getWidget(array $parameters = [])
 {
     if (!$this->haveWidget()) {
         return null;
     }
     $defaultParameters = ['transactionToken' => $this->getTransactionToken()];
     if ($this->request) {
         $defaultParameters['testMode'] = $this->request->getTestMode();
         $defaultParameters['returnUrl'] = $this->request->getReturnUrl();
         $defaultParameters['brands'] = $this->request->getBrands();
     }
     $parameters = array_replace($defaultParameters, $parameters);
     $widget = new CopyAndPayWidget($parameters);
     return $widget;
 }
 public function testGetReturnUrl()
 {
     $request = new CopyAndPayPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
     $request->initialize($this->options);
     $this->assertSame('https://my.site.example/redirect/url', $request->getReturnUrl());
 }