8889841cPK[Commands/PaymentComplete.phpnu[gatewayTransactionId = $gatewayTransactionId; $this->gatewaySubscriptionId = $gatewaySubscriptionId; } } PK[ֲCommands/PaymentProcessing.phpnu[data = $data; } } PK[h(VCommands/PaymentRefunded.phpnu[gatewayTransactionId = $gatewayTransactionId; $this->gatewaySubscriptionId = $gatewaySubscriptionId; } } PK[FzWWCommands/RedirectOffsite.phpnu[redirectUrl = $redirectUrl; } } PK[iCommands/PaymentCommand.phpnu[gatewayTransactionId = $gatewayTransactionId; } /** * @since 2.22.0 add type, so it is typesafe * * @param string|string[] ...$paymentNotes * * @return $this */ public function setPaymentNotes(string ...$paymentNotes): PaymentCommand { $this->paymentNotes = $paymentNotes; return $this; } /** * @param string $gatewayTransactionId * * @return $this */ public function setTransactionId(string $gatewayTransactionId): PaymentCommand { $this->gatewayTransactionId = $gatewayTransactionId; return $this; } } PK[0B6Commands/PaymentAbandoned.phpnu[getId()}" filter * To provide payment method request data to gateway before updating payment method (filter is in recurring donations add-on). * @since 2.20.0 */ public function updateSubscriptionPaymentMethod(Subscription $subscription, $gatewayData); } PK[v}65Contracts/Subscription/SubscriptionAmountEditable.phpnu[gateways); } /** * @since 2.18.0 */ #[\ReturnTypeWillChange] public function next() { next($this->gateways); } /** * @since 2.18.0 * @return string */ #[\ReturnTypeWillChange] public function key() { return key($this->gateways); } /** * @since 2.18.0 * @return bool */ #[\ReturnTypeWillChange] public function valid() { return key($this->gateways) !== null; } /** * @since 2.18.0 */ #[\ReturnTypeWillChange] public function rewind() { reset($this->gateways); } } PK[ %Contracts/PaymentGatewayInterface.phpnu[)Contracts/SubscriptionModuleInterface.phpnu[ 'give-gateway', 'give-gateway-id' => $gatewayId, 'give-gateway-method' => $gatewayMethod, ]; if ($args) { $queryArgs = array_merge($queryArgs, $args); } return esc_url_raw(add_query_arg( $queryArgs, home_url() )); } } PK[ n n 'Actions/HandleGatewayPaymentCommand.phpnu[handle($donation); return new RedirectResponse(give_get_success_page_uri()); } if ($command instanceof PaymentProcessing) { $handler = new PaymentProcessingHandler($command); $handler->handle($donation); return new RedirectResponse(give_get_success_page_uri()); } if ($command instanceof PaymentRefunded) { $handler = new PaymentRefundedHandler($command); $handler->handle($donation); $url = isset($_REQUEST['_wp_http_referer']) ? home_url($_REQUEST['_wp_http_referer']) : home_url('/'); return new RedirectResponse($url); } if ($command instanceof RedirectOffsite) { return (new RedirectOffsiteHandler())($command); } if ($command instanceof RespondToBrowser) { return (new RespondToBrowserHandler())($command); } throw new TypeNotSupported( sprintf( "Return type must be an instance of %s", GatewayCommand::class ) ); } } PK[i1wRoutes/GatewayRoute.phpnu[isValidListener()) { /** @var PaymentGatewayRegister $paymentGatewaysRegister */ $paymentGatewaysRegister = give(PaymentGatewayRegister::class); // get all registered gateways $paymentGateways = $paymentGatewaysRegister->getPaymentGateways(); // get all registered gateway ids $gatewayIds = array_keys($paymentGateways); // make sure required params are valid if (!$this->isValidRequest($gatewayIds)) { throw new PaymentGatewayException('This route is not valid.'); } // create DTO from GET request $data = GatewayRouteData::fromRequest(give_clean($_GET)); /** * Get the PaymentGateway instance * * @var PaymentGateway $gateway */ $gateway = give($paymentGateways[$data->gatewayId]); if (!$gateway->supportsMethodRoute($data->gatewayMethod)) { throw new PaymentGatewayException('The gateway method does not exist.'); } // If method is in secureRouteMethods then, validate signature if (in_array($data->gatewayMethod, $gateway->secureRouteMethods, true)) { $this->validateSignature($data->routeSignature, $data); } // Navigate to our payment gateway api to handle calling the gateway's method $this->handleGatewayRouteMethod($gateway, $data->gatewayMethod, $data->queryParams); exit; } } /** * Check if the request is valid * * @since 2.19.0 remove required check give-donation-id * * @since 2.18.0 * * @param array $gatewayIds * * @return bool * * @example ?give-listener=give-gateway&give-gateway-id=test-gateway&give-donation-id=1&give-gateway-method=returnFromOffsiteRedirect * */ private function isValidRequest($gatewayIds) { $isset = isset($_GET['give-gateway-id'], $_GET['give-gateway-method']); $idValid = in_array($_GET['give-gateway-id'], $gatewayIds, true); return $isset && $idValid; } /** * Check if the listener is valid * * @since 2.18.0 * * @return bool */ private function isValidListener() { return isset($_GET['give-listener']) && $_GET['give-listener'] === 'give-gateway'; } /** * Validate signature using nonces * * @since 2.19.5 replace nonce with hash * @since 2.19.4 replace RouteSignature args with unique donationId * @since 2.19.0 * * @param string $routeSignature * @param GatewayRouteData $data * * @return void */ private function validateSignature($routeSignature, GatewayRouteData $data) { $signature = new RouteSignature( $data->gatewayId, $data->gatewayMethod, $data->routeSignatureId, $data->routeSignatureExpiration ); if (!$signature->isValid($routeSignature)) { PaymentGatewayLog::error( 'Invalid Secure Route', [ 'routeSignature' => $routeSignature, 'signature' => $signature, 'signatureString' => $signature->toString(), 'signatureHash' => $signature->toHash(), 'signatureExpiration' => $signature->expiration, 'data' => $data ] ); wp_die('Forbidden', 403); } } /** * Handle gateway route method * * @since 2.18.0 * * @since 2.19.0 - replace $donationId with $queryParams array * @since 2.19.0 Record gateway id, callback method name and query params in log. * * @param PaymentGateway $gateway * @param string $method * @param array $queryParams */ private function handleGatewayRouteMethod(PaymentGateway $gateway, $method, $queryParams) { try { $this->handleResponse($gateway->callRouteMethod($method, $queryParams)); } catch (PaymentGatewayException $paymentGatewayException) { $this->handleResponse(response()->json($paymentGatewayException->getMessage())); } catch (\Exception $exception) { PaymentGatewayLog::error( $exception->getMessage(), [ 'Payment Gateway' => $gateway::id(), 'Payment Gateway Method' => $method, 'Query Params' => $queryParams ] ); $this->handleResponse( response()->json( __( 'An unexpected error occurred while processing your donation. Please try again or contact us to help resolve.', 'give' ) ) ); } } } PK[ym  Routes/RouteSignature.phpnu[expiration = $expiration ?: $this->createExpirationTimestamp(); $this->signature = $this->generateSignatureString($gatewayId, $gatewayMethod, $donationId, $this->expiration); } /** * @since 2.19.5 * * @param string $gatewayId * @param string $gatewayMethod * @param int $donationId * @param string $expiration * @return string */ private function generateSignatureString($gatewayId, $gatewayMethod, $donationId, $expiration) { return "$gatewayId@$gatewayMethod:$donationId|$expiration"; } /** * @since 2.19.0 * * @return string */ public function toString() { return $this->signature; } /** * @since 2.19.5 * * @return string */ public function toHash() { return wp_hash($this->signature); } /** * Create expiration timestamp * * @since 2.19.5 * * @return string */ public function createExpirationTimestamp() { return (string)current_datetime()->modify('+1 day')->getTimestamp(); } /** * @since 2.19.5 * * @param string $suppliedSignature * @return bool */ public function isValid($suppliedSignature) { $isSignatureValid = hash_equals( $suppliedSignature, $this->toHash() ); $isNotExpired = ((int)$this->expiration) >= current_datetime()->getTimestamp(); return $isSignatureValid && $isNotExpired; } } PK[^\88*CommandHandlers/PaymentCompleteHandler.phpnu[status = DonationStatus::COMPLETE(); $donation->gatewayTransactionId = $subscriptionComplete->gatewayTransactionId; $donation->save(); $subscription->status = SubscriptionStatus::ACTIVE(); $subscription->gatewaySubscriptionId = $subscriptionComplete->gatewaySubscriptionId; $subscription->transactionId = $subscriptionComplete->gatewayTransactionId; $subscription->save(); } } PK[Ρ66*CommandHandlers/PaymentRefundedHandler.phpnu[json($command->data); } } PK[5A"CommandHandlers/PaymentHandler.phpnu[paymentCommand = $paymentCommand; } /** * @since 2.18.0 */ public static function make(PaymentCommand $paymentCommand): PaymentHandler { return new static($paymentCommand); } /** * @since 2.21.0 replace $donationId with Donation model * @since 2.18.0 * * @throws Exception */ public function handle(Donation $donation) { $donation->status = $this->getPaymentStatus(); $donation->gatewayTransactionId = $this->paymentCommand->gatewayTransactionId; $donation->save(); foreach ($this->paymentCommand->paymentNotes as $paymentNote) { DonationNote::create([ 'donationId' => $donation->id, 'content' => $paymentNote ]); } } } PK[ 1CommandHandlers/SubscriptionProcessingHandler.phpnu[subscriptionComplete = $subscriptionComplete; $this->subscription = $subscription; $this->donation = $donation; } /** * @since 2.23.2 * @return void * @throws Exception */ public function __invoke() { $this->donation->status = DonationStatus::PROCESSING(); $this->subscription->status = SubscriptionStatus::PENDING(); $this->subscription->gatewaySubscriptionId = $this->subscriptionComplete->gatewaySubscriptionId; // Only save no-empty gateway transaction ids. if ($this->subscriptionComplete->gatewayTransactionId) { $this->donation->gatewayTransactionId = $this->subscriptionComplete->gatewayTransactionId; $this->subscription->transactionId = $this->subscriptionComplete->gatewayTransactionId; } $this->donation->save(); $this->subscription->save(); } } PK[V*CommandHandlers/RedirectOffsiteHandler.phpnu[redirectTo($command->redirectUrl); } } PK[+Traits/HasRouteMethods.phpnu[routeMethods, $this->secureRouteMethods); return in_array($method, $allGatewayMethods, true); } /** * @since 2.20.0 * * @param string $method * * @throws Exception */ public function callRouteMethod($method, $queryParams) { if ($this->supportsMethodRoute($method)) { return $this->$method($queryParams); } throw new PaymentGatewayException( sprintf( '%1$s route method is not supported by %2$s and %3$s', $method, get_class($this), get_class($this->subscriptionModule) ) ); } } PK[0\Traits/HandleHttpResponses.phpnu[ 'redirect', 'data' => [ 'redirectUrl' => $type->getTargetUrl() ] ]); } wp_redirect($type->getTargetUrl()); exit; } if ($type instanceof JsonResponse) { wp_send_json(['data' => $type->getData()]); } } /** * Handle response on basis of request mode when exception occurs: * 1. Redirect to donation form if donation form submit. * 2. Return json response if processing payment on ajax. * * @since 2.21.0 Handle PHP exception. * @since 2.19.0 */ public function handleExceptionResponse(\Exception $exception, string $message) { if ($exception instanceof PaymentGatewayException) { $message = $exception->getMessage(); } if (wp_doing_ajax()) { $response = new JsonResponse($message); $this->handleResponse($response); } give_set_error('PaymentGatewayException', $message); give_send_back_to_checkout(); } } PK[ Exceptions/OverflowException.phpnu[gateway = $gateway; } /** * @since 2.27.0 */ public function create(Donation $donation, Subscription $subscription, array $gatewayData = []) { try { $command = $this->gateway->createSubscription($donation, $subscription, $gatewayData); $this->handleGatewayCommand($command, $donation, $subscription); } catch (\Exception $exception) { PaymentGatewayLog::error( $exception->getMessage(), [ 'Payment Gateway' => $this->gateway::id(), 'Donation' => $donation->toArray(), 'Subscription' => $subscription->toArray(), ] ); $message = __( 'An unexpected error occurred while processing the subscription. Please try again or contact the site administrator.', 'give' ); $this->handleExceptionResponse($exception, $message); } } /** * Handle gateway subscription command * * @since 2.27.0 move logic into action * @since 2.26.0 add RespondToBrowser command * @since 2.21.0 Handle RedirectOffsite response. * @since 2.18.0 * * @throws TypeNotSupported * @throws Exception */ public function handleGatewayCommand( GatewayCommand $command, Donation $donation, Subscription $subscription ) { $response = (new HandleGatewaySubscriptionCommand())($command, $donation, $subscription); $this->handleResponse($response); } } PK[XKw w (Controllers/GatewayPaymentController.phpnu[gateway = $gateway; } /** * @since 2.27.0 */ public function create(Donation $donation, array $gatewayData = []) { try { $command = $this->gateway->createPayment($donation, $gatewayData); $this->handleGatewayCommand($command, $donation); } catch (\Exception $exception) { PaymentGatewayLog::error( $exception->getMessage(), [ 'Payment Gateway' => $this->gateway::id(), 'Donation' => $donation->toArray(), ] ); $message = __( 'An unexpected error occurred while processing the donation. Please try again or contact a site administrator.', 'give' ); $this->handleExceptionResponse($exception, $message); } } /** * @since 2.29.0 */ public function refund(Donation $donation) { try { $command = $this->gateway->refundDonation($donation); if ($command instanceof GatewayCommand) { $this->handleGatewayCommand($command, $donation); } } catch (\Exception $exception) { PaymentGatewayLog::error( $exception->getMessage(), [ 'Payment Gateway' => $this->gateway::id(), 'Donation' => $donation->toArray(), ] ); $message = __( 'An unexpected error occurred while refunding the donation. Please try again or contact a site administrator.', 'give' ); $this->handleExceptionResponse($exception, $message); } } /** * Handle gateway command * * @since 2.27.0 move logic into action * @since 2.18.0 * * @throws TypeNotSupported * @throws Exception */ protected function handleGatewayCommand(GatewayCommand $command, Donation $donation) { $response = (new HandleGatewayPaymentCommand())($command, $donation); $this->handleResponse($response); } } PK[_8??SubscriptionModule.phpnu[gateway = $gateway; } /** * @inheritDoc */ public function canSyncSubscriptionWithPaymentGateway(): bool { return $this instanceof SubscriptionTransactionsSynchronizable; } /** * @inheritDoc */ public function canUpdateSubscriptionAmount(): bool { return $this instanceof SubscriptionAmountEditable; } /** * @inheritDoc */ public function canUpdateSubscriptionPaymentMethod(): bool { return $this instanceof SubscriptionPaymentMethodEditable; } /** * @since 2.21.2 */ public function hasGatewayDashboardSubscriptionUrl(): bool { return $this instanceof SubscriptionDashboardLinkable; } } PK[(DataTransferObjects/GatewayRouteData.phpnu[gatewayId = $request['give-gateway-id']; $self->gatewayMethod = $request['give-gateway-method']; $self->routeSignature = isset($request['give-route-signature']) ? $request['give-route-signature'] : null; $self->routeSignatureId = isset($request['give-route-signature-id']) ? $request['give-route-signature-id'] : null; $self->routeSignatureExpiration = isset($request['give-route-signature-expiration']) ? $request['give-route-signature-expiration'] : null; $self->queryParams = array_filter($request, static function ($param) { return ! in_array( $param, [ 'give-listener', 'give-gateway-id', 'give-gateway-method', 'give-route-signature', 'give-route-signature-id', 'give-route-signature-expiration', ] ); }, ARRAY_FILTER_USE_KEY); return $self; } } PK["uk(k(PaymentGateway.phpnu[setGateway($this); } $this->subscriptionModule = $subscriptionModule; } /** * @since 2.30.0 */ public function supportsFormVersions(): array { $versions = []; if (method_exists($this, 'getLegacyFormFieldMarkup') && $this->isFunctionImplementedInGatewayClass( 'getLegacyFormFieldMarkup' )) { $versions[] = 2; } if (method_exists($this, 'enqueueScript') && $this->isFunctionImplementedInGatewayClass('enqueueScript')) { $versions[] = 3; } return $versions; } /** * Enqueue gateway scripts using WordPress wp_enqueue_script(). * * @since 2.30.0 * * @return void */ public function enqueueScript(int $formId) { //wp_enqueue_scripts(); } /** * Convenient way of localizing data to the JS gateway object accessible from `this.settings`. * * @since 2.30.0 */ public function formSettings(int $formId): array { return []; } /** * @inheritDoc * * @since 2.29.0 */ public function supportsRefund(): bool { return $this->isFunctionImplementedInGatewayClass('refundDonation'); } /** * @inheritDoc */ public function supportsSubscriptions(): bool { return isset($this->subscriptionModule) || $this->isFunctionImplementedInGatewayClass('createSubscription'); } /** * If a subscription module isn't wanted this method can be overridden by a child class instead. * Just make sure to override the supportsSubscriptions method as well. * * @inheritDoc */ public function createSubscription( Donation $donation, Subscription $subscription, $gatewayData ) { return $this->subscriptionModule->createSubscription($donation, $subscription, $gatewayData); } /** * @inheritDoc */ public function cancelSubscription(Subscription $subscription) { $this->subscriptionModule->cancelSubscription($subscription); } /** * @since 2.21.2 * @inheritDoc */ public function canSyncSubscriptionWithPaymentGateway(): bool { if ($this->subscriptionModule) { return $this->subscriptionModule->canSyncSubscriptionWithPaymentGateway(); } return $this->isFunctionImplementedInGatewayClass('synchronizeSubscription'); } /** * @since 2.21.2 * @inheritDoc */ public function canUpdateSubscriptionAmount(): bool { if ($this->subscriptionModule) { return $this->subscriptionModule->canUpdateSubscriptionAmount(); } return $this->isFunctionImplementedInGatewayClass('updateSubscriptionAmount'); } /** * @since 2.21.2 * @inheritDoc */ public function canUpdateSubscriptionPaymentMethod(): bool { if ($this->subscriptionModule) { return $this->subscriptionModule->canUpdateSubscriptionPaymentMethod(); } return $this->isFunctionImplementedInGatewayClass('updateSubscriptionPaymentMethod'); } /** * @since 2.25.0 update return logic * @since 2.21.2 */ public function hasGatewayDashboardSubscriptionUrl(): bool { if ($this->subscriptionModule) { return $this->subscriptionModule->hasGatewayDashboardSubscriptionUrl(); } return $this->isFunctionImplementedInGatewayClass('gatewayDashboardSubscriptionUrl'); } /** * @since 2.21.2 * @inheritDoc * @throws Exception */ public function synchronizeSubscription(Subscription $subscription) { if ($this->subscriptionModule instanceof SubscriptionTransactionsSynchronizable) { $this->subscriptionModule->synchronizeSubscription($subscription); return; } throw new Exception('Gateway does not support syncing subscriptions.'); } /** * @since 2.21.2 * @inheritDoc * @throws Exception */ public function updateSubscriptionAmount(Subscription $subscription, Money $newRenewalAmount) { if ($this->subscriptionModule instanceof SubscriptionAmountEditable) { $this->subscriptionModule->updateSubscriptionAmount($subscription, $newRenewalAmount); return; } throw new Exception('Gateway does not support updating the subscription amount.'); } /** * @since 2.21.2 * @inheritDoc * @throws Exception */ public function updateSubscriptionPaymentMethod(Subscription $subscription, $gatewayData) { if ($this->subscriptionModule instanceof SubscriptionPaymentMethodEditable) { $this->subscriptionModule->updateSubscriptionPaymentMethod($subscription, $gatewayData); return; } throw new Exception('Gateway does not support updating the subscription payment method.'); } /** * @since 2.21.2 * @inheritDoc */ public function gatewayDashboardSubscriptionUrl(Subscription $subscription): string { if ($this->subscriptionModule instanceof SubscriptionDashboardLinkable) { return $this->subscriptionModule->gatewayDashboardSubscriptionUrl($subscription); } return false; } /** * Generate gateway route url * * @since 2.18.0 * @since 2.19.0 remove $donationId param in favor of args */ public function generateGatewayRouteUrl(string $gatewayMethod, array $args = []): string { return (new GenerateGatewayRouteUrl())(static::id(), $gatewayMethod, $args); } /** * Generate secure gateway route url * * @since 2.19.5 replace nonce with hash and expiration * @since 2.19.4 replace RouteSignature args with unique donationId * @since 2.19.0 */ public function generateSecureGatewayRouteUrl(string $gatewayMethod, int $donationId, array $args = []): string { $signature = new RouteSignature(static::id(), $gatewayMethod, $donationId); return (new GenerateGatewayRouteUrl())( static::id(), $gatewayMethod, array_merge($args, [ 'give-route-signature' => $signature->toHash(), 'give-route-signature-id' => $donationId, 'give-route-signature-expiration' => $signature->expiration, ]) ); } /** * @since 2.20.0 */ public function supportsMethodRoute(string $method): bool { if ($this->subscriptionModule && $this->subscriptionModule->supportsMethodRoute($method)) { return true; } return $this->supportsOwnMethodRoute($method); } /** * @since 2.20.0 * * @param string $method * * @throws Exception */ public function callRouteMethod($method, $queryParams) { if ($this->subscriptionModule && $this->subscriptionModule->supportsMethodRoute($method)) { return $this->subscriptionModule->callRouteMethod($method, $queryParams); } return $this->callOwnRouteMethod($method, $queryParams); } /** * Checks to see if the provided method is being used by the child gateway class. This is used as a helper in the "can" methods * to see if the gateway is implementing a recurring feature without using a subscription module. * * @since 2.21.2 */ private function isFunctionImplementedInGatewayClass(string $methodName): bool { try { $reflector = new ReflectionMethod($this, $methodName); } catch (ReflectionException $e) { Log::error( sprintf( 'ReflectionException thrown when trying to check if %s::%s is implemented in the gateway class.', static::id(), $methodName ), [ 'exception' => $e, ] ); return false; } return ($reflector->getDeclaringClass()->getName() === get_class($this)); } } PK[H PaymentGatewayRegister.phpnu[gateways; } return array_filter($this->gateways, static function (string $gatewayClass) use ($supportedFormVersion) { /** @var PaymentGateway $gateway */ $gateway = give($gatewayClass); return in_array($supportedFormVersion, $gateway->supportsFormVersions(), true); }); } /** * Get Gateway * * @since 2.18.0 */ public function getPaymentGateway(string $id): PaymentGateway { if (!$this->hasPaymentGateway($id)) { throw new InvalidArgumentException("No gateway exists with the ID {$id}"); } /** @var PaymentGateway $gateway */ $gateway = give($this->gateways[$id]); return $gateway; } /** * @since 2.18.0 */ public function hasPaymentGateway(string $id): bool { return isset($this->gateways[$id]); } /** * Register Gateway * * @since 2.18.0 * * @throws OverflowException|InvalidArgumentException|Exception */ public function registerGateway(string $gatewayClass) { if (!is_subclass_of($gatewayClass, PaymentGateway::class)) { throw new InvalidArgumentException( sprintf( '%1$s must extend %2$s', $gatewayClass, PaymentGateway::class ) ); } $gatewayId = $gatewayClass::id(); if ($this->hasPaymentGateway($gatewayId)) { throw new OverflowException("Cannot register a gateway with an id that already exists: $gatewayId"); } $this->gateways[$gatewayId] = $gatewayClass; $this->registerGatewayWithServiceContainer($gatewayClass, $gatewayId); } /** * Unregister Gateway * * @since 2.18.0 * * @param $gatewayId */ public function unregisterGateway($gatewayId) { if (isset($this->gateways[$gatewayId])) { unset($this->gateways[$gatewayId]); } } /** * * Register Gateway with Service Container as Singleton * with option of adding Subscription Module through filter "give_gateway_{$gatewayId}_subscription_module" * * @since 2.18.0 * * @return void */ private function registerGatewayWithServiceContainer(string $gatewayClass, string $gatewayId) { give()->singleton($gatewayClass, function (Container $container) use ($gatewayClass, $gatewayId) { $subscriptionModule = apply_filters("givewp_gateway_{$gatewayId}_subscription_module", null); return new $gatewayClass($subscriptionModule ? $container->make($subscriptionModule) : null); }); } } PK[[444Log/PaymentGatewayLog.phpnu[gateway()->getName(); } parent::__callStatic($name, $arguments); } } PK[a a DonationSummary.phpnu[donation = $donation; } /** * @since 2.19.0 * * @param int $length */ public function setLength(int $length) { $this->length = $length; } /** * @since 2.19.0 * * @return string */ public function getSummaryWithDonor(): string { return $this->trim( implode(' - ', [ $this->getSummary(), $this->getDonorLabel(), ]) ); } /** * @since 2.19.0 * * @return string */ public function getSummary(): string { return $this->trimAndFilter( implode( ': ', array_filter([ $this->getLabel(), $this->getPriceLabel(), ]) ) ); } /** * @since 2.19.0 * * @return string */ protected function getLabel(): string { $formId = give_get_payment_form_id($this->donation->id); $formTitle = get_the_title($formId); return $formTitle ?: sprintf(__('Donation Form ID: %d', 'give'), $formId); } /** * @since 2.19.0 * @return string */ protected function getPriceLabel(): string { $priceId = $this->donation->levelId; return is_numeric($priceId) ? give_get_price_option_name($this->donation->formId, $this->donation->levelId) : ''; } /** * @since 2.19.0 */ protected function getDonorLabel(): string { return sprintf( '%s %s (%s)', $this->donation->firstName, $this->donation->lastName, $this->donation->email ); } /** * @since 2.19.0 * * @param string $text * * @return string */ protected function trimAndFilter(string $text): string { /** * @since 2.25.0 Re-use trim method for text. * @since 1.8.12 */ return apply_filters('give_payment_gateway_donation_summary', $this->trim($text)); } /** * @since 2.25.0 * * @param string $text * * @return string */ protected function trim(string $text): string { return substr($text, 0, $this->length); } } PK[Commands/PaymentComplete.phpnu[PK[RDDwrrCommands/GatewayCommand.phpnu[PK[k'!Commands/SubscriptionComplete.phpnu[PK[ֲmCommands/PaymentProcessing.phpnu[PK[sPAABCommands/RespondToBrowser.phpnu[PK[h(VCommands/PaymentRefunded.phpnu[PK[+f#Commands/SubscriptionProcessing.phpnu[PK[FzWW Commands/RedirectOffsite.phpnu[PK[iD Commands/PaymentCommand.phpnu[PK[0B6Commands/PaymentAbandoned.phpnu[PK[0 <iContracts/Subscription/SubscriptionPaymentMethodEditable.phpnu[PK[v}65Contracts/Subscription/SubscriptionAmountEditable.phpnu[PK[)LAContracts/Subscription/SubscriptionTransactionsSynchronizable.phpnu[PK[- 998Contracts/Subscription/SubscriptionDashboardLinkable.phpnu[PK[B)%Contracts/PaymentGatewaysIterator.phpnu[PK[ % Contracts/PaymentGatewayInterface.phpnu[PK[>),Contracts/SubscriptionModuleInterface.phpnu[PK["M M ,3Actions/HandleGatewaySubscriptionCommand.phpnu[PK[y`,,#5=Actions/GenerateGatewayRouteUrl.phpnu[PK[ n n '@Actions/HandleGatewayPaymentCommand.phpnu[PK[i1wyKRoutes/GatewayRoute.phpnu[PK[ym  bRoutes/RouteSignature.phpnu[PK[^\88*kCommandHandlers/PaymentCompleteHandler.phpnu[PK[2ffq;;+^nCommandHandlers/PaymentAbandonedHandler.phpnu[PK[;