Integrations DI refactor, remove Sellasist/Baselinker, fix product-edit encoding (0.263)

- New: Domain\Integrations\IntegrationsRepository + admin\Controllers\IntegrationsController (DI)
- Cleanup: removed all Sellasist and Baselinker integrations from entire project
- Fix: product-edit.php Polish characters (UTF-8/CP1250 double-encoding)
- Update: factory\Integrations as facade (Apilo + ShopPRO only)
- Tests: 212 tests, 577 assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 21:59:26 +01:00
parent 67705f1f56
commit d824ba3909
51 changed files with 1166 additions and 2663 deletions

View File

@@ -8,9 +8,7 @@ class Order implements \ArrayAccess
public $statuses;
public $status;
public $client_email;
public $sellasist_order_id;
public $summary;
public $baselinker_order_id;
public $apilo_order_id;
public $date_order;
public $payment_method_id;
@@ -61,12 +59,6 @@ class Order implements \ArrayAccess
return $statuses;
}
public function update_baselinker_order_status_date( $date )
{
global $mdb;
return $mdb -> update( 'pp_shop_orders', [ 'baselinker_order_status_date' => $date ], [ 'id' => $this -> id ] );
}
public function update_aplio_order_status_date( $date )
{
global $mdb;
@@ -77,28 +69,6 @@ class Order implements \ArrayAccess
public function set_as_unpaid() {
global $mdb;
$sellasist_settings = \admin\factory\Integrations::sellasist_settings();
if ( $sellasist_settings['enabled'] and $sellasist_settings['api_code'] and $sellasist_settings['sync_orders'] ) {
if ( $this -> sellasist_order_id ) {
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://projectpro.sellasist.pl/api/v1/orders/" . $this -> sellasist_order_id );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( [
'paid' => 0,
'payment_status' => 'unpaid'
] ) );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array(
"accept: application/json",
"apiKey: " . $sellasist_settings['api_code'],
"Content-Type: application/json"
) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_exec( $ch );
curl_close( $ch );
}
}
$mdb -> update( 'pp_shop_orders', [ 'paid' => 0 ], [ 'id' => $this -> id ] );
return true;
}
@@ -108,53 +78,6 @@ class Order implements \ArrayAccess
{
global $mdb, $config;
$sellasist_settings = \admin\factory\Integrations::sellasist_settings();
if ( $sellasist_settings['enabled'] and $sellasist_settings['api_code'] and $sellasist_settings['sync_orders'] )
{
if ( $this -> sellasist_order_id )
{
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://projectpro.sellasist.pl/api/v1/orders/" . $this -> sellasist_order_id );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( [
'paid' => str_replace( ',', '.', $this -> summary ),
'payment_status' => 'paid'
] ) );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array(
"accept: application/json",
"apiKey: " . $sellasist_settings['api_code'],
"Content-Type: application/json"
) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_exec( $ch );
curl_close( $ch );
}
}
$baselinker_settings = \admin\factory\Integrations::baselinker_settings();
if ( $baselinker_settings['enabled'] and $baselinker_settings['api_code'] and $baselinker_settings['sync_orders'] )
{
if ( $this -> baselinker_order_id )
{
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://api.baselinker.com/connector.php" );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( [
'token' => $baselinker_settings['api_code'],
'method' => 'setOrderPayment',
'parameters' => json_encode( [
'order_id' => $this -> baselinker_order_id,
'payment_done' => $this -> summary,
'payment_date' => time( 'Y-m-d H:i:s' )
] )
] ) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_exec( $ch );
curl_close( $ch );
}
}
// apilo
$apilo_settings = \admin\factory\Integrations::apilo_settings();
if ( $apilo_settings['enabled'] and $apilo_settings['access-token'] and $apilo_settings['sync_orders'] )
@@ -233,51 +156,6 @@ class Order implements \ArrayAccess
$response['result'] = true;
$sellasist_settings = \admin\factory\Integrations::sellasist_settings();
if ( $sellasist_settings['enabled'] and $sellasist_settings['api_code'] and $sellasist_settings['sync_orders'] )
{
if ( $this -> sellasist_order_id )
{
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://projectpro.sellasist.pl/api/v1/orders/" . $this -> sellasist_order_id );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( [
'status' => \front\factory\ShopStatuses::get_sellasist_status_id( $status )
] ) );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array(
"accept: application/json",
"apiKey: " . $sellasist_settings['api_code'],
"Content-Type: application/json"
) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_exec( $ch );
curl_close( $ch );
}
}
$baselinker_settings = \admin\factory\Integrations::baselinker_settings();
if ( $baselinker_settings['enabled'] and $baselinker_settings['api_code'] and $baselinker_settings['sync_orders'] )
{
if ( $this -> baselinker_order_id )
{
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://api.baselinker.com/connector.php" );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( [
'token' => $baselinker_settings['api_code'],
'method' => 'setOrderStatus',
'parameters' => json_encode( [
'order_id' => $this -> baselinker_order_id,
'status_id' => \shop\ShopStatus::get_baselinker_status_by_shop_status( $status )
] )
] ) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
$curl_result = curl_exec( $ch );
curl_close( $ch );
}
}
// apilo
$apilo_settings = \admin\factory\Integrations::apilo_settings();
if ( $apilo_settings['enabled'] and $apilo_settings['access-token'] and $apilo_settings['sync_orders'] )

View File

@@ -264,18 +264,6 @@ class Product implements \ArrayAccess
return false;
}
// pobierz id produktu z Baselinker
static public function get_baselinker_product_id( int $product_id )
{
global $mdb;
$result = $mdb -> get( 'pp_shop_products', [ 'parent_id', 'baselinker_product_id' ], [ 'id' => $product_id ] );
if ( $result['baselinker_product_id'] )
return $result['baselinker_product_id'];
else
return $mdb -> get( 'pp_shop_products', 'baselinker_product_id', [ 'id' => $result['parent_id'] ] );
}
// pobierz kod SKU
static public function get_product_sku( int $product_id )
{

View File

@@ -1,15 +0,0 @@
<?
namespace shop;
class ShopStatus {
// get_status_by_baselinker_status
static public function get_shop_status_by_baselinker_status( int $baselinker_status_id ) {
global $mdb;
return $mdb -> get( 'pp_shop_statuses', 'id', [ 'baselinker_status_id' => $baselinker_status_id ] );
}
// get_baselinker_status_by_shop_status
static public function get_baselinker_status_by_shop_status( int $shop_status_id ) {
global $mdb;
return $mdb -> get( 'pp_shop_statuses', 'baselinker_status_id', [ 'id' => $shop_status_id ] );
}
}