PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | src/Framework/PaymentGateways/PaymentGateway.php +10 -2 4.16.3 → 4.17.0 View file →
@@ -12,8 +12,9 @@
12 12 use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionPausable;
13 13 use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionPaymentMethodEditable;
14 14 use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionTransactionsSynchronizable;
15 15 use Give\Framework\PaymentGateways\Contracts\WebhookNotificationsListener;
16 +use Give\Framework\PaymentGateways\DataTransferObjects\GatewayRouteData;
16 17 use Give\Framework\PaymentGateways\Routes\RouteSignature;
17 18 use Give\Framework\PaymentGateways\Traits\HandleHttpResponses;
18 19 use Give\Framework\PaymentGateways\Traits\HasRouteMethods;
19 20 use Give\Framework\PaymentGateways\Webhooks\Webhook;
@@ -353,8 +354,10 @@
353 354
354 355 /**
355 356 * Generate secure gateway route url
356 357 *
358 + * @since 4.16.8 put the signed values on the URL encoded, so a raw value with an ampersand round-trips
359 + * @since 4.16.8 cover $args with the signature
357 360 * @since 2.19.5 replace nonce with hash and expiration
358 361 * @since 2.19.4 replace RouteSignature args with unique donationId
359 362 * @since 2.19.0
360 363 */
@@ -359,17 +362,22 @@
359 362 * @since 2.19.0
360 363 */
361 364 public function generateSecureGatewayRouteUrl(string $gatewayMethod, int $donationId, array $args = []): string
362 365 {
363 - $signature = new RouteSignature(static::id(), $gatewayMethod, $donationId);
366 + $args = RouteSignature::normalizeArgs(array_diff_key($args, array_flip(GatewayRouteData::ROUTE_PARAMS)));
364 367
368 + $signature = new RouteSignature(static::id(), $gatewayMethod, $donationId, null, $args);
369 +
365 370 return (new GenerateGatewayRouteUrl())(
366 371 static::id(),
367 372 $gatewayMethod,
368 - array_merge($args, [
373 + array_merge(RouteSignature::encodeArgs($args), [
369 374 'give-route-signature' => $signature->toHash(),
370 375 'give-route-signature-id' => $donationId,
371 376 'give-route-signature-expiration' => $signature->expiration,
377 + // Named here so the route knows which args to rebuild the signature from, and so a gateway
378 + // appending its own on the way back does not break it. The list is itself signed.
379 + 'give-route-signature-args' => implode(',', $signature->argKeys),
372 380 ])
373 381 );
374 382 }
375 383