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

SW-384 remove pp installments #446

Merged
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
2 changes: 2 additions & 0 deletions Frontend/MoptPaymentPayone/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ public function install()

$riskRules = new RiskRules();
$riskRules->createRiskRules();
$riskRules->removeRiskRules('mopt_payone__fin_paypal_installment');

$this->removePayment('mopt_payone__fin_klarna_installment');
$this->removePayment('mopt_payone__ewallet_masterpass');
$this->removePayment('mopt_payone__fin_billsafe');
$this->removePayment('mopt_payone__fin_paypal_installment');

// Only relevant for update, not for reinstall
if (!$this->doesCronJobExist('PayoneTransactionForward') && !$this->doesCronJobExist('Shopware_CronJob_PayoneTransactionForward')) {
Expand Down
30 changes: 26 additions & 4 deletions Frontend/MoptPaymentPayone/Bootstrap/RiskRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,32 @@ public function __construct()
*/
public function createRiskRules()
{
$this->createPayoneRiskRule('mopt_payone__fin_paypal_installment',
'ORDERVALUELESS', '100', '', '', 2);
$this->createPayoneRiskRule('mopt_payone__fin_paypal_installment',
'ORDERVALUEMORE', '5000', '', '', 2);
// currently no risk rules are created
}

/**
* remove risk rules belonging to $paymentname
*
* @param $paymentName
* @throws \Exception
* @return void
*/
public function removeRiskRules($paymentName)
{
/** @var \Shopware\Components\Model\ModelManager $manager */
$manager = $this->plugin->get('models');
/** @var $payment Payment */
$payment = Shopware()->Models()->getRepository(Payment::class)->findOneBy(['name' => $paymentName]);
if ($payment) {
$rules = $payment->getRuleSets();
foreach ($rules as $rule) {
$manager->remove($rule);
$manager->flush($rule);
}
$payment->setRuleSets(null);
$manager->persist($payment);
$manager->flush($payment);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class Mopt_PayoneConfig
'mopt_payone__ibt_bancontact',
'mopt_payone__ewallet_amazon_pay',
'mopt_payone__ewallet_alipay',
'mopt_payone__fin_paypal_installment',
];

const PAYMENTS_ADDRESSCHECK_EXCLUDED = [
Expand Down Expand Up @@ -106,7 +105,6 @@ class Mopt_PayoneConfig
'mopt_payone__acc_payone_safe_invoice',
'mopt_payone__ibt_bancontact',
'mopt_payone__ewallet_alipay',
'mopt_payone__fin_paypal_installment',
];

const PAYMENTS_EXCLUDED_FROM_ACCOUNTPAGE = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,31 +557,26 @@ public function mopt_payone__getPaymentMethods()
'description' => 'PAYONE AliPay',
'template' => 'mopt_paymentmean_alipay_ewallet.tpl',
'position' => 37,),
array(
'name' => 'mopt_payone__fin_paypal_installment',
'description' => 'PAYONE Ratenkauf powered by Paypal',
'template' => 'mopt_paymentmean_paypal_installment.tpl',
'position' => 38,),
array(
'name' => 'mopt_payone__ewallet_paydirekt_express',
'description' => 'PAYONE Paydirekt Express',
'template' => null,
'position' => 39,),
'position' => 38,),
array(
'name' => 'mopt_payone__ewallet_wechatpay',
'description' => 'PAYONE WeChatPay',
'template' => null,
'position' => 40,),
'position' => 39,),
array(
'name' => 'mopt_payone__ibt_trustly',
'description' => 'PAYONE Trustly',
'template' => 'mopt_paymentmean_trustly.tpl',
'position' => 41,),
'position' => 40,),
array(
'name' => 'mopt_payone__ewallet_applepay',
'description' => 'PAYONE Apple Pay',
'template' => 'mopt_paymentmean_applepay.tpl',
'position' => 42,),
'position' => 41,),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ public function buildOrderCapture($order, $postionIds, $finalize, $includeShipme
$params['sequencenumber'] = $this->getParamSequencenumber($order);
$params['amount'] = $this->getParamCaptureAmount($order, $postionIds, $includeShipment);
$params['currency'] = $order->getCurrency();
if ($paymentName === 'mopt_payone__fin_paypal_installment') {
$params['clearingtype'] = 'fnc';
$params['financingtype'] = Payone_Api_Enum_FinancingType::PPI;
}

if ($this->payonePaymentHelper->isPayoneKlarna($paymentName)) {
$params['capturemode'] = $finalize ? 'completed' : 'notcompleted';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,17 +756,6 @@ public function isPayoneAmazonPay($paymentName)
return preg_match('#mopt_payone__ewallet_amazon_pay#', $paymentName) ? true : false;
}

/**
* check if given payment name is payone paypal installments
*
* @param string $paymentName
* @return boolean
*/
public function isPayonePaypalInstallment($paymentName)
{
return preg_match('#mopt_payone__fin_paypal_installment#', $paymentName) ? true : false;
}

/**
* check if given payment name is payone alipay payment
*
Expand Down Expand Up @@ -1240,10 +1229,6 @@ public function getActionFromPaymentName($paymentShortName)
return 'paypal';
}

if ($this->isPayonePaypalInstallment($paymentShortName)) {
return 'paypalinstallment';
}

if ($this->isPayoneDebitnote($paymentShortName)) {
return 'debitnote';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public function moptPayoneCaptureOrderAction()

if ($config['submitBasket'] ||
$this->moptPayone__main->getPaymentHelper()->isPayoneBillsafe($paymentName) ||
$this->moptPayone__main->getPaymentHelper()->isPayoneSafeInvoice($paymentName) ||
$this->moptPayone__main->getPaymentHelper()->isPayonePaypalInstallment($paymentName)
$this->moptPayone__main->getPaymentHelper()->isPayoneSafeInvoice($paymentName)
) {
$invoicing = $this->moptPayone__main->getParamBuilder()
->getInvoicingFromOrder($order, $positionIds, $finalize, false, $includeShipment);
Expand Down
Loading