Add ACSS or USD option for ACSS transfers

This commit is contained in:
David Bomba 2024-09-05 11:55:47 +10:00
parent 5b290a99b4
commit 500f289647
3 changed files with 15 additions and 14 deletions

View File

@ -56,8 +56,8 @@ class PaymentMethodController extends Controller
$data['gateway'] = $gateway; $data['gateway'] = $gateway;
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->user(); $client_contact = auth()->guard('contact')->user();
$data['client'] = $client_contact->client; $data['client'] = $client_contact->client;
return $gateway return $gateway
@ -77,8 +77,8 @@ class PaymentMethodController extends Controller
{ {
$gateway = $this->getClientGateway(); $gateway = $this->getClientGateway();
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->user(); $client_contact = auth()->guard('contact')->user();
return $gateway return $gateway
->driver($client_contact->client) ->driver($client_contact->client)
@ -103,8 +103,8 @@ class PaymentMethodController extends Controller
public function verify(ClientGatewayToken $payment_method) public function verify(ClientGatewayToken $payment_method)
{ {
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->user(); $client_contact = auth()->guard('contact')->user();
return $payment_method->gateway return $payment_method->gateway
->driver($client_contact->client) ->driver($client_contact->client)
@ -114,8 +114,8 @@ class PaymentMethodController extends Controller
public function processVerification(Request $request, ClientGatewaytoken $payment_method) public function processVerification(Request $request, ClientGatewaytoken $payment_method)
{ {
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->user(); $client_contact = auth()->guard('contact')->user();
return $payment_method->gateway return $payment_method->gateway
->driver($client_contact->client) ->driver($client_contact->client)
@ -131,7 +131,7 @@ class PaymentMethodController extends Controller
*/ */
public function destroy(ClientGatewayToken $payment_method) public function destroy(ClientGatewayToken $payment_method)
{ {
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->guard('contact')->user(); $client_contact = auth()->guard('contact')->user();
if ($payment_method->gateway()->exists()) { if ($payment_method->gateway()->exists()) {
@ -171,8 +171,8 @@ class PaymentMethodController extends Controller
private function getClientGateway() private function getClientGateway()
{ {
/** @var \App\Models\ClientContact auth()->user() **/ /** @var \App\Models\ClientContact auth()->guard('contact')->user() **/
$client_contact = auth()->user(); $client_contact = auth()->guard('contact')->user();
if (request()->query('method') == GatewayType::CREDIT_CARD) { if (request()->query('method') == GatewayType::CREDIT_CARD) {
return $client_contact->client->getCreditCardGateway(); return $client_contact->client->getCreditCardGateway();

View File

@ -661,7 +661,8 @@ class Client extends BaseModel implements HasLocalePreference
} }
} }
if ($this->currency()->code == 'CAD' && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) { if (in_array($this->currency()->code, ['CAD','USD']) && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
// if ($this->currency()->code == 'CAD' && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
foreach ($pms as $pm) { foreach ($pms as $pm) {
if ($pm['gateway_type_id'] == GatewayType::ACSS) { if ($pm['gateway_type_id'] == GatewayType::ACSS) {
$cg = CompanyGateway::query()->find($pm['company_gateway_id']); $cg = CompanyGateway::query()->find($pm['company_gateway_id']);

View File

@ -63,7 +63,7 @@ class ACSS implements LivewireMethodInterface
'customer' => $data['customer'], 'customer' => $data['customer'],
'payment_method_options' => [ 'payment_method_options' => [
'acss_debit' => [ 'acss_debit' => [
'currency' => 'cad', 'currency' => strtolower($this->stripe->client->currency()->code),
'mandate_options' => [ 'mandate_options' => [
'payment_schedule' => 'combined', 'payment_schedule' => 'combined',
'interval_description' => 'On any invoice due date', 'interval_description' => 'On any invoice due date',
@ -183,7 +183,7 @@ class ACSS implements LivewireMethodInterface
'customer' => $data['customer'], 'customer' => $data['customer'],
'payment_method_options' => [ 'payment_method_options' => [
'acss_debit' => [ 'acss_debit' => [
'currency' => 'cad', 'currency' => strtolower($this->stripe->client->currency()->code),
'mandate_options' => [ 'mandate_options' => [
'payment_schedule' => 'combined', 'payment_schedule' => 'combined',
'interval_description' => 'On any invoice due date', 'interval_description' => 'On any invoice due date',