Plugin Directory

Changeset 3832026


Ignore:
Timestamp:
11/28/2026 07:04:26 PM (less than one hour ago)
Author:
patrickkivits
Message:

Update to version 2.3.0 from GitHub

Location:
pay-with-bunq-for-woocommerce
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pay-with-bunq-for-woocommerce/tags/2.3.0/pay-with-bunq-for-woocommerce.php

    r3831953 r3832026  
    33 * Plugin Name: Pay with bunq for WooCommerce
    44 * Description: Accept payments in your WooCommerce shop with just your bunq account.
    5  * Version: 2.2.0
     5 * Version: 2.3.0
    66 * Author: Patrick Kivits
    77 * Author URI: https://www.patrickkivits.nl
  • pay-with-bunq-for-woocommerce/tags/2.3.0/readme.txt

    r3831953 r3832026  
    66Tested up to: 7.1
    77Requires PHP: 8.1
    8 Stable tag: 2.2.0
     8Stable tag: 2.3.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    139139== Changelog ==
    140140
     141= 2.3.0 =
     142* A payment request for a chosen payment method now offers only that method on bunq.me. A customer who comes back and picks another method gets a new payment request for it, and a payment link sent from the order screen still offers every method.
     143* New banner and icon for the plugin page on wordpress.org.
     144
    141145= 2.2.0 =
    142146* The plugin talks to bunq through the WordPress HTTP API and no longer bundles Guzzle or league/oauth2-client; it has no third-party libraries left. Production calls still pin the public key of api.bunq.com, now on WordPress' cURL transport.
    … …  
    250254== Upgrade Notice ==
    251255
     256= 2.3.0 =
     257bunq.me now offers only the payment method the customer chose at checkout. No need to connect again.
     258
    252259= 2.2.0 =
    253260Uses the WordPress HTTP API instead of bundled libraries. No change in behavior; no need to connect again.
  • pay-with-bunq-for-woocommerce/tags/2.3.0/src/Bunq/ApiClient.php

    r3831953 r3832026  
    226226         * Create a bunq.me payment request.
    227227         *
    228          * @param string   $amount              Amount.
    229          * @param string   $currency            Currency.
    230          * @param string   $description         Shown to the payer.
    231          * @param string   $return_url          Where bunq.me sends the payer after paying.
    232          * @param int|null $monetary_account_id The receiving account, null for the default account.
     228         * @param string      $amount              Amount.
     229         * @param string      $currency            Currency.
     230         * @param string      $description         Shown to the payer.
     231         * @param string      $return_url          Where bunq.me sends the payer after paying.
     232         * @param int|null    $monetary_account_id The receiving account, null for the default account.
     233         * @param string|null $payment_method      The only method bunq.me offers for it (bunq's name, such as "IDEAL"),
     234         *                                         null to offer all of them.
    233235         * @return array The share URL ("url"), the id ("id") and the account ("monetary_account_id") of the request.
    234236         */
    235         public function create_payment_request( $amount, $currency, $description, $return_url, $monetary_account_id = null ) {
    236                 $response = $this->request(
    237                         'POST',
    238                         $this->account_path( $monetary_account_id, 'bunqme-tab' ),
    239                         array(
    240                                 'bunqme_tab_entry' => array(
    241                                         'amount_inquired' => array(
    242                                                 'value'    => (string) $amount,
    243                                                 'currency' => $currency,
    244                                         ),
    245                                         'description'     => $description,
    246                                         'redirect_url'    => $return_url,
     237        public function create_payment_request( $amount, $currency, $description, $return_url, $monetary_account_id = null, $payment_method = null ) {
     238                $body = array(
     239                        'bunqme_tab_entry' => array(
     240                                'amount_inquired' => array(
     241                                        'value'    => (string) $amount,
     242                                        'currency' => $currency,
    247243                                ),
    248                         )
    249                 );
     244                                'description'     => $description,
     245                                'redirect_url'    => $return_url,
     246                        ),
     247                );
     248
     249                // A field of the tab itself, not of its entry (bunq rejects it there as superfluous).
     250                if ( $payment_method ) {
     251                        $body['payment_method'] = (string) $payment_method;
     252                }
     253
     254                $response = $this->request( 'POST', $this->account_path( $monetary_account_id, 'bunqme-tab' ), $body );
    250255
    251256                // Only the id comes back; the share URL is in the payment request itself.
  • pay-with-bunq-for-woocommerce/tags/2.3.0/src/Gateway/Gateway.php

    r3831953 r3832026  
    10491049                        // A second attempt for the same order (the customer came back from bunq.me) reuses the open payment request,
    10501050                        // or cancels it: a payment through a forgotten request would not be matched to the order any more.
    1051                         $link = $this->get_payment_link( $order );
     1051                        $link = $this->get_payment_link( $order, $bunqme_payment_method );
    10521052
    10531053                        // The customer paid the earlier request already.
    … …  
    10591059                        }
    10601060
    1061                         // Direct gateway: bunq.me opens the chosen method straight away when it is passed as ?paymentMethod= (it
    1062                         // used to be a path segment, which bunq.me now ignores).
     1061                        // The payment request offers only the chosen method; ?paymentMethod= also makes bunq.me open it straight
     1062                        // away (it used to be a path segment, which bunq.me now ignores).
    10631063                        $redirect = $bunqme_payment_method
    10641064                                ? add_query_arg( 'paymentMethod', $bunqme_payment_method, $link['url'] )
    … …  
    10821082         * callback and the checks, and a background check as fallback for a callback that never arrives.
    10831083         *
    1084          * @param WC_Order $order The order.
     1084         * @param WC_Order    $order          The order.
     1085         * @param string|null $payment_method The only method bunq.me offers (bunq's name), null for all of them.
    10851086         * @return array The share URL ("url") and the id ("id") of the request.
    10861087         * @throws Throwable When bunq could not be reached or did not return a payment request.
    10871088         */
    1088         private function create_order_payment_request( WC_Order $order ): array {
     1089        private function create_order_payment_request( WC_Order $order, ?string $payment_method = null ): array {
    10891090                $payment_request = $this->call_bunq(
    10901091                        fn() => $this->api->create_payment_request(
    … …  
    10931094                                '#' . $order->get_order_number(),
    10941095                                $this->get_return_url( $order ),
    1095                                 $this->get_monetary_account_bank_id()
     1096                                $this->get_monetary_account_bank_id(),
     1097                                $payment_method
    10961098                        )
    10971099                );
    … …  
    11291131        /**
    11301132         * A bunq.me link the customer can pay the order with: at checkout, and for a payment link the merchant sends (see
    1131          * Orders\PaymentLink). The order's payment request is reused while it can still be paid and asks for the order
    1132          * total; otherwise it is cancelled and a new one is created.
    1133          *
    1134          * @param WC_Order $order An order that needs payment.
     1133         * Orders\PaymentLink). The order's payment request is reused while it can still be paid, asks for the order
     1134         * total and offers the same payment methods; otherwise it is cancelled and a new one is created.
     1135         *
     1136         * @param WC_Order    $order          An order that needs payment.
     1137         * @param string|null $payment_method The only method bunq.me should offer (bunq's name, such as "IDEAL"), null
     1138         *                                    for all of them.
    11351139         * @return array Keys: "url" (the bunq.me link; null when a payment already came in) and "outcome": "created",
    11361140         *               "reused", or the outcome of check_payment_status() when a payment already came in.
    11371141         * @throws Throwable When bunq could not be reached or did not return a payment request.
    11381142         */
    1139         public function get_payment_link( $order ) {
     1143        public function get_payment_link( $order, $payment_method = null ) {
    11401144                $payment_request_id = intval( $order->get_meta( self::META_PAYMENT_REQUEST_ID ) );
    11411145
    … …  
    11611165                                $amount = $payment_request['bunqme_tab_entry']['amount_inquired'] ?? null;
    11621166
     1167                                // A request limited to another method (or to one method, where all are wanted now) can't be reused.
     1168                                $offered = ! empty( $payment_request['payment_method'] ) ? (string) $payment_request['payment_method'] : null;
     1169
    11631170                                if ( ! empty( $payment_request['bunqme_tab_share_url'] ) && isset( $amount['value'], $amount['currency'] )
    11641171                                        && $amount['currency'] === $order->get_currency() && Money::amounts_match( $amount['value'], $order->get_total() )
     1172                                        && ( $payment_method ? (string) $payment_method : null ) === $offered
    11651173                                ) {
    11661174                                        return array(
    … …  
    11701178                                }
    11711179
    1172                                 // The order total changed since: the old link must not be paid any more.
     1180                                // The order total or the payment method changed since: the old link must not be paid any more.
    11731181                                $this->cancel_payment_request( $payment_request_id, $monetary_account_id );
    11741182                                $order->add_order_note(
    … …  
    11821190                }
    11831191
    1184                 $payment_request = $this->create_order_payment_request( $order );
     1192                $payment_request = $this->create_order_payment_request( $order, $payment_method ? (string) $payment_method : null );
    11851193
    11861194                return array(
  • pay-with-bunq-for-woocommerce/tags/2.3.0/src/Gateway/PaymentMethods.php

    r3831953 r3832026  
    2828
    2929        /**
    30          * Every payment method. "id" is what the setting and the checkout form store (keep stable); "bunqme" is the
    31          * value bunq.me expects in its paymentMethod query parameter to open that method directly; "icon" is the logo
    32          * in assets/images (null for none).
     30         * Every payment method. "id" is what the setting and the checkout form store (keep stable); "bunqme" is bunq's
     31         * name for it: the payment_method of a payment request that offers only this method, and the value bunq.me
     32         * expects in its paymentMethod query parameter to open it directly; "icon" is the logo in assets/images (null
     33         * for none).
    3334         *
    3435         * @return array[] Keys: id, bunqme, description, icon, min, max (null for no maximum).
  • pay-with-bunq-for-woocommerce/tags/2.3.0/src/Plugin.php

    r3831953 r3832026  
    3131         * The plugin version; matches the Version header of the main plugin file.
    3232         */
    33         const VERSION = '2.2.0';
     33        const VERSION = '2.3.0';
    3434
    3535        /**
  • pay-with-bunq-for-woocommerce/tags/2.3.0/vendor/composer/installed.php

    r3831953 r3832026  
    22    'root' => array(
    33        'name' => '__root__',
    4         'pretty_version' => 'v2.2.0',
    5         'version' => '2.2.0.0',
    6         'reference' => 'f0a779a476606c0890c399d8e6ed080d060661f4',
     4        'pretty_version' => 'v2.3.0',
     5        'version' => '2.3.0.0',
     6        'reference' => '74b7f01aca4bafca8b64f3c90d7205e1c0537e1b',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        '__root__' => array(
    14             'pretty_version' => 'v2.2.0',
    15             'version' => '2.2.0.0',
    16             'reference' => 'f0a779a476606c0890c399d8e6ed080d060661f4',
     14            'pretty_version' => 'v2.3.0',
     15            'version' => '2.3.0.0',
     16            'reference' => '74b7f01aca4bafca8b64f3c90d7205e1c0537e1b',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • pay-with-bunq-for-woocommerce/trunk/pay-with-bunq-for-woocommerce.php

    r3831953 r3832026  
    33 * Plugin Name: Pay with bunq for WooCommerce
    44 * Description: Accept payments in your WooCommerce shop with just your bunq account.
    5  * Version: 2.2.0
     5 * Version: 2.3.0
    66 * Author: Patrick Kivits
    77 * Author URI: https://www.patrickkivits.nl
  • pay-with-bunq-for-woocommerce/trunk/readme.txt

    r3831953 r3832026  
    66Tested up to: 7.1
    77Requires PHP: 8.1
    8 Stable tag: 2.2.0
     8Stable tag: 2.3.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    139139== Changelog ==
    140140
     141= 2.3.0 =
     142* A payment request for a chosen payment method now offers only that method on bunq.me. A customer who comes back and picks another method gets a new payment request for it, and a payment link sent from the order screen still offers every method.
     143* New banner and icon for the plugin page on wordpress.org.
     144
    141145= 2.2.0 =
    142146* The plugin talks to bunq through the WordPress HTTP API and no longer bundles Guzzle or league/oauth2-client; it has no third-party libraries left. Production calls still pin the public key of api.bunq.com, now on WordPress' cURL transport.
    … …  
    250254== Upgrade Notice ==
    251255
     256= 2.3.0 =
     257bunq.me now offers only the payment method the customer chose at checkout. No need to connect again.
     258
    252259= 2.2.0 =
    253260Uses the WordPress HTTP API instead of bundled libraries. No change in behavior; no need to connect again.
  • pay-with-bunq-for-woocommerce/trunk/src/Bunq/ApiClient.php

    r3831953 r3832026  
    226226         * Create a bunq.me payment request.
    227227         *
    228          * @param string   $amount              Amount.
    229          * @param string   $currency            Currency.
    230          * @param string   $description         Shown to the payer.
    231          * @param string   $return_url          Where bunq.me sends the payer after paying.
    232          * @param int|null $monetary_account_id The receiving account, null for the default account.
     228         * @param string      $amount              Amount.
     229         * @param string      $currency            Currency.
     230         * @param string      $description         Shown to the payer.
     231         * @param string      $return_url          Where bunq.me sends the payer after paying.
     232         * @param int|null    $monetary_account_id The receiving account, null for the default account.
     233         * @param string|null $payment_method      The only method bunq.me offers for it (bunq's name, such as "IDEAL"),
     234         *                                         null to offer all of them.
    233235         * @return array The share URL ("url"), the id ("id") and the account ("monetary_account_id") of the request.
    234236         */
    235         public function create_payment_request( $amount, $currency, $description, $return_url, $monetary_account_id = null ) {
    236                 $response = $this->request(
    237                         'POST',
    238                         $this->account_path( $monetary_account_id, 'bunqme-tab' ),
    239                         array(
    240                                 'bunqme_tab_entry' => array(
    241                                         'amount_inquired' => array(
    242                                                 'value'    => (string) $amount,
    243                                                 'currency' => $currency,
    244                                         ),
    245                                         'description'     => $description,
    246                                         'redirect_url'    => $return_url,
     237        public function create_payment_request( $amount, $currency, $description, $return_url, $monetary_account_id = null, $payment_method = null ) {
     238                $body = array(
     239                        'bunqme_tab_entry' => array(
     240                                'amount_inquired' => array(
     241                                        'value'    => (string) $amount,
     242                                        'currency' => $currency,
    247243                                ),
    248                         )
    249                 );
     244                                'description'     => $description,
     245                                'redirect_url'    => $return_url,
     246                        ),
     247                );
     248
     249                // A field of the tab itself, not of its entry (bunq rejects it there as superfluous).
     250                if ( $payment_method ) {
     251                        $body['payment_method'] = (string) $payment_method;
     252                }
     253
     254                $response = $this->request( 'POST', $this->account_path( $monetary_account_id, 'bunqme-tab' ), $body );
    250255
    251256                // Only the id comes back; the share URL is in the payment request itself.
  • pay-with-bunq-for-woocommerce/trunk/src/Gateway/Gateway.php

    r3831953 r3832026  
    10491049                        // A second attempt for the same order (the customer came back from bunq.me) reuses the open payment request,
    10501050                        // or cancels it: a payment through a forgotten request would not be matched to the order any more.
    1051                         $link = $this->get_payment_link( $order );
     1051                        $link = $this->get_payment_link( $order, $bunqme_payment_method );
    10521052
    10531053                        // The customer paid the earlier request already.
    … …  
    10591059                        }
    10601060
    1061                         // Direct gateway: bunq.me opens the chosen method straight away when it is passed as ?paymentMethod= (it
    1062                         // used to be a path segment, which bunq.me now ignores).
     1061                        // The payment request offers only the chosen method; ?paymentMethod= also makes bunq.me open it straight
     1062                        // away (it used to be a path segment, which bunq.me now ignores).
    10631063                        $redirect = $bunqme_payment_method
    10641064                                ? add_query_arg( 'paymentMethod', $bunqme_payment_method, $link['url'] )
    … …  
    10821082         * callback and the checks, and a background check as fallback for a callback that never arrives.
    10831083         *
    1084          * @param WC_Order $order The order.
     1084         * @param WC_Order    $order          The order.
     1085         * @param string|null $payment_method The only method bunq.me offers (bunq's name), null for all of them.
    10851086         * @return array The share URL ("url") and the id ("id") of the request.
    10861087         * @throws Throwable When bunq could not be reached or did not return a payment request.
    10871088         */
    1088         private function create_order_payment_request( WC_Order $order ): array {
     1089        private function create_order_payment_request( WC_Order $order, ?string $payment_method = null ): array {
    10891090                $payment_request = $this->call_bunq(
    10901091                        fn() => $this->api->create_payment_request(
    … …  
    10931094                                '#' . $order->get_order_number(),
    10941095                                $this->get_return_url( $order ),
    1095                                 $this->get_monetary_account_bank_id()
     1096                                $this->get_monetary_account_bank_id(),
     1097                                $payment_method
    10961098                        )
    10971099                );
    … …  
    11291131        /**
    11301132         * A bunq.me link the customer can pay the order with: at checkout, and for a payment link the merchant sends (see
    1131          * Orders\PaymentLink). The order's payment request is reused while it can still be paid and asks for the order
    1132          * total; otherwise it is cancelled and a new one is created.
    1133          *
    1134          * @param WC_Order $order An order that needs payment.
     1133         * Orders\PaymentLink). The order's payment request is reused while it can still be paid, asks for the order
     1134         * total and offers the same payment methods; otherwise it is cancelled and a new one is created.
     1135         *
     1136         * @param WC_Order    $order          An order that needs payment.
     1137         * @param string|null $payment_method The only method bunq.me should offer (bunq's name, such as "IDEAL"), null
     1138         *                                    for all of them.
    11351139         * @return array Keys: "url" (the bunq.me link; null when a payment already came in) and "outcome": "created",
    11361140         *               "reused", or the outcome of check_payment_status() when a payment already came in.
    11371141         * @throws Throwable When bunq could not be reached or did not return a payment request.
    11381142         */
    1139         public function get_payment_link( $order ) {
     1143        public function get_payment_link( $order, $payment_method = null ) {
    11401144                $payment_request_id = intval( $order->get_meta( self::META_PAYMENT_REQUEST_ID ) );
    11411145
    … …  
    11611165                                $amount = $payment_request['bunqme_tab_entry']['amount_inquired'] ?? null;
    11621166
     1167                                // A request limited to another method (or to one method, where all are wanted now) can't be reused.
     1168                                $offered = ! empty( $payment_request['payment_method'] ) ? (string) $payment_request['payment_method'] : null;
     1169
    11631170                                if ( ! empty( $payment_request['bunqme_tab_share_url'] ) && isset( $amount['value'], $amount['currency'] )
    11641171                                        && $amount['currency'] === $order->get_currency() && Money::amounts_match( $amount['value'], $order->get_total() )
     1172                                        && ( $payment_method ? (string) $payment_method : null ) === $offered
    11651173                                ) {
    11661174                                        return array(
    … …  
    11701178                                }
    11711179
    1172                                 // The order total changed since: the old link must not be paid any more.
     1180                                // The order total or the payment method changed since: the old link must not be paid any more.
    11731181                                $this->cancel_payment_request( $payment_request_id, $monetary_account_id );
    11741182                                $order->add_order_note(
    … …  
    11821190                }
    11831191
    1184                 $payment_request = $this->create_order_payment_request( $order );
     1192                $payment_request = $this->create_order_payment_request( $order, $payment_method ? (string) $payment_method : null );
    11851193
    11861194                return array(
  • pay-with-bunq-for-woocommerce/trunk/src/Gateway/PaymentMethods.php

    r3831953 r3832026  
    2828
    2929        /**
    30          * Every payment method. "id" is what the setting and the checkout form store (keep stable); "bunqme" is the
    31          * value bunq.me expects in its paymentMethod query parameter to open that method directly; "icon" is the logo
    32          * in assets/images (null for none).
     30         * Every payment method. "id" is what the setting and the checkout form store (keep stable); "bunqme" is bunq's
     31         * name for it: the payment_method of a payment request that offers only this method, and the value bunq.me
     32         * expects in its paymentMethod query parameter to open it directly; "icon" is the logo in assets/images (null
     33         * for none).
    3334         *
    3435         * @return array[] Keys: id, bunqme, description, icon, min, max (null for no maximum).
  • pay-with-bunq-for-woocommerce/trunk/src/Plugin.php

    r3831953 r3832026  
    3131         * The plugin version; matches the Version header of the main plugin file.
    3232         */
    33         const VERSION = '2.2.0';
     33        const VERSION = '2.3.0';
    3434
    3535        /**
  • pay-with-bunq-for-woocommerce/trunk/vendor/composer/installed.php

    r3831953 r3832026  
    22    'root' => array(
    33        'name' => '__root__',
    4         'pretty_version' => 'v2.2.0',
    5         'version' => '2.2.0.0',
    6         'reference' => 'f0a779a476606c0890c399d8e6ed080d060661f4',
     4        'pretty_version' => 'v2.3.0',
     5        'version' => '2.3.0.0',
     6        'reference' => '74b7f01aca4bafca8b64f3c90d7205e1c0537e1b',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        '__root__' => array(
    14             'pretty_version' => 'v2.2.0',
    15             'version' => '2.2.0.0',
    16             'reference' => 'f0a779a476606c0890c399d8e6ed080d060661f4',
     14            'pretty_version' => 'v2.3.0',
     15            'version' => '2.3.0.0',
     16            'reference' => '74b7f01aca4bafca8b64f3c90d7205e1c0537e1b',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.