diff --git a/src/Handlers/ResponseHandler.php b/src/Handlers/ResponseHandler.php index 12d8987..083786b 100644 --- a/src/Handlers/ResponseHandler.php +++ b/src/Handlers/ResponseHandler.php @@ -130,7 +130,7 @@ public function retrieveH000ReportText(DOMDocument $xml): string public function extractInitializationSegment(Response $response, Keyring $keyring): InitializationSegment { $transactionKeyEncoded = $this->retrieveH00XTransactionKey($response); - $transactionKey = $this->base64Service->decode($transactionKeyEncoded); + $transactionKey = $transactionKeyEncoded !== null ? $this->base64Service->decode($transactionKeyEncoded) : ''; $orderDataEncrypted = $this->base64Service->decode($this->retrieveH00XOrderData($response)); $orderDataCompressed = $this->cryptService->decryptOrderDataCompressed( @@ -154,7 +154,7 @@ public function extractDownloadSegment(Response $response): DownloadSegment $transactionId = $this->retrieveH00XTransactionId($response); $transactionPhase = $this->retrieveH00XTransactionPhase($response); $transactionKeyEncoded = $this->retrieveH00XTransactionKey($response); - $transactionKey = $this->base64Service->decode($transactionKeyEncoded); + $transactionKey = $transactionKeyEncoded !== null ? $this->base64Service->decode($transactionKeyEncoded) : ''; $numSegments = $this->retrieveH00XNumSegments($response); $segmentNumber = $this->retrieveH00XSegmentNumber($response); $orderDataEncrypted = $this->retrieveH00XOrderData($response); diff --git a/src/Services/Processor/Base64Encoder.php b/src/Services/Processor/Base64Encoder.php index 24c5b0f..c8f0630 100644 --- a/src/Services/Processor/Base64Encoder.php +++ b/src/Services/Processor/Base64Encoder.php @@ -13,10 +13,10 @@ */ final class Base64Encoder implements Base64EncoderInterface { - /** Max encoded length = 10 * 1024 * 1024 (10 MB) */ - private const MAX_ENCODED_LENGTH = 10485760; - /** Max raw length = MAX_ENCODED_LENGTH * 3 / 4 (~7.5 MB) */ - private const MAX_RAW_LENGTH = 7864320; + /** Max encoded length = 512 * 1024 * 1024 (512 MB) */ + private const MAX_ENCODED_LENGTH = 536870912; + /** Max raw length = MAX_ENCODED_LENGTH * 3 / 4 (~384 MB) */ + private const MAX_RAW_LENGTH = 402653184; public function encode(string $data): string {