public function testGetInstructionsSetInformation() { $this->assertNull($this->_instructions->getInstructions()); $testInstruction = 'second test'; $this->_info->setAdditionalInformation('instructions', $testInstruction); $this->assertEquals($testInstruction, $this->_instructions->getInstructions()); }
public function testHasAdditionalInformation() { $this->assertFalse($this->info->hasAdditionalInformation()); $data = ['key1' => 'data1', 'key2' => 'data2']; $this->info->setAdditionalInformation($data); $this->assertFalse($this->info->hasAdditionalInformation('key3')); $this->assertTrue($this->info->hasAdditionalInformation('key2')); $this->assertTrue($this->info->hasAdditionalInformation()); }
/** * Cancel partial authorizations and flush current split_tender_id record * * @param \Magento\Payment\Model\Info $payment * @return void * @throws \Magento\Framework\Model\Exception */ public function cancelPartialAuthorization(\Magento\Payment\Model\Info $payment) { if (!$payment->getAdditionalInformation($this->_splitTenderIdKey)) { throw new \Magento\Framework\Model\Exception(__('This is an invalid split tenderId ID.')); } $request = $this->_getRequest(); $request->setXSplitTenderId($payment->getAdditionalInformation($this->_splitTenderIdKey)); $request->setXType(self::REQUEST_TYPE_VOID)->setXMethod(self::REQUEST_METHOD_CC); $result = $this->_postRequest($request); switch ($result->getResponseCode()) { case self::RESPONSE_CODE_APPROVED: $payment->setAdditionalInformation($this->_splitTenderIdKey, null); $this->_session->setData($this->_partialAuthorizationChecksumSessionKey, null); $this->getCardsStorage($payment)->flushCards(); $this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_ALL_CANCELED); return; default: throw new \Magento\Framework\Model\Exception(__('Something went wrong while canceling the payment.')); } }
/** * Remove all cards from payment instance * * @return $this */ public function flushCards() { $this->_cards = array(); $this->_payment->setAdditionalInformation(self::CARDS_NAMESPACE, null); return $this; }