コード例 #1
0
ファイル: EZCash.php プロジェクト: sahanh/ezcash
 /**
  * Get receipt object from an encrypted response
  * @param  string $response
  * @return Receipt
  */
 public function getReceipt($response)
 {
     $res = new Response($response);
     $c = new Crypter();
     $c->setKey($this->private_key);
     $data = $c->process($res);
     $receipt = new Receipt($data);
     $receipt->validate();
     return $receipt;
 }
コード例 #2
0
ファイル: ResponseTest.php プロジェクト: sahanh/ezcash
 public function testSample()
 {
     $receipt = 'xbWNp6KqkCcTC81uvniHfWUt9C3+LspvPTTCajzkSlPXod4hYDDOOsXF/Dq/hT3RWRgQJ6hA1DcRqAvYZ/Xm8fgqJGhtlPmv/OSDcfo4H+Yn63cLYAX2IJ5bfNaPDoEppS6atohYoZ3RPoxwLa8ESMy5nj3rboxEjBEIk08UP18=';
     $to_decrypt = m::mock('SZ\\EZCash\\Cryptable')->shouldReceive('getCryptableData')->andReturn($receipt)->getMock();
     $c = new E\Crypter();
     $c->setKey($this->private_key);
     $receipt_data = $c->process($to_decrypt);
     $receipt = new Receipt($receipt_data);
     $expected = array('transaction_id' => 'TX_1403351950', 'status_code' => '14', 'status_description' => 'Insufficient balance in your eZ Cash account.', 'transaction_amount' => '20.00', 'merchant_code' => 'TESTMERCHANT', 'wallet_reference_id' => NULL);
     $this->assertEquals($expected, $receipt->toArray());
 }