Skip to content

Commit

Permalink
Use base64_encode for crypt to avoid invalid characters in remittance…
Browse files Browse the repository at this point in the history
… identifier
  • Loading branch information
hakito committed Feb 19, 2015
1 parent 2257dd7 commit 7a4f3fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SoCommunicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private function AppendHash($string)
if (empty($this->ObscuritySeed))
throw new \UnexpectedValueException('No security seed set when using security suffix.');

$hash = crypt($string, $this->ObscuritySeed);
$hash = base64_encode(crypt($string, $this->ObscuritySeed));
return $string . substr($hash, 0, $this->ObscuritySuffixLength);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function testSendTransferInitiatorDetailsWithSecurityAppendsHash()

$this->target->SendTransferInitiatorDetails($transferInitiatorDetails, $url);
$this->assertEquals('string', gettype($this->mTransport->lastPostBody));
$this->assertContains('>'. 'Order1SoxmdwbL' . '<', $this->mTransport->lastPostBody);
$this->assertContains('>'. 'Order1U294bWR3' . '<', $this->mTransport->lastPostBody);
}

public function testHandleConfirmationUrlThrowsExceptionOnMissingCallback()
Expand Down Expand Up @@ -403,7 +403,7 @@ public function testHandleConfirmationUrlStripsSecurityHashFromRemittanceIdentif
{
$original = $this->GetEpsData('BankConfirmationDetailsWithoutSignature.xml');
$expected = 'AT1234567890XYZ';
$data = str_replace($expected, $expected . 'Fo7', $original);
$data = str_replace($expected, $expected . 'Rm8', $original);
$dataPath = tempnam(sys_get_temp_dir(), 'SoCommunicatorTest_');
file_put_contents($dataPath, $data);

Expand Down

0 comments on commit 7a4f3fd

Please sign in to comment.