예제 #1
0
파일: settings.php 프로젝트: kalushta/darom
 /**
  * Displays notices if the user does have a premier/business account.
  */
 function invalid_account_type_warning()
 {
     $options = APP_Gateway_Registry::get_options();
     if (APP_Gateway_Registry::is_gateway_enabled('paypal', 'escrow') && empty($options->gateways['paypal']['business_account'])) {
         $this->admin_msg(__('<strong>Important:</strong> You need a Premier or Verified Business PayPal account to be able to use the PayPal Adaptive service.', APP_TD));
     }
 }
 public function test_register()
 {
     APP_Gateway_Registry::register_gateway('APP_Mock_Gateway');
     $this->assertTrue(APP_Gateway_Registry::is_gateway_registered('mock-gateway'));
     $gateway = APP_Gateway_Registry::get_gateway('mock-gateway');
     $this->assertEquals('mock-gateway', $gateway->identifier());
     $this->assertFalse(APP_Gateway_Registry::is_gateway_enabled('mock-gateway'));
     return $gateway;
 }
예제 #3
0
파일: settings.php 프로젝트: kalushta/darom
 /**
  * Displays notices if a gateway is disabled
  * @return void
  */
 function disabled_gateway_warning()
 {
     if (isset($_GET['tab'])) {
         $gateway_id = $_GET['tab'];
         if (APP_Gateway_Registry::is_gateway_registered($gateway_id) && !APP_Gateway_Registry::is_gateway_enabled($gateway_id)) {
             $this->admin_msg(__('This gateway is currently <strong>disabled</strong>. Users cannot use it as a purchasing option. Go to the <a href="?page=app-payments-settings">General</a> tab to enable it.', APP_TD));
         }
     }
 }
예제 #4
0
 public function register()
 {
     if (!APP_Gateway_Registry::is_gateway_enabled('paypal')) {
         return;
     }
     $options = APP_Gateway_Registry::get_gateway_options('paypal');
     if (!empty($options['ipn_enabled'])) {
         $this->listener = new APP_PayPal_IPN_Listener(array('APP_PayPal_Notifier', 'handle_response'));
     }
 }
예제 #5
0
function appthemes_recurring_available($gateway_id = '')
{
    if (!empty($gateway_id) && APP_Gateway_Registry::is_gateway_enabled($gateway_id)) {
        $gateways = array(APP_Gateway_Registry::get_gateway($gateway_id));
    } else {
        $gateways = APP_Gateway_Registry::get_active_gateways();
    }
    foreach ($gateways as $gateway) {
        if ($gateway->is_recurring()) {
            return true;
        }
    }
    return false;
}
예제 #6
0
 /**
  * @depends test_gateway_creation
  * @depends test_anonymous_process_fail
  */
 public function test_anonymous_process_success($gateway)
 {
     $order = appthemes_new_order();
     $order->add_item('mock-process-test-item', 5, $order->get_id());
     $old_options = APP_Gateway_Registry::get_options();
     // Create new options object with gateway enabled
     $options = new stdClass();
     $options->gateways = array('enabled' => array('mock-gateway' => true));
     APP_Gateway_Registry::register_options($options);
     // Gateway should be enabled
     $this->assertTrue(APP_Gateway_Registry::is_gateway_enabled('mock-gateway'));
     // After enabled, it should pass
     $status = appthemes_process_gateway('mock-gateway', $order);
     $this->assertTrue($status);
     // Processing should call the gateway
     $this->assertTrue($gateway->process_called());
     APP_Gateway_Registry::register_options($old_options);
 }
예제 #7
0
/**
 * Retrieves details for an escrow order.
 *
 * @param APP_Escrow_Order $order The order object
 *
 * @return bool|mixed The details for the order or False if no details found
 */
function appthemes_get_escrow_details(APP_Escrow_Order $order)
{
    $gateway_id = $order->get_gateway();
    $gateway = APP_Gateway_Registry::get_gateway($gateway_id);
    if ($gateway && (APP_Gateway_Registry::is_gateway_enabled($gateway_id) || current_user_can('manage_options'))) {
        if (!$gateway instanceof APP_Escrow_Payment_Processor) {
            return false;
        }
        $options = APP_Gateway_Registry::get_gateway_options($gateway_id);
        return $gateway->get_details($order, $options);
    } else {
        return false;
    }
}
function appthemes_is_gateway_enabled($identifier)
{
    return APP_Gateway_Registry::is_gateway_enabled($identifier);
}