Skip to content

Commit

Permalink
Merge pull request #517 from fatchip-Stefan/SW-447_giropay
Browse files Browse the repository at this point in the history
SW-447: removed giropay, renamed paydirekt to giropay
  • Loading branch information
janteuber authored Mar 21, 2024
2 parents d0a8193 + 28e2219 commit b0cd66a
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 138 deletions.
20 changes: 20 additions & 0 deletions Frontend/MoptPaymentPayone/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public function install()
$this->removePayment('mopt_payone__fin_billsafe');
$this->removePayment('mopt_payone__fin_paypal_installment');
$this->removePayment('mopt_payone__ewallet_paydirekt_express');
$this->removePayment('mopt_payone__ibt_giropay');

// Only relevant for update, not for reinstall
if (!$this->doesCronJobExist('PayoneTransactionForward') && !$this->doesCronJobExist('Shopware_CronJob_PayoneTransactionForward')) {
Expand Down Expand Up @@ -597,6 +598,16 @@ protected function updatePayments()
Shopware()->Models()->persist($payment);
Shopware()->Models()->flush();
}

/** @var Payment $payment */
$payment = $this->Payments()->findOneBy(
array('name' => 'mopt_payone__ewallet_paydirekt')
);
if ($payment) {
$payment->setDescription('PAYONE Giropay');
Shopware()->Models()->persist($payment);
Shopware()->Models()->flush();
}
}


Expand Down Expand Up @@ -808,6 +819,10 @@ protected function createDatabase()

$this->getInstallHelper()->checkAndAddPaypalExpressUseDefaultShipping();

$this->getInstallHelper()->checkAndAddPaydirektOrderSecured();

$this->getInstallHelper()->checkAndAddPaydirektPreauthorizationValidity();

// Do not add/remove columns to s_plugin_mopt_payone_config, after PPE migration

/** @var Payment $payment */
Expand All @@ -831,6 +846,11 @@ protected function createDatabase()
$this->getInstallHelper()->checkAndUpdateAmazonPayShopModelExtension();

$this->getInstallHelper()->checkAndAddPaypalExpressUseDefaultShipping();

$this->getInstallHelper()->checkAndAddPaydirektOrderSecured();

$this->getInstallHelper()->checkAndAddPaydirektPreauthorizationValidity();

$this->getInstallHelper()->moptCreateCreditcardPaymentDataTable();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Mopt_PayoneConfig
'mopt_payone__cc_maestro_international',
'mopt_payone__cc_china_union',
'mopt_payone__ibt_sofortueberweisung',
'mopt_payone__ibt_giropay',
'mopt_payone__ibt_eps',
'mopt_payone__ibt_post_efinance',
'mopt_payone__ibt_post_finance_card',
Expand Down Expand Up @@ -84,7 +83,6 @@ class Mopt_PayoneConfig
'mopt_payone__cc_maestro_international',
'mopt_payone__cc_china_union',
'mopt_payone__ibt_sofortueberweisung',
'mopt_payone__ibt_giropay',
'mopt_payone__ibt_eps',
'mopt_payone__ibt_post_efinance',
'mopt_payone__ibt_post_finance_card',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public function processPaymentForm($paymentId, $formData, $paymentHelper)
return $this->proccessBancontact($formData);
}

if ($paymentHelper->isPayoneGiropay($paymentId)) {
return $this->proccessGiropay($formData);
}

if ($paymentHelper->isPayoneEPS($paymentId)) {
return $this->proccessEps($formData);
}
Expand Down Expand Up @@ -236,40 +232,6 @@ protected function proccessBancontact($formData)
return $paymentData;
}

/**
* process form data
*
* @param array $formData
* @return array
*/
protected function proccessGiropay($formData)
{
$paymentData = array();

if (!$formData['mopt_payone__giropay_iban'] || !$this->isValidIban($formData['mopt_payone__giropay_iban'])) {
$paymentData['sErrorFlag']['mopt_payone__giropay_iban'] = true;
} else {
$paymentData['formData']['mopt_payone__giropay_iban'] = $formData['mopt_payone__giropay_iban'];
}

if (!$formData['mopt_payone__giropay_bic'] || !$this->isValidBic($formData['mopt_payone__giropay_bic']) ) {
$paymentData['sErrorFlag']['mopt_payone__giropay_bic'] = true;
} else {
$paymentData['formData']['mopt_payone__giropay_bic'] = $formData['mopt_payone__giropay_bic'];
}

if (!empty($paymentData['sErrorFlag']) && count($paymentData['sErrorFlag'])) {
return $paymentData;
}

$paymentData['formData']['mopt_payone__onlinebanktransfertype'] = Payone_Api_Enum_OnlinebanktransferType::GIROPAY;
$paymentData['formData']['mopt_payone__giropay_bankcountry'] = 'DE';

$this->setFormSubmittedFlag();

return $paymentData;
}

/**
* process form data
*
Expand Down
126 changes: 89 additions & 37 deletions Frontend/MoptPaymentPayone/Components/Classes/PayoneInstallHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,81 +424,76 @@ public function mopt_payone__getPaymentMethods()
'description' => 'PAYONE SOFORT Überweisung',
'template' => 'mopt_paymentmean_sofort.tpl',
'position' => 10,],
[
'name' => 'mopt_payone__ibt_giropay',
'description' => 'PAYONE Giropay',
'template' => 'mopt_paymentmean_giropay.tpl',
'position' => 11,],
[
'name' => 'mopt_payone__ibt_eps',
'description' => 'PAYONE eps',
'template' => 'mopt_paymentmean_eps.tpl',
'position' => 12,],
'position' => 11,],
[
'name' => 'mopt_payone__ibt_post_efinance',
'description' => 'PAYONE Post-Finance EFinance',
'template' => null,
'position' => 13,],
'position' => 12,],
[
'name' => 'mopt_payone__ibt_post_finance_card',
'description' => 'PAYONE Post-Finance Card',
'template' => null,
'position' => 14,],
'position' => 13,],
[
'name' => 'mopt_payone__ibt_ideal',
'description' => 'PAYONE iDeal',
'template' => 'mopt_paymentmean_ideal.tpl',
'position' => 15,],
'position' => 14,],
[
'name' => 'mopt_payone__ewallet_paypal',
'description' => 'PAYONE PayPal',
'template' => null,
'position' => 16,],
'position' => 15,],
[
'name' => 'mopt_payone__acc_debitnote',
'description' => 'PAYONE Lastschrift',
'template' => 'mopt_paymentmean_debit.tpl',
'position' => 17,],
'position' => 16,],
[
'name' => 'mopt_payone__acc_invoice',
'description' => 'PAYONE Offene Rechnung',
'template' => null,
'position' => 18,],
'position' => 17,],
[
'name' => 'mopt_payone__acc_payinadvance',
'description' => 'PAYONE Vorkasse',
'template' => null,
'position' => 19,],
'position' => 18,],
[
'name' => 'mopt_payone__acc_cashondel',
'description' => 'PAYONE Nachnahme',
'template' => null,
'position' => 20,],
'position' => 19,],
[
'name' => 'mopt_payone__fin_kis_klarna_installments',
'description' => 'PAYONE Klarna Slice It',
'template' => 'mopt_paymentmean_klarna.tpl',
'position' => 22,],
'position' => 20,],
[
'name' => 'mopt_payone__fin_kiv_klarna_invoice',
'description' => 'PAYONE Klarna Pay Later',
'template' => 'mopt_paymentmean_klarna.tpl',
'position' => 23,],
'position' => 21,],
[
'name' => 'mopt_payone__fin_kdd_klarna_direct_debit',
'description' => 'PAYONE Klarna Pay Now',
'template' => 'mopt_paymentmean_klarna.tpl',
'position' => 24,],
'position' => 22,],
[
'name' => 'mopt_payone__ibt_p24',
'description' => 'PAYONE P24',
'template' => null,
'position' => 25,],
'position' => 23,],
[
'name' => 'mopt_payone__csh_barzahlen',
'description' => 'PAYONE Barzahlen',
'template' => null,
'position' => 26,
'position' => 24,
'additionalDescription' => '<label for="payment_barzahlen">'
. ' <img style="height: 3em; vertical-align: -1em;" src="https://cdn.barzahlen.de/images/barzahlen_logo.png" alt="Barzahlen">'
. '</label>'
Expand All @@ -520,92 +515,92 @@ public function mopt_payone__getPaymentMethods()
'name' => 'mopt_payone__ewallet_paydirekt',
'description' => 'PAYONE Paydirekt',
'template' => null,
'position' => 27,],
'position' => 25,],
[
'name' => 'mopt_payone__fin_payolution_invoice',
'description' => 'PAYONE Unzer Rechnungskauf',
'template' => 'mopt_paymentmean_payolution_invoice.tpl',
'position' => 28,],
'position' => 26,],
[
'name' => 'mopt_payone__fin_payolution_debitnote',
'description' => 'PAYONE Unzer Lastschrift',
'template' => 'mopt_paymentmean_payolution_debitnote.tpl',
'position' => 29,],
'position' => 27,],
[
'name' => 'mopt_payone__fin_payolution_installment',
'description' => 'PAYONE Unzer Ratenkauf',
'template' => 'mopt_paymentmean_payolution_installment.tpl',
'position' => 30,],
'position' => 28,],
[
'name' => 'mopt_payone__fin_ratepay_invoice',
'description' => 'PAYONE Ratepay Rechnungskauf',
'template' => 'mopt_paymentmean_ratepay_invoice.tpl',
'position' => 31,],
'position' => 29,],
[
'name' => 'mopt_payone__fin_ratepay_installment',
'description' => 'PAYONE Ratepay Ratenkauf',
'template' => 'mopt_paymentmean_ratepay_installment.tpl',
'position' => 32,],
'position' => 30,],
[
'name' => 'mopt_payone__fin_ratepay_direct_debit',
'description' => 'PAYONE Ratepay Lastschrift',
'template' => 'mopt_paymentmean_ratepay_direct_debit.tpl',
'position' => 33,],
'position' => 31,],
[
'name' => 'mopt_payone__acc_payone_safe_invoice',
'description' => 'PAYONE Rechnung mit Zahlungsgarantie',
'template' => 'mopt_paymentmean_payone_safe_invoice.tpl',
'position' => 34,],
'position' => 32,],
[
'name' => 'mopt_payone__ibt_bancontact',
'description' => 'PAYONE Bancontact',
'template' => 'mopt_paymentmean_bancontact.tpl',
'position' => 35,],
'position' => 33,],
[
'name' => 'mopt_payone__ewallet_amazon_pay',
'description' => 'PAYONE Amazon Pay',
'template' => 'mopt_paymentmean_amazon_ewallet.tpl',
'position' => 36,],
'position' => 34,],
[
'name' => 'mopt_payone__ewallet_alipay',
'description' => 'PAYONE AliPay',
'template' => 'mopt_paymentmean_alipay_ewallet.tpl',
'position' => 37,],
'position' => 35,],
[
'name' => 'mopt_payone__ewallet_wechatpay',
'description' => 'PAYONE WeChatPay',
'template' => null,
'position' => 38,],
'position' => 36,],
[
'name' => 'mopt_payone__ibt_trustly',
'description' => 'PAYONE Trustly',
'template' => 'mopt_paymentmean_trustly.tpl',
'position' => 39,],
'position' => 37,],
[
'name' => 'mopt_payone__ewallet_applepay',
'description' => 'PAYONE Apple Pay',
'template' => 'mopt_paymentmean_applepay.tpl',
'position' => 40,],
'position' => 38,],
[
'name' => 'mopt_payone__ewallet_paypal_express',
'description' => 'PAYONE PayPal Express',
'template' => null,
'position' => 41,],
'position' => 39,],
[
'name' => 'mopt_payone__fin_payone_secured_invoice',
'description' => 'PAYONE Gesicherter Rechnungskauf',
'template' => 'mopt_paymentmean_payone_secured_invoice.tpl',
'position' => 42,],
'position' => 40,],
[
'name' => 'mopt_payone__fin_payone_secured_installment',
'description' => 'PAYONE Gesicherter Ratenkauf',
'template' => 'mopt_paymentmean_payone_secured_installment.tpl',
'position' => 43,],
'position' => 41,],
[
'name' => 'mopt_payone__fin_payone_secured_directdebit',
'description' => 'PAYONE Gesicherte Lastschrift',
'template' => 'mopt_paymentmean_payone_secured_directdebit.tpl',
'position' => 44,],
'position' => 42,],
];
}

Expand Down Expand Up @@ -2196,5 +2191,62 @@ public function checkAndAddPaypalExpressUseDefaultShipping()
}
}
}
/**
* Checks if paypalExressUseDefaultShipping columns are present and creates
* columns if not present.
*
* @return void
* @throws Zend_Db_Adapter_Exception
* @throws Zend_Db_Statement_Exception
*/
public function checkAndAddPaydirektOrderSecured()
{
$textColumns = ['paydirekt_order_secured'];
$db = Shopware()->Db();
$dbConfig = $db->getConfig();

foreach ($textColumns AS $column) {
$sql = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='s_plugin_mopt_payone_config'
AND TABLE_SCHEMA = '{$dbConfig['dbname']}'
AND COLUMN_NAME = '$column'";

$result = $db->query($sql);

if ($result->rowCount() === 0) {
$sql = "ALTER TABLE `s_plugin_mopt_payone_config`
ADD COLUMN `$column` TINYINT(1) NOT NULL DEFAULT 0;";
$db->exec($sql);
}
}
}

/**
* Checks if paypalExressUseDefaultShipping columns are present and creates
* columns if not present.
*
* @return void
* @throws Zend_Db_Adapter_Exception
* @throws Zend_Db_Statement_Exception
*/
public function checkAndAddPaydirektPreauthorizationValidity()
{
$textColumns = ['paydirekt_preauthorization_validity'];
$db = Shopware()->Db();
$dbConfig = $db->getConfig();

foreach ($textColumns AS $column) {
$sql = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='s_plugin_mopt_payone_config'
AND TABLE_SCHEMA = '{$dbConfig['dbname']}'
AND COLUMN_NAME = '$column'";

$result = $db->query($sql);

if ($result->rowCount() === 0) {
$sql = "ALTER TABLE `s_plugin_mopt_payone_config`
ADD COLUMN `$column` TINYINT(2) NOT NULL DEFAULT 0;";
$db->exec($sql);
}
}
}
}

Loading

0 comments on commit b0cd66a

Please sign in to comment.