/** * @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); }
/** * Allows the gateway for the current order to process the order * The gateway may output content during this call * @return void */ function process_the_order() { $order = get_order(); appthemes_process_gateway($order->get_gateway(), $order); }
/** * Allows the gateway for the current order to process the order. * The gateway may output content during this call * * @param int $order_id (optional) If given, uses the specified order id, otherwise uses the order currently being queried. * * @return void */ function process_the_order($order_id = null) { $order = get_order($order_id); if ($order->is_escrow()) { $result = appthemes_escrow_process($order->get_gateway(), $order); } else { $result = appthemes_process_gateway($order->get_gateway(), $order); } return $result; }