Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### NEW

- All PayPal payment methods have "PayPal" as a prefix in a fresh installation to better identify them in the admin panel. When setting up payment methods, the merchant can decide which name best fits their needs.
- Additional check of eligibility for unbranded payments
- Move PayPal-Config to Config-Section in Admin > Module-List > Module > Options

### FIX
Expand Down
102 changes: 101 additions & 1 deletion metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,42 @@
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalEpsEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalPrzelewy24Eligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSepaEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalBlikEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalBanContactEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalIDealEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxAcdcEligibility',
'type' => 'bool',
Expand Down Expand Up @@ -524,6 +560,42 @@
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxEpsEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxPrzelewy24Eligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxSepaEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxBlikEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxBanContactEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSandboxIDealEligibility',
'type' => 'bool',
'value' => false,
'group' => null
],
[
'name' => 'oscPayPalSCAContingency',
'type' => 'select',
Expand Down Expand Up @@ -570,7 +642,35 @@
[
'name' => 'oscPayPalUseStructuralCustomIdSchema',
'type' => 'bool',
'value' => false,
'value' => true,
'group' => null
],
[
'name' => 'oscPayPalButtonStyleLayout',
'type' => 'select',
'constraints' => 'vertical|horizontal',
'value' => 'vertical',
'group' => null
],
[
'name' => 'oscPayPalButtonStyleColor',
'type' => 'select',
'constraints' => 'gold|blue|silver|white|black',
'value' => 'gold',
'group' => null
],
[
'name' => 'oscPayPalButtonStyleShape',
'type' => 'select',
'constraints' => 'rect|pill|sharp',
'value' => 'rect',
'group' => null
],
[
'name' => 'oscPayPalButtonStyleLabel',
'type' => 'select',
'constraints' => 'paypal|checkout|buynow|pay|installment',
'value' => 'paypal',
'group' => null
],
],
Expand Down
33 changes: 32 additions & 1 deletion src/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

$user = $this->getUser();

if ($user) {

Check failure on line 46 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

If condition is always true.
$isVaultingPossible = false;
$moduleSettings = $this->getServiceFromContainer(ModuleSettings::class);
if ($moduleSettings->getIsVaultingActive() && $user->getFieldData('oxpassword')) {
Expand All @@ -57,7 +57,7 @@
($paypalCustomerId = $user->getFieldData("oscpaypalcustomerid"))
) {
$vaultingService = Registry::get(ServiceFactory::class)->getVaultingService();
$vaultedPaymentTokens = $vaultingService->getVaultPaymentTokens($paypalCustomerId)["payment_tokens"];

Check failure on line 60 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Parameter #1 $paypalCustomerId of method OxidSolutionCatalysts\PayPal\Core\Api\VaultingService::getVaultPaymentTokens() expects string, mixed given.
if ($vaultedPaymentTokens) {
$vaultedPaymentSources = [];
$uniquePaypalVaultedPaymentSources = [];
Expand All @@ -65,7 +65,7 @@
foreach ($vaultedPaymentToken["payment_source"] as $paymentType => $paymentSource) {
if ($paymentType === "card" && $moduleSettings->isVaultingAllowedForACDC()) {
$string = $lang->translateString("OSC_PAYPAL_CARD_ENDING_IN");
$vaultedPaymentSources[$paymentType][] = $paymentSource["brand"] . " " .

Check failure on line 68 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Binary operation "." between non-falsy-string and array|string results in an error.
$string . $paymentSource["last_digits"];
} elseif ($paymentType === "paypal" && $moduleSettings->isVaultingAllowedForPayPal()) {
$string = $lang->translateString("OSC_PAYPAL_CARD_PAYPAL_PAYMENT");
Expand All @@ -83,7 +83,7 @@

$uniquePaypalVaultedPaymentSources[$email][] = $payer_id;
$vaultedPaymentSources[$paymentType][] =
$string . " " . $email;

Check failure on line 86 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Binary operation "." between array|string and ' ' results in an error.
}
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@
$paymentList = [];
$payPalHealth = $this->getServiceFromContainer(ModuleSettings::class)->checkHealth();
$basket = Registry::getSession()->getBasket();
$isCalculationModeNetto = $basket ? $basket->isCalculationModeNetto() : false;

Check failure on line 129 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Ternary operator condition is always true.

/*
* check:
Expand All @@ -138,7 +138,7 @@
* - netto-mode
*/

foreach ($paymentListRaw as $key => $payment) {

Check failure on line 141 in src/Controller/PaymentController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Argument of an invalid type object supplied for foreach, only iterables are supported.
if (
!isset($payPalDefinitions[$key]) ||
(
Expand All @@ -161,7 +161,10 @@
)
)
) {
if ($key !== PayPalDefinitions::EXPRESS_PAYPAL_PAYMENT_ID || PayPalSession::isPayPalExpressOrderActive()) {
if (
$key !== PayPalDefinitions::EXPRESS_PAYPAL_PAYMENT_ID
|| PayPalSession::isPayPalExpressOrderActive()
) {
$paymentList[$key] = $payment;
}
}
Expand All @@ -176,6 +179,34 @@
if (!$this->getServiceFromContainer(ModuleSettings::class)->isPuiEligibility()) {
unset($paymentList[PayPalDefinitions::PUI_PAYPAL_PAYMENT_ID]);
}
// check GooglePay Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isGooglePayEligibility()) {
unset($paymentList[PayPalDefinitions::GOOGLEPAY_PAYPAL_PAYMENT_ID]);
}
// check ApplePay Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isApplePayEligibility()) {
unset($paymentList[PayPalDefinitions::APPLEPAY_PAYPAL_PAYMENT_ID]);
}
// check Eps Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isEpsEligibility()) {
unset($paymentList[PayPalDefinitions::EPS_PAYPAL_PAYMENT_ID]);
}
// check Przelewy24 Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isPrzelewy24Eligibility()) {
unset($paymentList[PayPalDefinitions::PRZELEWY24_PAYPAL_PAYMENT_ID]);
}
// check Blik Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isBlikEligibility()) {
unset($paymentList[PayPalDefinitions::BLIK_PAYPAL_PAYMENT_ID]);
}
// check BanContact Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isBanContactEligibility()) {
unset($paymentList[PayPalDefinitions::BANCONTACT_PAYPAL_PAYMENT_ID]);
}
// check iDeal Eligibility
if (!$this->getServiceFromContainer(ModuleSettings::class)->isIDealEligibility()) {
unset($paymentList[PayPalDefinitions::IDEAL_PAYPAL_PAYMENT_ID]);
}

return $paymentList;
}
Expand Down
Loading
Loading