| @@ 46-73 (lines=28) @@ | ||
| 43 | $this->payOutTranslator = $payOutTranslator; |
|
| 44 | } |
|
| 45 | ||
| 46 | public function createBankWire(PayOutBankWire $payOutBankWire) : PayOutBankWire |
|
| 47 | { |
|
| 48 | try { |
|
| 49 | $payout = $this->payOutTranslator->translatePayOutDtoToMango($payOutBankWire); |
|
| 50 | $createdPayout = $this->mangoPayApi->PayOuts->Create($payout); |
|
| 51 | ||
| 52 | if ($createdPayout instanceof PayOut) { |
|
| 53 | ||
| 54 | if ($createdPayout->Status == PayOutStatus::Created) { |
|
| 55 | return $this->payOutTranslator->translateMangoToPayOutDto($createdPayout); |
|
| 56 | } |
|
| 57 | $this->logger->addCritical( |
|
| 58 | "Pay-Out has been created with status: ".$createdPayout->Status . ' (result code: ' . $createdPayout->ResultCode . ')' |
|
| 59 | ); |
|
| 60 | throw new PartFireException( |
|
| 61 | "Pay-Out has been created with status: ".$createdPayout->Status . ' (result code: ' . $createdPayout->ResultCode . ')' |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | $this->logger->addCritical("Failed to create PayOut"); |
|
| 65 | throw new PartFireException("Failed to create PayOut"); |
|
| 66 | } catch (ResponseException $e) { |
|
| 67 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); |
|
| 68 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 69 | } catch (Exception $e) { |
|
| 70 | $this->logger->addError($e->getMessage()); |
|
| 71 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| 75 | public function getBankWire(string $payOutId): PayOutBankWire |
|
| 76 | { |
|
| @@ 66-93 (lines=28) @@ | ||
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | public function createBankWireDirectPayIn(BankwireDirectPayIn $bankwireDirectPayIn) : BankwireDirectPayIn |
|
| 67 | { |
|
| 68 | try { |
|
| 69 | $payIn = $this->payInTranslator->translateDtoToMangoPayInForBankwireDirectPayIn($bankwireDirectPayIn); |
|
| 70 | $createdPayIn = $this->mangoPayApi->PayIns->Create($payIn); |
|
| 71 | ||
| 72 | if ($createdPayIn instanceof PayIn) { |
|
| 73 | ||
| 74 | if ($createdPayIn->Status == PayInStatus::Created) { |
|
| 75 | return $this->payInTranslator->translateMangoPayBankwireDirectPayInToDto($createdPayIn); |
|
| 76 | } |
|
| 77 | $this->logger->addCritical( |
|
| 78 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' |
|
| 79 | ); |
|
| 80 | throw new PartFireException( |
|
| 81 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' |
|
| 82 | ); |
|
| 83 | } |
|
| 84 | $this->logger->addCritical("Failed to create PayIn"); |
|
| 85 | throw new PartFireException("Failed to create PayIn"); |
|
| 86 | } catch (ResponseException $e) { |
|
| 87 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); |
|
| 88 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 89 | } catch (Exception $e) { |
|
| 90 | $this->logger->addError($e->getMessage()); |
|
| 91 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| 95 | public function get($id) : BankwireDirectPayIn |
|
| 96 | { |
|