/**
  * @cover ::handleBankInfo
  */
 public function testBankInfoValidate()
 {
     $vendors = Mirakl::getVendor();
     $miraklData = reset($vendors);
     $vendor = $this->getVendorInstance($miraklData);
     $miraklData = array($vendor->getMiraklId() => $miraklData);
     $this->hipay->bankInfosStatus($this->vendorArgument)->willReturn(BankInfoStatus::VALIDATED)->shouldBeCalled();
     $this->hipay->bankInfosCheck(Argument::is($vendor))->will(function () use($miraklData, $vendor) {
         $bankInfo = new BankInfo();
         return $bankInfo->setMiraklData($miraklData[$vendor->getMiraklId()]);
     })->shouldBeCalled();
     $this->vendorProcessor->handleBankInfo(array($vendor), $miraklData);
 }
 /**
  * Create a bank account in HiPay.
  *
  * @param VendorInterface $vendor
  * @param BankInfo        $bankInfo
  *
  * @return array|bool if array is empty
  *
  * @throws Exception
  */
 public function bankInfosRegister(VendorInterface $vendor, BankInfo $bankInfo)
 {
     $parameters = $this->mergeSubAccountParameters($vendor);
     $parameters = $bankInfo->mergeIntoParameters($parameters);
     return $this->callSoap('bankInfosRegister', $parameters);
 }
 /**
  * Add the bank information to a wallet
  * The call will fail if the bank information status is not blank
  * @param VendorInterface $vendor
  * @param array|BankInfo $miraklBankInfo
  * @param bool|false $checkBankStatus set to true if you also want to check to bank info status prior to add them
  * @return bool
  */
 public function addBankInformation($vendor, $miraklBankInfo, $checkBankStatus = false)
 {
     if ($checkBankStatus) {
         $bankInfoStatus = $this->getBankInfoStatus($vendor);
         if (trim($bankInfoStatus) == BankInfoStatus::BLANK) {
             return false;
         }
     }
     if (is_array($miraklBankInfo)) {
         $bankInfo = new BankInfo();
         $miraklBankInfo = $bankInfo->setMiraklData($miraklBankInfo);
     }
     return $this->sendBankAccount($vendor, $miraklBankInfo);
 }