/** * Initialize */ public static function load_gateway() { if (function_exists('appthemes_register_gateway')) { appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_IDealGateway'); add_action('pronamic_payment_status_update_' . self::SLUG, array(__CLASS__, 'status_update'), 10, 2); add_filter('pronamic_payment_source_text_' . self::SLUG, array(__CLASS__, 'source_text'), 10, 2); } }
public function test_gateway_creation() { appthemes_register_gateway('APP_Mock_Gateway'); $gateway = APP_Gateway_Registry::get_gateway('mock-gateway'); $this->assertNotEmpty($gateway); // New gateways should not be enabled $this->assertFalse(APP_Gateway_Registry::is_gateway_enabled('mock-gateway')); $this->assertTrue($this->_test_gateway_creation_internal($gateway)); return $gateway; }
/** * Initialize */ public static function load_gateway() { if (function_exists('appthemes_register_gateway')) { appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_Gateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_BancontactGateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_BankTransferGateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_CreditCardGateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_DirectDebitGateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_IDealGateway'); appthemes_register_gateway('Pronamic_WP_Pay_Extensions_AppThemes_SofortGateway'); add_action('pronamic_payment_status_update_' . self::SLUG, array(__CLASS__, 'status_update'), 10, 2); add_filter('pronamic_payment_source_text_' . self::SLUG, array(__CLASS__, 'source_text'), 10, 2); } }
exit; } $xml = simplexml_load_string($xml); if (count($xml->error) > 0) { echo 'Falha na requisição.<br>'; foreach ($xml->error as $error) { echo $error . '<br>'; } exit; } $payment_url = $options['use_sandbox'] ? 'https://sandbox.pagseguro.uol.com.br/v2/checkout/payment.html' : 'https://pagseguro.uol.com.br/v2/checkout/payment.html'; echo '<p>Total do pedido: ' . $order->get_total() . '</p>'; echo '<a class="obtn btn_orange" href=' . $payment_url . '?code=' . $xml->code . '>Concluir pagamento agora</a>'; } } appthemes_register_gateway('PagseguroGateway'); add_action('wp_footer', 'pagseguro_create_payment_listener'); function pagseguro_create_payment_listener() { $code = isset($_POST['notificationCode']) && trim($_POST['notificationCode']) !== "" ? trim($_POST['notificationCode']) : null; $type = isset($_POST['notificationType']) && trim($_POST['notificationType']) !== "" ? trim($_POST['notificationType']) : null; if ($code && $type) { pagseguro_log('::::: Notificação PagSeguro recebida :::::'); $options = APP_Gateway_Registry::get_gateway_options('pagseguro'); $email = $options['user_email']; $token = $options['use_sandbox'] ? $options['user_token_sandbox'] : $options['user_token']; $url = $options['use_sandbox'] ? 'https://ws.sandbox.pagseguro.uol.com.br/v2/transactions/notifications/' : 'https://ws.pagseguro.uol.com.br/v2/transactions/notifications/'; $url = $url . $code . '?email=' . $email . '&token=' . $token; $ch = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
* @param APP_Order $order Order being processed * @return array $sections with added sections */ public function display_order($sections, $order) { $sections['General Information'] = array('ID' => $order->get_id()); $sections['Money & Currency'] = array('Currency' => APP_Currencies::get_name($order->get_currency()) . ' (' . $order->get_currency() . ')', 'Total' => APP_Currencies::get_price($order->get_total(), $order->get_currency())); return $sections; } /** * Formats a section header * @param string $title Title of section * @return string Formatted section header html */ private function display_section($title) { return '<div class="featured-head"><h3>' . $title . ' </h3></div>'; } /** * Formats a field * @param string $field Field name * @param string $value Field value * @return string Formatted field html */ private function display_field($field, $value) { return '<div class="form-field"><label>' . $field . ': <strong>' . $value . '</strong></label></div>'; } } appthemes_register_gateway('APP_TestGateway');
} public function form() { $general = array('title' => __('General Information', APP_TD), 'fields' => array(array('title' => __('PayPal Email', APP_TD), 'tip' => __('Enter your PayPal account email address. This is where your money gets sent.', APP_TD), 'type' => 'text', 'name' => 'email_address', 'extra' => array('size' => 50)), array('title' => __('Sandbox Mode', APP_TD), 'desc' => sprintf(__("You must have a <a target='_new' href='%s'>PayPal Sandbox</a> account setup before using this feature.", APP_TD), 'http://developer.paypal.com/'), 'tip' => __('By default PayPal is set to live mode. If you would like to test and see if payments are being processed correctly, check this box to switch to sandbox mode.', APP_TD), 'type' => 'checkbox', 'name' => 'sandbox_enabled'))); $pdt = array('title' => __('Payment Data Transfer (PDT)', APP_TD), 'fields' => array(array('title' => __('Enable PDT', APP_TD), 'desc' => sprintf(__('See our <a href="%s">tutorial</a> on enabling Payment Data Transfer.', APP_TD), 'http://docs.appthemes.com/tutorials/enable-paypal-pdt-payment-data-transfer/'), 'type' => 'checkbox', 'name' => 'pdt_enabled'), array('title' => __('Identity Token', APP_TD), 'type' => 'text', 'name' => 'pdt_key'))); return array($general, $pdt); } private function can_be_handled() { return wp_verify_nonce($_GET['_wpnonce'], 'paypal'); } private function complete_order($order) { $order->complete(); $listing_item = $order->get_item(); $url = get_permalink($listing_item['post']->ID); $this->js_redirect($url, __('You are now being redirected to your listing.', APP_TD)); } private function fail_order($message) { appthemes_display_notice('error', $message); } private function js_redirect($url, $text) { $attributes = array('class' => 'redirect-text'); echo html('span', $attributes, $text); echo html('script', array(), 'location.href="' . $url . '"'); } } appthemes_register_gateway('APP_PayPal');
return $return_array; } /** * Processes a Bank Transfer Order to display * instructions to the user * @param APP_Order $order Order to display information for * @param array $options User entered options * @return void */ public function process($order, $options) { $sent = get_post_meta($order->get_ID(), 'bt-sentemail', true); if (empty($sent)) { appthemes_bank_transfer_pending_email(get_post($order->get_ID())); update_post_meta($order->get_ID(), 'bt-sentemail', true); } $templates = appthemes_payments_get_args('templates'); $template_name = $templates['bank-transfer']; $located = appthemes_locate_template($template_name); if ($located) { // load theme template $order = appthemes_get_order($order->get_ID()); appthemes_load_template($template_name, array('order' => $order)); } else { // load bundled template require_once dirname(__FILE__) . '/template/' . $template_name; } } } appthemes_register_gateway('APP_Bank_Transfer_Gateway');
/** * Registers PayPal Adaptive gateway. * * @return void */ function _appthemes_init_paypal_adaptive() { if (appthemes_is_escrow_enabled()) { appthemes_register_gateway('APP_PayPal_Adaptive'); } }