1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Define countries availability for Stripe

This commit is contained in:
Benjamin Beganović 2021-01-27 13:36:10 +01:00
parent 0c7ae3bca8
commit 44f6dd3e4d

View File

@ -95,17 +95,37 @@ class StripePaymentDriver extends BaseDriver
{
$types = [
GatewayType::CREDIT_CARD,
GatewayType::BANK_TRANSFER,
GatewayType::CRYPTO,
GatewayType::ALIPAY,
// GatewayType::SEPA, // TODO: Missing implementation
// GatewayType::APPLE_PAY, // TODO:: Missing implementation
];
if ($this->company_gateway->getSofortEnabled() && $this->invitation && $this->client() && isset($this->client()->country) && in_array($this->client()->country, ['AUT', 'BEL', 'DEU', 'ITA', 'NLD', 'ESP'])) {
// $this->invitation = false
// $this->client doesn't exist
// $this->client->country is relationship?
// Missing Slovenia for Alipay
if ($this->company_gateway->getSofortEnabled()
&& $this->client
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['AUT', 'BEL', 'DEU', 'ITA', 'NLD', 'ESP'])) {
$types[] = GatewayType::SOFORT;
}
if ($this->company_gateway->getAchEnabled()
&& $this->client
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['USA'])) {
$types[] = GatewayType::BANK_TRANSFER;
}
if ($this->company_gateway->getAchEnabled()
&& $this->client
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['AUS', 'DNK', 'DEU', 'ITA', 'LUX', 'NOR', 'SVN', 'GBR', 'AUT', 'EST', 'GRC', 'JPN', 'MYS', 'PRT', 'ESP', 'USA', 'BEL', 'FIN', 'HKG', 'LVA', 'NLD', 'SGP', 'SWE', 'CAN', 'FRA', 'IRL', 'LTU', 'NZL', 'SVK', 'CHE'])) {
$types[] = GatewayType::ALIPAY;
}
return $types;
}
@ -175,7 +195,7 @@ class StripePaymentDriver extends BaseDriver
return $this->payment_method->paymentView($data);
}
public function processPaymentResponse($request)
public function processPaymentResponse($request)
{
return $this->payment_method->paymentResponse($request);
}