Changeset 2655871
- Timestamp:
- 01/11/2022 02:14:58 PM (4 years ago)
- Location:
- flywire-payment-gateway/trunk
- Files:
-
- 4 edited
-
CHANGELOG (modified) (1 diff)
-
flywire-payment-gateway.php (modified) (5 diffs)
-
includes/flywire-payment-gateway-request.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flywire-payment-gateway/trunk/CHANGELOG
r2618228 r2655871 2 2 All notable changes to this project will be documented in this file. 3 3 4 5 ## [1.0.4] - 2022-01-11 6 7 ### Added 8 - subunit config setting which will determine the amount sent to Flywire 4 9 5 10 ## [1.0.3] - 2021-10-21 -
flywire-payment-gateway/trunk/flywire-payment-gateway.php
r2618228 r2655871 6 6 * Author: Flywire 7 7 * Author URI: http://www.flywire.com/ 8 * Version: 1.0. 38 * Version: 1.0.4 9 9 * Text Domain: flywire-payment-gateway 10 10 * Domain Path: /i18n/languages/ … … 113 113 */ 114 114 public $portal; 115 116 /** 117 * Number of sub-units in the currency, e.g. 100 cents in 1 dollar 118 * 119 * @var string 120 */ 121 public $number_of_subunits_in_currency; 115 122 116 123 /** … … 181 188 182 189 // Define user set variables 183 $this->title = $this->get_option( 'title' ); 184 $this->description = $this->get_option( 'description' ); 185 $this->enabled = $this->get_option( 'enabled' ); 186 $this->testmode = 'yes' === $this->get_option( 'testmode' ); 187 $this->complete_order = 'yes' === $this->get_option( 'complete_order' ); 188 $this->on_guaranteed = 'yes' === $this->get_option( 'complete_on_guaranteed' ); 189 $this->portal = $this->testmode ? $this->get_option( 'demo_portal' ) : $this->get_option( 'prod_portal' ); 190 $this->instructions = $this->get_option( 'instructions' ); 191 $this->field_mapping = $this->get_option( 'field_mapping' ); 192 $this->api_url = WC()->api_request_url( 'WC_Gateway_Flywire' ); 193 $this->order_notes = 'yes' === $this->get_option( 'enable_notes' ); 194 self::$log_enabled = 'yes' === $this->get_option( 'enable_log' ); 190 $this->title = $this->get_option( 'title' ); 191 $this->description = $this->get_option( 'description' ); 192 $this->enabled = $this->get_option( 'enabled' ); 193 $this->testmode = 'yes' === $this->get_option( 'testmode' ); 194 $this->number_of_subunits_in_currency = $this->get_option( 'number_of_subunits_in_currency' ); 195 $this->complete_order = 'yes' === $this->get_option( 'complete_order' ); 196 $this->on_guaranteed = 'yes' === $this->get_option( 'complete_on_guaranteed' ); 197 $this->portal = $this->testmode ? $this->get_option( 'demo_portal' ) : $this->get_option( 'prod_portal' ); 198 $this->instructions = $this->get_option( 'instructions' ); 199 $this->field_mapping = $this->get_option( 'field_mapping' ); 200 $this->api_url = WC()->api_request_url( 'WC_Gateway_Flywire' ); 201 $this->order_notes = 'yes' === $this->get_option( 'enable_notes' ); 202 self::$log_enabled = 'yes' === $this->get_option( 'enable_log' ); 195 203 196 204 // Actions … … 282 290 '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}", 283 291 'desc_tip' => true, 292 ), 293 294 'number_of_subunits_in_currency' => array( 295 'title' => __( 'Number of Sub-units In Currency', 'flywire-payment-gateway' ), 296 'type' => 'text', 297 'default' => '100', 298 'description' => __( 'There 100 subunits in most currenies e.g. USD/GBP/EUR and 1 subunit in JPY.', 'flywire-payment-gateway' ) 284 299 ), 285 300 … … 443 458 444 459 /** 460 * Validate the number_of_subunits_in_currency. Enforce that it is a number 461 * 462 * @param string $key The new setting key 463 * @param string $value The new setting value 464 * @param array $fields All form fields 465 * 466 * @return string 467 */ 468 protected function validate_number_of_subunits_in_currency( string $key, string $value, array $fields ): string { 469 if ( false === is_numeric( $value ) ) { 470 throw new Exception( '<strong>' . $fields[ $key ]['title'] . '</strong> is not numeric. Expected values are 1, 10, 100 or 1000. Please check with your Solutions Consultant if you are unsure of the value to use.' ); 471 } 472 473 return $value; 474 } 475 476 /** 445 477 * Logging method. 446 478 * -
flywire-payment-gateway/trunk/includes/flywire-payment-gateway-request.php
r2618228 r2655871 40 40 41 41 /** 42 * Number of sub-units in the currency. e.g. 100 cents in 1 dollar 43 * 44 * @var bool 45 */ 46 public $number_of_subunits_in_currency; 47 48 /** 42 49 * Webhook URL 43 50 * … … 61 68 */ 62 69 public function __construct( WC_Gateway_Flywire $gateway, string $order_id ) { 63 $this->order = wc_get_order( $order_id ); 64 $this->mapping = json_decode( $gateway->field_mapping ); 65 $this->portal = apply_filters( 'flywpg_portal_code', $gateway->portal, $this->order, $gateway->testmode ); 66 $this->testmode = $gateway->testmode; 67 $this->api_url = $gateway->api_url; 68 $this->return_url = $gateway->get_return_url( $this->order ); 70 $this->order = wc_get_order( $order_id ); 71 $this->mapping = json_decode( $gateway->field_mapping ); 72 $this->portal = apply_filters( 'flywpg_portal_code', $gateway->portal, $this->order, $gateway->testmode ); 73 $this->number_of_subunits_in_currency = intval($gateway->number_of_subunits_in_currency, 10); 74 $this->testmode = $gateway->testmode; 75 $this->api_url = $gateway->api_url; 76 $this->return_url = $gateway->get_return_url( $this->order ); 69 77 } 70 78 … … 82 90 $settings['locale'] = substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ); 83 91 $settings['recipient'] = $this->portal; 84 $settings['amount'] = intval( $this->order->get_total() * 100);92 $settings['amount'] = intval( $this->order->get_total() * $this->number_of_subunits_in_currency ); 85 93 $settings['return_url'] = $this->return_url; 86 94 $settings['callback_id'] = $this->order->get_id(); -
flywire-payment-gateway/trunk/readme.txt
r2618228 r2655871 3 3 Tags: woocommerce, credit card, bank transfer, pay, payment gateway 4 4 Requires at least: 5.7 5 Tested up to: 5.8 6 Stable tag: 1.0. 35 Tested up to: 5.8.3 6 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 28 28 == Changelog == 29 29 30 = 1.0.4 = 31 * Added subunit config setting which will determine the amount sent to Flywire 32 30 33 = 1.0.3 = 31 34 * Removed custom Flywire thank you page, moved to WooCommerce standard order complete page
Note: See TracChangeset
for help on using the changeset viewer.