Esempio n. 1
0
function upgrade_module_0_9_7($module)
{
    // Add test status && add hook
    Configuration::deleteByName('PAYPLUG_ORDER_STATE_REFUND');
    Payplug::updateConfiguration('PAYPLUG_SANDBOX', '0');
    $install = new InstallPayplug();
    $install->createOrderState();
    $module->registerHook('header');
    $install->installPayplugLock();
    return true;
    // Return true if success.
}
Esempio n. 2
0
function upgrade_module_1_1_0($module)
{
    // Update OS PayPlug payment
    if (defined('_PS_OS_ERROR_') || Configuration::get('PS_OS_ERROR')) {
        // If is in configuration (since 1.5)
        if ($os = Configuration::get('PS_OS_ERROR')) {
            $os_payment = $os;
        } else {
            $os_payment = constant('_PS_OS_ERROR_');
        }
        Payplug::updateConfiguration('PAYPLUG_ORDER_STATE_ERROR', (int) $os_payment);
    }
    return true;
    // Return true if success.
}
Esempio n. 3
0
 /**
  * Create order
  * @param  string  $key  OS Key
  * @param  boolean $test if os test
  */
 private function createOrderStateSpecifc($key, $test = false)
 {
     // Logo source
     $source = dirname(__FILE__) . '/logo.gif';
     // If is an OS test
     if ($test == true) {
         $key .= '_test';
     }
     // Configuration key
     $key_config = 'PAYPLUG_ORDER_STATE_' . Tools::strtoupper($key);
     // If configuration not exists
     if (!($os = Payplug::getConfiguration($key_config))) {
         // New state
         $order_state = new OrderState();
         // Init state
         $this->initOrderState($order_state, Tools::strtolower($key));
         // Add state
         if ($order_state->add()) {
             // Change
             $destination = _PS_IMG_DIR_ . 'os/' . (int) $order_state->id . '.gif';
             copy($source, $destination);
         }
         // Update configuration
         Payplug::updateConfiguration($key_config, (int) $order_state->id);
     } else {
         // Get status
         $order_state = new OrderState($os);
         // Init status
         $this->initOrderState($order_state, Tools::strtolower($key));
         // Update status
         $order_state->update();
     }
 }