| @@ 58-74 (lines=17) @@ | ||
| 55 | * @return null|Card |
|
| 56 | * @throws PartFireException |
|
| 57 | */ |
|
| 58 | public function get(string $cardId): Card |
|
| 59 | { |
|
| 60 | try { |
|
| 61 | $card = $this->mangoPayApi->Cards->Get($cardId); |
|
| 62 | if ($card instanceof mangoCard) { |
|
| 63 | return $this->cardTranslator->translateMangoCardToDto($card); |
|
| 64 | } |
|
| 65 | $this->logger->addCritical("Card ID: $cardId not found when querying API."); |
|
| 66 | throw new PartFireException("Card ID: $cardId not found when querying API."); |
|
| 67 | } catch (ResponseException $e) { |
|
| 68 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); |
|
| 69 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 70 | } catch (Exception $e) { |
|
| 71 | $this->logger->addError($e->getMessage()); |
|
| 72 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | public function deactivate(string $cardId): Card |
|
| 77 | { |
|
| @@ 97-113 (lines=17) @@ | ||
| 94 | } |
|
| 95 | } |
|
| 96 | ||
| 97 | public function get(string $cardRegisteredId): CardRegistrationDto |
|
| 98 | { |
|
| 99 | try { |
|
| 100 | $cardRegister = $this->mangoPayApi->CardRegistrations->Get($cardRegisteredId); |
|
| 101 | if ($cardRegister instanceof CardRegistration) { |
|
| 102 | return $this->cardTranslator->translateMangoCardRegistrationDataToDto($cardRegister); |
|
| 103 | } |
|
| 104 | $this->logger->addCritical("Card Registration ID: $cardRegisteredId not found when querying API."); |
|
| 105 | throw new PartFireException("Card Registration ID: $cardRegisteredId not found when querying API."); |
|
| 106 | } catch (ResponseException $e) { |
|
| 107 | $this->logger->addCritical($e->getMessage(), ['code' => $e->getCode(), 'details' => $e->GetErrorDetails()]); |
|
| 108 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 109 | } catch (Exception $e) { |
|
| 110 | $this->logger->addError($e->getMessage()); |
|
| 111 | throw new PartFireException($e->getMessage(), $e->getCode(), $e); |
|
| 112 | } |
|
| 113 | } |
|
| 114 | } |
|
| 115 | ||