コード例 #1
0
 public function testDecrypt()
 {
     $data = 'data';
     $encryptedData = 'd1a2t3a4';
     $this->encryptorInterfaceMock->expects($this->once())->method('decrypt')->with($encryptedData)->will($this->returnValue($data));
     $this->assertEquals($data, $this->info->decrypt($encryptedData));
 }
コード例 #2
0
 /**
  * Refund the amount
  * Need to decode last 4 digits for request.
  *
  * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment
  * @param float $amount
  * @return $this
  * @throws \Exception
  */
 public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
 {
     $last4 = $payment->getCcLast4();
     $payment->setCcLast4($payment->decrypt($last4));
     try {
         $this->processRefund($payment, $amount);
     } catch (\Exception $e) {
         $payment->setCcLast4($last4);
         throw $e;
     }
     $payment->setCcLast4($last4);
     return $this;
 }