| @@ 46-72 (lines=27) @@ | ||
| 43 | $this->payInTranslator = $payInTranslator; | |
| 44 | } | |
| 45 | ||
| 46 | public function createPayInCardDirect(CardDirectPayIn $cardDirectPayIn) : CardDirectPayIn | |
| 47 |     { | |
| 48 |         try { | |
| 49 | $payIn = $this->payInTranslator->translateDtoToMangoPayInForDirectPayIn($cardDirectPayIn); | |
| 50 | $createdPayIn = $this->mangoPayApi->PayIns->Create($payIn); | |
| 51 | ||
| 52 |             if ($createdPayIn instanceof PayIn) { | |
| 53 |                 if ($createdPayIn->Status == PayInStatus::Succeeded) { | |
| 54 | return $this->payInTranslator->translateMangoPayDirectPayInToDto($createdPayIn); | |
| 55 | } | |
| 56 | $this->logger->addCritical( | |
| 57 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' | |
| 58 | ); | |
| 59 | throw new PartFireException( | |
| 60 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' | |
| 61 | ); | |
| 62 | } | |
| 63 |             $this->logger->addCritical("Failed to create PayIn"); | |
| 64 |             throw new PartFireException("Failed to create PayIn"); | |
| 65 |         } catch (ResponseException $e) { | |
| 66 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); | |
| 67 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); | |
| 68 |         } catch (Exception $e) { | |
| 69 | $this->logger->addError($e->getMessage()); | |
| 70 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); | |
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | public function createBankWireDirectPayIn(BankwireDirectPayIn $bankwireDirectPayIn) : BankwireDirectPayIn | |
| 75 |     { | |
| @@ 74-101 (lines=28) @@ | ||
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | public function createBankWireDirectPayIn(BankwireDirectPayIn $bankwireDirectPayIn) : BankwireDirectPayIn | |
| 75 |     { | |
| 76 |         try { | |
| 77 | $payIn = $this->payInTranslator->translateDtoToMangoPayInForBankwireDirectPayIn($bankwireDirectPayIn); | |
| 78 | $createdPayIn = $this->mangoPayApi->PayIns->Create($payIn); | |
| 79 | ||
| 80 |             if ($createdPayIn instanceof PayIn) { | |
| 81 | ||
| 82 |                 if ($createdPayIn->Status == PayInStatus::Created) { | |
| 83 | return $this->payInTranslator->translateMangoPayBankwireDirectPayInToDto($createdPayIn); | |
| 84 | } | |
| 85 | $this->logger->addCritical( | |
| 86 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' | |
| 87 | ); | |
| 88 | throw new PartFireException( | |
| 89 | "Pay-In has been created with status: ".$createdPayIn->Status . ' (result code: ' . $createdPayIn->ResultCode . ')' | |
| 90 | ); | |
| 91 | } | |
| 92 |             $this->logger->addCritical("Failed to create PayIn"); | |
| 93 |             throw new PartFireException("Failed to create PayIn"); | |
| 94 |         } catch (ResponseException $e) { | |
| 95 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); | |
| 96 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); | |
| 97 |         } catch (Exception $e) { | |
| 98 | $this->logger->addError($e->getMessage()); | |
| 99 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 103 | public function get($id) : BankwireDirectPayIn | |
| 104 |     { | |
| @@ 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 |     { | |