From c0c9c00c809b7a364481c7a2df8fe367ea1db757 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 13:53:02 +1000 Subject: [PATCH] eWay error codes --- app/PaymentDrivers/Eway/CreditCard.php | 122 +++++++++++++++++++++---- app/PaymentDrivers/Eway/ErrorCode.php | 94 +++++++++++++++++++ 2 files changed, 196 insertions(+), 20 deletions(-) create mode 100644 app/PaymentDrivers/Eway/ErrorCode.php diff --git a/app/PaymentDrivers/Eway/CreditCard.php b/app/PaymentDrivers/Eway/CreditCard.php index 426b19834a1d..c340a7db9734 100644 --- a/app/PaymentDrivers/Eway/CreditCard.php +++ b/app/PaymentDrivers/Eway/CreditCard.php @@ -47,28 +47,91 @@ class CreditCard } + /* + Eway\Rapid\Model\Response\CreateCustomerResponse {#2374 ▼ + #fillable: array:16 [▶] + #errors: [] + #attributes: array:11 [▼ + "AuthorisationCode" => null + "ResponseCode" => "00" + "ResponseMessage" => "A2000" + "TransactionID" => null + "TransactionStatus" => false + "TransactionType" => "MOTO" + "BeagleScore" => null + "Verification" => Eway\Rapid\Model\Verification {#2553 ▼ + #fillable: array:5 [▶] + #attributes: array:5 [▶] + } + "Customer" => Eway\Rapid\Model\Customer {#2504 ▼ + #fillable: array:38 [▶] + #attributes: array:20 [▼ + "CardDetails" => Eway\Rapid\Model\CardDetails {#2455 ▼ + #fillable: array:8 [▶] + #attributes: array:7 [▼ + "Number" => "411111XXXXXX1111" + "Name" => "Joey Diaz" + "ExpiryMonth" => "10" + "ExpiryYear" => "23" + "StartMonth" => null + "StartYear" => null + "IssueNumber" => null + ] + } + "TokenCustomerID" => 917047257342 + "Reference" => "A12345" + "Title" => "Mr." + "FirstName" => "John" + "LastName" => "Smith" + "CompanyName" => "Demo Shop 123" + "JobDescription" => "PHP Developer" + "Street1" => "Level 5" + "Street2" => "369 Queen Street" + "City" => "Sydney" + "State" => "NSW" + "PostalCode" => "2000" + "Country" => "au" + "Email" => "demo@example.org" + "Phone" => "09 889 0986" + "Mobile" => "09 889 6542" + "Comments" => "" + "Fax" => "" + "Url" => "http://www.ewaypayments.com" + ] + } + "Payment" => Eway\Rapid\Model\Payment {#2564 ▼ + #fillable: array:5 [▶] + #attributes: array:5 [▼ + "TotalAmount" => 0 + "InvoiceNumber" => "" + "InvoiceDescription" => "" + "InvoiceReference" => "" + "CurrencyCode" => "AUD" + ] + } + "Errors" => null + ] +} + */ + public function authorizeResponse($request) { - $this->eway_driver->init(); - - $transaction = [ - 'Reference' => 'A12345', - 'Title' => 'Mr.', - 'FirstName' => 'John', - 'LastName' => 'Smith', - 'CompanyName' => 'Demo Shop 123', - 'JobDescription' => 'PHP Developer', - 'Street1' => 'Level 5', - 'Street2' => '369 Queen Street', - 'City' => 'Sydney', - 'State' => 'NSW', - 'PostalCode' => '2000', - 'Country' => 'au', - 'Phone' => '09 889 0986', - 'Mobile' => '09 889 6542', - 'Email' => 'demo@example.org', - "Url" => "http://www.ewaypayments.com", + $transaction = [ + 'Reference' => $this->eway_driver->client->number, + 'Title' => '', + 'FirstName' => $this->eway_driver->client->primary_contact()->present()->last_name(), + 'LastName' => $this->eway_driver->client->primary_contact()->present()->first_name(), + 'CompanyName' => $this->eway_driver->client->name, + 'Street1' => $this->eway_driver->client->address1, + 'Street2' => $this->eway_driver->client->address2, + 'City' => $this->eway_driver->client->city, + 'State' => $this->eway_driver->client->state, + 'PostalCode' => $this->eway_driver->client->postal_code, + 'Country' => $this->eway_driver->client->country->iso_3166_2, + 'Phone' => $this->eway_driver->client->phone, + 'Email' => $this->eway_driver->client->primary_contact()->email, + "Url" => $this->eway_driver->client->website, 'Payment' => [ 'TotalAmount' => 0, ], @@ -79,7 +142,26 @@ class CreditCard $response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); -dd($response); + nlog($response); + + //success + $cgt = []; + $cgt['token'] = $data['token']; + $cgt['payment_method_id'] = GatewayType::CREDIT_CARD; + + $payment_meta = new \stdClass; + $payment_meta->exp_month = 'xx'; + $payment_meta->exp_year = 'xx'; + $payment_meta->brand = 'CC'; + $payment_meta->last4 = 'xxxx'; + $payment_meta->type = GatewayType::CREDIT_CARD; + + $cgt['payment_meta'] = $payment_meta; + + $token = $this->eway_driver->storeGatewayToken($cgt, []); + + return redirect()->route('client.payment_methods.index'); + } public function paymentView($data) diff --git a/app/PaymentDrivers/Eway/ErrorCode.php b/app/PaymentDrivers/Eway/ErrorCode.php new file mode 100644 index 000000000000..71a44fad27bc --- /dev/null +++ b/app/PaymentDrivers/Eway/ErrorCode.php @@ -0,0 +1,94 @@ + "Transaction Approved"], + ["A2008" => "Honour With Identification"], + ["A2010" => "Approved For Partial Amount"], + ["A2011" => "Approved, VIP"], + ["A2016" => "Approved, Update Track 3"], + ], + + public $failure = [ + ["D4401" => "Refer to Issuer"], + ["D4402" => "Refer to Issuer, special"], + ["D4403" => "No Merchant"], + ["D4404" => "Pick Up Card"], + ["D4405" => "Do Not Honour"], + ["D4406" => "Error"], + ["D4407" => "Pick Up Card, Special"], + ["D4409" => "Request In Progress"], + ["D4412" => "Invalid Transaction"], + ["D4413" => "Invalid Amount"], + ["D4414" => "Invalid Card Number"], + ["D4415" => "No Issuer"], + ["D4417" => "3D Secure Error"], + ["D4419" => "Re-enter Last Transaction"], + ["D4421" => "No Action Taken"], + ["D4422" => "Suspected Malfunction"], + ["D4423" => "Unacceptable Transaction Fee"], + ["D4425" => "Unable to Locate Record On File"], + ["D4430" => "Format Error"], + ["D4431" => "Bank Not Supported By Switch"], + ["D4433" => "Expired Card, Capture"], + ["D4434" => "Suspected Fraud, Retain Card"], + ["D4435" => "Card Acceptor, Contact Acquirer, Retain Card"], + ["D4436" => "Restricted Card, Retain Card"], + ["D4437" => "Contact Acquirer Security Department, Retain Card"], + ["D4438" => "PIN Tries Exceeded, Capture"], + ["D4439" => "No Credit Account"], + ["D4440" => "Function Not Supported"], + ["D4441" => "Lost Card"], + ["D4442" => "No Universal Account"], + ["D4443" => "Stolen Card"], + ["D4444" => "No Investment Account"], + ["D4450" => "Click-to-Pay (Visa Checkout) Transaction"], + ["D4451" => "Insufficient Funds"], + ["D4452" => "No Cheque Account"], + ["D4453" => "No Savings Account"], + ["D4454" => "Expired Card"], + ["D4455" => "Incorrect PIN"], + ["D4456" => "No Card Record"], + ["D4457" => "Function Not Permitted to Cardholder"], + ["D4458" => "Function Not Permitted to Terminal"], + ["D4459" => "Suspected Fraud"], + ["D4460" => "Acceptor Contact Acquirer"], + ["D4461" => "Exceeds Withdrawal Limit"], + ["D4462" => "Restricted Card"], + ["D4463" => "Security Violation"], + ["D4464" => "Original Amount Incorrect"], + ["D4466" => "Acceptor Contact Acquirer, Security"], + ["D4467" => "Capture Card"], + ["D4475" => "PIN Tries Exceeded"], + ["D4476" => "Invalidate Txn Reference"], + ["D4481" => "Accumulated Transaction Counter (Amount) Exceeded"], + ["D4482" => "CVV Validation Error"], + ["D4483" => "Acquirer Is Not Accepting Transactions From You At This Time"], + ["D4484" => "Acquirer Is Not Accepting This Transaction"], + ["D4490" => "Cut off In Progress"], + ["D4491" => "Card Issuer Unavailable"], + ["D4492" => "Unable To Route Transaction"], + ["D4493" => "Cannot Complete, Violation Of The Law"], + ["D4494" => "Duplicate Transaction"], + ["D4495" => "Amex Declined"], + ["D4496" => "System Error"], + ["D4497" => "MasterPass Error"], + ["D4498" => "PayPal Create Transaction Error"], + ["D4499" => "Invalid Transaction for Auth/Void"], + ]; + +} \ No newline at end of file