Пример #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();
         }
     }
 }
        }
        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]);
        }
    }
}
Membership_Gateway::register_gateway('authorizenetarb', 'M_authorizenetarb');
                					$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');
}
Пример #4
0
<?php

/*
Addon Name: Authorize.net gateway
Description: The Authorize.net payment gateway
Author: Incsub
Author URI: http://premium.wpmudev.org
Gateway ID: authorize
*/
Membership_Gateway::register_gateway('authorize', 'Membership_Gateway_Authorize');
                    membership_debug_log(sprintf(__('Recurring payment has been suspended - for %d', 'membership'), $user_id));
                    break;
                case 'recurring_payment_suspended_due_to_max_failed_payment':
                case 'recurring_payment_failed':
                    list($timestamp, $user_id, $sub_id, $key) = explode(':', $_POST['custom']);
                    $member = $factory->get_member($user_id);
                    $member->drop_subscription($sub_id);
                    membership_debug_log(sprintf(__('Recurring payment failed - the number of attempts to collect payment has exceeded the value specified for "max failed payments" - for %d', 'membership'), $user_id));
                    break;
                case 'new_case':
                    // a dispute
                    if ($_POST['case_type'] == 'dispute') {
                        // immediately suspend the account
                        $member = $factory->get_member($user_id);
                        $member->deactivate();
                        membership_debug_log(sprintf(__('Dispute for %d', 'membership'), $user_id));
                    }
                    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.';
            membership_debug_log('Error: Missing POST variables. Identification is not possible.');
            exit;
        }
    }
}
Membership_Gateway::register_gateway('paypalexpress', 'paypalexpress');
Пример #6
0
                    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 = $factory->get_member($user_id);
                        if ($member) {
                            $member->deactivate();
                            membership_debug_log(sprintf(__('Dispute for %d', 'membership'), $user_id));
                        }
                    }
                    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.';
            membership_debug_log('Error: Missing POST variables. Identification is not possible.');
            exit;
        }
    }
}
Membership_Gateway::register_gateway('paypalsolo', 'paypalsolo');
Пример #7
0
                        default:
                            $member = Membership_Plugin::factory()->get_member($user_id);
                            if ($member) {
                                $member->mark_for_expire($sub_id);
                                membership_debug_log(sprintf(__('Recurring failed for user %d on subscription %d.', 'membership'), $user_id, $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.';
                    membership_debug_log('Error: Unexpected Security Value. Verification is not possible.');
                    exit;
                }
                echo "OK";
                membership_debug_log('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.';
                membership_debug_log('Error: Missing POST variables. Identification is not possible.');
                exit;
            }
        }
    }
}
Membership_Gateway::register_gateway('twocheckout', 'twocheckout');
        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 button-primary " . esc_attr(apply_filters('membership_subscription_button_color', '')) . "' />";
            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
    }
}
Membership_Gateway::register_gateway('freesubscriptions', 'freesubscriptions');