Plugin Directory

Changeset 3373384


Ignore:
Timestamp:
10/06/2025 05:44:12 AM (6 months ago)
Author:
idokd
Message:

Update to version 2.4.7 from GitHub

Location:
simple-payment
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-payment/tags/2.4.7/addons/woocommerce/init.php

    r3332473 r3373384  
    692692            try {
    693693                //get_checkout_order_received_url, get_cancel_order_url_raw
    694 
     694                $settings = $this->get_option( 'settings' ) ? json_decode( $this->get_option( 'settings' ), true, 512, JSON_OBJECT_AS_ARRAY ) : [];
     695                if ( $settings ) $params = array_merge( $settings, $params );
     696               
    695697                $params[ 'redirect_url' ] = WC()->api_request_url( "{$this}" );
    696698
  • simple-payment/tags/2.4.7/admin/transaction-list-table.php

    r3338694 r3373384  
    6060              echo '<select id="engine" class="sp-filter-engine" name="engine"><option value="">' . __( 'All Engines', 'simple-payment' ) . '</option>';
    6161              foreach ($options as $option) {
    62                   if ( $option[ 'title' ] ) echo '<option value="' . esc_attr( $option[ 'title' ] ) . '"' . ( $engine == $option[ 'title' ] ? ' selected' : '' ) . '>' . esc_html( $option[ 'title' ] ) . '</option>';
     62                  if ( $option[ 'title' ] )
     63                    echo '<option value="' . esc_attr( $option[ 'title' ] ) . '"' . ( $engine == $option[ 'title' ] ? ' selected' : '' ) . '>' 
     64                    . esc_html( $option[ 'title' ] ) . '</option>';
    6365              }
    6466              echo "</select>";
    6567          }
    66           echo '<label for="from-date">Date Range:</label><input type="date" name="created_from" id="from-date" value="' . ( isset( $_REQUEST[ 'created_from' ] ) ? $_REQUEST[ 'created_from' ] : '' ) . '" /><input type="date" name="created_to" id="to-date" value="' . ( isset( $_REQUEST[ 'created_to' ] ) ? $_REQUEST[ 'created_to' ] : '' ) . '" />';
     68          echo '<label for="from-date">Date Range:</label><input type="date" name="created_from" id="from-date" value="' . ( isset( $_REQUEST[ 'created_from' ] ) ? sanitize_text_field( $_REQUEST[ 'created_from' ] ) : '' ) . '" /><input type="date" name="created_to" id="to-date" value="' . ( isset( $_REQUEST[ 'created_to' ] ) ? sanitize_text_field( $_REQUEST[ 'created_to' ] ) : '' ) . '" />';
    6769          echo '<input type="submit" name="filter_action" id="transaction-query-submit" class="button" value="' . __( 'Filter', 'simple-payment' ) . '">';
    6870          echo '</div>';
  • simple-payment/tags/2.4.7/curl.log

    r3332473 r3373384  
    657657<
    658658* Connection #0 to host licensing.yalla-ya.com left intact
     659* Host licensing.yalla-ya.com:443 was resolved.
     660* IPv6: 2607:f8b0:4012:808::2013
     661* IPv4: 172.217.3.147
     662*   Trying [2607:f8b0:4012:808::2013]:443...
     663* ALPN: curl offers h2,http/1.1
     664*  CAfile: /usr/local/etc/openssl@3/cert.pem
     665*  CApath: none
     666* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / RSASSA-PSS
     667* ALPN: server accepted h2
     668* Server certificate:
     669*  subject: CN=licensing.yalla-ya.com
     670*  start date: Aug  9 05:17:41 2025 GMT
     671*  expire date: Nov  7 06:04:50 2025 GMT
     672*  subjectAltName: host "licensing.yalla-ya.com" matched cert's "licensing.yalla-ya.com"
     673*  issuer: C=US; O=Google Trust Services; CN=WR3
     674*  SSL certificate verify ok.
     675*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     676*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     677*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
     678* Connected to licensing.yalla-ya.com (2607:f8b0:4012:808::2013) port 443
     679* using HTTP/2
     680* [HTTP/2] [1] OPENED stream for https://licensing.yalla-ya.com/validate
     681* [HTTP/2] [1] [:method: POST]
     682* [HTTP/2] [1] [:scheme: https]
     683* [HTTP/2] [1] [:authority: licensing.yalla-ya.com]
     684* [HTTP/2] [1] [:path: /validate]
     685* [HTTP/2] [1] [accept: */*]
     686* [HTTP/2] [1] [content-length: 5]
     687* [HTTP/2] [1] [content-type: application/x-www-form-urlencoded]
     688> POST /validate HTTP/2
     689Host: licensing.yalla-ya.com
     690Accept: */*
     691Content-Length: 5
     692Content-Type: application/x-www-form-urlencoded
     693
     694* upload completely sent off: 5 bytes
     695< HTTP/2 200
     696< x-powered-by: Express
     697< content-type: application/json; charset=utf-8
     698< etag: W/"b5-ksg7nPT+IdK8wH8TvJQvncgMyDw"
     699< vary: Accept-Encoding
     700< x-cloud-trace-context: dee11b461b9238b47bc2823bbeea064b;o=1
     701< date: Thu, 02 Oct 2025 01:12:13 GMT
     702< server: Google Frontend
     703< content-length: 181
     704<
     705* Connection #0 to host licensing.yalla-ya.com left intact
     706* Host licensing.yalla-ya.com:443 was resolved.
     707* IPv6: 2607:f8b0:4012:808::2013
     708* IPv4: 172.217.3.147
     709*   Trying [2607:f8b0:4012:808::2013]:443...
     710* ALPN: curl offers h2,http/1.1
     711*  CAfile: /usr/local/etc/openssl@3/cert.pem
     712*  CApath: none
     713* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / RSASSA-PSS
     714* ALPN: server accepted h2
     715* Server certificate:
     716*  subject: CN=licensing.yalla-ya.com
     717*  start date: Aug  9 05:17:41 2025 GMT
     718*  expire date: Nov  7 06:04:50 2025 GMT
     719*  subjectAltName: host "licensing.yalla-ya.com" matched cert's "licensing.yalla-ya.com"
     720*  issuer: C=US; O=Google Trust Services; CN=WR3
     721*  SSL certificate verify ok.
     722*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     723*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     724*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
     725* Connected to licensing.yalla-ya.com (2607:f8b0:4012:808::2013) port 443
     726* using HTTP/2
     727* [HTTP/2] [1] OPENED stream for https://licensing.yalla-ya.com/validate
     728* [HTTP/2] [1] [:method: POST]
     729* [HTTP/2] [1] [:scheme: https]
     730* [HTTP/2] [1] [:authority: licensing.yalla-ya.com]
     731* [HTTP/2] [1] [:path: /validate]
     732* [HTTP/2] [1] [accept: */*]
     733* [HTTP/2] [1] [content-length: 5]
     734* [HTTP/2] [1] [content-type: application/x-www-form-urlencoded]
     735> POST /validate HTTP/2
     736Host: licensing.yalla-ya.com
     737Accept: */*
     738Content-Length: 5
     739Content-Type: application/x-www-form-urlencoded
     740
     741* upload completely sent off: 5 bytes
     742< HTTP/2 200
     743< x-powered-by: Express
     744< content-type: application/json; charset=utf-8
     745< etag: W/"b5-KIAY0Qta3YH+dNXP3Fnhv/lO+Zw"
     746< vary: Accept-Encoding
     747< x-cloud-trace-context: 8fafc6f3dee85d9ba599f71d1deb6c75;o=1
     748< date: Thu, 02 Oct 2025 14:22:04 GMT
     749< server: Google Frontend
     750< content-length: 181
     751<
     752* Connection #0 to host licensing.yalla-ya.com left intact
  • simple-payment/tags/2.4.7/languages/simple-payment.pot

    r3338694 r3373384  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Simple Payment 2.4.5\n"
     5"Project-Id-Version: Simple Payment 2.4.6\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/simple-payment\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-08-04T04:57:57+00:00\n"
     12"POT-Creation-Date: 2025-10-06T05:41:34+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.10.0\n"
     
    8686
    8787#: addons/elementor/widget.php:103
    88 #: admin/transaction-list-table.php:236
     88#: admin/transaction-list-table.php:238
    8989msgid "Amount"
    9090msgstr ""
     
    202202#: addons/wpjobboard/config.php:12
    203203#: admin/settings.php:111
    204 #: admin/transaction-list-table.php:237
     204#: admin/transaction-list-table.php:239
    205205#: settings.php:110
    206206msgid "Engine"
     
    581581msgstr ""
    582582
    583 #: addons/woocommerce/init.php:734
     583#: addons/woocommerce/init.php:736
    584584msgid "Payment error [ SP ID: %s ]: %s"
    585585msgstr ""
    586586
    587 #: addons/woocommerce/init.php:761
     587#: addons/woocommerce/init.php:763
    588588msgid "Payment error[ SP ID: %s ]: unkown."
    589589msgstr ""
    590590
    591 #: addons/woocommerce/init.php:813
     591#: addons/woocommerce/init.php:815
    592592msgid "Pay for order"
    593593msgstr ""
    594594
    595 #: addons/woocommerce/init.php:837
     595#: addons/woocommerce/init.php:839
    596596msgid "Visa"
    597597msgstr ""
    598598
    599 #: addons/woocommerce/init.php:838
     599#: addons/woocommerce/init.php:840
    600600msgid "Mastercard"
    601601msgstr ""
    602602
    603 #: addons/woocommerce/init.php:839
     603#: addons/woocommerce/init.php:841
    604604msgid "American Express"
    605605msgstr ""
     
    717717#: admin/admin.php:190
    718718#: admin/admin.php:191
    719 #: admin/transaction-list-table.php:239
     719#: admin/transaction-list-table.php:241
    720720msgid "Payments"
    721721msgstr ""
     
    11571157
    11581158#: admin/settings.php:117
    1159 #: admin/transaction-list-table.php:249
     1159#: admin/transaction-list-table.php:251
    11601160#: settings.php:116
    11611161msgid "Sandbox"
     
    13341334
    13351335#: admin/settings.php:168
    1336 #: admin/transaction-list-table.php:155
    1337 #: admin/transaction-list-table.php:176
     1336#: admin/transaction-list-table.php:157
     1337#: admin/transaction-list-table.php:178
    13381338#: settings.php:167
    13391339msgid "Archive"
     
    18711871
    18721872#: admin/transaction-list-table.php:36
    1873 #: admin/transaction-list-table.php:251
     1873#: admin/transaction-list-table.php:253
    18741874msgid "Created"
    18751875msgstr ""
     
    18831883msgstr ""
    18841884
    1885 #: admin/transaction-list-table.php:67
     1885#: admin/transaction-list-table.php:69
    18861886msgid "Filter"
    18871887msgstr ""
    18881888
    1889 #: admin/transaction-list-table.php:132
     1889#: admin/transaction-list-table.php:134
    18901890msgid "No transactions avaliable."
    18911891msgstr ""
    18921892
    1893 #: admin/transaction-list-table.php:145
    1894 #: admin/transaction-list-table.php:171
     1893#: admin/transaction-list-table.php:147
     1894#: admin/transaction-list-table.php:173
    18951895msgid "Unarchive"
    18961896msgstr ""
    18971897
    1898 #: admin/transaction-list-table.php:160
    1899 #: admin/transaction-list-table.php:175
     1898#: admin/transaction-list-table.php:162
     1899#: admin/transaction-list-table.php:177
    19001900msgid "Verify"
    19011901msgstr ""
    19021902
    1903 #: admin/transaction-list-table.php:163
     1903#: admin/transaction-list-table.php:165
    19041904msgid "Details"
    19051905msgstr ""
    19061906
    1907 #: admin/transaction-list-table.php:234
     1907#: admin/transaction-list-table.php:236
    19081908msgid "ID"
    19091909msgstr ""
    19101910
    1911 #: admin/transaction-list-table.php:235
     1911#: admin/transaction-list-table.php:237
    19121912msgid "Concept"
    19131913msgstr ""
    19141914
    1915 #: admin/transaction-list-table.php:238
     1915#: admin/transaction-list-table.php:240
    19161916msgid "Status"
    19171917msgstr ""
    19181918
    1919 #: admin/transaction-list-table.php:240
     1919#: admin/transaction-list-table.php:242
    19201920msgid "Transaction ID"
    19211921msgstr ""
    19221922
    1923 #: admin/transaction-list-table.php:241
     1923#: admin/transaction-list-table.php:243
    19241924msgid "Confirmation Code"
    19251925msgstr ""
    19261926
    1927 #: admin/transaction-list-table.php:242
     1927#: admin/transaction-list-table.php:244
    19281928msgid "User"
    19291929msgstr ""
    19301930
    1931 #: admin/transaction-list-table.php:243
     1931#: admin/transaction-list-table.php:245
    19321932msgid "URL"
    19331933msgstr ""
    19341934
    1935 #: admin/transaction-list-table.php:244
     1935#: admin/transaction-list-table.php:246
    19361936msgid "Parameters"
    19371937msgstr ""
    19381938
    1939 #: admin/transaction-list-table.php:245
     1939#: admin/transaction-list-table.php:247
    19401940msgid "IP Address"
    19411941msgstr ""
    19421942
    1943 #: admin/transaction-list-table.php:246
     1943#: admin/transaction-list-table.php:248
    19441944msgid "User Agent"
    19451945msgstr ""
    19461946
    1947 #: admin/transaction-list-table.php:247
     1947#: admin/transaction-list-table.php:249
    19481948msgid "Error"
    19491949msgstr ""
    19501950
    1951 #: admin/transaction-list-table.php:248
     1951#: admin/transaction-list-table.php:250
    19521952msgid "Token"
    19531953msgstr ""
    19541954
    1955 #: admin/transaction-list-table.php:250
     1955#: admin/transaction-list-table.php:252
    19561956msgid "Modified"
    19571957msgstr ""
    19581958
    1959 #: admin/transaction-list-table.php:279
     1959#: admin/transaction-list-table.php:281
    19601960msgid "Verification result for %s:<br />%s"
    19611961msgstr ""
     
    19701970msgstr ""
    19711971
    1972 #: simple-payment-plugin.php:144
     1972#: simple-payment-plugin.php:146
    19731973msgid "Simple Payment License Error: %s"
    19741974msgstr ""
    19751975
    1976 #: simple-payment-plugin.php:144
     1976#: simple-payment-plugin.php:146
    19771977msgid "License error, or no license."
    19781978msgstr ""
    19791979
    1980 #: simple-payment-plugin.php:190
     1980#: simple-payment-plugin.php:192
    19811981msgid "Every %s Minutes"
    19821982msgstr ""
    19831983
    1984 #: simple-payment-plugin.php:587
     1984#: simple-payment-plugin.php:599
    19851985msgid "Error payment recharge"
    19861986msgstr ""
    19871987
    1988 #: simple-payment-plugin.php:836
     1988#: simple-payment-plugin.php:832
     1989msgid "Couldn't register transaction: %s"
     1990msgstr ""
     1991
     1992#: simple-payment-plugin.php:855
    19891993msgid "Couldn't update transaction: %s"
    19901994msgstr ""
  • simple-payment/tags/2.4.7/readme.txt

    r3338694 r3373384  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 2.4.6
     7Stable tag: 2.4.7
    88Requires PHP: 5.4
    99License: GPLv2 or later
  • simple-payment/tags/2.4.7/simple-payment-plugin.php

    r3338694 r3373384  
    44 * Plugin URI: https://simple-payment.yalla-ya.com
    55 * Description: Simple Payment enables integration with multiple payment gateways, and customize multiple payment forms.
    6  * Version: 2.4.6
     6 * Version: 2.4.7
    77 * Author: Ido Kobelkowsky / yalla ya!
    88 * Author URI: https://github.com/idokd
     
    9191        }
    9292        if ( $engine != 'Custom' && $this->engine && $this->engine::$name == $engine ) return;
    93         if ( file_exists( SPWP_PLUGIN_DIR . '/engines/' . strtolower( $engine ) . '.php' ) ) require_once( SPWP_PLUGIN_DIR . '/engines/' . strtolower( $engine ) . '.php' );
     93        $filename =  strtolower( sanitize_file_name( wp_basename( $engine, '.php' ) ) );
     94        if ( file_exists( SPWP_PLUGIN_DIR . '/engines/' . $filename . '.php' ) )
     95            require_once( SPWP_PLUGIN_DIR . '/engines/' . $filename . '.php' );
    9496        parent::setEngine( $engine );
    9597        $callback = $this->callback_url();
     
    299301                'status' => self::TRANSACTION_SUCCESS
    300302            ];
    301             if ( $this->engine->confirmation_code) $args['confirmation_code'] = $this->engine->confirmation_code;
    302             if ( $this->engine->payments) $args['payments'] = $this->engine->payments;
    303             if ( $this->engine->amount) $args['amount'] = $this->engine->amount;
     303            if ( $this->engine->confirmation_code) $args[ 'confirmation_code' ] = $this->engine->confirmation_code;
     304            if ( $this->engine->payments) $args[ 'payments' ] = $this->engine->payments;
     305            if ( $this->engine->amount) $args[ 'amount' ] = $this->engine->amount;
     306            if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'post' && !get_current_user_id() ) {
     307                $user_id = $this->create_user( $params );
     308                if ( $user_id ) $args[ 'user_id' ] = $user_id;
     309            }
    304310            self::update( $this->payment_id ? : $this->engine->transaction, $args , !$this->payment_id );
    305             if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'post' && !get_current_user_id() ) $this->create_user( $params );
    306311            do_action( 'sp_payment_post_process', $params, $this->engine );
    307312            return( true );
     
    334339        if (!isset($params[self::FULL_NAME]) && (isset($params[self::FIRST_NAME]) || isset($params[self::LAST_NAME]))) $params[self::FULL_NAME] = trim((isset($params[self::FIRST_NAME]) ? $params[self::FIRST_NAME] : '').' '.(isset($params[self::LAST_NAME]) ? $params[self::LAST_NAME] : ''));
    335340        if (!isset($params[self::CARD_OWNER]) && isset($params[self::FULL_NAME])) $params[self::CARD_OWNER] = $params[self::FULL_NAME];
    336         if (!isset($params['payment_id']) || !$params['payment_id']) $params['payment_id'] = $this->register($params);
    337         $this->payment_id = $params['payment_id'];
     341        //if ( !isset( $params[ 'payment_id' ] ) || !$params[ 'payment_id' ] ) $params[ 'payment_id' ] =
     342        $params = apply_filters( 'sp_payment_pre_process_filter', $params, $this->engine );
     343        //if ( empty( $params[ 'payment_id' ] ) )
     344        $params[ 'payment_id' ] = $this->payment_id = $this->register( $params );
    338345        try {
    339             $params = apply_filters( 'sp_payment_pre_process_filter', $params, $this->engine );
    340346            $process = parent::pre_process( $params );
    341             self::update( $params[ 'payment_id' ], [ 'status' => self::TRANSACTION_PENDING, 'transaction_id' => $this->engine->transaction ] );
     347            self::update( $params[ 'payment_id' ], [
     348                'status' => self::TRANSACTION_PENDING,
     349                'transaction_id' => $this->engine->transaction
     350            ] );
    342351        } catch ( Exception $e ) {
    343             self::update($params[ 'payment_id' ], [
    344                 'status' => self::TRANSACTION_FAILED, 
     352            self::update( $params[ 'payment_id' ], [
     353                'status' => self::TRANSACTION_FAILED,
    345354                'transaction_id' => $this->engine->transaction,
    346355                'error_code' => $e->getCode(),
     
    349358            throw $e;
    350359        }
    351         if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'pre' && !get_current_user_id()) $this->create_user( $params );
     360        if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'pre' && !get_current_user_id() ) {
     361            $user_id = $this->create_user( $params );
     362            $params[ 'user_id' ] = $user_id;
     363        }
    352364        do_action( 'sp_payment_pre_process', $params, $this->engine  );
    353365        return( $process );
     
    366378        $engine = $engine ? : $this->param( 'engine' );
    367379        $this->setEngine( $engine );
     380        $params = apply_filters( 'sp_creditcard_token_params', $params, $this->engine  );
    368381        $params[ 'payment_id' ] = $this->register( $params );
    369         $params = apply_filters( 'sp_creditcard_token_params', $params, $this->engine  );
    370382        if ( $params = parent::store( $params ) ) {
    371383            if ( isset( $params[ 'token' ] ) ) {
     
    662674                $username = $this->generate_unique_username( strtolower( $username ) );
    663675                if ( $this->param( 'user_create_step' ) == 'register' ) $user_id = register_new_user( $username, $email );
    664                 else $user_id = wp_create_user( $username, wp_generate_password( 12, false), $email );
     676                else $user_id = wp_create_user( $username, wp_generate_password( 12, false ), $email );
    665677                do_action( 'sp_user_created', $user_id, $params, false );
     678
     679                // TODO: allow ssetting for autologin, or not
    666680                wp_set_auth_cookie( $user_id );
    667681            }
    668682        }
    669683        if ( $user_id ) {
    670             // TODO: Login should be handled by developer, implmention,
     684            // TODO: Login should be handled by developer, implementation,
    671685            // could be redirecting user to login screen, or validating
    672686            // other data field that comes in $params that indicates it the user.
     
    676690        return( $user_id );
    677691    }
    678 
     692       
    679693    function generate_unique_username( $username ) {
    680694        $username = sanitize_user( $username );
    681         static $i;
    682         if ( null === $i ) $i = 1;
    683         else $i ++;
    684         if (! username_exists( $username ) ) return( $username );
    685         $new_username = sprintf( '%s-%s', $username, $i );
    686         if ( !username_exists( $new_username ) ) return( $new_username );
    687         else return( $this->generate_unique_username( $username ) );
     695        $i = 1;
     696        $new_username = $username;
     697        while ( username_exists( $new_username ) ) {
     698            $new_username = $username . '-' . $i++;
     699        }
     700        return( $new_username );
    688701    }
    689702
     
    799812        $values = [
    800813            'engine' => $this->engine::$name,
    801             'currency' => isset($params[self::CURRENCY]) && $params[self::CURRENCY] ? $params[self::CURRENCY] : $this->param('currency'),
    802             'amount' => self::tofloat($params[self::AMOUNT]),
    803             'concept' => $params['product'],
    804             'payments' => isset($params[self::PAYMENTS]) ? $params[self::PAYMENTS] : null,
    805             'parameters' => $this->sanitize_pci_dss(json_encode($params)),
     814            'currency' => isset( $params[ self::CURRENCY ] ) && $params[ self::CURRENCY ] ? $params[ self::CURRENCY ] : $this->param('currency' ),
     815            'amount' => self::tofloat( $params[ self::AMOUNT ] ),
     816            'concept' => $params[ 'product' ] ?? ( isset( $params[ self::PRODUCT ] ) ? $params[ self::PRODUCT ] : null ),
     817            'payments' => isset( $params[ self::PAYMENTS ] ) ? $params[ self::PAYMENTS ] : null,
     818            'parameters' => $this->sanitize_pci_dss( json_encode( $params ) ),
    806819            'url' => wp_get_referer() ? $this->sanitize_pci_dss(wp_get_referer()) : '',
    807820            'status' => self::TRANSACTION_NEW,
    808821            'sandbox' => $this->sandbox,
    809             'user_id' => get_current_user_id() ? : null,
    810             'ip_address' => $_SERVER['REMOTE_ADDR'],
    811             'user_agent' => $_SERVER['HTTP_USER_AGENT'],
    812             'parent_id' => isset($params['payment_id']) ? $params['payment_id'] : null,
     822            'user_id' => $params[ 'user_id' ] ?? get_current_user_id(),
     823            'ip_address' => $_SERVER[ 'REMOTE_ADDR' ] ?? null,
     824            'user_agent' => $_SERVER[ 'HTTP_USER_AGENT' ] ?? null,
     825            'parent_id' => isset( $params[ 'payment_id' ] ) ? $params[ 'payment_id' ] : null,
    813826            'modified' => current_time( 'mysql' ),
    814827            'created' => current_time( 'mysql' ),
    815828        ];
    816         $result = $wpdb->insert( $wpdb->prefix.self::$table_name, $values );
    817         if ( $wpdb->insert_id ) {
    818             $this->payment_id = $wpdb->insert_id;
    819             return( $this->payment_id );
    820         }
    821         return( false );
     829        $result = $wpdb->insert( $wpdb->prefix . self::$table_name, $values );
     830        if ( $result === false )
     831            throw new Exception(
     832                sprintf( __( "Couldn't register transaction: %s", 'simple-payment' ),
     833                $wpdb->last_error
     834            ) );
     835        $this->payment_id = $wpdb->insert_id;
     836        return( $this->payment_id ? : false );
    822837    }
    823838
     
    833848        //$user_id = get_current_user_id();
    834849        //if ( $user_id ) $params[ 'user_id' ] = $user_id;
    835         $result = $wpdb->update( $table_name, $params, [ ( $transaction_id ? 'transaction_id' : 'id' ) => $id ] );
    836         if ( $result === false ) throw new Exception( sprintf( __( "Couldn't update transaction: %s", 'simple-payment' ), $wpdb->last_error ) );
     850        $result = $wpdb->update( $table_name, $params, [
     851            ( $transaction_id ? 'transaction_id' : 'id' ) => $id
     852        ] );
     853        if ( $result === false )
     854            throw new Exception(
     855                sprintf( __( "Couldn't update transaction: %s", 'simple-payment' ), $wpdb->last_error )
     856            );
    837857        if ( isset( $token ) && $token ) {
    838858            do_action( 'sp_creditcard_token', $token, ( $id ? $id : $transaction_id ), $params );
  • simple-payment/tags/2.4.7/vendor/yalla-ya/simple-payment/Engines/Cardcom.php

    r3319619 r3373384  
    548548
    549549    if ($refund) $post[ 'TokenToCharge.RefundInsteadOfCharge' ] = $refund;
    550     if ($params[ 'PAYMENTS' ] == 'monthly' ) $post[ 'TokenToCharge.IsAutoRecurringPayment' ] = 'true';
    551 
    552     if (isset($params[ 'approval_number' ]) && $params[ 'approval_number' ]) $post[ 'TokenToCharge.ApprovalNumber' ] = $params[ 'approval_number' ];
     550    if ($params[ 'payments' ] == 'monthly' ) $post[ 'TokenToCharge.IsAutoRecurringPayment' ] = 'true';
     551
     552    if ( !$refund  &&isset($params[ 'approval_number' ]) && $params[ 'approval_number' ]) $post[ 'TokenToCharge.ApprovalNumber' ] = $params[ 'approval_number' ];
    553553
    554554
  • simple-payment/tags/2.4.7/vendor/yalla-ya/simple-payment/Engines/Engine.php

    r3319619 r3373384  
    163163      # some error , send email to developer // TODO: Handle Error
    164164      if ( !empty( $error ) ) {
    165         throw new Exception( $error . ' ' . $response. ' - ' . $url . ' (' . print_r( $vars, true ) . ')', 500 );
     165        throw new Exception( $error . ' ' . $response. ' - ' . $url, 500 );
    166166      }
    167167      curl_close( $curl );
  • simple-payment/trunk/addons/woocommerce/init.php

    r3332473 r3373384  
    692692            try {
    693693                //get_checkout_order_received_url, get_cancel_order_url_raw
    694 
     694                $settings = $this->get_option( 'settings' ) ? json_decode( $this->get_option( 'settings' ), true, 512, JSON_OBJECT_AS_ARRAY ) : [];
     695                if ( $settings ) $params = array_merge( $settings, $params );
     696               
    695697                $params[ 'redirect_url' ] = WC()->api_request_url( "{$this}" );
    696698
  • simple-payment/trunk/admin/transaction-list-table.php

    r3338694 r3373384  
    6060              echo '<select id="engine" class="sp-filter-engine" name="engine"><option value="">' . __( 'All Engines', 'simple-payment' ) . '</option>';
    6161              foreach ($options as $option) {
    62                   if ( $option[ 'title' ] ) echo '<option value="' . esc_attr( $option[ 'title' ] ) . '"' . ( $engine == $option[ 'title' ] ? ' selected' : '' ) . '>' . esc_html( $option[ 'title' ] ) . '</option>';
     62                  if ( $option[ 'title' ] )
     63                    echo '<option value="' . esc_attr( $option[ 'title' ] ) . '"' . ( $engine == $option[ 'title' ] ? ' selected' : '' ) . '>' 
     64                    . esc_html( $option[ 'title' ] ) . '</option>';
    6365              }
    6466              echo "</select>";
    6567          }
    66           echo '<label for="from-date">Date Range:</label><input type="date" name="created_from" id="from-date" value="' . ( isset( $_REQUEST[ 'created_from' ] ) ? $_REQUEST[ 'created_from' ] : '' ) . '" /><input type="date" name="created_to" id="to-date" value="' . ( isset( $_REQUEST[ 'created_to' ] ) ? $_REQUEST[ 'created_to' ] : '' ) . '" />';
     68          echo '<label for="from-date">Date Range:</label><input type="date" name="created_from" id="from-date" value="' . ( isset( $_REQUEST[ 'created_from' ] ) ? sanitize_text_field( $_REQUEST[ 'created_from' ] ) : '' ) . '" /><input type="date" name="created_to" id="to-date" value="' . ( isset( $_REQUEST[ 'created_to' ] ) ? sanitize_text_field( $_REQUEST[ 'created_to' ] ) : '' ) . '" />';
    6769          echo '<input type="submit" name="filter_action" id="transaction-query-submit" class="button" value="' . __( 'Filter', 'simple-payment' ) . '">';
    6870          echo '</div>';
  • simple-payment/trunk/curl.log

    r3332473 r3373384  
    657657<
    658658* Connection #0 to host licensing.yalla-ya.com left intact
     659* Host licensing.yalla-ya.com:443 was resolved.
     660* IPv6: 2607:f8b0:4012:808::2013
     661* IPv4: 172.217.3.147
     662*   Trying [2607:f8b0:4012:808::2013]:443...
     663* ALPN: curl offers h2,http/1.1
     664*  CAfile: /usr/local/etc/openssl@3/cert.pem
     665*  CApath: none
     666* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / RSASSA-PSS
     667* ALPN: server accepted h2
     668* Server certificate:
     669*  subject: CN=licensing.yalla-ya.com
     670*  start date: Aug  9 05:17:41 2025 GMT
     671*  expire date: Nov  7 06:04:50 2025 GMT
     672*  subjectAltName: host "licensing.yalla-ya.com" matched cert's "licensing.yalla-ya.com"
     673*  issuer: C=US; O=Google Trust Services; CN=WR3
     674*  SSL certificate verify ok.
     675*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     676*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     677*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
     678* Connected to licensing.yalla-ya.com (2607:f8b0:4012:808::2013) port 443
     679* using HTTP/2
     680* [HTTP/2] [1] OPENED stream for https://licensing.yalla-ya.com/validate
     681* [HTTP/2] [1] [:method: POST]
     682* [HTTP/2] [1] [:scheme: https]
     683* [HTTP/2] [1] [:authority: licensing.yalla-ya.com]
     684* [HTTP/2] [1] [:path: /validate]
     685* [HTTP/2] [1] [accept: */*]
     686* [HTTP/2] [1] [content-length: 5]
     687* [HTTP/2] [1] [content-type: application/x-www-form-urlencoded]
     688> POST /validate HTTP/2
     689Host: licensing.yalla-ya.com
     690Accept: */*
     691Content-Length: 5
     692Content-Type: application/x-www-form-urlencoded
     693
     694* upload completely sent off: 5 bytes
     695< HTTP/2 200
     696< x-powered-by: Express
     697< content-type: application/json; charset=utf-8
     698< etag: W/"b5-ksg7nPT+IdK8wH8TvJQvncgMyDw"
     699< vary: Accept-Encoding
     700< x-cloud-trace-context: dee11b461b9238b47bc2823bbeea064b;o=1
     701< date: Thu, 02 Oct 2025 01:12:13 GMT
     702< server: Google Frontend
     703< content-length: 181
     704<
     705* Connection #0 to host licensing.yalla-ya.com left intact
     706* Host licensing.yalla-ya.com:443 was resolved.
     707* IPv6: 2607:f8b0:4012:808::2013
     708* IPv4: 172.217.3.147
     709*   Trying [2607:f8b0:4012:808::2013]:443...
     710* ALPN: curl offers h2,http/1.1
     711*  CAfile: /usr/local/etc/openssl@3/cert.pem
     712*  CApath: none
     713* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / RSASSA-PSS
     714* ALPN: server accepted h2
     715* Server certificate:
     716*  subject: CN=licensing.yalla-ya.com
     717*  start date: Aug  9 05:17:41 2025 GMT
     718*  expire date: Nov  7 06:04:50 2025 GMT
     719*  subjectAltName: host "licensing.yalla-ya.com" matched cert's "licensing.yalla-ya.com"
     720*  issuer: C=US; O=Google Trust Services; CN=WR3
     721*  SSL certificate verify ok.
     722*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     723*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
     724*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
     725* Connected to licensing.yalla-ya.com (2607:f8b0:4012:808::2013) port 443
     726* using HTTP/2
     727* [HTTP/2] [1] OPENED stream for https://licensing.yalla-ya.com/validate
     728* [HTTP/2] [1] [:method: POST]
     729* [HTTP/2] [1] [:scheme: https]
     730* [HTTP/2] [1] [:authority: licensing.yalla-ya.com]
     731* [HTTP/2] [1] [:path: /validate]
     732* [HTTP/2] [1] [accept: */*]
     733* [HTTP/2] [1] [content-length: 5]
     734* [HTTP/2] [1] [content-type: application/x-www-form-urlencoded]
     735> POST /validate HTTP/2
     736Host: licensing.yalla-ya.com
     737Accept: */*
     738Content-Length: 5
     739Content-Type: application/x-www-form-urlencoded
     740
     741* upload completely sent off: 5 bytes
     742< HTTP/2 200
     743< x-powered-by: Express
     744< content-type: application/json; charset=utf-8
     745< etag: W/"b5-KIAY0Qta3YH+dNXP3Fnhv/lO+Zw"
     746< vary: Accept-Encoding
     747< x-cloud-trace-context: 8fafc6f3dee85d9ba599f71d1deb6c75;o=1
     748< date: Thu, 02 Oct 2025 14:22:04 GMT
     749< server: Google Frontend
     750< content-length: 181
     751<
     752* Connection #0 to host licensing.yalla-ya.com left intact
  • simple-payment/trunk/languages/simple-payment.pot

    r3338694 r3373384  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Simple Payment 2.4.5\n"
     5"Project-Id-Version: Simple Payment 2.4.6\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/simple-payment\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-08-04T04:57:57+00:00\n"
     12"POT-Creation-Date: 2025-10-06T05:41:34+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.10.0\n"
     
    8686
    8787#: addons/elementor/widget.php:103
    88 #: admin/transaction-list-table.php:236
     88#: admin/transaction-list-table.php:238
    8989msgid "Amount"
    9090msgstr ""
     
    202202#: addons/wpjobboard/config.php:12
    203203#: admin/settings.php:111
    204 #: admin/transaction-list-table.php:237
     204#: admin/transaction-list-table.php:239
    205205#: settings.php:110
    206206msgid "Engine"
     
    581581msgstr ""
    582582
    583 #: addons/woocommerce/init.php:734
     583#: addons/woocommerce/init.php:736
    584584msgid "Payment error [ SP ID: %s ]: %s"
    585585msgstr ""
    586586
    587 #: addons/woocommerce/init.php:761
     587#: addons/woocommerce/init.php:763
    588588msgid "Payment error[ SP ID: %s ]: unkown."
    589589msgstr ""
    590590
    591 #: addons/woocommerce/init.php:813
     591#: addons/woocommerce/init.php:815
    592592msgid "Pay for order"
    593593msgstr ""
    594594
    595 #: addons/woocommerce/init.php:837
     595#: addons/woocommerce/init.php:839
    596596msgid "Visa"
    597597msgstr ""
    598598
    599 #: addons/woocommerce/init.php:838
     599#: addons/woocommerce/init.php:840
    600600msgid "Mastercard"
    601601msgstr ""
    602602
    603 #: addons/woocommerce/init.php:839
     603#: addons/woocommerce/init.php:841
    604604msgid "American Express"
    605605msgstr ""
     
    717717#: admin/admin.php:190
    718718#: admin/admin.php:191
    719 #: admin/transaction-list-table.php:239
     719#: admin/transaction-list-table.php:241
    720720msgid "Payments"
    721721msgstr ""
     
    11571157
    11581158#: admin/settings.php:117
    1159 #: admin/transaction-list-table.php:249
     1159#: admin/transaction-list-table.php:251
    11601160#: settings.php:116
    11611161msgid "Sandbox"
     
    13341334
    13351335#: admin/settings.php:168
    1336 #: admin/transaction-list-table.php:155
    1337 #: admin/transaction-list-table.php:176
     1336#: admin/transaction-list-table.php:157
     1337#: admin/transaction-list-table.php:178
    13381338#: settings.php:167
    13391339msgid "Archive"
     
    18711871
    18721872#: admin/transaction-list-table.php:36
    1873 #: admin/transaction-list-table.php:251
     1873#: admin/transaction-list-table.php:253
    18741874msgid "Created"
    18751875msgstr ""
     
    18831883msgstr ""
    18841884
    1885 #: admin/transaction-list-table.php:67
     1885#: admin/transaction-list-table.php:69
    18861886msgid "Filter"
    18871887msgstr ""
    18881888
    1889 #: admin/transaction-list-table.php:132
     1889#: admin/transaction-list-table.php:134
    18901890msgid "No transactions avaliable."
    18911891msgstr ""
    18921892
    1893 #: admin/transaction-list-table.php:145
    1894 #: admin/transaction-list-table.php:171
     1893#: admin/transaction-list-table.php:147
     1894#: admin/transaction-list-table.php:173
    18951895msgid "Unarchive"
    18961896msgstr ""
    18971897
    1898 #: admin/transaction-list-table.php:160
    1899 #: admin/transaction-list-table.php:175
     1898#: admin/transaction-list-table.php:162
     1899#: admin/transaction-list-table.php:177
    19001900msgid "Verify"
    19011901msgstr ""
    19021902
    1903 #: admin/transaction-list-table.php:163
     1903#: admin/transaction-list-table.php:165
    19041904msgid "Details"
    19051905msgstr ""
    19061906
    1907 #: admin/transaction-list-table.php:234
     1907#: admin/transaction-list-table.php:236
    19081908msgid "ID"
    19091909msgstr ""
    19101910
    1911 #: admin/transaction-list-table.php:235
     1911#: admin/transaction-list-table.php:237
    19121912msgid "Concept"
    19131913msgstr ""
    19141914
    1915 #: admin/transaction-list-table.php:238
     1915#: admin/transaction-list-table.php:240
    19161916msgid "Status"
    19171917msgstr ""
    19181918
    1919 #: admin/transaction-list-table.php:240
     1919#: admin/transaction-list-table.php:242
    19201920msgid "Transaction ID"
    19211921msgstr ""
    19221922
    1923 #: admin/transaction-list-table.php:241
     1923#: admin/transaction-list-table.php:243
    19241924msgid "Confirmation Code"
    19251925msgstr ""
    19261926
    1927 #: admin/transaction-list-table.php:242
     1927#: admin/transaction-list-table.php:244
    19281928msgid "User"
    19291929msgstr ""
    19301930
    1931 #: admin/transaction-list-table.php:243
     1931#: admin/transaction-list-table.php:245
    19321932msgid "URL"
    19331933msgstr ""
    19341934
    1935 #: admin/transaction-list-table.php:244
     1935#: admin/transaction-list-table.php:246
    19361936msgid "Parameters"
    19371937msgstr ""
    19381938
    1939 #: admin/transaction-list-table.php:245
     1939#: admin/transaction-list-table.php:247
    19401940msgid "IP Address"
    19411941msgstr ""
    19421942
    1943 #: admin/transaction-list-table.php:246
     1943#: admin/transaction-list-table.php:248
    19441944msgid "User Agent"
    19451945msgstr ""
    19461946
    1947 #: admin/transaction-list-table.php:247
     1947#: admin/transaction-list-table.php:249
    19481948msgid "Error"
    19491949msgstr ""
    19501950
    1951 #: admin/transaction-list-table.php:248
     1951#: admin/transaction-list-table.php:250
    19521952msgid "Token"
    19531953msgstr ""
    19541954
    1955 #: admin/transaction-list-table.php:250
     1955#: admin/transaction-list-table.php:252
    19561956msgid "Modified"
    19571957msgstr ""
    19581958
    1959 #: admin/transaction-list-table.php:279
     1959#: admin/transaction-list-table.php:281
    19601960msgid "Verification result for %s:<br />%s"
    19611961msgstr ""
     
    19701970msgstr ""
    19711971
    1972 #: simple-payment-plugin.php:144
     1972#: simple-payment-plugin.php:146
    19731973msgid "Simple Payment License Error: %s"
    19741974msgstr ""
    19751975
    1976 #: simple-payment-plugin.php:144
     1976#: simple-payment-plugin.php:146
    19771977msgid "License error, or no license."
    19781978msgstr ""
    19791979
    1980 #: simple-payment-plugin.php:190
     1980#: simple-payment-plugin.php:192
    19811981msgid "Every %s Minutes"
    19821982msgstr ""
    19831983
    1984 #: simple-payment-plugin.php:587
     1984#: simple-payment-plugin.php:599
    19851985msgid "Error payment recharge"
    19861986msgstr ""
    19871987
    1988 #: simple-payment-plugin.php:836
     1988#: simple-payment-plugin.php:832
     1989msgid "Couldn't register transaction: %s"
     1990msgstr ""
     1991
     1992#: simple-payment-plugin.php:855
    19891993msgid "Couldn't update transaction: %s"
    19901994msgstr ""
  • simple-payment/trunk/readme.txt

    r3338694 r3373384  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 2.4.6
     7Stable tag: 2.4.7
    88Requires PHP: 5.4
    99License: GPLv2 or later
  • simple-payment/trunk/simple-payment-plugin.php

    r3338694 r3373384  
    44 * Plugin URI: https://simple-payment.yalla-ya.com
    55 * Description: Simple Payment enables integration with multiple payment gateways, and customize multiple payment forms.
    6  * Version: 2.4.6
     6 * Version: 2.4.7
    77 * Author: Ido Kobelkowsky / yalla ya!
    88 * Author URI: https://github.com/idokd
     
    9191        }
    9292        if ( $engine != 'Custom' && $this->engine && $this->engine::$name == $engine ) return;
    93         if ( file_exists( SPWP_PLUGIN_DIR . '/engines/' . strtolower( $engine ) . '.php' ) ) require_once( SPWP_PLUGIN_DIR . '/engines/' . strtolower( $engine ) . '.php' );
     93        $filename =  strtolower( sanitize_file_name( wp_basename( $engine, '.php' ) ) );
     94        if ( file_exists( SPWP_PLUGIN_DIR . '/engines/' . $filename . '.php' ) )
     95            require_once( SPWP_PLUGIN_DIR . '/engines/' . $filename . '.php' );
    9496        parent::setEngine( $engine );
    9597        $callback = $this->callback_url();
     
    299301                'status' => self::TRANSACTION_SUCCESS
    300302            ];
    301             if ( $this->engine->confirmation_code) $args['confirmation_code'] = $this->engine->confirmation_code;
    302             if ( $this->engine->payments) $args['payments'] = $this->engine->payments;
    303             if ( $this->engine->amount) $args['amount'] = $this->engine->amount;
     303            if ( $this->engine->confirmation_code) $args[ 'confirmation_code' ] = $this->engine->confirmation_code;
     304            if ( $this->engine->payments) $args[ 'payments' ] = $this->engine->payments;
     305            if ( $this->engine->amount) $args[ 'amount' ] = $this->engine->amount;
     306            if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'post' && !get_current_user_id() ) {
     307                $user_id = $this->create_user( $params );
     308                if ( $user_id ) $args[ 'user_id' ] = $user_id;
     309            }
    304310            self::update( $this->payment_id ? : $this->engine->transaction, $args , !$this->payment_id );
    305             if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'post' && !get_current_user_id() ) $this->create_user( $params );
    306311            do_action( 'sp_payment_post_process', $params, $this->engine );
    307312            return( true );
     
    334339        if (!isset($params[self::FULL_NAME]) && (isset($params[self::FIRST_NAME]) || isset($params[self::LAST_NAME]))) $params[self::FULL_NAME] = trim((isset($params[self::FIRST_NAME]) ? $params[self::FIRST_NAME] : '').' '.(isset($params[self::LAST_NAME]) ? $params[self::LAST_NAME] : ''));
    335340        if (!isset($params[self::CARD_OWNER]) && isset($params[self::FULL_NAME])) $params[self::CARD_OWNER] = $params[self::FULL_NAME];
    336         if (!isset($params['payment_id']) || !$params['payment_id']) $params['payment_id'] = $this->register($params);
    337         $this->payment_id = $params['payment_id'];
     341        //if ( !isset( $params[ 'payment_id' ] ) || !$params[ 'payment_id' ] ) $params[ 'payment_id' ] =
     342        $params = apply_filters( 'sp_payment_pre_process_filter', $params, $this->engine );
     343        //if ( empty( $params[ 'payment_id' ] ) )
     344        $params[ 'payment_id' ] = $this->payment_id = $this->register( $params );
    338345        try {
    339             $params = apply_filters( 'sp_payment_pre_process_filter', $params, $this->engine );
    340346            $process = parent::pre_process( $params );
    341             self::update( $params[ 'payment_id' ], [ 'status' => self::TRANSACTION_PENDING, 'transaction_id' => $this->engine->transaction ] );
     347            self::update( $params[ 'payment_id' ], [
     348                'status' => self::TRANSACTION_PENDING,
     349                'transaction_id' => $this->engine->transaction
     350            ] );
    342351        } catch ( Exception $e ) {
    343             self::update($params[ 'payment_id' ], [
    344                 'status' => self::TRANSACTION_FAILED, 
     352            self::update( $params[ 'payment_id' ], [
     353                'status' => self::TRANSACTION_FAILED,
    345354                'transaction_id' => $this->engine->transaction,
    346355                'error_code' => $e->getCode(),
     
    349358            throw $e;
    350359        }
    351         if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'pre' && !get_current_user_id()) $this->create_user( $params );
     360        if ( $this->param( 'user_create' ) != 'disabled' && $this->param( 'user_create_step' ) == 'pre' && !get_current_user_id() ) {
     361            $user_id = $this->create_user( $params );
     362            $params[ 'user_id' ] = $user_id;
     363        }
    352364        do_action( 'sp_payment_pre_process', $params, $this->engine  );
    353365        return( $process );
     
    366378        $engine = $engine ? : $this->param( 'engine' );
    367379        $this->setEngine( $engine );
     380        $params = apply_filters( 'sp_creditcard_token_params', $params, $this->engine  );
    368381        $params[ 'payment_id' ] = $this->register( $params );
    369         $params = apply_filters( 'sp_creditcard_token_params', $params, $this->engine  );
    370382        if ( $params = parent::store( $params ) ) {
    371383            if ( isset( $params[ 'token' ] ) ) {
     
    662674                $username = $this->generate_unique_username( strtolower( $username ) );
    663675                if ( $this->param( 'user_create_step' ) == 'register' ) $user_id = register_new_user( $username, $email );
    664                 else $user_id = wp_create_user( $username, wp_generate_password( 12, false), $email );
     676                else $user_id = wp_create_user( $username, wp_generate_password( 12, false ), $email );
    665677                do_action( 'sp_user_created', $user_id, $params, false );
     678
     679                // TODO: allow ssetting for autologin, or not
    666680                wp_set_auth_cookie( $user_id );
    667681            }
    668682        }
    669683        if ( $user_id ) {
    670             // TODO: Login should be handled by developer, implmention,
     684            // TODO: Login should be handled by developer, implementation,
    671685            // could be redirecting user to login screen, or validating
    672686            // other data field that comes in $params that indicates it the user.
     
    676690        return( $user_id );
    677691    }
    678 
     692       
    679693    function generate_unique_username( $username ) {
    680694        $username = sanitize_user( $username );
    681         static $i;
    682         if ( null === $i ) $i = 1;
    683         else $i ++;
    684         if (! username_exists( $username ) ) return( $username );
    685         $new_username = sprintf( '%s-%s', $username, $i );
    686         if ( !username_exists( $new_username ) ) return( $new_username );
    687         else return( $this->generate_unique_username( $username ) );
     695        $i = 1;
     696        $new_username = $username;
     697        while ( username_exists( $new_username ) ) {
     698            $new_username = $username . '-' . $i++;
     699        }
     700        return( $new_username );
    688701    }
    689702
     
    799812        $values = [
    800813            'engine' => $this->engine::$name,
    801             'currency' => isset($params[self::CURRENCY]) && $params[self::CURRENCY] ? $params[self::CURRENCY] : $this->param('currency'),
    802             'amount' => self::tofloat($params[self::AMOUNT]),
    803             'concept' => $params['product'],
    804             'payments' => isset($params[self::PAYMENTS]) ? $params[self::PAYMENTS] : null,
    805             'parameters' => $this->sanitize_pci_dss(json_encode($params)),
     814            'currency' => isset( $params[ self::CURRENCY ] ) && $params[ self::CURRENCY ] ? $params[ self::CURRENCY ] : $this->param('currency' ),
     815            'amount' => self::tofloat( $params[ self::AMOUNT ] ),
     816            'concept' => $params[ 'product' ] ?? ( isset( $params[ self::PRODUCT ] ) ? $params[ self::PRODUCT ] : null ),
     817            'payments' => isset( $params[ self::PAYMENTS ] ) ? $params[ self::PAYMENTS ] : null,
     818            'parameters' => $this->sanitize_pci_dss( json_encode( $params ) ),
    806819            'url' => wp_get_referer() ? $this->sanitize_pci_dss(wp_get_referer()) : '',
    807820            'status' => self::TRANSACTION_NEW,
    808821            'sandbox' => $this->sandbox,
    809             'user_id' => get_current_user_id() ? : null,
    810             'ip_address' => $_SERVER['REMOTE_ADDR'],
    811             'user_agent' => $_SERVER['HTTP_USER_AGENT'],
    812             'parent_id' => isset($params['payment_id']) ? $params['payment_id'] : null,
     822            'user_id' => $params[ 'user_id' ] ?? get_current_user_id(),
     823            'ip_address' => $_SERVER[ 'REMOTE_ADDR' ] ?? null,
     824            'user_agent' => $_SERVER[ 'HTTP_USER_AGENT' ] ?? null,
     825            'parent_id' => isset( $params[ 'payment_id' ] ) ? $params[ 'payment_id' ] : null,
    813826            'modified' => current_time( 'mysql' ),
    814827            'created' => current_time( 'mysql' ),
    815828        ];
    816         $result = $wpdb->insert( $wpdb->prefix.self::$table_name, $values );
    817         if ( $wpdb->insert_id ) {
    818             $this->payment_id = $wpdb->insert_id;
    819             return( $this->payment_id );
    820         }
    821         return( false );
     829        $result = $wpdb->insert( $wpdb->prefix . self::$table_name, $values );
     830        if ( $result === false )
     831            throw new Exception(
     832                sprintf( __( "Couldn't register transaction: %s", 'simple-payment' ),
     833                $wpdb->last_error
     834            ) );
     835        $this->payment_id = $wpdb->insert_id;
     836        return( $this->payment_id ? : false );
    822837    }
    823838
     
    833848        //$user_id = get_current_user_id();
    834849        //if ( $user_id ) $params[ 'user_id' ] = $user_id;
    835         $result = $wpdb->update( $table_name, $params, [ ( $transaction_id ? 'transaction_id' : 'id' ) => $id ] );
    836         if ( $result === false ) throw new Exception( sprintf( __( "Couldn't update transaction: %s", 'simple-payment' ), $wpdb->last_error ) );
     850        $result = $wpdb->update( $table_name, $params, [
     851            ( $transaction_id ? 'transaction_id' : 'id' ) => $id
     852        ] );
     853        if ( $result === false )
     854            throw new Exception(
     855                sprintf( __( "Couldn't update transaction: %s", 'simple-payment' ), $wpdb->last_error )
     856            );
    837857        if ( isset( $token ) && $token ) {
    838858            do_action( 'sp_creditcard_token', $token, ( $id ? $id : $transaction_id ), $params );
  • simple-payment/trunk/vendor/yalla-ya/simple-payment/Engines/Cardcom.php

    r3319619 r3373384  
    548548
    549549    if ($refund) $post[ 'TokenToCharge.RefundInsteadOfCharge' ] = $refund;
    550     if ($params[ 'PAYMENTS' ] == 'monthly' ) $post[ 'TokenToCharge.IsAutoRecurringPayment' ] = 'true';
    551 
    552     if (isset($params[ 'approval_number' ]) && $params[ 'approval_number' ]) $post[ 'TokenToCharge.ApprovalNumber' ] = $params[ 'approval_number' ];
     550    if ($params[ 'payments' ] == 'monthly' ) $post[ 'TokenToCharge.IsAutoRecurringPayment' ] = 'true';
     551
     552    if ( !$refund  &&isset($params[ 'approval_number' ]) && $params[ 'approval_number' ]) $post[ 'TokenToCharge.ApprovalNumber' ] = $params[ 'approval_number' ];
    553553
    554554
  • simple-payment/trunk/vendor/yalla-ya/simple-payment/Engines/Engine.php

    r3319619 r3373384  
    163163      # some error , send email to developer // TODO: Handle Error
    164164      if ( !empty( $error ) ) {
    165         throw new Exception( $error . ' ' . $response. ' - ' . $url . ' (' . print_r( $vars, true ) . ')', 500 );
     165        throw new Exception( $error . ' ' . $response. ' - ' . $url, 500 );
    166166      }
    167167      curl_close( $curl );
Note: See TracChangeset for help on using the changeset viewer.