示例#1
0
 /**
  * Verify that an order is retrieved correctly
  */
 public function test_order_retrieval()
 {
     $order = appthemes_new_order();
     $this->assertNotEmpty($order);
     $retrieved_order = appthemes_get_order($order->get_id());
     $this->assertEquals($order, $retrieved_order);
 }
示例#2
0
 public function getOrder($blank = false)
 {
     $order = appthemes_new_order();
     if ($blank) {
         return $order;
     }
     $order->add_item('paypal-test-item', 5, $order->get_id());
     $order->set_gateway('paypal');
     return $order;
 }
示例#3
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);
 }
        _e('Membership Updated', APP_TD);
    }
    ?>
                </h2>
            
                <img src="<?php 
    echo appthemes_locate_template_uri('images/step3.gif');
    ?>
" alt="" class="stepimg" />
            
                <div class="thankyou">
            
                    <?php 
    // call in the selected payment gateway as long as the price isn't zero
    if (cp_payments_is_enabled() && $order['total_cost'] > 0) {
        $membership_order = appthemes_new_order();
        $membership_order->add_item(CP_ITEM_MEMBERSHIP, $order['total_cost']);
        do_action('appthemes_create_order', $membership_order);
        echo html('h3', __('Payment', APP_TD));
        echo html('p', __('Please wait while we redirect you to our payment page.', APP_TD));
        echo html('p', html('small', __('(Click the button below if you are not automatically redirected within 5 seconds.)', APP_TD)));
        cp_js_redirect($membership_order->get_return_url(), __('Continue to Payment', APP_TD));
        //process the "free" orders on this page
    } else {
        $order_processed = appthemes_process_membership_order($current_user, $order);
        //send email to user
        if ($order_processed) {
            cp_owner_activated_membership_email($current_user, $order_processed);
        }
        ?>
            
示例#5
0
 function test_remove_item_by_id_reflects()
 {
     $new_order = appthemes_new_order();
     $this->order->add_item('payment-test', 5);
     $this->order->add_item('payment-test', 4);
     $this->order->add_item('payment-test1', 3, $new_order->get_id());
     $this->order->add_item('payment-test2', 2, $new_order->get_id());
     $this->order->add_item('payment-test3', 1, $new_order->get_id());
     $this->order->remove_item('', '', $new_order->get_id());
     $this->assertCount(2, $this->order->get_items());
 }
示例#6
0
	

	<div class="processlog">
		<?php 
    // insert the ad and get back the post id
    $renew_id = isset($_GET['renew']) ? $_GET['renew'] : false;
    //var_dump($advals);
    $post_id = cp_add_new_listing($advals, $renew_id);
    ?>
	</div>
	<div class="thankyou">

		<?php 
    // call in the selected payment gateway as long as the price isn't zero
    if (cp_payments_is_enabled() && $advals['cp_sys_total_ad_cost'] > 0) {
        $order = appthemes_new_order();
        $order->add_item(CP_ITEM_LISTING, $advals['cp_sys_total_ad_cost'], $post_id);
        do_action('appthemes_create_order', $order);
        echo html('h3', __('Payment', APP_TD));
        echo html('p', __('Please wait while we redirect you to our payment page.', APP_TD));
        echo html('p', html('small', __('(Click the button below if you are not automatically redirected within 5 seconds.)', APP_TD)));
        cp_js_redirect($order->get_return_url(), __('Continue to Payment', APP_TD));
    } else {
        // otherwise the ad was free and show the thank you page.
        // get the post status
        $the_post = get_post($post_id);
        // check to see what the ad status is set to
        if ($the_post->post_status == 'pending') {
            // send ad owner an email
            cp_owner_new_ad_email($post_id);
            echo html('h3', __('Thank you! Your ad listing has been submitted for review.', APP_TD));
 public function setUp()
 {
     parent::setUp();
     self::$order = appthemes_new_order();
 }