/**
  * @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 testSetCardReference()
 {
     $request = new CopyAndPayPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
     $this->assertNull($request->getCardReference());
     $value = uniqid();
     $request->initialize(['cardReference' => $value]);
     $this->assertSame($value, $request->getCardReference());
     $this->assertNull($request->getIdentificationReferenceId());
     $this->assertSame($request, $request->setCardReference(null));
     $this->assertNull($request->getCardReference());
     $this->assertNull($request->getIdentificationReferenceId());
 }