ver. 0.276: ShopOrder migration, Integrations cleanup, global admin search
This commit is contained in:
@@ -55,10 +55,9 @@ class Order implements \ArrayAccess
|
||||
public static function order_statuses()
|
||||
{
|
||||
global $mdb;
|
||||
$results = $mdb -> select( 'pp_shop_statuses', [ 'id', 'status' ], [ 'ORDER' => [ 'o' => 'ASC' ] ] );
|
||||
if ( \S::is_array_fix( $results ) ) foreach ( $results as $row )
|
||||
$statuses[ (int)$row['id'] ] = $row['status'];
|
||||
return $statuses;
|
||||
|
||||
$repository = new \Domain\ShopStatus\ShopStatusRepository( $mdb );
|
||||
return $repository -> allStatuses();
|
||||
}
|
||||
|
||||
public function update_aplio_order_status_date( $date )
|
||||
@@ -80,8 +79,10 @@ class Order implements \ArrayAccess
|
||||
{
|
||||
global $mdb, $config;
|
||||
|
||||
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
||||
|
||||
// apilo
|
||||
$apilo_settings = \admin\factory\Integrations::apilo_settings();
|
||||
$apilo_settings = $integrationsRepository -> getSettings( 'apilo' );
|
||||
if ( $apilo_settings['enabled'] and $apilo_settings['access-token'] and $apilo_settings['sync_orders'] )
|
||||
{
|
||||
// put data to file
|
||||
@@ -117,6 +118,8 @@ class Order implements \ArrayAccess
|
||||
{
|
||||
global $mdb, $config;
|
||||
|
||||
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
||||
|
||||
if ( $this -> status == $status )
|
||||
return false;
|
||||
|
||||
@@ -137,7 +140,7 @@ class Order implements \ArrayAccess
|
||||
$response['result'] = true;
|
||||
|
||||
// apilo
|
||||
$apilo_settings = \admin\factory\Integrations::apilo_settings();
|
||||
$apilo_settings = $integrationsRepository -> getSettings( 'apilo' );
|
||||
if ( $apilo_settings['enabled'] and $apilo_settings['access-token'] and $apilo_settings['sync_orders'] )
|
||||
{
|
||||
// put data to file
|
||||
@@ -322,7 +325,9 @@ class Order implements \ArrayAccess
|
||||
|
||||
private function sync_apilo_payment(): bool
|
||||
{
|
||||
global $config;
|
||||
global $config, $mdb;
|
||||
|
||||
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
||||
|
||||
if ( !(int)$this -> apilo_order_id )
|
||||
return true;
|
||||
@@ -332,7 +337,7 @@ class Order implements \ArrayAccess
|
||||
$payment_type = 1;
|
||||
|
||||
$payment_date = new \DateTime( $this -> date_order );
|
||||
$access_token = \admin\factory\Integrations::apilo_get_access_token();
|
||||
$access_token = $integrationsRepository -> apiloGetAccessToken();
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt( $ch, CURLOPT_URL, "https://projectpro.apilo.com/rest/api/orders/" . $this -> apilo_order_id . '/payment/' );
|
||||
@@ -371,12 +376,14 @@ class Order implements \ArrayAccess
|
||||
|
||||
private function sync_apilo_status( int $status ): bool
|
||||
{
|
||||
global $config;
|
||||
global $config, $mdb;
|
||||
|
||||
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
||||
|
||||
if ( !(int)$this -> apilo_order_id )
|
||||
return true;
|
||||
|
||||
$access_token = \admin\factory\Integrations::apilo_get_access_token();
|
||||
$access_token = $integrationsRepository -> apiloGetAccessToken();
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt( $ch, CURLOPT_URL, "https://projectpro.apilo.com/rest/api/orders/" . $this -> apilo_order_id . '/status/' );
|
||||
|
||||
Reference in New Issue
Block a user