public function testHoldAndCapture() { $request = $this->gateway->authorize(array('amount' => '42.42', 'card' => $this->getValidCard())); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Authorization should succeed'); $transactionRef = $response->getTransactionReference(); $request = $this->gateway->capture(array('amount' => '42.42', 'transactionReference' => $transactionRef)); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Capture should succeed'); }
public function testPurchaseRefundAutoVoid() { // Purchase $request = $this->gateway->purchase(array('amount' => 10.01, 'card' => $this->getValidCard())); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Purchase should succeed'); $transactionRef = $response->getTransactionReference(); // Refund (should fail) $request = $this->gateway->refund(array('transactionReference' => $transactionRef, 'amount' => 10.01)); $response = $request->send(); $this->assertFalse($response->isSuccessful(), 'Refund should fail since the transaction has not been settled'); // Refund with auto-void $request = $this->gateway->refund(array('transactionReference' => $transactionRef, 'amount' => 10.01, 'voidIfRefundFails' => true)); $response = $request->send(); $this->assertTrue($response->isSuccessful(), 'Automatic void should succeed'); }
public function testRefundFailure() { $this->setMockHttpResponse('AIMRefundFailure.txt'); $response = $this->gateway->refund($this->refundOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('The referenced transaction does not meet the criteria for issuing a credit.', $response->getMessage()); }
public function testRefundFailure() { $this->setMockHttpResponse('AIMRefundFailure.txt'); $response = $this->gateway->refund($this->refundOptions)->send(); $this->assertFalse($response->isSuccessful()); $expiry = $this->getExpiry($this->refundOptions['card']); $this->assertSame('{"approvalCode":"","transId":"0","card":{"number":"1111","expiry":"' . $expiry . '"}}', $response->getTransactionReference()); $this->assertSame('The referenced transaction does not meet the criteria for issuing a credit.', $response->getMessage()); }
/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration * @return SIMGateway */ public function handle(ConfigurationRepositoryInterface $configuration) { /* @var EncryptedFieldTypePresenter $id */ /* @var EncryptedFieldTypePresenter $key */ /* @var EncryptedFieldTypePresenter $secret */ /* @var SettingInterface $mode */ $id = $configuration->presenter('anomaly.extension.authorizenet_aim_gateway::api_login_id', $this->gateway->getSlug()); $key = $configuration->presenter('anomaly.extension.authorizenet_aim_gateway::transaction_key', $this->gateway->getSlug()); $mode = $configuration->get('anomaly.extension.authorizenet_aim_gateway::test_mode', $this->gateway->getSlug()); $gateway = new AIMGateway(); $gateway->setTransactionKey($key->decrypted()); $gateway->setDeveloperMode($mode->getValue()); $gateway->setApiLoginId($id->decrypted()); $gateway->setTestMode($mode->getValue()); return $gateway; }
public function getDefaultParameters() { $parameters = parent::getDefaultParameters(); $parameters['hashSecret'] = ''; return $parameters; }