Skip to content

Commit

Permalink
0054206 added universal payment (#18)
Browse files Browse the repository at this point in the history
* 0054187 added additional fields
+ some refactorring

* fixed afterbuy order helper registration

* added todo for variant articles base association

* 0054206: Create fallback payment on install and update

* 0054206: Make payment mapping config fields not required

* 0054206: Return new Afterbuy universal payment at first

* 0054206: Refactor code

* 0054206: Improve order sort

* 0054206: Avoid collisions with other plugin configs

* 0054206: Remove TODO as there is nothing to do

* 0054206: Refactor ShopwareResetHelper

* 0054206: Make payment mapping fields not required - in "our" config tool

* 0054187: Added some refactoring hints

* 0054187: Add baseProductFlag to ValueArticle

* 0054187: Refactor AfterbuyProductsHelper

* 0054187: Use baseProductsFlag, to identify variation sets

* refactored article retrieval method

* refactored services

* extended exception handling

* fixed payment type association

* fixed payment type association

* code opt

* fixed missing shipping address in order export

* fixed return value for article generation

* updated changelog
  • Loading branch information
FCStephanAltmann authored Dec 11, 2019
1 parent 4e27b94 commit 9fbbb5f
Show file tree
Hide file tree
Showing 42 changed files with 1,204 additions and 829 deletions.
12 changes: 0 additions & 12 deletions Commands/ExportCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ protected function configure()
$this
->setName('Afterbuy:Export:Categories')
->setDescription('Export Categories to Afterbuy')
/*->addArgument(
'my-argument',
InputArgument::REQUIRED,
'An required argument (positional)'
)
->addOption(
'my-option',
null,
InputOption::VALUE_OPTIONAL,
'An optional *option*',
'My-Default-Value'
)*/
->setHelp(<<<EOF
The <info>%command.name%</info> implements a command.
EOF
Expand Down
12 changes: 0 additions & 12 deletions Commands/ExportOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ protected function configure()
$this
->setName('Afterbuy:Export:Orders')
->setDescription('Submit orders to Afterbuy')
/*->addArgument(
'my-argument',
InputArgument::REQUIRED,
'An required argument (positional)'
)
->addOption(
'my-option',
null,
InputOption::VALUE_OPTIONAL,
'An optional *option*',
'My-Default-Value'
)*/
->setHelp(<<<EOF
The <info>%command.name%</info> implements a command.
EOF
Expand Down
12 changes: 0 additions & 12 deletions Commands/ImportCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ protected function configure()
$this
->setName('Afterbuy:Import:Categories')
->setDescription('Import Categories from Afterbuy')
/*->addArgument(
'my-argument',
InputArgument::REQUIRED,
'An required argument (positional)'
)
->addOption(
'my-option',
null,
InputOption::VALUE_OPTIONAL,
'An optional *option*',
'My-Default-Value'
)*/
->setHelp(<<<EOF
The <info>%command.name%</info> implements a command.
EOF
Expand Down
2 changes: 2 additions & 0 deletions Commands/ImportProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace viaebShopwareAfterbuy\Commands;

use Doctrine\ORM\ORMException;
use viaebShopwareAfterbuy\Services\ReadData\ReadDataInterface;
use viaebShopwareAfterbuy\Services\WriteData\WriteDataInterface;
use viaebShopwareAfterbuy\Services\WriteData\Internal\WriteProductsService;
Expand Down Expand Up @@ -65,6 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$data = $this->readDataService->get($filter);
$output->writeln('Got ' . count($data) . ' Products');

$this->writeDataService->put($data);
}
}
2 changes: 2 additions & 0 deletions Commands/ImportStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace viaebShopwareAfterbuy\Commands;

use Doctrine\ORM\ORMException;
use viaebShopwareAfterbuy\Services\ReadData\ReadDataInterface;
use viaebShopwareAfterbuy\Services\WriteData\Internal\WriteStatusService;
use viaebShopwareAfterbuy\Services\WriteData\WriteDataInterface;
Expand Down Expand Up @@ -63,6 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$filter = $this->writeDataService->getOrdersForRequestingStatusUpdate();

$data = $this->readDataService->get($filter);

$this->writeDataService->put($data);
}
}
15 changes: 15 additions & 0 deletions Components/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ public static function getSetterByField(string $field) {
return 'set' . strtoupper($field[0]) . substr($field, 1);
}

/**
* @param string $value
* @return float
*/
public static function convertDeString2Float(string $value) {
$value = str_replace('.', '', $value);
$value = str_replace(',', '.', $value);

return (float)$value;
}

/**
* @param $value
* @return mixed|string
*/
public static function convertNumberToABString($value) {
$value = number_format((float)$value, 2);
$value = str_replace(',', '', $value);
Expand All @@ -28,6 +36,13 @@ public static function convertNumberToABString($value) {
return $value;
}

/**
* @param float $price
* @param float $tax
* @param bool $isNet
* @param bool $toNet
* @return float|int
*/
public static function convertPrice(float $price, float $tax, $isNet = true, $toNet = false) {
if($isNet === $toNet) {
return $price;
Expand Down
2 changes: 2 additions & 0 deletions Controllers/Backend/AfterbuyConnector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/** @noinspection SpellCheckingInspection */

/** @noinspection PhpUnused */

class Shopware_Controllers_Backend_AfterbuyConnector extends Shopware_Controllers_Backend_ExtJs
{
public function indexAction() {
Expand Down
2 changes: 1 addition & 1 deletion Controllers/Backend/viaebConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Shopware\Components\ConfigWriter;
use viaebShopwareAfterbuy\Services\Helper\ShopwareConfigHelper;

/** @noinspection PhpUnused */
class Shopware_Controllers_Backend_viaebConfigForm extends Shopware_Controllers_Backend_ExtJs
{
/** @var ConfigWriter $configWriter */
Expand Down Expand Up @@ -46,7 +47,6 @@ public function saveConnectionConfigAction() {
]);

try{
//TODO: typecast related to Shopware Version ordernumberMapping mainSystem ExportAllArticles
$this->configWriter->save('partnerId', $_REQUEST['partnerId'], $this->pluginName);
$this->configWriter->save('partnerPassword', $_REQUEST['partnerPassword'], $this->pluginName);
$this->configWriter->save('userName', $_REQUEST['userName'], $this->pluginName);
Expand Down
1 change: 1 addition & 0 deletions Controllers/Backend/viaebResetShopConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use viaebShopwareAfterbuy\Services\Helper\ShopwareResetHelper;

/** @noinspection PhpUnused */
class Shopware_Controllers_Backend_viaebResetShopConnection extends Shopware_Controllers_Backend_ExtJs
{
public function indexAction()
Expand Down
34 changes: 17 additions & 17 deletions Resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<label lang="en">Customer group</label>
<store>Shopware.apps.Base.store.CustomerGroup</store>
</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentINVOICE</name>
<label lang="de">Zahlungsart INVOICE</label>
<label lang="en">Payment INVOICE</label>
Expand All @@ -146,7 +146,7 @@
<displayField>description</displayField>
</options>
</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCREDIT_CARD</name>
<label lang="de">Zahlungsart CREDIT_CARD</label>
<label lang="en">Payment CREDIT_CARD</label>
Expand All @@ -155,7 +155,7 @@
<displayField>description</displayField>
</options>
</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentDIRECT_DEBIT</name>
<label lang="de">Zahlungsart DIRECT_DEBIT</label>
<label lang="en">Payment DIRECT_DEBIT</label>
Expand All @@ -165,7 +165,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentTRANSFER</name>
<label lang="de">Zahlungsart TRANSFER</label>
<label lang="en">Payment TRANSFER</label>
Expand All @@ -175,7 +175,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCASH_PAID</name>
<label lang="de">Zahlungsart CASH_PAID</label>
<label lang="en">Payment CASH_PAID</label>
Expand All @@ -185,7 +185,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCASH_ON_DELIVERY</name>
<label lang="de">Zahlungsart CASH_ON_DELIVERY</label>
<label lang="en">Payment CASH_ON_DELIVERY</label>
Expand All @@ -195,7 +195,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentPAYPAL</name>
<label lang="de">Zahlungsart PAYPAL</label>
<label lang="en">Payment PAYPAL</label>
Expand All @@ -205,7 +205,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentINVOICE_TRANSFER</name>
<label lang="de">Zahlungsart INVOICE_TRANSFER</label>
<label lang="en">Payment INVOICE_TRANSFER</label>
Expand All @@ -215,7 +215,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCLICKANDBUY</name>
<label lang="de">Zahlungsart CLICKANDBUY</label>
<label lang="en">Payment CLICKANDBUY</label>
Expand All @@ -225,7 +225,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentEXPRESS_CREDITWORTHINESS</name>
<label lang="de">Zahlungsart EXPRESS_CREDITWORTHINESS</label>
<label lang="en">Payment EXPRESS_CREDITWORTHINESS</label>
Expand All @@ -235,7 +235,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentPAYNET</name>
<label lang="de">Zahlungsart PAYNET</label>
<label lang="en">Payment PAYNET</label>
Expand All @@ -245,7 +245,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCOD_CREDITWORTHINESS</name>
<label lang="de">Zahlungsart COD_CREDITWORTHINESS</label>
<label lang="en">Payment COD_CREDITWORTHINESS</label>
Expand All @@ -255,7 +255,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentEBAY_EXPRESS</name>
<label lang="de">Zahlungsart EBAY_EXPRESS</label>
<label lang="en">Payment EBAY_EXPRESS</label>
Expand All @@ -265,7 +265,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentMONEYBOOKERS</name>
<label lang="de">Zahlungsart MONEYBOOKERS</label>
<label lang="en">Payment MONEYBOOKERS</label>
Expand All @@ -275,7 +275,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentCREDIT_CARD_MB</name>
<label lang="de">Zahlungsart CREDIT_CARD_MB</label>
<label lang="en">Payment CREDIT_CARD_MB</label>
Expand All @@ -285,7 +285,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentDIRECT_DEBIT_MB</name>
<label lang="de">Zahlungsart DIRECT_DEBIT_MB</label>
<label lang="en">Payment DIRECT_DEBIT_MB</label>
Expand All @@ -295,7 +295,7 @@
</options>

</element>
<element type="combo" required="true">
<element type="combo" required="false">
<name>paymentOTHERS</name>
<label lang="de">Zahlungsart OTHERS</label>
<label lang="en">Payment OTHERS</label>
Expand Down
9 changes: 8 additions & 1 deletion Resources/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<service class="viaebShopwareAfterbuy\Services\ReadData\External\ReadOrdersService" id="viaeb_shopware_afterbuy.services.read_data.external.read_orders_service" parent="viaeb_shopware_afterbuy.services.abstract_data_service">
<argument id="models" type="service"/>
<call method="initHelper">
<argument type="service" id="viaeb_shopware_afterbuy.services.helper.shopware_order_helper"/>
<argument type="service" id="viaeb_shopware_afterbuy.services.helper.afterbuy_order_helper"/>
<argument type="string">number</argument>
<argument>false</argument>
</call>
Expand Down Expand Up @@ -313,6 +313,13 @@
</call>
</service>

<service class="viaebShopwareAfterbuy\Services\Helper\AfterbuyOrderHelper" id="viaeb_shopware_afterbuy.services.helper.afterbuy_order_helper">
<argument id="models" type="service"/>
<call method="setLogger">
<argument type="service" id="afterbuy.logger" />
</call>
</service>

<service class="viaebShopwareAfterbuy\Services\Helper\AfterbuyProductsHelper" id="viaeb_shopware_afterbuy.services.helper.afterbuy_products_helper">
<argument id="models" type="service"/>
<call method="setLogger">
Expand Down
1 change: 1 addition & 0 deletions Resources/views/backend/_resources/css/grid-row.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*noinspection CssUnusedSymbol*/
.afterbuy-grid-cell {
background-image: radial-gradient(#f8e435, transparent);
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Ext.define('Shopware.apps.viaebConfigForm.view.ConfigWindow', {
childDefaults: {
xtype: 'combo',
forceSelection: true,
allowBlank: false,
allowBlank: true,
displayField: 'description',
valueField: 'id',
store: me.createRemoteStore(Shopware.apps.Base.store.Payment),
Expand Down
Loading

0 comments on commit 9fbbb5f

Please sign in to comment.