Changeset 2722478
- Timestamp:
- 05/12/2022 08:10:43 AM (4 years ago)
- Location:
- valuepay-for-fluent-forms/trunk
- Files:
-
- 5 edited
-
includes/class-valuepay-fluentform-init.php (modified) (2 diffs)
-
includes/class-valuepay-fluentform-processor.php (modified) (3 diffs)
-
includes/functions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
valuepay-fluentform.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
valuepay-for-fluent-forms/trunk/includes/class-valuepay-fluentform-init.php
r2714608 r2722478 8 8 9 9 add_action( 'fluentform_loaded', array( $this, 'load_dependencies' ) ); 10 11 // Smartcodes 12 add_filter( 'fluentform_form_settings_smartcodes', array( $this, 'register_smartcodes' ) ); 13 add_filter( 'fluentform_shortcode_parser_callback_valuepay.payment_id', array( $this, 'smartcode_parse_payment_id' ), 10, 2 ); 14 add_filter( 'fluentform_shortcode_parser_callback_valuepay.payment_url', array( $this, 'smartcode_parse_payment_url' ), 10, 2 ); 10 15 11 16 } … … 26 31 } 27 32 33 // Register smartcodes (shortcodes) 34 public function register_smartcodes( $groups ) { 35 36 $groups[] = array( 37 'title' => __( 'ValuePay Payment Details', 'valuepay-fluentform' ), 38 'shortcodes' => array( 39 '{valuepay.payment_id}' => __( 'ValuePay Payment ID', 'valuepay-fluentform' ), 40 '{valuepay.payment_url}' => __( 'ValuePay Payment URL', 'valuepay-fluentform' ), 41 ), 42 ); 43 44 return $groups; 45 46 } 47 48 // Parse smartcode for ValuePay payment ID 49 public function smartcode_parse_payment_id( $return, $instance ) { 50 51 $form = $instance::getForm(); 52 $entry = $instance::getEntry(); 53 $fields = \FluentForm\App\Modules\Form\FormFieldsParser::getEntryInputs( $form ); 54 $submission = \FluentForm\App\Modules\Form\FormDataParser::parseFormSubmission( $entry, $form, $fields, true ); 55 56 $return = \FluentForm\App\Helpers\Helper::getSubmissionMeta( $submission->id, '_valuepay_payment_id' ); 57 58 return $return; 59 60 } 61 62 // Parse smartcode for ValuePay payment URL 63 public function smartcode_parse_payment_url( $return, $instance ) { 64 65 $form = $instance::getForm(); 66 $entry = $instance::getEntry(); 67 $fields = \FluentForm\App\Modules\Form\FormFieldsParser::getEntryInputs( $form ); 68 $submission = \FluentForm\App\Modules\Form\FormDataParser::parseFormSubmission( $entry, $form, $fields, true ); 69 70 $payment_id = $this->smartcode_parse_payment_id( $return, $instance ); 71 $payment_type = valuepay_fluentform_get_form_submission_value( $form, $submission, 'payment_type' ); 72 73 if ( $payment_type === 'recurring' ) { 74 $return = 'https://valuepay.my/m/' . $payment_id; 75 } else { 76 $return = 'https://valuepay.my/b/' . $payment_id; 77 } 78 79 return $return; 80 81 } 82 28 83 } 29 84 new Valuepay_Fluentform_Init(); -
valuepay-for-fluent-forms/trunk/includes/class-valuepay-fluentform-processor.php
r2714608 r2722478 183 183 } 184 184 185 $paymentType = $this->getSubmissionValueByAdminLabel( $form, $submission, 'payment_type' );185 $paymentType = valuepay_fluentform_get_form_submission_value( $form, $submission, 'payment_type' ); 186 186 187 187 if ( $paymentType === 'recurring' ) { … … 236 236 } 237 237 238 // Get single submission value by admin label239 private function getSubmissionValueByAdminLabel( $form, $submission, $field ) {240 241 $labels = FormFieldsParser::getAdminLabels( $form );242 $fieldId = array_search( $field, $labels );243 244 return isset( $submission->response[ $fieldId ] ) ? $submission->response[ $fieldId ] : false;245 246 }247 248 238 // Create an enrolment in ValuePay (for recurring payment) 249 239 private function getEnrolmentUrl( $transaction, $submission, $form ) { … … 266 256 267 257 // Identity information and bank code 268 $identityType = $this->getSubmissionValueByAdminLabel( $form, $submission, 'identity_type' );269 $identityValue = $this->getSubmissionValueByAdminLabel( $form, $submission, 'identity_value' );270 $bank = $this->getSubmissionValueByAdminLabel( $form, $submission, 'bank' );258 $identityType = valuepay_fluentform_get_form_submission_value( $form, $submission, 'identity_type' ); 259 $identityValue = valuepay_fluentform_get_form_submission_value( $form, $submission, 'identity_value' ); 260 $bank = valuepay_fluentform_get_form_submission_value( $form, $submission, 'bank' ); 271 261 272 262 if ( !$identityType || !$identityValue ) { -
valuepay-for-fluent-forms/trunk/includes/functions.php
r2714608 r2722478 68 68 69 69 } 70 71 // Get single submission value by admin label from the form 72 function valuepay_fluentform_get_form_submission_value( $form, $submission, $field ) { 73 74 $labels = \FluentForm\App\Modules\Form\FormFieldsParser::getAdminLabels( $form ); 75 $field_id = array_search( $field, $labels ); 76 77 return isset( $submission->response[ $field_id ] ) ? $submission->response[ $field_id ] : false; 78 79 } -
valuepay-for-fluent-forms/trunk/readme.txt
r2714608 r2722478 1 1 === ValuePay for Fluent Forms === 2 Contributors: valuepaymy3 Tags: valuepay, fluent forms, payment2 Contributors: valuepaymy 3 Tags: valuepay, fluent forms, payment 4 4 Requires at least: 4.6 5 Tested up to: 5.9.36 Stable tag: 1.0.27 Requires PHP: 7.08 License: GPLv2 or later9 License URI: https://www.gnu.org/licenses/gpl-2.0.html5 Tested up to: 6.0 6 Stable tag: 1.0.3 7 Requires PHP: 7.0 8 License: GPLv2 or later 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 11 Accept payment on Fluent Forms using ValuePay. … … 40 40 == Changelog == 41 41 42 = 1.0.3 - 2022-04-30 = 43 - Added: ValuePay payment ID and payment shortcodes in Fluent Forms 44 42 45 = 1.0.2 - 2022-04-17 = 43 46 - Modified: Improve instant payment notification response data sanitization -
valuepay-for-fluent-forms/trunk/valuepay-fluentform.php
r2714608 r2722478 3 3 * Plugin Name: ValuePay for Fluent Forms 4 4 * Description: Accept payment on Fluent Forms using ValuePay. 5 * Version: 1.0. 25 * Version: 1.0.3 6 6 * Requires at least: 4.6 7 7 * Requires PHP: 7.0 … … 20 20 define( 'VALUEPAY_FLUENTFORM_PATH', plugin_dir_path( VALUEPAY_FLUENTFORM_FILE ) ); 21 21 define( 'VALUEPAY_FLUENTFORM_BASENAME', plugin_basename( VALUEPAY_FLUENTFORM_FILE ) ); 22 define( 'VALUEPAY_FLUENTFORM_VERSION', '1.0. 2' );22 define( 'VALUEPAY_FLUENTFORM_VERSION', '1.0.3' ); 23 23 24 24 // Plugin core class
Note: See TracChangeset
for help on using the changeset viewer.