diff --git a/app/PaymentDrivers/Forte/ACH.php b/app/PaymentDrivers/Forte/ACH.php index 1a35cf1060..a60e30fd6c 100644 --- a/app/PaymentDrivers/Forte/ACH.php +++ b/app/PaymentDrivers/Forte/ACH.php @@ -61,21 +61,63 @@ class ACH implements LivewireMethodInterface public function authorizeResponse(Request $request) { - $payment_meta = new \stdClass(); - $payment_meta->brand = (string)ctrans('texts.ach'); - $payment_meta->last4 = (string) $request->last_4; - $payment_meta->exp_year = '-'; - $payment_meta->type = GatewayType::BANK_TRANSFER; + $cst = $this->forte->findOrCreateCustomer(); + + $name = $request->account_holder_name; $data = [ - 'payment_meta' => $payment_meta, - 'token' => $request->one_time_token, - 'payment_method_id' => $request->gateway_type_id, + "notes" => $request->account_holder_name, + "echeck" => [ + "one_time_token" => $request->one_time_token, + "account_holder" => $request->account_holder_name, + "account_type" => "checking" + ], ]; - $this->forte->storeGatewayToken($data); + $response = $this->forte->stubRequest() + ->post("{$this->forte->baseUri()}/organizations/{$this->forte->getOrganisationId()}/locations/{$this->forte->getLocationId()}/customers/{$cst}/paymethods", $data); + + if ($response->successful()) { + + $token = $response->object(); + + $payment_meta = new \stdClass(); + $payment_meta->exp_month = (string) ''; + $payment_meta->exp_year = (string) ''; + $payment_meta->brand = (string) 'ACH'; + $payment_meta->last4 = (string) $request->last_4; + $payment_meta->type = GatewayType::BANK_TRANSFER; + + $data = [ + 'payment_meta' => $payment_meta, + 'token' => $token->paymethod_token, + 'payment_method_id' => GatewayType::BANK_TRANSFER, + ]; + + $this->forte->storeGatewayToken($data, ['gateway_customer_reference' => $cst]); + + return redirect()->route('client.payment_methods.index')->withSuccess('Payment Method added.'); + + } + + $error = $response->object(); + $message = [ + 'server_message' => $error->response->response_desc, + 'server_response' => $response->json(), + 'data' => $data, + ]; + + SystemLogger::dispatch( + $message, + SystemLog::CATEGORY_GATEWAY_RESPONSE, + SystemLog::EVENT_GATEWAY_FAILURE, + SystemLog::TYPE_FORTE, + $this->forte->client, + $this->forte->client->company, + ); + + throw new \App\Exceptions\PaymentFailed("Unable to store payment method: {$error->response->response_desc}", 400); - return redirect()->route('client.payment_methods.index')->withSuccess('Payment Method added.'); } public function paymentView(array $data) diff --git a/app/PaymentDrivers/FortePaymentDriver.php b/app/PaymentDrivers/FortePaymentDriver.php index 3021f1603b..d64233a9f6 100644 --- a/app/PaymentDrivers/FortePaymentDriver.php +++ b/app/PaymentDrivers/FortePaymentDriver.php @@ -210,7 +210,9 @@ class FortePaymentDriver extends BaseDriver ->withHeaders(['X-Forte-Auth-Organization-Id' => $forte_organization_id]) ->get("{$forte_base_uri}/organizations/{$forte_organization_id}/locations/{$forte_location_id}/customers/"); - return $response->successful() ? 'ok' : 'error'; + $error = $response->json()['response']['response_desc'] ?? 'error'; + + return $response->successful() ? 'ok' : $error; } @@ -275,6 +277,12 @@ class FortePaymentDriver extends BaseDriver ], ]; + if($cgt->gateway_type_id == GatewayType::BANK_TRANSFER) { + $data["echeck"] = [ + "sec_code" => "WEB", + ]; + } + if ($fee_total > 0) { $data["service_fee_amount"] = $fee_total; } diff --git a/composer.lock b/composer.lock index 607f05a138..5a98877264 100644 --- a/composer.lock +++ b/composer.lock @@ -2274,16 +2274,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "b115554301161fa21467629f1e1391c1936de517" + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b115554301161fa21467629f1e1391c1936de517", - "reference": "b115554301161fa21467629f1e1391c1936de517", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", "shasum": "" }, "require": { @@ -2329,7 +2329,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.3" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" }, "funding": [ { @@ -2337,7 +2337,7 @@ "type": "github" } ], - "time": "2024-12-27T00:36:43+00:00" + "time": "2025-03-06T22:45:56+00:00" }, { "name": "elastic/transport", @@ -4696,16 +4696,16 @@ }, { "name": "jean85/pretty-package-versions", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10" + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", - "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", "shasum": "" }, "require": { @@ -4715,8 +4715,9 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^1.4", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^7.5|^8.5|^9.6", + "rector/rector": "^2.0", "vimeo/psalm": "^4.3 || ^5.0" }, "type": "library", @@ -4749,9 +4750,9 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.0" + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" }, - "time": "2024-11-18T16:19:46+00:00" + "time": "2025-03-19T14:43:43+00:00" }, { "name": "jms/metadata", @@ -7500,16 +7501,16 @@ }, { "name": "monolog/monolog", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", - "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6", + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6", "shasum": "" }, "require": { @@ -7587,7 +7588,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.8.1" + "source": "https://github.com/Seldaek/monolog/tree/3.9.0" }, "funding": [ { @@ -7599,7 +7600,7 @@ "type": "tidelift" } ], - "time": "2024-12-05T17:15:07+00:00" + "time": "2025-03-24T10:02:05+00:00" }, { "name": "mpdf/mpdf", @@ -10701,16 +10702,16 @@ }, { "name": "ramsey/collection", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { @@ -10771,9 +10772,9 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-02T04:48:29+00:00" + "time": "2025-03-22T05:38:12+00:00" }, { "name": "ramsey/uuid", @@ -10869,16 +10870,16 @@ }, { "name": "razorpay/razorpay", - "version": "2.9.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/razorpay/razorpay-php.git", - "reference": "a3d7c2bcb416091edd6a76eb5a7600eaf00ac837" + "reference": "d5e49ef12c4862f6bc8003f87f79b942a9dd3a8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/a3d7c2bcb416091edd6a76eb5a7600eaf00ac837", - "reference": "a3d7c2bcb416091edd6a76eb5a7600eaf00ac837", + "url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/d5e49ef12c4862f6bc8003f87f79b942a9dd3a8b", + "reference": "d5e49ef12c4862f6bc8003f87f79b942a9dd3a8b", "shasum": "" }, "require": { @@ -10930,7 +10931,7 @@ "issues": "https://github.com/Razorpay/razorpay-php/issues", "source": "https://github.com/Razorpay/razorpay-php" }, - "time": "2023-12-18T04:19:46+00:00" + "time": "2025-03-20T12:51:47+00:00" }, { "name": "rmccue/requests", @@ -11021,16 +11022,16 @@ }, { "name": "sabberworm/php-css-parser", - "version": "v8.7.0", + "version": "v8.8.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", - "reference": "f414ff953002a9b18e3a116f5e462c56f21237cf" + "reference": "3de493bdddfd1f051249af725c7e0d2c38fed740" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/f414ff953002a9b18e3a116f5e462c56f21237cf", - "reference": "f414ff953002a9b18e3a116f5e462c56f21237cf", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/3de493bdddfd1f051249af725c7e0d2c38fed740", + "reference": "3de493bdddfd1f051249af725c7e0d2c38fed740", "shasum": "" }, "require": { @@ -11038,7 +11039,7 @@ "php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" }, "require-dev": { - "phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.40" + "phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.41" }, "suggest": { "ext-mbstring": "for parsing UTF-8 CSS" @@ -11080,9 +11081,9 @@ ], "support": { "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", - "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.7.0" + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.8.0" }, - "time": "2024-10-27T17:38:32+00:00" + "time": "2025-03-23T17:59:05+00:00" }, { "name": "sabre/uri", @@ -17432,16 +17433,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9" + "reference": "134b705ddb0025d397d8318a75825fe3c9d1da34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/ffe442c5974c44a9343e37a0abcb1cc37319f5b9", - "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/134b705ddb0025d397d8318a75825fe3c9d1da34", + "reference": "134b705ddb0025d397d8318a75825fe3c9d1da34", "shasum": "" }, "require": { @@ -17485,7 +17486,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.6.0" + "source": "https://github.com/composer/class-map-generator/tree/1.6.1" }, "funding": [ { @@ -17501,7 +17502,7 @@ "type": "tidelift" } ], - "time": "2025-02-05T10:05:34+00:00" + "time": "2025-03-24T13:50:44+00:00" }, { "name": "composer/semver", @@ -17831,16 +17832,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.72.0", + "version": "v3.73.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "900389362c43d116fee1ffc51f7878145fa61b57" + "reference": "ffcb8200a42045e65049af7910cfd022f631b064" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/900389362c43d116fee1ffc51f7878145fa61b57", - "reference": "900389362c43d116fee1ffc51f7878145fa61b57", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ffcb8200a42045e65049af7910cfd022f631b064", + "reference": "ffcb8200a42045e65049af7910cfd022f631b064", "shasum": "" }, "require": { @@ -17848,6 +17849,7 @@ "composer/semver": "^3.4", "composer/xdebug-handler": "^3.0.3", "ext-filter": "*", + "ext-hash": "*", "ext-json": "*", "ext-tokenizer": "*", "fidry/cpu-core-counter": "^1.2", @@ -17922,7 +17924,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.72.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.73.1" }, "funding": [ { @@ -17930,7 +17932,7 @@ "type": "github" } ], - "time": "2025-03-13T11:25:37+00:00" + "time": "2025-03-19T23:42:16+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -18547,16 +18549,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.21", + "version": "1.12.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "14276fdef70575106a3392a4ed553c06a984df28" + "reference": "29201e7a743a6ab36f91394eab51889a82631428" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/14276fdef70575106a3392a4ed553c06a984df28", - "reference": "14276fdef70575106a3392a4ed553c06a984df28", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/29201e7a743a6ab36f91394eab51889a82631428", + "reference": "29201e7a743a6ab36f91394eab51889a82631428", "shasum": "" }, "require": { @@ -18601,7 +18603,7 @@ "type": "github" } ], - "time": "2025-03-09T09:24:50+00:00" + "time": "2025-03-23T14:57:32+00:00" }, { "name": "phpunit/php-code-coverage", @@ -18928,16 +18930,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.13", + "version": "11.5.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3bbb8d54b3a6718e51fd48cd478079f5f49b82bd" + "reference": "4b6a4ee654e5e0c5e1f17e2f83c0f4c91dee1f9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3bbb8d54b3a6718e51fd48cd478079f5f49b82bd", - "reference": "3bbb8d54b3a6718e51fd48cd478079f5f49b82bd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4b6a4ee654e5e0c5e1f17e2f83c0f4c91dee1f9c", + "reference": "4b6a4ee654e5e0c5e1f17e2f83c0f4c91dee1f9c", "shasum": "" }, "require": { @@ -18957,7 +18959,7 @@ "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", - "sebastian/code-unit": "^3.0.2", + "sebastian/code-unit": "^3.0.3", "sebastian/comparator": "^6.3.1", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", @@ -19009,7 +19011,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.15" }, "funding": [ { @@ -19025,7 +19027,7 @@ "type": "tidelift" } ], - "time": "2025-03-18T13:41:57+00:00" + "time": "2025-03-23T16:02:11+00:00" }, { "name": "react/cache", @@ -19612,16 +19614,16 @@ }, { "name": "sebastian/code-unit", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", "shasum": "" }, "require": { @@ -19657,7 +19659,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" }, "funding": [ { @@ -19665,7 +19667,7 @@ "type": "github" } ], - "time": "2024-12-12T09:59:06+00:00" + "time": "2025-03-19T07:56:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup",