mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Get Authorize.net Transactions by refId
This commit is contained in:
parent
b85b0913a6
commit
8c260ece95
@ -42,6 +42,12 @@ class AuthorizeCreditCard
|
||||
$data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId');
|
||||
|
||||
return render('gateways.authorize.credit_card_payment', $data);
|
||||
|
||||
}
|
||||
|
||||
public function processPaymentResponse($response)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
66
app/PaymentDrivers/Authorize/AuthorizeTransactions.php
Normal file
66
app/PaymentDrivers/Authorize/AuthorizeTransactions.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\PaymentDrivers\Authorize;
|
||||
|
||||
use net\authorize\api\contract\v1\GetTransactionDetailsRequest;
|
||||
use net\authorize\api\controller\GetTransactionDetailsController;
|
||||
|
||||
|
||||
/**
|
||||
* Class AuthorizeTransactions
|
||||
* @package App\PaymentDrivers\Authorize
|
||||
*
|
||||
*/
|
||||
class AuthorizeTransactions
|
||||
{
|
||||
|
||||
public $authorize;
|
||||
|
||||
public function __construct(AuthorizePaymentDriver $authorize)
|
||||
{
|
||||
$this->authorize = $authorize;
|
||||
}
|
||||
|
||||
function getTransactionDetails($transactionId)
|
||||
{
|
||||
/* Create a merchantAuthenticationType object with authentication details
|
||||
retrieved from the constants file */
|
||||
$this->authorize->init();
|
||||
|
||||
// Set the transaction's refId
|
||||
$refId = 'ref' . time();
|
||||
|
||||
$request = new GetTransactionDetailsRequest();
|
||||
$request->setMerchantAuthentication($this->authorize->merchant_authentication);
|
||||
$request->setTransId($transactionId);
|
||||
|
||||
$controller = new GetTransactionDetailsController($request);
|
||||
|
||||
$response = $controller->executeWithApiResponse($this->authorize->mode());
|
||||
|
||||
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
|
||||
{
|
||||
echo "SUCCESS: Transaction Status:" . $response->getTransaction()->getTransactionStatus() . "\n";
|
||||
echo " Auth Amount:" . $response->getTransaction()->getAuthAmount() . "\n";
|
||||
echo " Trans ID:" . $response->getTransaction()->getTransId() . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR : Invalid response\n";
|
||||
$errorMessages = $response->getMessages()->getMessage();
|
||||
echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user