1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4779 from beganovich/v5-2701-stripe-countries

(v5) Define countries availability for Stripe
This commit is contained in:
Benjamin Beganović 2021-01-29 00:31:08 +01:00 committed by GitHub
commit 0db9f41a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}