Changeset 2592996
- Timestamp:
- 09/03/2021 01:19:16 AM (5 years ago)
- Location:
- flywire-payment-gateway/trunk
- Files:
-
- 5 edited
-
CHANGELOG (modified) (1 diff)
-
README.md (modified) (1 diff)
-
flywire-payment-gateway.php (modified) (5 diffs)
-
includes/flywire-payment-gateway-request.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flywire-payment-gateway/trunk/CHANGELOG
r2584468 r2592996 2 2 All notable changes to this project will be documented in this file. 3 3 4 5 ## [1.0.2] - 2021-09-03 6 7 ### Added 8 - support for custom checkout fields saved in the Order metadata 4 9 5 10 ## [1.0.1] - 2021-08-17 -
flywire-payment-gateway/trunk/README.md
r2571153 r2592996 1 # Woocommerce1 # Flywire for WooCommerce 2 2 3 Custompayment gateway for WooCommerce3 Flywire payment gateway for WooCommerce -
flywire-payment-gateway/trunk/flywire-payment-gateway.php
r2584468 r2592996 1 1 <?php 2 2 /** 3 * Plugin Name: Flywire Payment Gateway3 * Plugin Name: Flywire for WooCommerce 4 4 * Plugin URI: http://www.flywire.com/ 5 5 * Description: Enable Flywire payments option for WooCommerce 6 6 * Author: Flywire 7 7 * Author URI: http://www.flywire.com/ 8 * Version: 1.0. 18 * Version: 1.0.2 9 9 * Text Domain: flywire-payment-gateway 10 10 * Domain Path: /i18n/languages/ … … 146 146 147 147 /** 148 * Flywire Payment Gateway148 * Flywire for WooCommerce 149 149 * 150 150 * Provides a Flywire Payment Gateway … … 281 281 282 282 if ( ! $this->is_valid_for_use() ) { 283 WC_Gateway_Flywire::log( 'Flywire Payment Gatewayis not valid for use' );283 WC_Gateway_Flywire::log( 'Flywire for WooCommerce is not valid for use' ); 284 284 $this->enabled = 'no'; 285 285 } else { … … 356 356 'type' => 'textarea', 357 357 'description' => __( 'JSON configuration to define how WooCommerce fields will map to Flywire fields. Should be supplied by your Flywire Relationship Manager or Solutions Consultant.', 'flywire-payment-gateway' ), 358 'default' => '', 359 'desc_tip' => true, 360 ), 361 362 'testmode' => array( 363 'title' => __( 'Test Mode', 'flywire-payment-gateway' ), 364 'type' => 'checkbox', 365 'label' => __( 'Use Demo environment', 'flywire-payment-gateway' ), 366 'default' => 'yes', 358 'default' => "{\r\n\t\"sender_country\":\"{{billing_country}}\",\r\n\t\"sender_first_name\":\"{{billing_first_name}}\",\r\n\t\"sender_last_name\":\"{{billing_last_name}}\",\r\n\t\"sender_address1\":\"{{billing_address_1}}\",\r\n\t\"sender_phone\":\"{{billing_phone}}\",\r\n\t\"sender_city\":\"{{billing_city}}\",\r\n\t\"sender_zip\":\"{{billing_postcode}}\",\r\n\t\"sender_email\":\"{{billing_email}}\",\r\n\t\"student_first_name\":\"{{billing_first_name}}\",\r\n\t\"student_last_name\":\"{{billing_last_name}}\",\r\n\t\"student_email\":\"{{billing_email}}\"\r\n}", 359 'desc_tip' => true, 367 360 ), 368 361 … … 405 398 'type' => 'title', 406 399 'description' => __( 'Please contact your Relationship Manager if you need help determining these values.', 'flywire-payment-gateway' ), 400 ), 401 402 'testmode' => array( 403 'title' => __( 'Test Mode', 'flywire-payment-gateway' ), 404 'type' => 'checkbox', 405 'label' => __( 'Use Demo environment', 'flywire-payment-gateway' ), 406 'default' => 'yes', 407 407 ), 408 408 -
flywire-payment-gateway/trunk/includes/flywire-payment-gateway-request.php
r2584468 r2592996 156 156 /** 157 157 * Replaces tokens - e.g. {{name}} - in a template string with values from a given object 158 * Use {{custom.name}} for custom fields 158 159 * 159 160 * @param string $template template string … … 163 164 */ 164 165 protected static function expand_template( string $template, $obj ): string { 165 $re = '/{{( [a-z0-9_]+)}}/';166 $re = '/{{(custom\.)?([a-z0-9_.]+)}}/'; 166 167 preg_match_all( $re, $template, $matches, PREG_SET_ORDER ); 167 168 168 169 while ( count( $matches ) ) { 169 if ( ! method_exists( $obj, 'get_' . $matches[0][1] ) ) { 170 wc_add_notice( __( 'Field mapping failed: Method get_' . $matches[0][1] . '() not found.' ) ); 170 if ( 'custom.' == $matches[0][1] ) { // custom field in metadata 171 $key = substr( $matches[0][2], 0, 1 ) === "_" ? $matches[0][2] : '_' . $matches[0][2]; 172 $value = $obj->get_meta( $key ); 173 if ('' == $value) 174 $value = $obj->get_meta( ltrim($key, '_') ); // try without underscore 175 } else { // native WC Order field 176 if ( ! method_exists( $obj, 'get_' . $matches[0][2] ) ) { 177 wc_add_notice( __( 'Field mapping failed: Method get_' . $matches[0][2] . '() not found.' ) ); 178 } 179 $value = call_user_func( array( $obj, 'get_' . $matches[0][2] ) ); 171 180 } 172 $value = call_user_func( array( $obj, 'get_' . $matches[0][1] ) );173 181 $template = str_replace( $matches[0][0], $value, $template ); 174 182 -
flywire-payment-gateway/trunk/readme.txt
r2584468 r2592996 1 === Flywire Payment Gateway===1 === Flywire for WooCommerce === 2 2 Contributors: taiflywire 3 3 Tags: credit card, bank transfer, pay 4 4 Requires at least: 5.7 5 Tested up to: 5. 7.46 Stable tag: 1.0. 15 Tested up to: 5.8 6 Stable tag: 1.0.2 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 28 28 == Changelog == 29 29 30 = 1.0.2 = 31 * Added support for custom checkout fields saved in the Order metadata 32 30 33 = 1.0.1 = 31 34 * Updated filter 'flywpg_portal_code' to add test mode parameter … … 36 39 == Disclaimer == 37 40 38 By incorporating Flywire Payment Gatewayscripts and related materials contained in the plugin file (collectively, the "Plugin") onto your website, you acknowledge and agree to the following:41 By incorporating Flywire for WooCommerce scripts and related materials contained in the plugin file (collectively, the "Plugin") onto your website, you acknowledge and agree to the following: 39 42 40 43 The Plugin is only available for use by customers using Flywire's services, which use is subject to Flywire's onboarding process and your contractual agreement with Flywire.
Note: See TracChangeset
for help on using the changeset viewer.