Commit 71828e3f140 for woocommerce

commit 71828e3f14002f249b862a02f38bcaa405e2cbb8
Author: Vasily Belolapotkov <vasily.belolapotkov@automattic.com>
Date:   Thu Oct 8 13:30:09 2026 +0200

    Rename the engine payment instrument reference (#69580)

    * Rename the engine payment instrument reference

diff --git a/packages/php/woocommerce-subscriptions-engine/changelog/dev-rename-payment-instrument-ref b/packages/php/woocommerce-subscriptions-engine/changelog/dev-rename-payment-instrument-ref
new file mode 100644
index 00000000000..0c3bdcdd2cc
--- /dev/null
+++ b/packages/php/woocommerce-subscriptions-engine/changelog/dev-rename-payment-instrument-ref
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Rename the engine payment instrument reference; no merchant-facing change.
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Api/Contracts.php b/packages/php/woocommerce-subscriptions-engine/src/Api/Contracts.php
index 6ba3ae6a144..5eba92ee3c3 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Api/Contracts.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Api/Contracts.php
@@ -22,7 +22,7 @@ use Automattic\WooCommerce\SubscriptionsEngine\Api\View\ContractView;
 use Automattic\WooCommerce\SubscriptionsEngine\Api\View\CycleView;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Entity\Contract;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Entity\Cycle;
-use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\InstrumentRef;
+use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\PaymentInstrumentRef;
 use Automattic\WooCommerce\SubscriptionsEngine\Integration\Storage\ContractRepository;
 use Automattic\WooCommerce\SubscriptionsEngine\Integration\Storage\DuplicateCycleException;
 use Automattic\WooCommerce\SubscriptionsEngine\Integration\Support\ArgumentValidator;
@@ -514,7 +514,7 @@ final class Contracts {
 			}
 		}

-		$contract->set_payment_instrument( new InstrumentRef( $token_id, $gateway, $title ) );
+		$contract->set_payment_instrument( new PaymentInstrumentRef( $token_id, $gateway, $title ) );
 		$contract->assert_money_has_currency();
 	}
 	// phpcs:enable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Core/Entity/Contract.php b/packages/php/woocommerce-subscriptions-engine/src/Core/Entity/Contract.php
index 69680920ab5..50650d299e6 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Core/Entity/Contract.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Core/Entity/Contract.php
@@ -16,7 +16,7 @@
  * `origin_order_id` is an optional extension fact. Customer, currency, selling plan and
  * start are optional until the extension supplies them; a new contract defaults to
  * `draft`. Timestamps are GMT strings; money totals are decimal-safe strings on the
- * storage scale; the payment instrument is exposed as an {@see InstrumentRef}.
+ * storage scale; the payment instrument is exposed as a {@see PaymentInstrumentRef}.
  *
  * @package Automattic\WooCommerce\SubscriptionsEngine\Core\Entity
  */
@@ -28,7 +28,7 @@ namespace Automattic\WooCommerce\SubscriptionsEngine\Core\Entity;
 use DomainException;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Support\MoneyScale;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Support\Coercion;
-use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\InstrumentRef;
+use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\PaymentInstrumentRef;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\PlanSnapshot;

 defined( 'ABSPATH' ) || exit;
@@ -469,16 +469,16 @@ final class Contract {
 	/**
 	 * The payment instrument as an immutable reference.
 	 */
-	public function get_payment_instrument(): InstrumentRef {
-		return new InstrumentRef( $this->payment_token_id, $this->payment_method, $this->payment_method_title );
+	public function get_payment_instrument(): PaymentInstrumentRef {
+		return new PaymentInstrumentRef( $this->payment_token_id, $this->payment_method, $this->payment_method_title );
 	}

 	/**
 	 * Set the payment instrument from an immutable reference.
 	 *
-	 * @param InstrumentRef $instrument Payment instrument reference.
+	 * @param PaymentInstrumentRef $instrument Payment instrument reference.
 	 */
-	public function set_payment_instrument( InstrumentRef $instrument ): void {
+	public function set_payment_instrument( PaymentInstrumentRef $instrument ): void {
 		$this->payment_token_id     = $instrument->get_token_id();
 		$this->payment_method       = $instrument->get_gateway();
 		$this->payment_method_title = $instrument->get_title();
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/InstrumentRef.php b/packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/PaymentInstrumentRef.php
similarity index 91%
rename from packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/InstrumentRef.php
rename to packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/PaymentInstrumentRef.php
index 24d8ca3cfd0..e39536c281a 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/InstrumentRef.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Core/ValueObject/PaymentInstrumentRef.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * InstrumentRef - an immutable reference to a stored payment instrument.
+ * PaymentInstrumentRef - an immutable reference to a stored payment instrument.
  *
  * Carries the payment token id plus the gateway code and human-readable title
  * frozen at the time the instrument was attached. The Core zone never loads a
@@ -17,12 +17,12 @@ namespace Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject;
 defined( 'ABSPATH' ) || exit;

 /**
- * InstrumentRef value object.
+ * PaymentInstrumentRef value object.
  *
  * Immutable. A null token id covers gateways that do not expose a stored token
  * (for example some manual gateways).
  */
-final class InstrumentRef {
+final class PaymentInstrumentRef {

 	/**
 	 * Payment token id, or null when the gateway exposes no token.
diff --git a/packages/php/woocommerce-subscriptions-engine/tests/unit/Core/Entity/ContractTest.php b/packages/php/woocommerce-subscriptions-engine/tests/unit/Core/Entity/ContractTest.php
index 98e56aab395..5c86b44d8d3 100644
--- a/packages/php/woocommerce-subscriptions-engine/tests/unit/Core/Entity/ContractTest.php
+++ b/packages/php/woocommerce-subscriptions-engine/tests/unit/Core/Entity/ContractTest.php
@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Entity\Contract;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Entity\ContractStatus;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\Entity\StatusRegistry;
-use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\InstrumentRef;
+use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\PaymentInstrumentRef;
 use Automattic\WooCommerce\SubscriptionsEngine\Core\ValueObject\PlanSnapshot;

 /**
@@ -348,12 +348,12 @@ class ContractTest extends TestCase {
 	}

 	/**
-	 * @testdox The payment instrument round-trips through an InstrumentRef.
+	 * @testdox The payment instrument round-trips through a PaymentInstrumentRef.
 	 */
 	public function test_payment_instrument_round_trips(): void {
 		$contract = $this->make_contract();

-		$contract->set_payment_instrument( new InstrumentRef( 99, 'dummy', 'Dummy Gateway' ) );
+		$contract->set_payment_instrument( new PaymentInstrumentRef( 99, 'dummy', 'Dummy Gateway' ) );

 		$instrument = $contract->get_payment_instrument();
 		$this->assertSame( 99, $instrument->get_token_id() );