예제 #1
0
 public function get_description()
 {
     if (Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Extension::is_membership2()) {
         return $this->subscription->name;
     }
     return $this->subscription->sub_name();
 }
예제 #2
0
    /**
     * Render buy subscription plan box.
     *
     * @since 3.5
     *
     * @access private
     * @global array $M_options The settings array.
     * @param Membership_Model_Subscription $subscription
     */
    private function _render_buy_subscription(Membership_Model_Subscription $subscription)
    {
        global $M_options;
        $pricing = $subscription->get_pricingarray();
        ?>
<div class="pricebox subscriptionbox" id="subscriptionbox-<?php 
        echo $subscription->id;
        ?>
">
			<div class="topbar">
				<span class="title"><?php 
        echo $subscription->sub_name();
        ?>
</span>
			</div>

			<div class="pricedetails">
				<?php 
        echo $subscription->sub_description();
        ?>
			</div>

			<div class="bottombar">
				<?php 
        if (!empty($pricing)) {
            ?>
					<div class="link" style="float:right;margin-right:10px">
						<?php 
            $class = '';
            if (isset($M_options['formtype']) && $M_options['formtype'] == 'new') {
                // pop up form
                $link = add_query_arg(array('action' => 'buynow', 'subscription' => $subscription->id), admin_url('admin-ajax.php'));
                $class = 'popover';
            } else {
                // original form
                $link = add_query_arg(array('action' => 'registeruser', 'subscription' => $subscription->id), get_permalink($M_options['registration_page']));
            }
            ?>
<a href="<?php 
            echo esc_url($link);
            ?>
" class="button button-primary <?php 
            echo $class;
            ?>
 <?php 
            echo esc_attr(apply_filters('membership_subscription_button_color', ''));
            ?>
">
						<?php 
            echo esc_html(apply_filters('membership_subscription_signup_text', __('Sign Up', 'membership')));
            ?>
						</a>
					</div>
				<?php 
        }
        ?>
				<span class="price"><?php 
        echo $subscription->sub_pricetext();
        ?>
</span>
			</div>
		</div><?php 
    }
예제 #3
0
 public function get_description()
 {
     return $this->subscription->sub_name();
 }
예제 #4
0
 /**
  * Processes transactions.
  *
  * @since  3.5
  *
  * @access protected
  * @global array $M_options The array of plugin options.
  */
 protected function _commit_transactions()
 {
     global $M_options;
     $sub_id = $this->_subscription->sub_id();
     $notes = $this->_get_option('mode', self::MODE_SANDBOX) != self::MODE_LIVE ? 'Sandbox' : '';
     // process each transaction information and save it to CIM
     foreach ($this->_transactions as $index => $info) {
         if (is_null($info)) {
             continue;
         }
         // :: NOTE :: This code added only for developers who know what they are doing. You probably should not mess with this!
         // Remove (VOID) auth only transactions for serial purchases
         //if( isset( $info['void'] ) && true == $info['void'] ) {
         //
         //	if ( 'aim' == $info['method'] ) {
         //		$this->_get_aim( true, false )->void( $info['transaction'] );
         //	} elseif ( 'cim' == $info['method'] ) {
         //		$this->_get_cim()->createCustomerProfileTransaction( 'Void', $info['transaction'] );
         //	}
         //
         //	$this->_record_transaction(
         //		$this->_member->ID,
         //		$sub_id,
         //		$info['amount'],
         //		$M_options['paymentcurrency'],
         //		$info['date'],
         //		$info['transaction'],
         //		self::TRANSACTION_TYPE_VOIDED,
         //		__('Authorize only transaction removed.', 'membership' )
         //	);
         //}
         $status = 0;
         if ($info['method'] == 'aim') {
             $status = self::TRANSACTION_TYPE_AUTHORIZED;
             // capture first transaction
             if ($index == 0) {
                 $this->_get_aim(true, false)->priorAuthCapture($info['transaction']);
                 $status = self::TRANSACTION_TYPE_CAPTURED;
             }
         } elseif ($info['method'] == 'cim') {
             $status = self::TRANSACTION_TYPE_CIM_AUTHORIZED;
             // capture first transaction
             if ($index == 0) {
                 $transaction = $this->_get_cim_transaction();
                 $transaction->transId = $info['transaction'];
                 $transaction->amount = $info['amount'];
                 $lineItem = new AuthorizeNetLineItem();
                 $lineItem->itemId = $this->_subscription->sub_id();
                 $lineItem->name = $this->_subscription->sub_name();
                 $lineItem->description = $this->_subscription->sub_description();
                 $lineItem->quantity = 1;
                 $lineItem->unitPrice = $info['amount'];
                 $transaction->lineItems = array($lineItem);
                 $this->_get_cim()->createCustomerProfileTransaction('PriorAuthCapture', $transaction);
                 $status = self::TRANSACTION_TYPE_CAPTURED;
             }
         } elseif ($info['method'] == 'arb') {
             $status = self::TRANSACTION_TYPE_RECURRING;
         }
         if ($status) {
             // save transaction information in the database
             $this->_record_transaction($this->_member->ID, $sub_id, $info['amount'], $M_options['paymentcurrency'], $info['date'], $info['transaction'], $status, $notes);
         }
     }
 }