Catch type 4 codes for auth.net

This commit is contained in:
David Bomba 2024-05-04 10:35:46 +10:00
parent cdb65a8a95
commit e374b12fb4
4 changed files with 15 additions and 17 deletions

View File

@ -59,7 +59,6 @@ class Register extends Component
public function register(array $data)
{
nlog($data);
$service = new ClientRegisterService(
company: $this->subscription->company,
@ -68,13 +67,8 @@ class Register extends Component
$rules = $service->rules();
nlog($rules);
$data = Validator::make($data, $rules)->validate();
nlog("validated data");
nlog($data);
$client = $service->createClient($data);
$contact = $service->createClientContact($data, $client);

View File

@ -147,7 +147,7 @@ class AuthorizeTransaction
if($tresponse->getResponseCode() == "4"){
//notify user that this transaction is being held under FDS review:
FDSReview::dispatch((string)$tresponse->getTransId(), $this->authorize->payment_hash, $this->authorize->company_gateway->company->db);
FDSReview::dispatch((string)$tresponse->getTransId(), $this->authorize->payment_hash, $this->authorize->company_gateway->company->db);
}
} else {

View File

@ -13,14 +13,15 @@
namespace App\PaymentDrivers\Authorize;
use App\Models\Invoice;
use App\PaymentDrivers\AuthorizePaymentDriver;
use App\Utils\Traits\MakesHash;
use net\authorize\api\contract\v1\CreateTransactionRequest;
use net\authorize\api\contract\v1\CustomerProfilePaymentType;
use net\authorize\api\contract\v1\ExtendedAmountType;
use App\PaymentDrivers\Authorize\FDSReview;
use net\authorize\api\contract\v1\OrderType;
use App\PaymentDrivers\AuthorizePaymentDriver;
use net\authorize\api\contract\v1\ExtendedAmountType;
use net\authorize\api\contract\v1\PaymentProfileType;
use net\authorize\api\contract\v1\TransactionRequestType;
use net\authorize\api\contract\v1\CreateTransactionRequest;
use net\authorize\api\contract\v1\CustomerProfilePaymentType;
use net\authorize\api\controller\CreateTransactionController;
/**
@ -109,6 +110,12 @@ class ChargePaymentProfile
nlog(' Code : '.$tresponse->getMessages()[0]->getCode());
nlog(' Description : '.$tresponse->getMessages()[0]->getDescription());
nlog(print_r($tresponse->getMessages()[0], 1));
if($tresponse->getResponseCode() == "4") {
//notify user that this transaction is being held under FDS review:
FDSReview::dispatch((string)$tresponse->getTransId(), $this->authorize?->payment_hash, $this->authorize->company_gateway->company->db);
}
} else {
nlog('Transaction Failed ');
if ($tresponse->getErrors() != null) {

View File

@ -17,7 +17,7 @@ use App\Services\Email\Email;
use Illuminate\Bus\Queueable;
use App\Services\Email\EmailObject;
use Illuminate\Support\Facades\App;
use Symfony\Component\Mime\Address;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
@ -50,21 +50,18 @@ class FDSReview implements ShouldQueue
$invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: '';
$body = "Transaction {$this->transaction_reference} has been held for your review in Auth.net based on your Fraud Detection Settings.\n We have marked invoices {$invoices_string} as paid in Invoice Ninja.\n Please review these transaction in your auth.net account, and authorize them if they are correct to ensure the transactions are processed as expected. If these charges need to be cancelled, you will need to delete the payments that have been created in Invoice Ninja to reverse those payments.";
$body = "Transaction {$this->transaction_reference} has been held for your review in Auth.net based on your Fraud Detection Settings.\n\n\nWe have marked invoices {$invoices_string} as paid in Invoice Ninja.\n\n\nPlease review this transaction in your auth.net account, and authorize if correct to ensure the transaction is finalized as expected.\n\n\nIf these charges need to be cancelled, you will need to delete the payments that have been created in Invoice Ninja.";
$mo = new EmailObject();
$mo->subject = "Transaction {$this->transaction_reference} held for review by auth.net";
$mo->body = $body;
$mo->body = nl2br($body);
$mo->text_body = $body;
$mo->company_key = $company->company_key;
$mo->html_template = 'email.template.generic';
$mo->to = [new Address($company->owner()->email, $company->owner()->present()->name())];
// $mo->email_template_body = 'nordigen_requisition_body';
// $mo->email_template_subject = 'nordigen_requisition_subject';
Email::dispatch($mo, $company);
}
}