/** * Create the vendor operation * dispatch <b>after.operation.create</b>. * * @param int $amount * @param DateTime $cycleDate * @param string $paymentVoucher * @param bool|int $miraklId false if it an operator operation * * @return OperationInterface|null */ public function createOperation($amount, DateTime $cycleDate, $paymentVoucher, $miraklId = null) { if ($amount <= 0) { $this->logger->notice("Operation wasn't created du to null amount"); return null; } //Call implementation function $operation = $this->operationManager->create($amount, $cycleDate, $paymentVoucher, $miraklId); //Set hipay id $hipayId = null; if ($miraklId) { $vendor = $this->vendorManager->findByMiraklId($miraklId); if ($vendor) { $hipayId = $vendor->getHiPayId(); } } else { $hipayId = $this->operator->getHiPayId(); } $operation->setHiPayId($hipayId); //Sets mandatory values $operation->setMiraklId($miraklId); $operation->setStatus(new Status(Status::CREATED)); $operation->setUpdatedAt(new DateTime()); $operation->setAmount($amount); $operation->setCycleDate($cycleDate); $operation->setPaymentVoucher($paymentVoucher); return $operation; }
/** * Transfer constructor. * * @param float $amount * @param VendorInterface $vendorInterface * @param string $privateLabel * @param string $publicLabel */ public function __construct($amount, VendorInterface $vendorInterface, $privateLabel, $publicLabel) { $this->amount = $amount; $this->recipientUserId = $vendorInterface->getHiPayId(); $this->recipientUsername = $vendorInterface->getEmail(); $this->privateLabel = $privateLabel; $this->publicLabel = $publicLabel; }
/** * Add sub account informations. * * @param array $parameters the parameters array to add the info to * @param VendorInterface $vendor the vendor from which subAccount info is fetched from * * @return array */ protected function mergeSubAccountParameters(VendorInterface $vendor, $parameters = array()) { $parameters += array('wsSubAccountLogin' => $vendor->getEmail(), 'wsSubAccountId' => $vendor->getHiPayId()); return $parameters; }
/** * TransactionException constructor. * * @param VendorInterface $vendor * @param string $message * @param int $code * @param $previousException */ public function __construct($vendor, $message = '', $code = 0, $previousException = null) { $this->vendor = $vendor; parent::__construct($message ?: "The HiPay Wallet account {$vendor->getHiPayId()} is unidentified. Please upload identification documents for Mirakl shop " . $vendor->getMiraklId() . " if you didn't already do so.", $code, $previousException); }
/** * NoWalletFoundException constructor. * * @param VendorInterface $vendor * @param string $message * @param int $code * @param Exception $previous */ public function __construct(VendorInterface $vendor = null, $message = '', $code = 0, Exception $previous = null) { $this->vendor = $vendor; $defaultMessage = $vendor ? "The wallet for {$vendor->getHiPayId()} is not found" : "The vendor is not found in the storage"; parent::__construct($message ?: $defaultMessage, $code, $previous); }
/** * InvalidBankInfoException constructor. * * @param VendorInterface $vendor * @param BankInfo $bankInfo * @param string $message * @param int $code * @param Exception $previous */ public function __construct(VendorInterface $vendor, BankInfo $bankInfo, $message = '', $code = 0, Exception $previous = null) { $this->vendor = $vendor; $this->bankInfo = $bankInfo; parent::__construct($message ?: "The creation of the bank account for hipay Wallet\n {$vendor->getHiPayId()} failed", $code, $previous); }
/** * Return the values who should't * change after the registration of the hipay wallet. * * @param VendorInterface $vendor */ protected function getImmutableValues(VendorInterface $vendor) { $previousValues['email'] = $vendor->getEmail(); $previousValues['hipayId'] = $vendor->getHiPayId(); $previousValues['miraklId'] = $vendor->getMiraklId(); return $previousValues; }