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:
@@ -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'] )
|
||||
|
||||
Reference in New Issue
Block a user