Changeset 3279051
- Timestamp:
- 04/22/2025 12:36:01 PM (11 months ago)
- Location:
- cardgate
- Files:
-
- 12 edited
- 1 copied
-
tags/3.2.4 (copied) (copied from cardgate/trunk)
-
tags/3.2.4/cardgate.php (modified) (3 diffs)
-
tags/3.2.4/classes/CGP_Common_Gateway.php (modified) (4 diffs)
-
tags/3.2.4/classes/WC_CardgateIdeal.php (modified) (1 diff)
-
tags/3.2.4/classes/woocommerce-blocks/ideal/IdealCardgate.php (modified) (2 diffs)
-
tags/3.2.4/classes/woocommerce-blocks/ideal/build/index.js (modified) (1 diff)
-
tags/3.2.4/readme.txt (modified) (1 diff)
-
trunk/cardgate.php (modified) (3 diffs)
-
trunk/classes/CGP_Common_Gateway.php (modified) (4 diffs)
-
trunk/classes/WC_CardgateIdeal.php (modified) (1 diff)
-
trunk/classes/woocommerce-blocks/ideal/IdealCardgate.php (modified) (2 diffs)
-
trunk/classes/woocommerce-blocks/ideal/build/index.js (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cardgate/tags/3.2.4/cardgate.php
r3218324 r3279051 7 7 * Author: CardGate 8 8 * Author URI: https://www.cardgate.com 9 * Version: 3.2. 39 * Version: 3.2.4 10 10 * Text Domain: cardgate 11 11 * Domain Path: /i18n/languages … … 195 195 update_option('cgp_merchant_api_key', $_POST['cgp_merchant_api_key']); 196 196 update_option('cgp_checkoutdisplay', $_POST['cgp_checkoutdisplay']); 197 update_option('cgp_checkoutidealissuers', $_POST['cgp_checkoutidealissuers']);198 199 //This wil refresh the bank issuer cache200 update_option('IssuerRefresh', 0, true);201 197 202 198 $bIsTest = ($_POST['cgp_mode'] == 1 ? TRUE : FALSE); … … 286 282 <option value="withlogo"<?php echo (get_option('cgp_checkoutdisplay') == 'withlogo' ? ('selected="selected"') : '') ?> > <?php echo __('With Logo','cardgate') ?></option> 287 283 </select> 288 </td>289 </tr>290 <tr>291 <th scope="row">292 <label for="cgp_checkoutidealissuers"><?php echo __('Show ideal issuers', 'cardgate') ?></label>293 </th>294 <td>295 <select style="width:140px;" id="cgp_checkoutidealissuers" name="cgp_checkoutidealissuers">296 <option value="0"<?php echo (get_option('cgp_checkoutidealissuers') == '0' ? ('selected="selected"') : '') ?> > <?php echo __('Without issuers','cardgate')?></option>297 <option value="1"<?php echo (get_option('cgp_checkoutidealissuers') == '1' ? ('selected="selected"') : '') ?> > <?php echo __('With issuers','cardgate') ?></option>298 </select><br>299 <?php echo __('iDEAL v2 will not show issuers any more by default (Mandatory by iDEAL).', 'cardgate') ?>300 284 </td> 301 285 </tr> -
cardgate/tags/3.2.4/classes/CGP_Common_Gateway.php
r3218324 r3279051 43 43 echo wpautop( wptexturize( $this->description ) ); 44 44 } 45 if (46 $this->has_fields47 && get_option( 'cgp_checkoutidealissuers' ) == '1'48 ) {49 $this->generate_bank_html();50 }51 45 } 52 46 … … 59 53 } 60 54 } 61 62 /**63 * Generate the bank options64 */65 public function generate_bank_html() {66 $aIssuers = $this->getBankOptions();67 $html = '<fieldset>68 <p class="form-row form-row-first ">69 <label for="cc-expire-month">' . __( 'Bank Options', 'cardgate' ) . '</label>';70 $html .= '<select name="cgp_bank_options" id="cgp_bank_options" class="woocommerce-select">';71 $html .= '<option value="0">' . __( 'Choose Bank', 'cardgate' ) . '</option>';72 foreach ( $aIssuers as $id => $name ) {73 $html .= '<option value="' . $id;74 $html .= ( ( isset( $this->bankOption ) && $id == $this->bankOption ) ? ' selected="selected" ' : '' );75 $html .= '">' . $name . '</option>';76 }77 $html .= '</select></p></fieldset>';78 echo $html;79 }80 81 // ////////////////////////////////////////////////82 83 /**84 * Fetch bank options from Card Gate85 */86 public function getBankOptions() {87 $this->checkBankOptions();88 $aIssuers = get_option( 'sIssuers' );89 return $aIssuers;90 }91 92 private function checkBankOptions() {93 if ( get_option( 'IssuerRefresh' ) ) {94 $iIssuerRefresh = (int) get_option( 'IssuerRefresh' );95 if ( $iIssuerRefresh < time() ) {96 $this->cacheBankOptions();97 }98 } else {99 $this->cacheBankOptions();100 }101 }102 103 private function cacheBankOptions() {104 $iCacheTime = 24 * 60 * 60;105 $iIssuerRefresh = time() + $iCacheTime;106 update_option( 'IssuerRefresh', $iIssuerRefresh, true );107 108 try {109 $iMerchantId = ( get_option( 'cgp_merchant_id' ) ? get_option( 'cgp_merchant_id' ) : 0 );110 $sMerchantApiKey = ( get_option( 'cgp_merchant_api_key' ) ? get_option( 'cgp_merchant_api_key' ) : 0 );111 $bIsTest = ( get_option( 'cgp_mode' ) == 1 ? true : false );112 113 $oCardGate = new cardgate\api\Client( (int) $iMerchantId, $sMerchantApiKey, $bIsTest );114 $oCardGate->setIp( $_SERVER['REMOTE_ADDR'] );115 116 $aIssuers = $oCardGate->methods()117 ->get( cardgate\api\Method::IDEAL )118 ->getIssuers();119 } catch ( cardgate\api\Exception $oException_ ) {120 $aIssuers[0] = [121 'id' => 0,122 'name' => htmlspecialchars( $oException_->getMessage() )123 ];124 }125 126 foreach ( $aIssuers as $aIssuer ) {127 $aOptions[ $aIssuer['id'] ] = $aIssuer['name'];128 }129 $bIsValid = array_key_exists('INGBNL2A', $aOptions);130 if ($bIsValid) {131 update_option( 'sIssuers', $aOptions, true );132 }133 }134 55 135 56 // ////////////////////////////////////////////// … … 231 152 // Configure payment option. 232 153 $oTransaction->setPaymentMethod( $this->payment_method ); 233 if ( $this->payment_method == 'ideal' && get_option('cgp_checkoutidealissuers') == '1') {234 $oTransaction->setIssuer( $this->bankOption );235 }236 154 237 155 method_exists( $oOrder, 'get_billing_email' ) ? $billing_email = $oOrder->get_billing_email() : $billing_email = $oOrder->billing_email; … … 816 734 */ 817 735 public function validate_fields() { 818 global $woocommerce; 819 if ( key_exists('wc-cardgateideal-new-payment-method', $_POST) && get_option('cgp_checkoutidealissuers') == '1' ) { 820 if ( empty( $_POST['cardgateideal_issuer'] ) || $_POST['cardgateideal_issuer'] == '0' ) { 821 wc_add_notice( __( ' Choose your bank first, please', 'cardgate' ), 'error' ); 822 return false; 823 } else { 824 $this->bankOption = $_POST['cardgateideal_issuer']; 825 } 826 } elseif ( key_exists('payment_method', $_POST) && $_POST['payment_method'] == 'cardgateideal' && get_option('cgp_checkoutidealissuers') == '1' ) { 827 if ( empty( $_POST['cgp_bank_options'] ) || $_POST['cgp_bank_options'] == '0' ) { 828 wc_add_notice( __( ' Choose your bank first, please', 'cardgate' ), 'error' ); 829 return false; 830 } else { 831 $this->bankOption = $_POST['cgp_bank_options']; 832 } 833 } else { 834 return true; 835 } 736 return true; 836 737 } 837 738 -
cardgate/tags/3.2.4/classes/WC_CardgateIdeal.php
r2491968 r3279051 19 19 var $company = 'CardGate'; 20 20 public $supports = ['products', 'refunds']; 21 var $has_fields = true; //extra field for bank data21 var $has_fields = false; // no more bank field 22 22 23 23 public function __construct() { -
cardgate/tags/3.2.4/classes/woocommerce-blocks/ideal/IdealCardgate.php
r3218324 r3279051 63 63 'icon' => $this->iconpath.'ideal.svg', 64 64 'show_icon' => $this->settings['show_icon'], 65 'show_issuers' => $this->settings['show_issuers'],66 65 'supports' => ['products'], 67 'issuers' => $this->settings['issuers'],68 66 'feeUrl' => $this->settings['feeUrl'], 69 67 ); … … 75 73 $settings['show_icon'] = ($use_icon == 'withlogo'); 76 74 $settings['show_issuers'] = false; 77 $aIssuers = [];78 79 if ( get_option( 'cgp_checkoutidealissuers' ) == '1' ) {80 $settings['show_issuers'] = true;81 $settings['issuers'] = get_option( 'sIssuers' );82 83 $aIssuers[] = [ 'value' => '', 'name' => __( 'Choose Bank', 'cardgate' )];84 $availableGateways = WC()->payment_gateways()->get_available_payment_gateways();85 foreach ($availableGateways as $key => $gateway) {86 if ( $key == 'cardgateideal' ) {87 $issuers = $gateway->getBankoptions();88 foreach ( $issuers as $key => $value ) {89 $aIssuers[] = [ 'value' => $key, 'name' => $value ];90 }91 }92 }93 }94 95 $settings['issuers'] = json_encode(($aIssuers));96 75 $settings['feeUrl'] = admin_url('admin-ajax.php'); 97 76 return $settings; -
cardgate/tags/3.2.4/classes/woocommerce-blocks/ideal/build/index.js
r3218324 r3279051 1 (()=>{"use strict";let e=window.wc.wcBlocksRegistry,t=window.wp.i18n,a=window.wc.wcSettings,o=window.wp.htmlEntities,c=window.React,n=window.JSON,l=(0,a.getSetting)("cardgateideal_data",{}),s=(0,t.__)("iDEAL","wc_payment_method_cardgateideal"),r=(0,o.decodeEntities)(l.title)||s,m=n.parse(l.issuers),i=e=>{let[a,n]=(0,c.useState)(""),{eventRegistration:s,emitResponse:r}=e,{onPaymentSetup:i}=s;if(c.useEffect(()=>{let t=(e,t)=>{let a="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(t+e)+"</span>";jQuery(".wc-block-components-totals-footer-item .wc-block-formatted-money-amount:first").replaceWith(a)},a=(e,t)=>{let a="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(t+e)+"</span>";jQuery("div.wp-block-woocommerce-checkout-order-summary-taxes-block.wc-block-components-totals-wrapper > div > span.wc-block-formatted-money-amount.wc-block-components-formatted-money-amount.wc-block-components-totals-item__value:first").replaceWith(a)};jQuery.ajax({url:l.feeUrl,method:"POST",data:{action:"wp_ajax_cardgate_checkout_fees",method:e.activePaymentMethod},complete:function e(t,a){},success:function e(o,c,n){let l=jQuery(".wc-block-components-totals-fees");if(o.data.amount){let s="<div class='wc-block-components-totals-item wc-block-components-totals-fees'><span class='wc-block-components-totals-item__label'>"+o.data.name+"</span><span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+o.data.currency+o.data.amount.toFixed(2).replace(".",",")+"</span><div class='wc-block-components-totals-item__description'></div></div>";l.length?(l.replaceWith(s),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)):(jQuery(".wc-block-components-totals-item:first").after(s),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency))}else null==l||l.hide(),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)},error:function e(t,a,o){console.warn(a,o)}})}),(0,c.useEffect)(()=>{let e=i(async()=>{let e=a;return l.show_issuers?e.length?{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:{cardgateideal_issuer:e}}}:{type:r.responseTypes.ERROR,message:(0,t.__)(" Choose your bank first, please","cardgate")}:()=>{e()}});return()=>{e()}},[r.responseTypes.ERROR,r.responseTypes.SUCCESS,i,a]),l.show_issuers){let d=c.createElement("div",null,(0,o.decodeEntities)(l.description||"")),p=c.createElement("select",{name:"issuers",value:a,onChange(e){n(e.target.value)}},...m.map((e,t)=>c.createElement("option",{value:e.value},e.name)));return c.createElement("div",null,p,d)}},d={name:"cardgateideal",label:c.createElement(e=>{var t=c.createElement("img",{src:l.icon,width:28,height:24,style:{display:"inline"}});return l.show_icon||(t=null),c.createElement("span",{className:"wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon"},t,(0,o.decodeEntities)(l.title)||s)},null),content:c.createElement(i,null),edit:c.createElement(i,null),icons:null,canMakePayment:e=>!0,ariaLabel:r,supports:{features:c.supports}};(0,e.registerPaymentMethod)(d)})();1 (()=>{"use strict";let t=window.wc.wcBlocksRegistry,e=window.wp.i18n,a=window.wc.wcSettings,o=window.wp.htmlEntities,c=window.React,n=(0,a.getSetting)("cardgateideal_data",{}),l=(0,e.__)("iDEAL","wc_payment_method_cardgateideal"),s=(0,o.decodeEntities)(n.title)||l,r=t=>{let[e,a]=(0,c.useState)(""),{eventRegistration:l,emitResponse:s}=t,{onPaymentSetup:r}=l;return c.useEffect(()=>{let e=(t,e)=>{var a,o,c="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(e+t)+"</span>";jQuery(".wc-block-components-totals-footer-item .wc-block-formatted-money-amount:first").replaceWith(c)},a=(t,e)=>{var a,o,c="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(e+t)+"</span>";jQuery("div.wp-block-woocommerce-checkout-order-summary-taxes-block.wc-block-components-totals-wrapper > div > span.wc-block-formatted-money-amount.wc-block-components-formatted-money-amount.wc-block-components-totals-item__value:first").replaceWith(c)};jQuery.ajax({url:n.feeUrl,method:"POST",data:{action:"wp_ajax_cardgate_checkout_fees",method:t.activePaymentMethod},complete:function t(e,a){},success:function t(o,c,n){let l=jQuery(".wc-block-components-totals-fees");if(o.data.amount){let s="<div class='wc-block-components-totals-item wc-block-components-totals-fees'><span class='wc-block-components-totals-item__label'>"+o.data.name+"</span><span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+o.data.currency+o.data.amount.toFixed(2)+"</span><div class='wc-block-components-totals-item__description'></div></div>";l.length?(l.replaceWith(s),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)):(jQuery(".wc-block-components-totals-item:first").after(s),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency))}else null==l||l.hide(),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)},error:function t(e,a,o){console.warn(a,o)}})}),c.createElement("div",null,(0,o.decodeEntities)(n.description||""))},m={name:"cardgateideal",label:c.createElement(t=>{var e=c.createElement("img",{src:n.icon,width:28,height:24,style:{display:"inline"}});return n.show_icon||(e=null),c.createElement("span",{className:"wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon"},e,(0,o.decodeEntities)(n.title)||l)},null),content:c.createElement(r,null),edit:c.createElement(r,null),icons:null,canMakePayment:t=>!0,ariaLabel:s,supports:{features:c.supports}};(0,t.registerPaymentMethod)(m)})(); -
cardgate/tags/3.2.4/readme.txt
r3269659 r3279051 5 5 Requires at least: 4.4 6 6 Tested up to: 6.8 7 Stable tag: 3.2. 37 Stable tag: 3.2.4 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
cardgate/trunk/cardgate.php
r3218324 r3279051 7 7 * Author: CardGate 8 8 * Author URI: https://www.cardgate.com 9 * Version: 3.2. 39 * Version: 3.2.4 10 10 * Text Domain: cardgate 11 11 * Domain Path: /i18n/languages … … 195 195 update_option('cgp_merchant_api_key', $_POST['cgp_merchant_api_key']); 196 196 update_option('cgp_checkoutdisplay', $_POST['cgp_checkoutdisplay']); 197 update_option('cgp_checkoutidealissuers', $_POST['cgp_checkoutidealissuers']);198 199 //This wil refresh the bank issuer cache200 update_option('IssuerRefresh', 0, true);201 197 202 198 $bIsTest = ($_POST['cgp_mode'] == 1 ? TRUE : FALSE); … … 286 282 <option value="withlogo"<?php echo (get_option('cgp_checkoutdisplay') == 'withlogo' ? ('selected="selected"') : '') ?> > <?php echo __('With Logo','cardgate') ?></option> 287 283 </select> 288 </td>289 </tr>290 <tr>291 <th scope="row">292 <label for="cgp_checkoutidealissuers"><?php echo __('Show ideal issuers', 'cardgate') ?></label>293 </th>294 <td>295 <select style="width:140px;" id="cgp_checkoutidealissuers" name="cgp_checkoutidealissuers">296 <option value="0"<?php echo (get_option('cgp_checkoutidealissuers') == '0' ? ('selected="selected"') : '') ?> > <?php echo __('Without issuers','cardgate')?></option>297 <option value="1"<?php echo (get_option('cgp_checkoutidealissuers') == '1' ? ('selected="selected"') : '') ?> > <?php echo __('With issuers','cardgate') ?></option>298 </select><br>299 <?php echo __('iDEAL v2 will not show issuers any more by default (Mandatory by iDEAL).', 'cardgate') ?>300 284 </td> 301 285 </tr> -
cardgate/trunk/classes/CGP_Common_Gateway.php
r3218324 r3279051 43 43 echo wpautop( wptexturize( $this->description ) ); 44 44 } 45 if (46 $this->has_fields47 && get_option( 'cgp_checkoutidealissuers' ) == '1'48 ) {49 $this->generate_bank_html();50 }51 45 } 52 46 … … 59 53 } 60 54 } 61 62 /**63 * Generate the bank options64 */65 public function generate_bank_html() {66 $aIssuers = $this->getBankOptions();67 $html = '<fieldset>68 <p class="form-row form-row-first ">69 <label for="cc-expire-month">' . __( 'Bank Options', 'cardgate' ) . '</label>';70 $html .= '<select name="cgp_bank_options" id="cgp_bank_options" class="woocommerce-select">';71 $html .= '<option value="0">' . __( 'Choose Bank', 'cardgate' ) . '</option>';72 foreach ( $aIssuers as $id => $name ) {73 $html .= '<option value="' . $id;74 $html .= ( ( isset( $this->bankOption ) && $id == $this->bankOption ) ? ' selected="selected" ' : '' );75 $html .= '">' . $name . '</option>';76 }77 $html .= '</select></p></fieldset>';78 echo $html;79 }80 81 // ////////////////////////////////////////////////82 83 /**84 * Fetch bank options from Card Gate85 */86 public function getBankOptions() {87 $this->checkBankOptions();88 $aIssuers = get_option( 'sIssuers' );89 return $aIssuers;90 }91 92 private function checkBankOptions() {93 if ( get_option( 'IssuerRefresh' ) ) {94 $iIssuerRefresh = (int) get_option( 'IssuerRefresh' );95 if ( $iIssuerRefresh < time() ) {96 $this->cacheBankOptions();97 }98 } else {99 $this->cacheBankOptions();100 }101 }102 103 private function cacheBankOptions() {104 $iCacheTime = 24 * 60 * 60;105 $iIssuerRefresh = time() + $iCacheTime;106 update_option( 'IssuerRefresh', $iIssuerRefresh, true );107 108 try {109 $iMerchantId = ( get_option( 'cgp_merchant_id' ) ? get_option( 'cgp_merchant_id' ) : 0 );110 $sMerchantApiKey = ( get_option( 'cgp_merchant_api_key' ) ? get_option( 'cgp_merchant_api_key' ) : 0 );111 $bIsTest = ( get_option( 'cgp_mode' ) == 1 ? true : false );112 113 $oCardGate = new cardgate\api\Client( (int) $iMerchantId, $sMerchantApiKey, $bIsTest );114 $oCardGate->setIp( $_SERVER['REMOTE_ADDR'] );115 116 $aIssuers = $oCardGate->methods()117 ->get( cardgate\api\Method::IDEAL )118 ->getIssuers();119 } catch ( cardgate\api\Exception $oException_ ) {120 $aIssuers[0] = [121 'id' => 0,122 'name' => htmlspecialchars( $oException_->getMessage() )123 ];124 }125 126 foreach ( $aIssuers as $aIssuer ) {127 $aOptions[ $aIssuer['id'] ] = $aIssuer['name'];128 }129 $bIsValid = array_key_exists('INGBNL2A', $aOptions);130 if ($bIsValid) {131 update_option( 'sIssuers', $aOptions, true );132 }133 }134 55 135 56 // ////////////////////////////////////////////// … … 231 152 // Configure payment option. 232 153 $oTransaction->setPaymentMethod( $this->payment_method ); 233 if ( $this->payment_method == 'ideal' && get_option('cgp_checkoutidealissuers') == '1') {234 $oTransaction->setIssuer( $this->bankOption );235 }236 154 237 155 method_exists( $oOrder, 'get_billing_email' ) ? $billing_email = $oOrder->get_billing_email() : $billing_email = $oOrder->billing_email; … … 816 734 */ 817 735 public function validate_fields() { 818 global $woocommerce; 819 if ( key_exists('wc-cardgateideal-new-payment-method', $_POST) && get_option('cgp_checkoutidealissuers') == '1' ) { 820 if ( empty( $_POST['cardgateideal_issuer'] ) || $_POST['cardgateideal_issuer'] == '0' ) { 821 wc_add_notice( __( ' Choose your bank first, please', 'cardgate' ), 'error' ); 822 return false; 823 } else { 824 $this->bankOption = $_POST['cardgateideal_issuer']; 825 } 826 } elseif ( key_exists('payment_method', $_POST) && $_POST['payment_method'] == 'cardgateideal' && get_option('cgp_checkoutidealissuers') == '1' ) { 827 if ( empty( $_POST['cgp_bank_options'] ) || $_POST['cgp_bank_options'] == '0' ) { 828 wc_add_notice( __( ' Choose your bank first, please', 'cardgate' ), 'error' ); 829 return false; 830 } else { 831 $this->bankOption = $_POST['cgp_bank_options']; 832 } 833 } else { 834 return true; 835 } 736 return true; 836 737 } 837 738 -
cardgate/trunk/classes/WC_CardgateIdeal.php
r2491968 r3279051 19 19 var $company = 'CardGate'; 20 20 public $supports = ['products', 'refunds']; 21 var $has_fields = true; //extra field for bank data21 var $has_fields = false; // no more bank field 22 22 23 23 public function __construct() { -
cardgate/trunk/classes/woocommerce-blocks/ideal/IdealCardgate.php
r3218324 r3279051 63 63 'icon' => $this->iconpath.'ideal.svg', 64 64 'show_icon' => $this->settings['show_icon'], 65 'show_issuers' => $this->settings['show_issuers'],66 65 'supports' => ['products'], 67 'issuers' => $this->settings['issuers'],68 66 'feeUrl' => $this->settings['feeUrl'], 69 67 ); … … 75 73 $settings['show_icon'] = ($use_icon == 'withlogo'); 76 74 $settings['show_issuers'] = false; 77 $aIssuers = [];78 79 if ( get_option( 'cgp_checkoutidealissuers' ) == '1' ) {80 $settings['show_issuers'] = true;81 $settings['issuers'] = get_option( 'sIssuers' );82 83 $aIssuers[] = [ 'value' => '', 'name' => __( 'Choose Bank', 'cardgate' )];84 $availableGateways = WC()->payment_gateways()->get_available_payment_gateways();85 foreach ($availableGateways as $key => $gateway) {86 if ( $key == 'cardgateideal' ) {87 $issuers = $gateway->getBankoptions();88 foreach ( $issuers as $key => $value ) {89 $aIssuers[] = [ 'value' => $key, 'name' => $value ];90 }91 }92 }93 }94 95 $settings['issuers'] = json_encode(($aIssuers));96 75 $settings['feeUrl'] = admin_url('admin-ajax.php'); 97 76 return $settings; -
cardgate/trunk/classes/woocommerce-blocks/ideal/build/index.js
r3218324 r3279051 1 (()=>{"use strict";let e=window.wc.wcBlocksRegistry,t=window.wp.i18n,a=window.wc.wcSettings,o=window.wp.htmlEntities,c=window.React,n=window.JSON,l=(0,a.getSetting)("cardgateideal_data",{}),s=(0,t.__)("iDEAL","wc_payment_method_cardgateideal"),r=(0,o.decodeEntities)(l.title)||s,m=n.parse(l.issuers),i=e=>{let[a,n]=(0,c.useState)(""),{eventRegistration:s,emitResponse:r}=e,{onPaymentSetup:i}=s;if(c.useEffect(()=>{let t=(e,t)=>{let a="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(t+e)+"</span>";jQuery(".wc-block-components-totals-footer-item .wc-block-formatted-money-amount:first").replaceWith(a)},a=(e,t)=>{let a="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(t+e)+"</span>";jQuery("div.wp-block-woocommerce-checkout-order-summary-taxes-block.wc-block-components-totals-wrapper > div > span.wc-block-formatted-money-amount.wc-block-components-formatted-money-amount.wc-block-components-totals-item__value:first").replaceWith(a)};jQuery.ajax({url:l.feeUrl,method:"POST",data:{action:"wp_ajax_cardgate_checkout_fees",method:e.activePaymentMethod},complete:function e(t,a){},success:function e(o,c,n){let l=jQuery(".wc-block-components-totals-fees");if(o.data.amount){let s="<div class='wc-block-components-totals-item wc-block-components-totals-fees'><span class='wc-block-components-totals-item__label'>"+o.data.name+"</span><span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+o.data.currency+o.data.amount.toFixed(2).replace(".",",")+"</span><div class='wc-block-components-totals-item__description'></div></div>";l.length?(l.replaceWith(s),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)):(jQuery(".wc-block-components-totals-item:first").after(s),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency))}else null==l||l.hide(),t(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)},error:function e(t,a,o){console.warn(a,o)}})}),(0,c.useEffect)(()=>{let e=i(async()=>{let e=a;return l.show_issuers?e.length?{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:{cardgateideal_issuer:e}}}:{type:r.responseTypes.ERROR,message:(0,t.__)(" Choose your bank first, please","cardgate")}:()=>{e()}});return()=>{e()}},[r.responseTypes.ERROR,r.responseTypes.SUCCESS,i,a]),l.show_issuers){let d=c.createElement("div",null,(0,o.decodeEntities)(l.description||"")),p=c.createElement("select",{name:"issuers",value:a,onChange(e){n(e.target.value)}},...m.map((e,t)=>c.createElement("option",{value:e.value},e.name)));return c.createElement("div",null,p,d)}},d={name:"cardgateideal",label:c.createElement(e=>{var t=c.createElement("img",{src:l.icon,width:28,height:24,style:{display:"inline"}});return l.show_icon||(t=null),c.createElement("span",{className:"wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon"},t,(0,o.decodeEntities)(l.title)||s)},null),content:c.createElement(i,null),edit:c.createElement(i,null),icons:null,canMakePayment:e=>!0,ariaLabel:r,supports:{features:c.supports}};(0,e.registerPaymentMethod)(d)})();1 (()=>{"use strict";let t=window.wc.wcBlocksRegistry,e=window.wp.i18n,a=window.wc.wcSettings,o=window.wp.htmlEntities,c=window.React,n=(0,a.getSetting)("cardgateideal_data",{}),l=(0,e.__)("iDEAL","wc_payment_method_cardgateideal"),s=(0,o.decodeEntities)(n.title)||l,r=t=>{let[e,a]=(0,c.useState)(""),{eventRegistration:l,emitResponse:s}=t,{onPaymentSetup:r}=l;return c.useEffect(()=>{let e=(t,e)=>{var a,o,c="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(e+t)+"</span>";jQuery(".wc-block-components-totals-footer-item .wc-block-formatted-money-amount:first").replaceWith(c)},a=(t,e)=>{var a,o,c="<span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+(e+t)+"</span>";jQuery("div.wp-block-woocommerce-checkout-order-summary-taxes-block.wc-block-components-totals-wrapper > div > span.wc-block-formatted-money-amount.wc-block-components-formatted-money-amount.wc-block-components-totals-item__value:first").replaceWith(c)};jQuery.ajax({url:n.feeUrl,method:"POST",data:{action:"wp_ajax_cardgate_checkout_fees",method:t.activePaymentMethod},complete:function t(e,a){},success:function t(o,c,n){let l=jQuery(".wc-block-components-totals-fees");if(o.data.amount){let s="<div class='wc-block-components-totals-item wc-block-components-totals-fees'><span class='wc-block-components-totals-item__label'>"+o.data.name+"</span><span class='wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value'>"+o.data.currency+o.data.amount.toFixed(2)+"</span><div class='wc-block-components-totals-item__description'></div></div>";l.length?(l.replaceWith(s),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)):(jQuery(".wc-block-components-totals-item:first").after(s),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency))}else null==l||l.hide(),e(o.data.newTotal.toFixed(2).replace(".",","),o.data.currency),a(o.data.totalTax.toFixed(2).replace(".",","),o.data.currency)},error:function t(e,a,o){console.warn(a,o)}})}),c.createElement("div",null,(0,o.decodeEntities)(n.description||""))},m={name:"cardgateideal",label:c.createElement(t=>{var e=c.createElement("img",{src:n.icon,width:28,height:24,style:{display:"inline"}});return n.show_icon||(e=null),c.createElement("span",{className:"wc-block-components-payment-method-label wc-block-components-payment-method-label--with-icon"},e,(0,o.decodeEntities)(n.title)||l)},null),content:c.createElement(r,null),edit:c.createElement(r,null),icons:null,canMakePayment:t=>!0,ariaLabel:s,supports:{features:c.supports}};(0,t.registerPaymentMethod)(m)})(); -
cardgate/trunk/readme.txt
r3269659 r3279051 5 5 Requires at least: 4.4 6 6 Tested up to: 6.8 7 Stable tag: 3.2. 37 Stable tag: 3.2.4 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset
for help on using the changeset viewer.