Ejemplo n.º 1
0
 /**
  * Plugins loaded
  */
 public static function plugins_loaded()
 {
     if (Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Membership::is_active()) {
         // Backwards compatibility Membership <= 3.4
         $class_aliases = array('M_Gateway' => 'Membership_Gateway', 'M_Subscription' => 'Membership_Model_Subscription', 'M_Membership' => 'Membership_Model_Member');
         foreach ($class_aliases as $orignal => $alias) {
             if (class_exists($orignal) && !class_exists($alias)) {
                 // http://www.php.net/manual/en/function.class-alias.php
                 class_alias($orignal, $alias);
             }
         }
         // Register the Membership iDEAL gateway
         // Membership < 3.5
         if (function_exists('M_register_gateway')) {
             M_register_gateway('pronamic_ideal', 'Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_IDealGateway');
         }
         // Membership >= 3.5
         if (method_exists('Membership_Gateway', 'register_gateway')) {
             Membership_Gateway::register_gateway('pronamic_ideal', 'Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_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);
         if (is_admin()) {
             $admin = new Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Admin();
         }
     }
 }
        echo "</form>";
    }
    function display_upgrade_from_free_button($subscription, $pricing, $user_id, $fromsub_id = false)
    {
        if ($pricing[0]['amount'] < 1) {
            // a free first level
            $this->display_upgrade_button($subscription, $pricing, $user_id, $fromsub_id);
        } else {
            //do_action('membership_purchase_button', $subscription, $pricing, $user_id);
            echo "<form class=''>";
            echo "<input type='submit' value=' " . __('Upgrades not available', 'membership') . " ' disabled='disabled' class='button blue' />";
            echo "</form>";
        }
    }
    function update()
    {
        if (isset($_POST['payment_button'])) {
            update_option($this->gateway . "_payment_button", $_POST['payment_button']);
            update_option($this->gateway . "_completed_message", $_POST['completed_message']);
        }
        // default action is to return true
        return true;
    }
    // IPN stuff
    function handle_paypal_return()
    {
        // PayPal IPN handling code
    }
}
M_register_gateway('freesubscriptions', 'freesubscriptions');
                case 'subscr_cancel':
                    // mark for removal
                    list($timestamp, $user_id, $sub_id, $key) = explode(':', $_POST['custom']);
                    $member = new M_Membership($user_id);
                    if ($member) {
                        $member->mark_for_expire($sub_id);
                    }
                    do_action('membership_payment_subscr_cancel', $user_id, $sub_id);
                    break;
                case 'new_case':
                    // a dispute
                    if ($_POST['case_type'] == 'dispute') {
                        // immediately suspend the account
                        $member = new M_Membership($user_id);
                        if ($member) {
                            $member->deactivate();
                        }
                    }
                    do_action('membership_payment_new_case', $user_id, $sub_id, $_POST['case_type']);
                    break;
            }
        } else {
            // Did not find expected POST variables. Possible access attempt from a non PayPal site.
            header('Status: 404 Not Found');
            echo 'Error: Missing POST variables. Identification is not possible.';
            exit;
        }
    }
}
M_register_gateway('paypalexpress', 'paypalexpress');
Ejemplo n.º 4
0
                            break;
                        case 'RECURRING_STOPPED':
                        case 'RECURRING_COMPLETE':
                        case 'RECURRING_INSTALLMENT_FAILED':
                        default:
                            $member = new M_Membership($user_id);
                            if ($member) {
                                $member->mark_for_expire($sub_id);
                            }
                            do_action('membership_payment_subscr_cancel', $user_id, $sub_id);
                            break;
                    }
                } else {
                    // MD5 Hash Failed
                    header('Status: 403 Forbidden');
                    echo 'Error: Unexpected Security Value. Verification is not possible.';
                    exit;
                }
                echo "OK";
                exit;
            } else {
                // Did not find expected POST variables. Possible access attempt from a non PayPal site.
                header('Status: 400 Bad Request');
                echo 'Error: Missing POST variables. Identification is not possible.';
                exit;
            }
        }
    }
}
M_register_gateway('twocheckout', 'twocheckout');
Ejemplo n.º 5
0
                    $this->record_transaction($user_id, $sub_id, $amount, $currency, $timestamp, $_POST['txn_id'], $_POST['payment_status'], $note);
                    do_action('membership_payment_pending', $user_id, $sub_id, $amount, $currency, $_POST['txn_id']);
                    break;
                default:
                    // case: various error cases
            }
            //check for subscription details
            switch ($_POST['txn_type']) {
                case 'new_case':
                    // a dispute
                    if ($_POST['case_type'] == 'dispute') {
                        list($timestamp, $user_id, $sub_id, $key, $sublevel) = explode(':', $_POST['custom']);
                        // immediately suspend the account
                        $member = new M_Membership($user_id);
                        if ($member) {
                            $member->deactivate();
                        }
                    }
                    do_action('membership_payment_new_case', $user_id, $sub_id, $_POST['case_type']);
                    break;
            }
        } else {
            // Did not find expected POST variables. Possible access attempt from a non PayPal site.
            header('Status: 404 Not Found');
            echo 'Error: Missing POST variables. Identification is not possible.';
            exit;
        }
    }
}
M_register_gateway('paypalsolo', 'paypalsolo');
                					$timestamp = $response['currentTime'];
                
                					// Update to work with latest 3.5.x Membership version
                					// and keep backward compatibility with older versions as well
                					if (!class_exists('Membership_Gateway'))
                						$this->record_transaction($user_id, $sub_id, $amount, $currency, $timestamp, $response['id'], $response['status'], $note);
                					else
                						$this->_record_transaction($user_id, $sub_id, $amount, $currency, $timestamp, $response['id'], $response['status'], $note);
                
                					do_action('membership_payment_pending', $user_id, $sub_id, $amount, $currency, $response['id']);
                					break;
                				*/
                default:
                    // case: various error cases
                    break;
            }
        } else {
            // Did not find expected POST variables. Possible access attempt from a non BitPay site.
            header('Status: 404 Not Found');
            echo 'Error: Missing POST variables. Identification is not possible.';
            exit;
        }
    }
}
// Update to work with latest 3.5.x Membership version
// and keep backward compatibility with older versions as well
if (!class_exists('Membership_Gateway')) {
    M_register_gateway('bitpay', 'bitpay');
} else {
    Membership_Gateway::register_gateway('bitpay', 'bitpay');
}
Ejemplo n.º 7
0
        }
        function isDeclined()
        {
            return $this->declined;
        }
        function isError()
        {
            return $this->error;
        }
        function getResponseText()
        {
            return $this->results[3];
            $strip = array($this->params['x_delim_char'], $this->params['x_encap_char'], '|', ',');
            return str_replace($strip, '', $this->results[3]);
        }
        function getAuthCode()
        {
            return str_replace($this->params['x_encap_char'], '', $this->results[4]);
        }
        function getAVSResponse()
        {
            return str_replace($this->params['x_encap_char'], '', $this->results[5]);
        }
        function getTransactionID()
        {
            return str_replace($this->params['x_encap_char'], '', $this->results[6]);
        }
    }
}
M_register_gateway('authorizenetaim', 'M_authorizenetaim');