Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-full-stripe-free/includes/stripe/autoload.php
+++ b/wp-full-stripe-free/includes/stripe/autoload.php
@@ -19,4 +19,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit840fe74f29f6cd297d98a99da192e3d3::getLoader();
+return ComposerAutoloaderInitc2a3e3257fb8e8457f74c3c5190d3222::getLoader();
--- a/wp-full-stripe-free/includes/stripe/composer/autoload_real.php
+++ b/wp-full-stripe-free/includes/stripe/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit840fe74f29f6cd297d98a99da192e3d3
+class ComposerAutoloaderInitc2a3e3257fb8e8457f74c3c5190d3222
{
private static $loader;
@@ -24,12 +24,12 @@
require __DIR__ . '/platform_check.php';
- spl_autoload_register(array('ComposerAutoloaderInit840fe74f29f6cd297d98a99da192e3d3', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInitc2a3e3257fb8e8457f74c3c5190d3222', 'loadClassLoader'), true, true);
self::$loader = $loader = new StripeWPFSComposerAutoloadClassLoader(dirname(__DIR__));
- spl_autoload_unregister(array('ComposerAutoloaderInit840fe74f29f6cd297d98a99da192e3d3', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInitc2a3e3257fb8e8457f74c3c5190d3222', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
- call_user_func(StripeWPFSComposerAutoloadComposerStaticInit840fe74f29f6cd297d98a99da192e3d3::getInitializer($loader));
+ call_user_func(StripeWPFSComposerAutoloadComposerStaticInitc2a3e3257fb8e8457f74c3c5190d3222::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
--- a/wp-full-stripe-free/includes/stripe/composer/autoload_static.php
+++ b/wp-full-stripe-free/includes/stripe/composer/autoload_static.php
@@ -4,7 +4,7 @@
namespace StripeWPFSComposerAutoload;
-class ComposerStaticInit840fe74f29f6cd297d98a99da192e3d3
+class ComposerStaticInitc2a3e3257fb8e8457f74c3c5190d3222
{
public static $prefixLengthsPsr4 = array (
'S' =>
@@ -398,9 +398,9 @@
public static function getInitializer(ClassLoader $loader)
{
return Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit840fe74f29f6cd297d98a99da192e3d3::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit840fe74f29f6cd297d98a99da192e3d3::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInit840fe74f29f6cd297d98a99da192e3d3::$classMap;
+ $loader->prefixLengthsPsr4 = ComposerStaticInitc2a3e3257fb8e8457f74c3c5190d3222::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInitc2a3e3257fb8e8457f74c3c5190d3222::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInitc2a3e3257fb8e8457f74c3c5190d3222::$classMap;
}, null, ClassLoader::class);
}
--- a/wp-full-stripe-free/includes/stripe/composer/installed.php
+++ b/wp-full-stripe-free/includes/stripe/composer/installed.php
@@ -2,8 +2,8 @@
'root' =>
array (
'name' => 'codeinwp/wp-full-stripe',
- 'pretty_version' => '8.5.0',
- 'version' => '8.5.0.0',
+ 'pretty_version' => '8.5.1',
+ 'version' => '8.5.1.0',
'reference' => NULL,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../',
--- a/wp-full-stripe-free/includes/wpfs-checkout-charge-handler.php
+++ b/wp-full-stripe-free/includes/wpfs-checkout-charge-handler.php
@@ -598,6 +598,36 @@
}
/**
+ * Resolves the PaymentMethod to use for a subscription donation.
+ *
+ * @param StripeWPFSStripeSubscription $subscription
+ * @param StripeWPFSStripePaymentIntent|null $paymentIntent
+ *
+ * @return StripeWPFSStripePaymentMethod|null
+ * @throws StripeWPFSStripeExceptionApiErrorException
+ */
+ protected function resolvePaymentMethodForSubscription($subscription, $paymentIntent)
+ {
+ $paymentMethod = null;
+ if (!is_null($paymentIntent)) {
+ $paymentMethod = $this->checkoutSubmissionService->retrieveStripePaymentMethodByPaymentIntent($paymentIntent);
+ }
+ if (is_null($paymentMethod) && isset($subscription->default_payment_method)) {
+ $defaultPaymentMethod = $subscription->default_payment_method;
+ if (is_object($defaultPaymentMethod) && isset($defaultPaymentMethod->id)) {
+ $paymentMethod = $defaultPaymentMethod;
+ } elseif (is_string($defaultPaymentMethod) && !empty($defaultPaymentMethod)) {
+ try {
+ $paymentMethod = $this->stripe->retrievePaymentMethod($defaultPaymentMethod);
+ } catch (Exception $ex) {
+ $this->logger->error(__FUNCTION__, 'Error while retrieving subscription default PaymentMethod', $ex);
+ }
+ }
+ }
+ return $paymentMethod;
+ }
+
+ /**
* @param MM_WPFS_Public_DonationFormModel $formModel
* @param StripeWPFSStripeCheckoutSession $checkoutSession
*
@@ -609,15 +639,67 @@
{
$chargeResult = new MM_WPFS_DonationCheckoutResult();
+ $isSubscriptionMode = isset($checkoutSession->mode) && 'subscription' === $checkoutSession->mode;
+ $isRecurring = $this->isRecurringDonation($formModel);
+
$stripeCustomer = $this->checkoutSubmissionService->retrieveStripeCustomerByCheckoutSession($checkoutSession);
- $paymentIntent = $this->checkoutSubmissionService->retrieveStripePaymentIntentByCheckoutSession($checkoutSession);
- $paymentMethod = $this->setDefaultPaymentMethodFromPaymentIntent($paymentIntent, $stripeCustomer, $formModel->isRecurringDonation() );
+ if (is_null($stripeCustomer)) {
+ $this->logger->error(__FUNCTION__, 'Error while handling checkout donation: cannot find Stripe customer.');
+ }
- $this->fixCustomerNamesAndAddresses($stripeCustomer, $paymentMethod, $checkoutSession);
+ $subscription = null;
+ $paymentIntent = null;
+ $paymentMethod = null;
+
+ if ($isSubscriptionMode) {
+ $subscription = $this->checkoutSubmissionService->retrieveStripeSubscriptionByCheckoutSession($checkoutSession);
+ if (is_null($subscription)) {
+ $this->logger->error(__FUNCTION__, 'Error while handling checkout donation: cannot find Stripe Subscription on checkout session.');
+ } else {
+ $paymentIntent = $this->checkoutSubmissionService->findPaymentIntentInSubscription($subscription);
+ if (is_null($paymentIntent)) {
+ $this->logger->error(__FUNCTION__, 'Error while handling checkout donation: cannot find PaymentIntent on subscription invoice.');
+ }
+
+ $paymentMethod = $this->resolvePaymentMethodForSubscription($subscription, $paymentIntent);
+ if (!is_null($paymentMethod) && !is_null($stripeCustomer)) {
+ $paymentMethod = $this->stripe->attachPaymentMethodToCustomerIfMissing(
+ $stripeCustomer,
+ $paymentMethod,
+ /* set to default */
+ true
+ );
+ }
+ }
+ } else {
+ $paymentIntent = $this->checkoutSubmissionService->retrieveStripePaymentIntentByCheckoutSession($checkoutSession);
+ if (is_null($paymentIntent)) {
+ $this->logger->error(__FUNCTION__, 'Error while handling checkout donation: cannot find PaymentIntent on checkout session.');
+ } else {
+ $paymentMethod = $this->setDefaultPaymentMethodFromPaymentIntent($paymentIntent, $stripeCustomer, $isRecurring);
+ }
+ }
+
+ if (is_null($stripeCustomer) || is_null($paymentIntent) || ($isSubscriptionMode && is_null($subscription))) {
+ $chargeResult->setSuccess(false);
+ $chargeResult->setMessageTitle(
+ /* translators: Banner title of failed transaction */
+ __('Failed', 'wp-full-stripe-free')
+ );
+ $chargeResult->setMessage(
+ /* It's an internal error, no need to localize it */
+ 'Cannot complete donation: missing Stripe customer / payment details.'
+ );
+ return $chargeResult;
+ }
+ $this->fixCustomerNamesAndAddresses($stripeCustomer, $paymentMethod, $checkoutSession);
$formModel->setTransactionId($paymentIntent->id);
$formModel->setStripePaymentMethod($paymentMethod);
$formModel->setStripeCustomer($stripeCustomer, true);
+ if (!is_null($subscription)) {
+ $formModel->setStripeSubscription($subscription);
+ }
$transactionData = MM_WPFS_TransactionDataService::createDonationDataByFormModel($formModel);
@@ -625,18 +707,23 @@
$this->addFormNameToPaymentIntent($paymentIntent, $formModel->getFormName());
if ($formModel->getForm()->generateInvoice == 1) {
- $createInvoiceOptions = new MM_WPFS_CreateOneTimeInvoiceOptions();
- $createInvoiceOptions->autoAdvance = false;
- $stripeInvoice = $this->createInvoiceForOneTimePaymentByFormModel($formModel, $createInvoiceOptions);
-
- $paidStripeInvoice = $this->stripe->payInvoiceOutOfBand($stripeInvoice->id);
- $this->setTransactionDataFromInvoice($transactionData, $paidStripeInvoice);
+ if ($isSubscriptionMode) {
+ $invoice = isset($subscription->latest_invoice) && is_object($subscription->latest_invoice)
+ ? $subscription->latest_invoice
+ : null;
+ if (!is_null($invoice)) {
+ $this->setTransactionDataFromInvoice($transactionData, $invoice);
+ }
+ } else {
+ $createInvoiceOptions = new MM_WPFS_CreateOneTimeInvoiceOptions();
+ $createInvoiceOptions->autoAdvance = false;
+ $stripeInvoice = $this->createInvoiceForOneTimePaymentByFormModel($formModel, $createInvoiceOptions);
+
+ $paidStripeInvoice = $this->stripe->payInvoiceOutOfBand($stripeInvoice->id);
+ $this->setTransactionDataFromInvoice($transactionData, $paidStripeInvoice);
+ }
}
- $subscription = null;
- if ($this->isRecurringDonation($formModel)) {
- $subscription = $this->createSubscriptionForDonation($formModel);
- }
$latest_charge = $this->stripe->getLatestCharge($paymentIntent);
$this->db->insertCheckoutDonation($formModel, $paymentIntent, $subscription, $latest_charge);
--- a/wp-full-stripe-free/includes/wpfs-checkout-submission-service.php
+++ b/wp-full-stripe-free/includes/wpfs-checkout-submission-service.php
@@ -379,6 +379,7 @@
$checkoutSession = $this->retrieveCheckoutSession( $popupFormSubmit->checkoutSessionId );
$paymentIntent = $this->findPaymentIntentInCheckoutSession( $checkoutSession );
+
if ( isset( $paymentIntent ) && StripeWPFSStripePaymentIntent::STATUS_SUCCEEDED === $paymentIntent->status ) {
// Already processed by a prior run: resolve without resending notifications.
@@ -466,8 +467,10 @@
'setup_intent',
'setup_intent.payment_method',
'subscription',
- 'subscription.latest_invoice.payment_intent',
+ 'subscription.latest_invoice',
+ 'subscription.latest_invoice.payments',
'subscription.pending_setup_intent',
+ 'subscription.default_payment_method',
'line_items',
'line_items.data.discounts',
'line_items.data.taxes',
@@ -546,9 +549,9 @@
[
'expand' => [
'latest_invoice',
- 'latest_invoice.payment_intent',
- 'latest_invoice.charge',
+ 'latest_invoice.payments',
'pending_setup_intent',
+ 'default_payment_method',
'discount.promotion_code'
]
]
@@ -562,39 +565,60 @@
/**
* @param $stripeSubscription
*
- * @return string|StripeWPFSStripePaymentIntent|null
- * @throws StripeWPFSStripeExceptionApiErrorException
+ * @return StripeWPFSStripePaymentIntent|null
*/
public function findPaymentIntentInSubscription( $stripeSubscription ) {
$paymentIntent = null;
- if ( isset( $stripeSubscription ) ) {
- if ( isset( $stripeSubscription->latest_invoice ) ) {
- $stripeInvoice = null;
- if ( isset( $stripeSubscription->latest_invoice ) ) {
- $stripeInvoice = $stripeSubscription->latest_invoice;
- } else {
- $retrieveParams = [
- 'expand' => [
- 'payment_intent',
- 'charge'
- ]
- ];
+ if ( ! isset( $stripeSubscription ) || ! isset( $stripeSubscription->latest_invoice ) ) {
+ return $paymentIntent;
+ }
- $stripeInvoice = $this->stripe->retrieveInvoiceWithParams(
- $stripeSubscription->latest_invoice,
- $retrieveParams
- );
- }
- if ( isset( $stripeInvoice->payment_intent ) ) {
- if ( $stripeInvoice->payment_intent->id ) {
- $paymentIntent = $stripeInvoice->payment_intent;
- } else {
- $paymentIntent = $this->stripe->retrievePaymentIntent( $stripeInvoice->payment_intent );
- }
+ $stripeInvoice = $stripeSubscription->latest_invoice;
+
+ if ( ! is_object( $stripeInvoice ) || ! isset( $stripeInvoice->payments ) ) {
+ $invoiceId = is_object( $stripeInvoice ) && isset( $stripeInvoice->id ) ? $stripeInvoice->id : $stripeInvoice;
+ try {
+ $stripeInvoice = $this->stripe->retrieveInvoiceWithParams(
+ $invoiceId,
+ [ 'expand' => [ 'payments' ] ]
+ );
+ } catch ( Exception $ex ) {
+ $this->logger->error( __FUNCTION__, 'Error while retrieving invoice for subscription', $ex );
+ return $paymentIntent;
+ }
+ }
+
+ $paymentIntentId = null;
+
+ if ( isset( $stripeInvoice->payments ) && isset( $stripeInvoice->payments->data ) ) {
+ foreach ( $stripeInvoice->payments->data as $payment ) {
+ if (
+ isset( $payment->payment ) &&
+ isset( $payment->payment->type ) &&
+ 'payment_intent' === $payment->payment->type &&
+ isset( $payment->payment->payment_intent )
+ ) {
+ $paymentIntentId = $payment->payment->payment_intent;
+ break;
}
}
}
+ if ( is_null( $paymentIntentId ) && isset( $stripeInvoice->payment_intent ) ) {
+ if ( is_object( $stripeInvoice->payment_intent ) && isset( $stripeInvoice->payment_intent->id ) ) {
+ return $stripeInvoice->payment_intent;
+ }
+ $paymentIntentId = $stripeInvoice->payment_intent;
+ }
+
+ if ( ! empty( $paymentIntentId ) ) {
+ try {
+ $paymentIntent = $this->stripe->retrievePaymentIntent( $paymentIntentId );
+ } catch ( Exception $ex ) {
+ $this->logger->error( __FUNCTION__, 'Error while retrieving PaymentIntent from subscription invoice', $ex );
+ }
+ }
+
return $paymentIntent;
}
@@ -825,7 +849,7 @@
/**
* @param StripeWPFSStripeCheckoutSession $checkoutSession
*
- * @return StripeWPFSStripeCustomer
+ * @return StripeWPFSStripeCustomer|null
*/
public function retrieveStripeCustomerByCheckoutSession( $checkoutSession ) {
$stripeCustomer = null;
@@ -1102,11 +1126,13 @@
$sessionData['mode'] = 'payment';
if ( $this->formModel->isRecurringDonation() ) {
+ $sessionData['mode'] = 'subscription';
+ } else {
$sessionData['payment_intent_data'] = [
'setup_future_usage' => 'off_session'
];
+ $sessionData['customer_creation'] = 'always'; // always capture a customer. we need it post payment for internal logic
}
- $sessionData['customer_creation'] = 'always'; // always capture a customer. we need it post payment for internal logic
$productData = [
'name' => $this->getProductLabel()
@@ -1130,6 +1156,19 @@
'quantity' => 1,
];
+ $intervals = [
+ 'daily' => 'day',
+ 'weekly' => 'week',
+ 'monthly' => 'month',
+ 'annual' => 'year'
+ ];
+
+ if ( $this->formModel->isRecurringDonation() ) {
+ $lineItem['price_data']['recurring'] = [
+ 'interval' => $intervals[ $this->formModel->getDonationFrequency() ],
+ ];
+ }
+
$sessionData['line_items'] = [ $lineItem ];
if ( $recoveryFee && ! empty( $recoveryFeeData ) ) {
@@ -1144,6 +1183,12 @@
'quantity' => 1
];
+ if ( $this->formModel->isRecurringDonation() ) {
+ $recoveryFeeLineItem['price_data']['recurring'] = [
+ 'interval' => $intervals[ $this->formModel->getDonationFrequency() ],
+ ];
+ }
+
array_push( $sessionData['line_items'], $recoveryFeeLineItem );
}
--- a/wp-full-stripe-free/includes/wpfs-customer-portal-service.php
+++ b/wp-full-stripe-free/includes/wpfs-customer-portal-service.php
@@ -2085,6 +2085,29 @@
}
/**
+ * Resolves the customer portal session for the current request, requiring both a valid
+ * customer portal cookie and a successfully consumed security code
+ * before any protected REST API action may proceed.
+ *
+ * @return object|WP_Error
+ */
+ private function getAuthenticatedCardUpdateSession()
+ {
+ $cardUpdateSessionHash = $this->findSessionCookieValue();
+ $cardUpdateSession = is_null($cardUpdateSessionHash) ? null : $this->findCustomerPortalSessionByHash($cardUpdateSessionHash);
+
+ if (is_null($cardUpdateSession) || !$this->isConfirmed($cardUpdateSession)) {
+ return new WP_Error(
+ 'wpfs_customer_portal_not_authenticated',
+ __('Unauthorized', 'wp-full-stripe-free'),
+ ['status' => 401]
+ );
+ }
+
+ return $cardUpdateSession;
+ }
+
+ /**
* Fetch Stripe Subscriptions for a given customer to supply data for a Backbone Collection
*
* @param WP_REST_Request $request
@@ -2096,25 +2119,24 @@
$data = [];
try {
- $cardUpdateSessionHash = $this->findSessionCookieValue();
- if (!is_null($cardUpdateSessionHash)) {
- $cardUpdateSession = $this->findCustomerPortalSessionByHash($cardUpdateSessionHash);
- if (!is_null($cardUpdateSession)) {
- $model = new MM_WPFS_CustomerPortalModel();
- if (is_user_logged_in()) {
- $model->setAuthenticationType(MM_WPFS_CustomerPortalModel::AUTHENTICATION_TYPE_WORDPRESS);
- } else {
- $model->setAuthenticationType(MM_WPFS_CustomerPortalModel::AUTHENTICATION_TYPE_PLUGIN);
- }
- $model->setStripeClient($this->stripe);
- $stripeCustomer = $this->findExistingStripeCustomerAnywhereByEmail($cardUpdateSession->email);
- $stripeCustomer = $this->stripe->retrieveCustomerWithParams($stripeCustomer->id, ['expand' => ['sources']]);
- $this->fetchDataIntoCustomerPortalModel($model, $stripeCustomer);
-
+ $cardUpdateSession = $this->getAuthenticatedCardUpdateSession();
+ if (is_wp_error($cardUpdateSession)) {
+ return $cardUpdateSession;
+ }
- $this->buildManagedSubscriptionsArray($model->getSubscriptions(), $data);
- }
+ $model = new MM_WPFS_CustomerPortalModel();
+ if (is_user_logged_in()) {
+ $model->setAuthenticationType(MM_WPFS_CustomerPortalModel::AUTHENTICATION_TYPE_WORDPRESS);
+ } else {
+ $model->setAuthenticationType(MM_WPFS_CustomerPortalModel::AUTHENTICATION_TYPE_PLUGIN);
}
+ $model->setStripeClient($this->stripe);
+ $stripeCustomer = $this->findExistingStripeCustomerAnywhereByEmail($cardUpdateSession->email);
+ $stripeCustomer = $this->stripe->retrieveCustomerWithParams($stripeCustomer->id, ['expand' => ['sources']]);
+ $this->fetchDataIntoCustomerPortalModel($model, $stripeCustomer);
+
+
+ $this->buildManagedSubscriptionsArray($model->getSubscriptions(), $data);
} catch (Exception $ex) {
$this->logger->error(__FUNCTION__, 'Error while fetching subscriptions', $ex);
@@ -2140,33 +2162,53 @@
$cancelAtPeriodEnd = MM_WPFS_Utils::getCancelSubscriptionsAtPeriodEnd($this->staticContext);
try {
+ $cardUpdateSession = $this->getAuthenticatedCardUpdateSession();
+ if (is_wp_error($cardUpdateSession)) {
+ return $cardUpdateSession;
+ }
+
$updatedSubscription = $request->get_json_params();
if (is_array($updatedSubscription)) {
if (array_key_exists('id', $updatedSubscription) && array_key_exists('action', $updatedSubscription)) {
$stripeSubscriptionId = sanitize_text_field($updatedSubscription['id']);
if ('cancel' === $updatedSubscription['action']) {
- $cardUpdateSessionHash = $this->findSessionCookieValue();
- if (!is_null($stripeSubscriptionId) && !is_null($cardUpdateSessionHash)) {
- $cardUpdateSession = $this->findCustomerPortalSessionByHash($cardUpdateSessionHash);
- if (!is_null($cardUpdateSession) && $this->isConfirmed($cardUpdateSession)) {
- $stripeCustomer = $this->stripe->retrieveCustomer($cardUpdateSession->stripeCustomerId);
- if (isset($stripeCustomer)) {
- $this->cancelSubscriptionInDatabase($stripeSubscriptionId);
- $this->stripe->cancelSubscription($stripeCustomer->id, $stripeSubscriptionId, $cancelAtPeriodEnd);
- }
+ if (!is_null($stripeSubscriptionId)) {
+ $subscriptionParams = [
+ 'expand' => [
+ 'items.data.price'
+ ]
+ ];
+ $subscription = $this->stripe->retrieveSubscriptionWithParams($stripeSubscriptionId, $subscriptionParams);
+ $subscriptionCustomerId = (is_object($subscription) && isset($subscription->customer)) ? $subscription->customer : null;
+ if ($subscriptionCustomerId !== $cardUpdateSession->stripeCustomerId) {
+ return new WP_Error(
+ 'wpfs_customer_portal_forbidden',
+ __('Unauthorized', 'wp-full-stripe-free'),
+ ['status' => 403]
+ );
}
+
+ if (self::isDonationPlan($subscription)) {
+ $this->db->cancelDonationByStripeSubscriptionId($stripeSubscriptionId);
+ } else {
+ $this->db->cancelSubscriptionByStripeSubscriptionId($stripeSubscriptionId);
+ }
+ $this->stripe->cancelSubscription($cardUpdateSession->stripeCustomerId, $stripeSubscriptionId, $cancelAtPeriodEnd);
}
} elseif ('activate' === $updatedSubscription['action']) {
- $cardUpdateSessionHash = $this->findSessionCookieValue();
- if (!is_null($stripeSubscriptionId) && !is_null($cardUpdateSessionHash)) {
- $cardUpdateSession = $this->findCustomerPortalSessionByHash($cardUpdateSessionHash);
- if (!is_null($cardUpdateSession) && $this->isConfirmed($cardUpdateSession)) {
- $stripeCustomer = $this->stripe->retrieveCustomer($cardUpdateSession->stripeCustomerId);
- if (isset($stripeCustomer)) {
- $this->activateSubscriptionInDatabase($stripeSubscriptionId);
- $this->stripe->activateCancelledSubscription($stripeSubscriptionId);
- }
+ if (!is_null($stripeSubscriptionId)) {
+ $subscription = $this->stripe->retrieveSubscription($stripeSubscriptionId);
+ $subscriptionCustomerId = (is_object($subscription) && isset($subscription->customer)) ? $subscription->customer : null;
+ if ($subscriptionCustomerId !== $cardUpdateSession->stripeCustomerId) {
+ return new WP_Error(
+ 'wpfs_customer_portal_forbidden',
+ __('Unauthorized', 'wp-full-stripe-free'),
+ ['status' => 403]
+ );
}
+
+ $this->activateSubscriptionInDatabase($stripeSubscriptionId);
+ $this->stripe->activateCancelledSubscription($stripeSubscriptionId);
}
}
} elseif (array_key_exists('id', $updatedSubscription)) {
@@ -2178,18 +2220,19 @@
$newQuantity = 1;
}
if (isset($stripeSubscriptionId) && isset($newPlanId) && is_numeric($newQuantity) && $newQuantity > 0) {
- $cardUpdateSessionHash = $this->findSessionCookieValue();
- if (!is_null($stripeSubscriptionId) && !is_null($cardUpdateSessionHash)) {
- $cardUpdateSession = $this->findCustomerPortalSessionByHash($cardUpdateSessionHash);
- if (!is_null($cardUpdateSession) && $this->isConfirmed($cardUpdateSession)) {
- $stripeCustomer = $this->stripe->retrieveCustomer($cardUpdateSession->stripeCustomerId);
- if (isset($stripeCustomer)) {
- $success = $this->stripe->updateSubscriptionPlanAndQuantity($stripeCustomer->id, $stripeSubscriptionId, $newPlanId, $newQuantity);
- if ($success) {
- $this->db->updateSubscriptionPlanAndQuantityByStripeSubscriptionId($stripeSubscriptionId, $newPlanId, $newQuantity);
- }
- }
- }
+ $subscription = $this->stripe->retrieveSubscription($stripeSubscriptionId);
+ $subscriptionCustomerId = (is_object($subscription) && isset($subscription->customer)) ? $subscription->customer : null;
+ if ($subscriptionCustomerId !== $cardUpdateSession->stripeCustomerId) {
+ return new WP_Error(
+ 'wpfs_customer_portal_forbidden',
+ __('Unauthorized', 'wp-full-stripe-free'),
+ ['status' => 403]
+ );
+ }
+
+ $success = $this->stripe->updateSubscriptionPlanAndQuantity($cardUpdateSession->stripeCustomerId, $stripeSubscriptionId, $newPlanId, $newQuantity);
+ if ($success) {
+ $this->db->updateSubscriptionPlanAndQuantityByStripeSubscriptionId($stripeSubscriptionId, $newPlanId, $newQuantity);
}
}
}
--- a/wp-full-stripe-free/includes/wpfs-customer.php
+++ b/wp-full-stripe-free/includes/wpfs-customer.php
@@ -596,6 +596,9 @@
// recomputed from a clean base instead of an already tax-inclusive amount (#413).
const METADATA_KEY_PRETAX_BASE_AMOUNT = 'wpfs_pretax_base_amount';
+ /** @var string POST flag the front-end sets when the final payable amount is 0 (e.g. a 100%-off coupon). */
+ const PARAM_WPFS_FREE_TRANSACTION = 'wpfs-free-transaction';
+
/** @var $stripe MM_WPFS_Stripe */
protected $stripe = null;
@@ -875,6 +878,140 @@
}
/**
+ * Check if the current request is a free transaction request.
+ * If so, we skip confirmation step and record the transaction directly.
+ *
+ * @return bool
+ */
+ private function isFreeTransactionRequest() {
+ return isset( $_POST[ self::PARAM_WPFS_FREE_TRANSACTION ] )
+ && '1' === sanitize_text_field( wp_unslash( $_POST[ self::PARAM_WPFS_FREE_TRANSACTION ] ) );
+ }
+
+ /**
+ * Create or retrieve a Stripe Customer for a free inline Payment.
+ *
+ * @param MM_WPFS_Public_FormModel $formModel
+ * @param MM_WPFS_CreateCustomerOptions $options
+ * @return void
+ * @throws StripeWPFSStripeExceptionApiErrorException
+ * @throws WPFS_UserFriendlyException
+ */
+ private function createCustomerWithoutPaymentMethod( $formModel, $options ) {
+ $ctx = $this->createCustomerContext( $formModel );
+ $stripeCustomer = $this->findExistingStripeCustomerAnywhereByEmail( $ctx->cardHolderEmail );
+ $metadata = $options->addMetadata ? $ctx->metadata : null;
+ if ( ! is_array( $metadata ) ) {
+ $metadata = [];
+ }
+ $metadata['webhookUrl'] = esc_attr( MM_WPFS_EventHandler::getWebhookEndpointURL( $this->staticContext ) );
+
+ if ( ! isset( $stripeCustomer ) ) {
+ $this->logger->debug( __FUNCTION__, 'Creating Stripe Customer without PaymentMethod (free transaction)...' );
+ $stripeCustomer = $this->stripe->createCustomerWithPaymentMethod(
+ null,
+ MM_WPFS_Utils::determineCustomerName( $ctx->cardHolderName, $ctx->businessName, $ctx->billingName ),
+ $ctx->cardHolderEmail,
+ $metadata,
+ $ctx->taxIdType,
+ $ctx->taxId,
+ $ctx->billingAddress,
+ $ctx->billingName,
+ $ctx->shippingAddress,
+ $ctx->shippingName
+ );
+ }
+
+ $formModel->setStripeCustomer( $stripeCustomer );
+ }
+
+ /**
+ * Process a free inline Payment (e.g. 100%-off coupon) by creating a Stripe Customer.
+ *
+ *
+ * @param MM_WPFS_Public_PaymentFormModel $paymentFormModel
+ * @return MM_WPFS_PaymentIntentResult
+ * @throws StripeWPFSStripeExceptionApiErrorException
+ * @throws WPFS_UserFriendlyException
+ */
+ private function processFreePayment( $paymentFormModel ) {
+ $this->logger->debug( __FUNCTION__, 'CALLED' );
+
+ $paymentIntentResult = new MM_WPFS_PaymentIntentResult();
+ $paymentIntentResult->setNonce( $paymentFormModel->getNonce() );
+
+ $createCustomerOptions = new MM_WPFS_CreateCustomerOptions();
+ $createCustomerOptions->addMetadata = false;
+ $this->createCustomerWithoutPaymentMethod( $paymentFormModel, $createCustomerOptions );
+
+ $transactionData = MM_WPFS_TransactionDataService::createOneTimePaymentDataByModel( $paymentFormModel );
+ $transactionData->setAmount( 0 );
+ $transactionData->setProductAmountNet( 0 );
+ $transactionData->setProductAmountTax( 0 );
+ $transactionData->setProductAmountGross( 0 );
+
+ $this->fireBeforeInlinePaymentAction( $paymentFormModel, $transactionData );
+
+ $createdAt = time();
+ $liveMode = ( $this->options->get( MM_WPFS_Options::OPTION_API_MODE ) === 'live' );
+ $currency = strtolower( $paymentFormModel->getForm()->currency );
+
+ $stubPaymentIntent = new stdClass();
+ $stubPaymentIntent->id = 'wpfs_free_pi_' . wp_generate_uuid4();
+ $stubPaymentIntent->amount = 0;
+ $stubPaymentIntent->currency = $currency;
+ $stubPaymentIntent->created = $createdAt;
+ $stubPaymentIntent->livemode = $liveMode;
+ $stubPaymentIntent->application_fee_amount = 0;
+ $stubPaymentIntent->description = MM_WPFS_Utils::prepareStripeChargeDescription(
+ $this->staticContext,
+ $paymentFormModel,
+ $transactionData
+ );
+ $stubPaymentIntent->wpfs_form = $paymentFormModel->getFormName();
+
+ $stubCharge = new stdClass();
+ $stubCharge->paid = true;
+ $stubCharge->captured = true;
+ $stubCharge->refunded = false;
+ $stubCharge->failure_code = null;
+ $stubCharge->failure_message = null;
+ $stubCharge->status = 'succeeded';
+ $stubCharge->livemode = $liveMode;
+ $stubCharge->created = $createdAt;
+
+ $paymentFormModel->setStripePaymentMethodType(
+ $paymentFormModel->getStripePaymentMethodType() ?: 'card'
+ );
+ $paymentFormModel->setStripePaymentIntent( $stubPaymentIntent );
+ $paymentFormModel->setTransactionId( $stubPaymentIntent->id );
+ $transactionData->setTransactionId( $stubPaymentIntent->id );
+
+ $this->db->insertOrUpdatePayment( $paymentFormModel, $transactionData, $stubCharge );
+
+ $this->fireAfterInlinePaymentAction( $paymentFormModel, $transactionData, $stubPaymentIntent );
+
+ $paymentIntentResult->setRequiresAction( false );
+ $paymentIntentResult->setSuccess( true );
+ $paymentIntentResult->setMessageTitle(
+ /* translators: Banner title of successful transaction */
+ __( 'Success', 'wp-full-stripe-free' )
+ );
+ $paymentIntentResult->setMessage(
+ /* translators: Banner message of successful payment */
+ __( 'Payment Successful!', 'wp-full-stripe-free' )
+ );
+
+ $this->handleRedirect( $paymentFormModel, $transactionData, $paymentIntentResult );
+
+ if ( MM_WPFS_Mailer::canSendPaymentPluginReceipt( $paymentFormModel->getForm() ) ) {
+ $this->mailer->sendOneTimePaymentReceipt( $paymentFormModel->getForm(), $transactionData );
+ }
+
+ return $paymentIntentResult;
+ }
+
+ /**
* retrieves a client secret for the payment element to use
* is used for both setup intents and payment intents
* @return string
@@ -2141,6 +2278,25 @@
private function processPaymentIntentCharge( $paymentFormModel ) {
$this->logger->debug( __FUNCTION__, "CALLED" );
+ // Handle free transactions first, as they don't require a PaymentIntent.
+ if ( $this->isFreeTransactionRequest() ) {
+ $freeCheckData = MM_WPFS_TransactionDataService::createOneTimePaymentDataByModel( $paymentFormModel );
+ $resolved = $this->computeInlinePaymentChargeAmount( $paymentFormModel, $freeCheckData );
+
+ if ( $resolved !== null ) {
+ // Tax and/or coupon was applied; $resolved[0] is the final charge amount.
+ list( $chargeAmount ) = $resolved;
+ $isFree = ( $chargeAmount <= 0 );
+ } else {
+ // No tax/coupon/fee adjustment: the raw model amount is the charge.
+ $isFree = ( (int) round( $paymentFormModel->getAmount() ) <= 0 );
+ }
+
+ if ( $isFree ) {
+ return $this->processFreePayment( $paymentFormModel );
+ }
+ }
+
$paymentIntentResult = new MM_WPFS_PaymentIntentResult();
$paymentIntentResult->setNonce( $paymentFormModel->getNonce() );
// get the payment intent from Stripe to be able to react to status etc.
--- a/wp-full-stripe-free/includes/wpfs-database.php
+++ b/wp-full-stripe-free/includes/wpfs-database.php
@@ -874,18 +874,30 @@
global $wpdb;
$stripeCustomerID = $donationFormModel->getStripeCustomer()->id;
- $stripeSubscriptionID = $donationFormModel->isRecurringDonation() ? $subscription->id : null;
- $subscriptionStatus = $donationFormModel->isRecurringDonation() ? $subscription->status : null;
+ $isRecurring = $donationFormModel->isRecurringDonation();
+ $stripeSubscriptionID = $isRecurring ? $subscription->id : null;
+ $subscriptionStatus = $isRecurring ? $subscription->status : null;
$billingAddress = $donationFormModel->getBillingAddress();
$shippingAddress = $donationFormModel->getShippingAddress();
+ $stripePlanID = null;
+ if ( $isRecurring ) {
+ if ( isset( $subscription->plan->id ) ) {
+ $stripePlanID = $subscription->plan->id;
+ } elseif ( isset( $subscription->items->data[0]->plan->id ) ) {
+ $stripePlanID = $subscription->items->data[0]->plan->id;
+ } elseif ( isset( $subscription->items->data[0]->price->id ) ) {
+ $stripePlanID = $subscription->items->data[0]->price->id;
+ }
+ }
+
$description = $this->getTruncatedDescriptionFromPaymentIntent( $paymentIntent );
$data = [
'stripeCustomerID' => $stripeCustomerID,
'stripeSubscriptionID' => $stripeSubscriptionID,
'stripePaymentIntentID' => $paymentIntent->id,
'stripeSetupIntentID' => $donationFormModel->getStripeSetupIntentId(),
- 'stripePlanID' => $donationFormModel->isRecurringDonation() ? $subscription->plan->id : null,
+ 'stripePlanID' => $stripePlanID,
'description' => $description,
'paymentMethod' => 'card',
'paid' => $lastCharge->paid,
--- a/wp-full-stripe-free/includes/wpfs-form-models.php
+++ b/wp-full-stripe-free/includes/wpfs-form-models.php
@@ -2210,7 +2210,9 @@
if ( MM_WPFS_Utils::getFormType( $this->__form ) === MM_WPFS::FORM_TYPE_CHECKOUT_PAYMENT ) {
$this->__amount = MM_WPFS_Currencies::parseByForm($this->__form, $this->__form->currency, $this->__amount);
}
- $this->__amount = MM_WPFS_Utils::parse_amount( $this->__form->currency, $this->__amount );
+ if ( is_numeric( $this->__amount ) ) {
+ $this->__amount = MM_WPFS_Currencies::convertAmountToMinorUnits( $this->__amount, $this->__form->currency );
+ }
$this->__productName = isset($this->__form->productDesc) ? $this->__form->productDesc : MM_WPFS_Utils::getDefaultProductDescription();
$this->__priceId = null;
@@ -2361,7 +2363,9 @@
$this->__amount = MM_WPFS_Currencies::parseByForm($this->__form, $this->__form->currency, $this->__amount);
}
- $this->__amount = MM_WPFS_Utils::parse_amount( $this->__form->currency, $this->__amount );
+ if ( is_numeric( $this->__amount ) ) {
+ $this->__amount = MM_WPFS_Currencies::convertAmountToMinorUnits( $this->__amount, $this->__form->currency );
+ }
} else {
$donationAmounts = MM_WPFS_Utils::decodeJsonArray($this->__form->donationAmounts);
if (isset($this->customAmountIndex) && $this->customAmountIndex > self::INITIAL_CUSTOM_AMOUNT_INDEX && count($donationAmounts) > $this->customAmountIndex) {
--- a/wp-full-stripe-free/includes/wpfs-logger-service.php
+++ b/wp-full-stripe-free/includes/wpfs-logger-service.php
@@ -409,7 +409,7 @@
* @param $message
* @param null|Throwable $exception
*/
- public function error( $function, $message, Throwable $exception = null ) {
+ public function error( $function, $message, ?Throwable $exception = null ) {
if ( $this->isErrorEnabled() ) {
$this->loggerService->log( $this->module, $this->class, $function, MM_WPFS_LoggerService::LEVEL_ERROR, $message, $exception );
}
--- a/wp-full-stripe-free/includes/wpfs-main.php
+++ b/wp-full-stripe-free/includes/wpfs-main.php
@@ -10,7 +10,7 @@
*/
class MM_WPFS {
- const VERSION = '8.5.0';
+ const VERSION = '8.5.1';
const REQUEST_PARAM_NAME_WPFS_RENDERED_FORMS = 'wpfs_rendered_forms';
const HANDLE_WP_FULL_STRIPE_JS = 'wp-full-stripe-js';
@@ -1385,7 +1385,7 @@
* @param int $code
* @param Throwable|null $previous
*/
- public function __construct( $message = "", $code = 0, Throwable $previous = null ) {
+ public function __construct( $message = "", $code = 0, ?Throwable $previous = null ) {
parent::__construct( $message, $code, $previous );
}
--- a/wp-full-stripe-free/includes/wpfs-tables.php
+++ b/wp-full-stripe-free/includes/wpfs-tables.php
@@ -1890,7 +1890,7 @@
*
* @return string
*/
- protected function format_column_header_title( $title, array $aggregated_columns = null ) {
+ protected function format_column_header_title( $title, ?array $aggregated_columns = null ) {
$column_label = "<b>{$title}</b>";
if ( ! empty( $aggregated_columns ) ) {
$size = sizeof( $aggregated_columns );
--- a/wp-full-stripe-free/includes/wpfs-web-hook-events.php
+++ b/wp-full-stripe-free/includes/wpfs-web-hook-events.php
@@ -617,7 +617,7 @@
$transactionData->setSetupFeeGrossAmountTotal($planSetupFeeGrossTotalComposite['gross']);
$transactionData->setSetupFeeTaxAmountTotal($planSetupFeeGrossTotalComposite['taxValue']);
- $transactionData->setPlanNetAmount($stripePlan->amount);
+ $transactionData->setPlanNetAmount($stripePlan->unit_amount);
$transactionData->setPlanGrossAmount($planAmountGrossComposite['gross']);
$transactionData->setPlanTaxAmount($transactionData->getPlanGrossAmount() - $transactionData->getPlanNetAmount());
$transactionData->setPlanQuantity($wpfsSubscriber->quantity);
--- a/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-donations.php
+++ b/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-donations.php
@@ -3,10 +3,10 @@
/** @var $textFilter */
/** @var $modeFilter */
?>
-<form name="wpfs-search-donations" action="<?php echo $pageUrl; ?>" method="post">
+<form name="wpfs-search-donations" action="<?php echo esc_url( $pageUrl ); ?>" method="post">
<div class="wpfs-page-controls">
<div class="wpfs-form-search wpfs-page-controls__control wpfs-page-controls__control--w320 js-form-search">
- <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_DONATIONS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? $textFilter : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
+ <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_DONATIONS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? esc_attr( $textFilter ) : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
<button class="wpfs-form-search__btn">
<span class="wpfs-icon-search"></span>
</button>
--- a/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-payments.php
+++ b/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-payments.php
@@ -4,10 +4,10 @@
/** @var $statusFilter */
/** @var $modeFilter */
?>
-<form name="wpfs-search-one-time-payments" action="<?php echo $pageUrl; ?>" method="post">
+<form name="wpfs-search-one-time-payments" action="<?php echo esc_url( $pageUrl ); ?>" method="post">
<div class="wpfs-page-controls">
<div class="wpfs-form-search wpfs-page-controls__control wpfs-page-controls__control--w320 js-form-search">
- <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_PAYMENTS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? $textFilter : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
+ <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_PAYMENTS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? esc_attr( $textFilter ) : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
<button class="wpfs-form-search__btn">
<span class="wpfs-icon-search"></span>
</button>
@@ -18,7 +18,7 @@
<?php
foreach (MM_WPFS_Utils::getPaymentStatuses() as $paymentStatus ) {
?>
- <option value="<?php echo $paymentStatus; ?>" <?php echo $statusFilter === $paymentStatus ? 'selected': ''; ?>><?php echo esc_html( MM_WPFS_Admin::getPaymentStatusLabel( $paymentStatus) ); ?></option>
+ <option value="<?php echo esc_attr( $paymentStatus ); ?>" <?php echo $statusFilter === $paymentStatus ? 'selected': ''; ?>><?php echo esc_html( MM_WPFS_Admin::getPaymentStatusLabel( $paymentStatus) ); ?></option>
<?php } ?>
</select>
</div>
--- a/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-saved-cards.php
+++ b/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-saved-cards.php
@@ -3,10 +3,10 @@
/** @var $textFilter */
/** @var $modeFilter */
?>
-<form name="wpfs-search-saved-cards" action="<?php echo $pageUrl; ?>" method="post">
+<form name="wpfs-search-saved-cards" action="<?php echo esc_url( $pageUrl ); ?>" method="post">
<div class="wpfs-page-controls">
<div class="wpfs-form-search wpfs-page-controls__control wpfs-page-controls__control--w320 js-form-search">
- <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_SAVED_CARDS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? $textFilter : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
+ <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_SAVED_CARDS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? esc_attr( $textFilter ) : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
<button class="wpfs-form-search__btn">
<span class="wpfs-icon-search"></span>
</button>
--- a/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-subscriptions.php
+++ b/wp-full-stripe-free/templates/admin/partials/wpfs-transactions-subscriptions.php
@@ -4,10 +4,10 @@
/** @var $statusFilter */
/** @var $modeFilter */
?>
-<form name="wpfs-search-subscriptions" action="<?php echo $pageUrl; ?>" method="post">
+<form name="wpfs-search-subscriptions" action="<?php echo esc_url( $pageUrl ); ?>" method="post">
<div class="wpfs-page-controls">
<div class="wpfs-form-search wpfs-page-controls__control wpfs-page-controls__control--w320 js-form-search">
- <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_SUBSCRIPTIONS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? $textFilter : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
+ <input class="wpfs-form-control wpfs-form-search__input" type="text" name="<?php echo MM_WPFS_Admin_Menu::PARAM_NAME_SUBSCRIPTIONS_TEXT_FILTER ?>" value="<?php echo !empty( $textFilter ) ? esc_attr( $textFilter ) : ""; ?>" placeholder="<?php esc_html_e( 'Search...', 'wp-full-stripe-free'); ?>">
<button class="wpfs-form-search__btn">
<span class="wpfs-icon-search"></span>
</button>
@@ -18,7 +18,7 @@
<?php
foreach (MM_WPFS_Utils::getSubscriptionStatuses() as $subscriptionStatus ) {
?>
- <option value="<?php echo $subscriptionStatus; ?>" <?php echo $statusFilter === $subscriptionStatus ? 'selected': ''; ?>><?php echo esc_html( MM_WPFS_Admin::getSubscriberStatusLabel( $subscriptionStatus) ); ?></option>
+ <option value="<?php echo esc_attr( $subscriptionStatus ); ?>" <?php echo $statusFilter === $subscriptionStatus ? 'selected': ''; ?>><?php echo esc_html( MM_WPFS_Admin::getSubscriberStatusLabel( $subscriptionStatus) ); ?></option>
<?php } ?>
</select>
</div>
--- a/wp-full-stripe-free/vendor/autoload.php
+++ b/wp-full-stripe-free/vendor/autoload.php
@@ -21,4 +21,4 @@
}
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit3b4c1e001fd8ea6c4b51d3dd13263df3::getLoader();
No newline at end of file
+return ComposerAutoloaderInited5a8e569d2e5c28188ada0670de1124::getLoader();
No newline at end of file
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/assets/js/build/about/about.asset.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/assets/js/build/about/about.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'wp-components', 'wp-element'), 'version' => '8d9c74cada5a40e4082b');
+<?php return array('dependencies' => array('react', 'wp-components', 'wp-element'), 'version' => '33f2e4c85280a9cf0f4e');
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/load.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/load.php
@@ -14,7 +14,7 @@
return;
}
// Current SDK version and path.
-$themeisle_sdk_version = '3.3.52';
+$themeisle_sdk_version = '3.3.54';
$themeisle_sdk_path = dirname( __FILE__ );
global $themeisle_sdk_max_version;
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Loader.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Loader.php
@@ -268,6 +268,42 @@
'newsHeading' => 'Stay connected for news & updates!',
'emailPlaceholder' => 'Your email address',
'signMeUp' => 'Sign me up',
+ 'services' => [
+ 'ariaLabel' => 'Themeisle services',
+ 'trustpilotLabel' => 'Rated excellent on Trustpilot',
+ 'trustpilotRated' => 'Rated',
+ 'trustpilotOn' => 'on',
+ 'trustpilotBrand' => 'Trustpilot',
+ 'heading' => 'Expert WordPress services from the Themeisle team',
+ 'description' => 'Done for you by the same people who build your plugins and themes.',
+ 'cta' => 'Explore all services',
+ 'items' => [
+ 'websiteDesign' => [
+ 'title' => 'Website Design',
+ 'subtitle' => 'Built for your business',
+ ],
+ 'support' => [
+ 'title' => 'Support',
+ 'subtitle' => 'On-demand expert help',
+ ],
+ 'speed' => [
+ 'title' => 'Speed Optimization',
+ 'subtitle' => 'Core Web Vitals boost',
+ ],
+ 'seo' => [
+ 'title' => 'SEO Foundation',
+ 'subtitle' => 'Rank & get found',
+ ],
+ 'maintenance' => [
+ 'title' => 'Maintenance',
+ 'subtitle' => 'Updates, backups, security',
+ ],
+ 'hackedSite' => [
+ 'title' => 'Hacked Site Repair',
+ 'subtitle' => 'Malware removed fast',
+ ],
+ ],
+ ],
'installNow' => 'Install Now',
'activate' => 'Activate',
'learnMore' => 'Learn More',
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php
@@ -225,6 +225,7 @@
'newsHeading' => Loader::$labels['about_us']['newsHeading'],
'emailPlaceholder' => Loader::$labels['about_us']['emailPlaceholder'],
'signMeUp' => Loader::$labels['about_us']['signMeUp'],
+ 'services' => Loader::$labels['about_us']['services'],
'installNow' => Loader::$labels['about_us']['installNow'],
'activate' => Loader::$labels['about_us']['activate'],
'learnMore' => Loader::$labels['about_us']['learnMore'],
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php
@@ -123,6 +123,10 @@
}
?>
<style type="text/css">
+ #dashboard-widgets #themeisle .hndle {
+ padding-left: 39px;
+ }
+
#themeisle ul li.ti-dw-recommend-item {
padding-left: 7px;
border-top: 1px solid #eee;
@@ -135,7 +139,6 @@
background-repeat: no-repeat;
background-position: 2% 50%;
background-size: 25px;
- padding-left: 39px;
}
#themeisle .inside {
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php
@@ -209,7 +209,7 @@
add_filter( 'themeisle_sdk_ran_promos', '__return_true' );
if ( get_option( $this->option_neve, false ) !== true ) {
- add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', 'ThemeisleSDKModulesNotification::regular_dismiss' );
+ add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', 'ThemeisleSDKModulesNotification::dismiss' );
}
}
--- a/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php
+++ b/wp-full-stripe-free/vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php
@@ -139,7 +139,8 @@
?>
<div class="ti-theme-uninstall-feedback-drawer ti-feedback">
<div class="popup--header">
- <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?> </h5>
+ <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?></h5>
+ <?php $this->do_popup_header_after_heading_action( 'theme' ); ?>
<button class="toggle"><span>×</span></button>
</div><!--/.popup--header-->
<div class="popup--body">
@@ -485,6 +486,19 @@
}
/**
+ * Fires after the popup header heading, allowing products to output extra markup.
+ *
+ * @param string $context Popup context. Either `theme` or `plugin`.
+ */
+ private function do_popup_header_after_heading_action( $context ) {
+ do_action(
+ $this->product->get_key() . '_uninstall_feedback_popup_header_after_heading',
+ $this->product,
+ $context
+ );
+ }
+
+ /**
* Render the options list.
*
* @param array $options the options for the feedback form.
@@ -535,6 +549,7 @@
id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
<div class="popup--header">
<h5><?php echo wp_kses( Loader::$labels['uninstall']['heading_plugin'], array( 'span' => true ) ); ?> </h5>
+ <?php $this->do_popup_header_after_heading_action( 'plugin' ); ?>
</div><!--/.popup--header-->
<div class="popup--body">
<?php $this->render_options_list( $options ); ?>
@@ -581,13 +596,14 @@
(function ($) {
$(document).ready(function () {
var targetElement = 'tr[data-plugin^="<?php echo esc_attr( $this->product->get_slug() ); ?>/"] span.deactivate a';
- var redirectUrl = $(targetElement).attr('href');
+ var $deactivateLink = $(targetElement);
+ var redirectUrl = $deactivateLink.attr('href');
if ($('.ti-feedback-overlay').length === 0) {
$('body').prepend('<div class="ti-feedback-overlay"></div>');
}
- $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($(targetElement).parent());
+ $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($deactivateLink.parent());
- $(targetElement).on('click', function (e) {
+ $deactivateLink.on('click', function (e) {
e.preventDefault();
$('<?php echo esc_attr( $popup_id ); ?> ').addClass('active');
$('body').addClass('ti-feedback-open');
@@ -622,7 +638,7 @@
$('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-no').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
- $(targetElement).unbind('click');
+ $deactivateLink.unbind('click');
$('body').removeClass('ti-feedback-open');
$('<?php echo esc_attr( $popup_id ); ?>').remove();
if (redirectUrl !== '') {
@@ -633,7 +649,7 @@
$('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
- $(targetElement).unbind('click');
+ $deactivateLink.unbind('click');
var selectedOption = $(
'<?php echo esc_attr( $popup_id ); ?> input[name="ti-deactivate-option"]:checked');
var data = {
--- a/wp-full-stripe-free/vendor/composer/autoload_real.php
+++ b/wp-full-stripe-free/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit3b4c1e001fd8ea6c4b51d3dd13263df3
+class ComposerAutoloaderInited5a8e569d2e5c28188ada0670de1124
{
private static $loader;
@@ -24,16 +24,16 @@
require __DIR__ . '/platform_check.php';
- spl_autoload_register(array('ComposerAutoloaderInit3b4c1e001fd8ea6c4b51d3dd13263df3', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInited5a8e569d2e5c28188ada0670de1124', 'loadClassLoader'), true, true);
self::$loader = $loader = new ComposerAutoloadClassLoader(dirname(__DIR__));
- spl_autoload_unregister(array('ComposerAutoloaderInit3b4c1e001fd8ea6c4b51d3dd13263df3', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInited5a8e569d2e5c28188ada0670de1124', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
- call_user_func(ComposerAutoloadComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3::getInitializer($loader));
+ call_user_func(ComposerAutoloadComposerStaticInited5a8e569d2e5c28188ada0670de1124::getInitializer($loader));
$loader->register(true);
- $filesToLoad = ComposerAutoloadComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3::$files;
+ $filesToLoad = ComposerAutoloadComposerStaticInited5a8e569d2e5c28188ada0670de1124::$files;
$requireFile = Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
--- a/wp-full-stripe-free/vendor/composer/autoload_static.php
+++ b/wp-full-stripe-free/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
namespace ComposerAutoload;
-class ComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3
+class ComposerStaticInited5a8e569d2e5c28188ada0670de1124
{
public static $files = array (
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
@@ -53,9 +53,9 @@
public static function getInitializer(ClassLoader $loader)
{
return Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInit3b4c1e001fd8ea6c4b51d3dd13263df3::$classMap;
+ $loader->prefixLengthsPsr4 = ComposerStaticInited5a8e569d2e5c28188ada0670de1124::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInited5a8e569d2e5c28188ada0670de1124::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInited5a8e569d2e5c28188ada0670de1124::$classMap;
}, null, ClassLoader::class);
}
--- a/wp-full-stripe-free/vendor/composer/installed.php
+++ b/wp-full-stripe-free/vendor/composer/installed.php
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'codeinwp/wp-full-stripe',
- 'pretty_version' => '8.5.0',
- 'version' => '8.5.0.0',
+ 'pretty_version' => '8.5.1',
+ 'version' => '8.5.1.0',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
@@ -11,17 +11,17 @@
),
'versions' => array(
'codeinwp/themeisle-sdk' => array(
- 'pretty_version' => '3.3.52',
- 'version' => '3.3.52.0',
- 'reference' => 'd1ae68cbd4f84934b4d982e9eeff317b9f4c814a',
+ 'pretty_version' => '3.3.54',
+ 'version' => '3.3.54.0',
+ 'reference' => '095c2d0f1388af0b0196c492a7f79e2fd092dab1',
'type' => 'library',
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
'aliases' => array(),
'dev_requirement' => false,
),
'codeinwp/wp-full-stripe' => array(
- 'pretty_version' => '8.5.0',
- 'version' => '8.5.0.0',
+ 'pretty_version' => '8.5.1',
+ 'version' => '8.5.1.0',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
--- a/wp-full-stripe-free/wp-full-stripe.php
+++ b/wp-full-stripe-free/wp-full-stripe.php
@@ -5,7 +5,7 @@
Plugin URI: https://paymentsplugin.com
Description: Use WP Full Pay to accept Stripe payments on your WordPress. Prebuilt forms to accept payments, donations and subscriptions.
Author: Themeisle
-Version: 8.5.0
+Version: 8.5.1
Author URI: https://themeisle.com
Text Domain: wp-full-stripe-free
Domain Path: /languages