Changeset 3832026
- Timestamp:
- 11/28/2026 07:04:26 PM (less than one hour ago)
- Location:
- pay-with-bunq-for-woocommerce
- Files:
-
- 18 edited
- 1 copied
-
assets/banner-1544x500.png (modified) ( previous)
-
assets/banner-772x250.png (modified) ( previous)
-
assets/icon-128x128.png (modified) ( previous)
-
assets/icon-256x256.png (modified) ( previous)
-
tags/2.3.0 (copied) (copied from pay-with-bunq-for-woocommerce/trunk )
-
tags/2.3.0/pay-with-bunq-for-woocommerce.php (modified) (1 diff)
-
tags/2.3.0/readme.txt (modified) (3 diffs)
-
tags/2.3.0/src/Bunq/ApiClient.php (modified) (1 diff)
-
tags/2.3.0/src/Gateway/Gateway.php (modified) (8 diffs)
-
tags/2.3.0/src/Gateway/PaymentMethods.php (modified) (1 diff)
-
tags/2.3.0/src/Plugin.php (modified) (1 diff)
-
tags/2.3.0/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/pay-with-bunq-for-woocommerce.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/Bunq/ApiClient.php (modified) (1 diff)
-
trunk/src/Gateway/Gateway.php (modified) (8 diffs)
-
trunk/src/Gateway/PaymentMethods.php (modified) (1 diff)
-
trunk/src/Plugin.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pay-with-bunq-for-woocommerce/tags/2.3.0/pay-with-bunq-for-woocommerce.php
r3831953 r3832026 3 3 * Plugin Name: Pay with bunq for WooCommerce 4 4 * Description: Accept payments in your WooCommerce shop with just your bunq account. 5 * Version: 2. 2.05 * Version: 2.3.0 6 6 * Author: Patrick Kivits 7 7 * Author URI: https://www.patrickkivits.nl -
pay-with-bunq-for-woocommerce/tags/2.3.0/readme.txt
r3831953 r3832026 6 6 Tested up to: 7.1 7 7 Requires PHP: 8.1 8 Stable tag: 2. 2.08 Stable tag: 2.3.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 139 139 == Changelog == 140 140 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 141 145 = 2.2.0 = 142 146 * 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. … … 250 254 == Upgrade Notice == 251 255 256 = 2.3.0 = 257 bunq.me now offers only the payment method the customer chose at checkout. No need to connect again. 258 252 259 = 2.2.0 = 253 260 Uses 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 226 226 * Create a bunq.me payment request. 227 227 * 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. 233 235 * @return array The share URL ("url"), the id ("id") and the account ("monetary_account_id") of the request. 234 236 */ 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, 247 243 ), 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 ); 250 255 251 256 // 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 1049 1049 // A second attempt for the same order (the customer came back from bunq.me) reuses the open payment request, 1050 1050 // 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 ); 1052 1052 1053 1053 // The customer paid the earlier request already. … … 1059 1059 } 1060 1060 1061 // Direct gateway: bunq.me opens the chosen method straight away when it is passed as ?paymentMethod= (it1062 // 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). 1063 1063 $redirect = $bunqme_payment_method 1064 1064 ? add_query_arg( 'paymentMethod', $bunqme_payment_method, $link['url'] ) … … 1082 1082 * callback and the checks, and a background check as fallback for a callback that never arrives. 1083 1083 * 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. 1085 1086 * @return array The share URL ("url") and the id ("id") of the request. 1086 1087 * @throws Throwable When bunq could not be reached or did not return a payment request. 1087 1088 */ 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 { 1089 1090 $payment_request = $this->call_bunq( 1090 1091 fn() => $this->api->create_payment_request( … … 1093 1094 '#' . $order->get_order_number(), 1094 1095 $this->get_return_url( $order ), 1095 $this->get_monetary_account_bank_id() 1096 $this->get_monetary_account_bank_id(), 1097 $payment_method 1096 1098 ) 1097 1099 ); … … 1129 1131 /** 1130 1132 * 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. 1135 1139 * @return array Keys: "url" (the bunq.me link; null when a payment already came in) and "outcome": "created", 1136 1140 * "reused", or the outcome of check_payment_status() when a payment already came in. 1137 1141 * @throws Throwable When bunq could not be reached or did not return a payment request. 1138 1142 */ 1139 public function get_payment_link( $order ) {1143 public function get_payment_link( $order, $payment_method = null ) { 1140 1144 $payment_request_id = intval( $order->get_meta( self::META_PAYMENT_REQUEST_ID ) ); 1141 1145 … … 1161 1165 $amount = $payment_request['bunqme_tab_entry']['amount_inquired'] ?? null; 1162 1166 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 1163 1170 if ( ! empty( $payment_request['bunqme_tab_share_url'] ) && isset( $amount['value'], $amount['currency'] ) 1164 1171 && $amount['currency'] === $order->get_currency() && Money::amounts_match( $amount['value'], $order->get_total() ) 1172 && ( $payment_method ? (string) $payment_method : null ) === $offered 1165 1173 ) { 1166 1174 return array( … … 1170 1178 } 1171 1179 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. 1173 1181 $this->cancel_payment_request( $payment_request_id, $monetary_account_id ); 1174 1182 $order->add_order_note( … … 1182 1190 } 1183 1191 1184 $payment_request = $this->create_order_payment_request( $order );1192 $payment_request = $this->create_order_payment_request( $order, $payment_method ? (string) $payment_method : null ); 1185 1193 1186 1194 return array( -
pay-with-bunq-for-woocommerce/tags/2.3.0/src/Gateway/PaymentMethods.php
r3831953 r3832026 28 28 29 29 /** 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). 33 34 * 34 35 * @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 31 31 * The plugin version; matches the Version header of the main plugin file. 32 32 */ 33 const VERSION = '2. 2.0';33 const VERSION = '2.3.0'; 34 34 35 35 /** -
pay-with-bunq-for-woocommerce/tags/2.3.0/vendor/composer/installed.php
r3831953 r3832026 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '__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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
pay-with-bunq-for-woocommerce/trunk/pay-with-bunq-for-woocommerce.php
r3831953 r3832026 3 3 * Plugin Name: Pay with bunq for WooCommerce 4 4 * Description: Accept payments in your WooCommerce shop with just your bunq account. 5 * Version: 2. 2.05 * Version: 2.3.0 6 6 * Author: Patrick Kivits 7 7 * Author URI: https://www.patrickkivits.nl -
pay-with-bunq-for-woocommerce/trunk/readme.txt
r3831953 r3832026 6 6 Tested up to: 7.1 7 7 Requires PHP: 8.1 8 Stable tag: 2. 2.08 Stable tag: 2.3.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 139 139 == Changelog == 140 140 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 141 145 = 2.2.0 = 142 146 * 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. … … 250 254 == Upgrade Notice == 251 255 256 = 2.3.0 = 257 bunq.me now offers only the payment method the customer chose at checkout. No need to connect again. 258 252 259 = 2.2.0 = 253 260 Uses 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 226 226 * Create a bunq.me payment request. 227 227 * 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. 233 235 * @return array The share URL ("url"), the id ("id") and the account ("monetary_account_id") of the request. 234 236 */ 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, 247 243 ), 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 ); 250 255 251 256 // 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 1049 1049 // A second attempt for the same order (the customer came back from bunq.me) reuses the open payment request, 1050 1050 // 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 ); 1052 1052 1053 1053 // The customer paid the earlier request already. … … 1059 1059 } 1060 1060 1061 // Direct gateway: bunq.me opens the chosen method straight away when it is passed as ?paymentMethod= (it1062 // 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). 1063 1063 $redirect = $bunqme_payment_method 1064 1064 ? add_query_arg( 'paymentMethod', $bunqme_payment_method, $link['url'] ) … … 1082 1082 * callback and the checks, and a background check as fallback for a callback that never arrives. 1083 1083 * 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. 1085 1086 * @return array The share URL ("url") and the id ("id") of the request. 1086 1087 * @throws Throwable When bunq could not be reached or did not return a payment request. 1087 1088 */ 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 { 1089 1090 $payment_request = $this->call_bunq( 1090 1091 fn() => $this->api->create_payment_request( … … 1093 1094 '#' . $order->get_order_number(), 1094 1095 $this->get_return_url( $order ), 1095 $this->get_monetary_account_bank_id() 1096 $this->get_monetary_account_bank_id(), 1097 $payment_method 1096 1098 ) 1097 1099 ); … … 1129 1131 /** 1130 1132 * 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. 1135 1139 * @return array Keys: "url" (the bunq.me link; null when a payment already came in) and "outcome": "created", 1136 1140 * "reused", or the outcome of check_payment_status() when a payment already came in. 1137 1141 * @throws Throwable When bunq could not be reached or did not return a payment request. 1138 1142 */ 1139 public function get_payment_link( $order ) {1143 public function get_payment_link( $order, $payment_method = null ) { 1140 1144 $payment_request_id = intval( $order->get_meta( self::META_PAYMENT_REQUEST_ID ) ); 1141 1145 … … 1161 1165 $amount = $payment_request['bunqme_tab_entry']['amount_inquired'] ?? null; 1162 1166 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 1163 1170 if ( ! empty( $payment_request['bunqme_tab_share_url'] ) && isset( $amount['value'], $amount['currency'] ) 1164 1171 && $amount['currency'] === $order->get_currency() && Money::amounts_match( $amount['value'], $order->get_total() ) 1172 && ( $payment_method ? (string) $payment_method : null ) === $offered 1165 1173 ) { 1166 1174 return array( … … 1170 1178 } 1171 1179 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. 1173 1181 $this->cancel_payment_request( $payment_request_id, $monetary_account_id ); 1174 1182 $order->add_order_note( … … 1182 1190 } 1183 1191 1184 $payment_request = $this->create_order_payment_request( $order );1192 $payment_request = $this->create_order_payment_request( $order, $payment_method ? (string) $payment_method : null ); 1185 1193 1186 1194 return array( -
pay-with-bunq-for-woocommerce/trunk/src/Gateway/PaymentMethods.php
r3831953 r3832026 28 28 29 29 /** 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). 33 34 * 34 35 * @return array[] Keys: id, bunqme, description, icon, min, max (null for no maximum). -
pay-with-bunq-for-woocommerce/trunk/src/Plugin.php
r3831953 r3832026 31 31 * The plugin version; matches the Version header of the main plugin file. 32 32 */ 33 const VERSION = '2. 2.0';33 const VERSION = '2.3.0'; 34 34 35 35 /** -
pay-with-bunq-for-woocommerce/trunk/vendor/composer/installed.php
r3831953 r3832026 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '__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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note:
See TracChangeset
for help on using the changeset viewer.