コード例 #1
0
 /**
  * Update entry property
  *
  * @param int    $entry_id Entry ID
  * @param string $property Name of the property to update
  * @param string $value    Value for the property
  */
 public static function update_entry_property($entry_id, $property, $value)
 {
     if (Pronamic_WP_Pay_Class::method_exists('GFAPI', 'update_entry_property')) {
         GFAPI::update_entry_property($entry_id, $property, $value);
     } elseif (Pronamic_WP_Pay_Class::method_exists('GFFormsModel', 'update_lead_property')) {
         GFFormsModel::update_lead_property($entry_id, $property, $value);
     }
 }
コード例 #2
0
 /**
  * Construct and intialize custom Gravity Forms fields.
  */
 public function __construct()
 {
     // Enable credit card field
     add_filter('gform_enable_credit_card_field', '__return_true');
     // Register custom fields
     if (Pronamic_WP_Pay_Class::method_exists('GF_Fields', 'register')) {
         GF_Fields::register(new Pronamic_WP_Pay_Extensions_GravityForms_PaymentMethodsField());
         GF_Fields::register(new Pronamic_WP_Pay_Extensions_GravityForms_IssuersField());
     }
     // Add extra fields settings
     add_action('gform_field_standard_settings', array($this, 'field_standard_settings'), 10, 2);
 }
コード例 #3
0
 /**
  * Charitable payments gateways.
  *
  * @see https://github.com/Charitable/Charitable/blob/1.1.4/includes/gateways/class-charitable-gateways.php#L44-L51
  * @param array $gateways
  * @retrun array
  */
 public function charitable_payment_gateways($gateways)
 {
     $classes = array('Pronamic_WP_Pay_Extensions_Charitable_Gateway', 'Pronamic_WP_Pay_Extensions_Charitable_BankTransferGateway', 'Pronamic_WP_Pay_Extensions_Charitable_CreditCardGateway', 'Pronamic_WP_Pay_Extensions_Charitable_DirectDebitGateway', 'Pronamic_WP_Pay_Extensions_Charitable_IDealGateway', 'Pronamic_WP_Pay_Extensions_Charitable_MisterCashGateway', 'Pronamic_WP_Pay_Extensions_Charitable_SofortGateway');
     foreach ($classes as $class) {
         $id = call_user_func(array($class, 'get_gateway_id'));
         $gateways[$id] = $class;
         // @see https://github.com/Charitable/Charitable/blob/1.1.4/includes/donations/class-charitable-donation-processor.php#L165-L174
         add_action('charitable_process_donation_' . $id, array($class, 'process_donation'), 10, 2);
         if (Pronamic_WP_Pay_Class::method_exists($class, 'form_gateway_fields') && Pronamic_WP_Pay_Class::method_exists($class, 'form_field_template')) {
             add_filter('charitable_donation_form_gateway_fields', array($class, 'form_gateway_fields'), 10, 2);
             add_filter('charitable_form_field_template', array($class, 'form_field_template'), 10, 4);
         }
     }
     return $gateways;
 }
コード例 #4
0
 /**
  * Update entry
  *
  * @param array $entry
  */
 public static function update_entry($entry)
 {
     /*
      * GFFormsModel::update_lead() is no longer in use since version 1.8.8! Instead use GFAPI::update_entry().
      *
      * @see https://github.com/gravityforms/gravityforms/blob/1.8.13/forms_model.php#L587-L624
      * @see https://github.com/gravityforms/gravityforms/blob/1.8.13/includes/api.php#L495-L654
      * @see https://github.com/gravityforms/gravityforms/blob/1.8.7.11/forms_model.php#L587-L621
      */
     if (Pronamic_WP_Pay_Class::method_exists('GFAPI', 'update_entry')) {
         GFAPI::update_entry($entry);
     } elseif (Pronamic_WP_Pay_Class::method_exists('GFFormsModel', 'update_lead')) {
         GFFormsModel::update_lead($entry);
     }
 }
コード例 #5
0
ファイル: Extension.php プロジェクト: daanbakker1995/vanteun
 /**
  * Fulfill order
  *
  * @param array $entry
  */
 public function fulfill_order($entry)
 {
     $feed = get_pronamic_gf_pay_feed_by_entry_id(rgar($entry, 'id'));
     if (null !== $feed) {
         $this->maybe_update_user_role($entry, $feed);
         $form = RGFormsModel::get_form_meta($entry['form_id']);
         // Delay post creation
         // @see https://github.com/gravityforms/gravityforms/blob/1.8.20.5/forms_model.php#L2383
         // @see https://github.com/gravityforms/gravityformspaypal/blob/1.10.3/paypal.php#L2411-L2415
         if ($feed->delay_post_creation) {
             RGFormsModel::create_post($form, $entry);
         }
         // Delay Aweber
         // @see https://github.com/gravityforms/gravityformsaweber/blob/1.4.2/aweber.php#L1167-L1197
         if ($feed->delay_aweber_subscription && Pronamic_WP_Pay_Class::method_exists('GFAWeber', 'export')) {
             call_user_func(array('GFAWeber', 'export'), $entry, $form, false);
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformsaweber/blob/2.2.1/aweber.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_aweber')) {
                 $addon = gf_aweber();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Campaign Monitor
         if ($feed->delay_campaignmonitor_subscription) {
             // @see https://github.com/gravityforms/gravityformscampaignmonitor/blob/2.5.1/campaignmonitor.php#L1184
             if (Pronamic_WP_Pay_Class::method_exists('GFCampaignMonitor', 'export')) {
                 call_user_func(array('GFCampaignMonitor', 'export'), $entry, $form, false);
             }
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformscampaignmonitor/blob/3.3.2/campaignmonitor.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_campaignmonitor')) {
                 $addon = gf_campaignmonitor();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Mailchimp
         if ($feed->delay_mailchimp_subscription) {
             // @see https://github.com/gravityforms/gravityformsmailchimp/blob/2.4.5/mailchimp.php#L1512
             if (Pronamic_WP_Pay_Class::method_exists('GFMailChimp', 'export')) {
                 call_user_func(array('GFMailChimp', 'export'), $entry, $form, false);
             }
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformsmailchimp/blob/3.6.3/mailchimp.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_mailchimp')) {
                 $addon = gf_mailchimp();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Zapier
         // @see https://github.com/gravityforms/gravityformszapier/blob/1.4.2/zapier.php#L469-L533
         if ($feed->delay_zapier && Pronamic_WP_Pay_Class::method_exists('GFZapier', 'send_form_data_to_zapier')) {
             call_user_func(array('GFZapier', 'send_form_data_to_zapier'), $entry, $form);
         }
         // Delay user registration
         // @see https://github.com/gravityforms/gravityformsuserregistration/blob/2.0/userregistration.php#L2133
         if ($feed->delay_user_registration && Pronamic_WP_Pay_Class::method_exists('GFUser', 'gf_create_user')) {
             call_user_func(array('GFUser', 'gf_create_user'), $entry, $form, false);
         }
         // Delay notifications
         // Determine if the feed has Gravity Form 1.7 Feed IDs
         if ($feed->has_delayed_notifications()) {
             // @see https://bitbucket.org/Pronamic/gravityforms/src/42773f75ad7ad9ac9c31ce149510ff825e4aa01f/common.php?at=1.7.8#cl-1512
             GFCommon::send_notifications($feed->delay_notification_ids, $form, $entry, true, 'form_submission');
         }
         if ($feed->delay_admin_notification && Pronamic_WP_Pay_Class::method_exists('GFCommon', 'send_admin_notification')) {
             // https://github.com/gravityforms/gravityforms/blob/1.8.9/common.php#L1265-L1270
             GFCommon::send_admin_notification($form, $entry);
         }
         if ($feed->delay_user_notification && Pronamic_WP_Pay_Class::method_exists('GFCommon', 'send_user_notification')) {
             // https://github.com/gravityforms/gravityforms/blob/1.8.9/common.php#L1258-L1263
             GFCommon::send_user_notification($form, $entry);
         }
     }
     // The Gravity Forms PayPal Add-On executes the 'gform_paypal_fulfillment' action
     do_action('gform_ideal_fulfillment', $entry, $feed);
 }
コード例 #6
0
 /**
  * Update lead status of the specified payment
  *
  * @param Pronamic_Pay_Payment $payment
  */
 public static function status_update(Pronamic_Pay_Payment $payment)
 {
     $invoice_id = get_post_meta($payment->get_id(), '_pronamic_payment_membership_invoice_id', true);
     $user_id = get_post_meta($payment->get_id(), '_pronamic_payment_membership_user_id', true);
     $sub_id = get_post_meta($payment->get_id(), '_pronamic_payment_membership_subscription_id', true);
     $amount = $payment->get_amount();
     $currency = $payment->get_currency();
     $status = $payment->get_status();
     $note = '';
     if (Pronamic_WP_Pay_Class::method_exists('MS_Factory', 'load') && class_exists('MS_Model_Invoice')) {
         $invoice = MS_Factory::load('MS_Model_Invoice', $invoice_id);
         $gateway_id = $invoice->gateway_id;
     } else {
         // Versions prior to Membership 2 only supported the iDEAL gateway.
         $gateway_id = 'pronamic_ideal';
     }
     if (isset(self::$gateways[$gateway_id])) {
         $gateway_class = self::$gateways[$gateway_id];
         if (class_exists($gateway_class)) {
             $gateway = new $gateway_class();
         }
         // Membership record transaction
         // @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/classes/class.gateway.php#L176
         $gateway->pronamic_record_transaction($user_id, $sub_id, $amount, $currency, time(), $payment->get_id(), $status, $note);
     }
     switch ($payment->get_status()) {
         case Pronamic_WP_Pay_Statuses::OPEN:
             // @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/gateways/gateway.paypalexpress.php#L871
             do_action('membership_payment_pending', $user_id, $sub_id, $amount, $currency, $payment->get_id());
             break;
         case Pronamic_WP_Pay_Statuses::SUCCESS:
             // @see https://github.com/wp-plugins/membership/blob/4.0.0.2/app/class-ms-factory.php#L116-L184
             // @see https://github.com/wp-plugins/membership/blob/4.0.0.2/app/model/class-ms-model-invoice.php
             if (isset($gateway, $invoice) && !$invoice->is_paid()) {
                 $invoice->pay_it($gateway->gateway, $payment->get_id());
             }
             if (class_exists('M_Membership')) {
                 $member = new M_Membership($user_id);
                 if ($member) {
                     $member->create_subscription($sub_id, $gateway->gateway);
                 }
             }
             // Added for affiliate system link
             // @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/gateways/gateway.paypalexpress.php#L790
             do_action('membership_payment_processed', $user_id, $sub_id, $amount, $currency, $payment->get_id());
             // @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/gateways/gateway.paypalexpress.php#L901
             do_action('membership_payment_subscr_signup', $user_id, $sub_id);
             break;
     }
 }