Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PT-13140 - Deactivates MyBank payment method #36

Merged
merged 1 commit into from
Sep 21, 2023
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
4 changes: 3 additions & 1 deletion Resources/snippets/backend/payment/controller/payment.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[en_GB]
onboardingMessageText = "Please be aware, that your PayPal-account needs to be eligible for receiving payments with "Pay Upon Invoice", for this payment method to be available to your customers. You may authorize your account in the PayPal settings module."
myBankDisclaimerText = "Merchants enabling MyBank after February 2023 will need manual approval by PayPal. Reach out to merchant support for further information on this."

[de_DE]
onboardingMessageText = "Bitte beachte, dass Dein PayPal-Konto für den Empfang von Zahlungen mit "PayPal Rechnungskauf" zugelassen sein muss, damit diese Zahlungsmethode für Deine Kunden verfügbar ist. Du kannst Dein Konto im PayPal-Einstellungsmodul autorisieren."
onboardingMessageText = "Bitte beachte, dass Dein PayPal-Konto für den Empfang von Zahlungen mit "PayPal Rechnungskauf" zugelassen sein muss, damit diese Zahlungsmethode für Deine Kunden verfügbar ist. Du kannst Dein Konto im PayPal-Einstellungsmodul autorisieren."
myBankDisclaimerText = "Händler, die MyBank nach Februar 2023 aktivieren, benötigen eine manuelle Freischaltung durch PayPal. Für weiterführende Informationen hierzu bitte den Händlersupport kontaktieren."
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@ Ext.define('Shopware.apps.Payment.controller.PaymentPaypalUnified', {
override: 'Shopware.apps.Payment.controller.Payment',

snippets: {
onboardingMessageText: '{s name="onboardingMessageText"}Please be aware, that your PayPal-account needs to be eligible for receiving payments with "Pay Upon Invoice", for this payment method to be available to your customers. You may authorize your account in the PayPal settings module.{/s}'
onboardingMessageText: '{s name="onboardingMessageText"}Please be aware, that your PayPal-account needs to be eligible for receiving payments with "Pay Upon Invoice", for this payment method to be available to your customers. You may authorize your account in the PayPal settings module.{/s}',
myBankDisclaimerText: '{s name="myBankDisclaimerText"}Merchants enabling MyBank after February 2023 will need manual approval by PayPal. Reach out to merchant support for further information on this.{/s}',
},

onboardingMessage: null,
payUponInvoicePaymentMethodName: 'SwagPaymentPayPalUnifiedPayUponInvoice',
myBankPaymentMethodName: 'SwagPaymentPayPalUnifiedMyBank',

/**
* @param { Ext.view.View } view
* @param { Ext.data.Record } record
*/
onItemClick: function (view, record) {
if (this.alreadyAdded === true) {
this.callParent(arguments);
return;
}

var win = view.up('window'),
form = win.generalForm,
treeToolBar = win.down('toolbar[name=treeToolBar]'),
Expand All @@ -31,13 +28,20 @@ Ext.define('Shopware.apps.Payment.controller.PaymentPaypalUnified', {

if (record.get('name') === this.payUponInvoicePaymentMethodName) {
form.insert(0, this._createOnboardingMessage());
this.alreadyAdded = true;
} else if (this.onboardingMessage !== null) {
form.remove(this.onboardingMessage);

this.onboardingMessage = null;
}

if (record.get('name') === this.myBankPaymentMethodName) {
form.insert(0, this._createMyBankDisclaimer());
} else if (this.myBankDisclaimer !== null) {
form.remove(this.myBankDisclaimer);

this.myBankDisclaimer = null;
}

this.callParent(arguments);
},

Expand All @@ -49,5 +53,14 @@ Ext.define('Shopware.apps.Payment.controller.PaymentPaypalUnified', {

return this.onboardingMessage;
},

_createMyBankDisclaimer: function () {
this.myBankDisclaimer = Shopware.Notification.createBlockMessage(
this.snippets.myBankDisclaimerText,
'alert'
);

return this.myBankDisclaimer;
},
});
// {/block}
4 changes: 4 additions & 0 deletions SwagPaymentPayPalUnified.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use SwagPaymentPayPalUnified\Components\DependencyInjection\RiskManagementValueCompilerPass;
use SwagPaymentPayPalUnified\Components\DependencyInjection\WebhookFactoryCompilerPass;
use SwagPaymentPayPalUnified\Components\PaymentMethodProvider;
use SwagPaymentPayPalUnified\Components\PaymentMethodProviderInterface;
use SwagPaymentPayPalUnified\Setup\Installer;
use SwagPaymentPayPalUnified\Setup\PaymentModels\PaymentModelFactory;
use SwagPaymentPayPalUnified\Setup\TranslationTransformer;
Expand Down Expand Up @@ -115,6 +116,9 @@ public function activate(ActivateContext $context)
{
$paymentMethodProvider = $this->getPaymentMethodProvider();
foreach (PaymentMethodProvider::getAllUnifiedNames() as $unifiedName) {
if ($unifiedName === PaymentMethodProviderInterface::MY_BANK_METHOD_NAME) {
continue;
}
$paymentMethodProvider->setPaymentMethodActiveFlag($unifiedName, true);
}

Expand Down
3 changes: 0 additions & 3 deletions Tests/Functional/Controller/Frontend/PaypalUnifiedV2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,6 @@ public function orderDataProvider()
];
}

/**
* @param Container $container
*/
private function getController(Container $container = null)
{
$request = new Enlight_Controller_Request_RequestTestCase();
Expand Down