diff --git a/changes.md b/changes.md index 5383789e176..586ab9d535e 100644 --- a/changes.md +++ b/changes.md @@ -99,6 +99,7 @@ - added property `minCartQuantity` to type `InventoryEntryDraft` - added property `maxCartQuantity` to type `InventoryEntryDraft` - added property `recurrenceInfo` to type `MyLineItemDraft` +- added property `interfaceId` to type `MyTransactionDraft` - added property `recurrenceInfo` to type `MyCartAddLineItemAction` - added property `value` to type `CustomerEmailTokenCreatedMessage` - added property `invalidateOlderTokens` to type `CustomerEmailTokenCreatedMessage` @@ -122,6 +123,8 @@ - added property `token` to type `PaymentMethodInfo` - added property `interfaceAccount` to type `PaymentMethodInfo` - added property `custom` to type `PaymentMethodInfo` +- added property `interfaceId` to type `Transaction` +- added property `interfaceId` to type `TransactionDraft` - added property `priceCustomerGroupAssignments` to type `ProductSearchProjectionParams` - added property `attributes` to type `ProductTailoringData` - added property `attributes` to type `ProductTailoringDraft` @@ -422,6 +425,7 @@ - added type `PaymentMethodNameSetMessage` - added type `PaymentMethodPaymentInterfaceSetMessage` - added type `PaymentMethodPaymentMethodStatusSetMessage` +- added type `PaymentTransactionInterfaceIdSetMessage` - added type `RecurringOrderCreatedMessage` - added type `RecurringOrderCustomFieldAddedMessage` - added type `RecurringOrderCustomFieldChangedMessage` @@ -476,6 +480,7 @@ - added type `PaymentMethodNameSetMessagePayload` - added type `PaymentMethodPaymentInterfaceSetMessagePayload` - added type `PaymentMethodPaymentMethodStatusSetMessagePayload` +- added type `PaymentTransactionInterfaceIdSetMessagePayload` - added type `RecurringOrderCreatedMessagePayload` - added type `RecurringOrderCustomFieldAddedMessagePayload` - added type `RecurringOrderCustomFieldChangedMessagePayload` @@ -515,6 +520,7 @@ - added type `PaymentSetMethodInfoCustomTypeAction` - added type `PaymentSetMethodInfoInterfaceAccountAction` - added type `PaymentSetMethodInfoTokenAction` +- added type `PaymentSetTransactionInterfaceIdAction` - added type `ProductSearchFacetResultStats` - added type `ProductSearchFacetStatsExpression` - added type `ProductSearchFacetStatsValue` diff --git a/lib/commercetools-api/src/Models/Common/BaseResource.php b/lib/commercetools-api/src/Models/Common/BaseResource.php index 946fc1a0b82..2a826eecd77 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResource.php +++ b/lib/commercetools-api/src/Models/Common/BaseResource.php @@ -170,6 +170,7 @@ use Commercetools\Api\Models\Message\PaymentStatusInterfaceCodeSetMessage; use Commercetools\Api\Models\Message\PaymentStatusStateTransitionMessage; use Commercetools\Api\Models\Message\PaymentTransactionAddedMessage; +use Commercetools\Api\Models\Message\PaymentTransactionInterfaceIdSetMessage; use Commercetools\Api\Models\Message\PaymentTransactionStateChangedMessage; use Commercetools\Api\Models\Message\ProductAddedToCategoryMessage; use Commercetools\Api\Models\Message\ProductCreatedMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php index bb25201a421..197762de6b1 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php @@ -332,6 +332,8 @@ use Commercetools\Api\Models\Message\PaymentStatusStateTransitionMessageBuilder; use Commercetools\Api\Models\Message\PaymentTransactionAddedMessage; use Commercetools\Api\Models\Message\PaymentTransactionAddedMessageBuilder; +use Commercetools\Api\Models\Message\PaymentTransactionInterfaceIdSetMessage; +use Commercetools\Api\Models\Message\PaymentTransactionInterfaceIdSetMessageBuilder; use Commercetools\Api\Models\Message\PaymentTransactionStateChangedMessage; use Commercetools\Api\Models\Message\PaymentTransactionStateChangedMessageBuilder; use Commercetools\Api\Models\Message\ProductAddedToCategoryMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php index 0c3664964de..52d91da4676 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php @@ -332,6 +332,8 @@ use Commercetools\Api\Models\Message\PaymentStatusStateTransitionMessageModel; use Commercetools\Api\Models\Message\PaymentTransactionAddedMessage; use Commercetools\Api\Models\Message\PaymentTransactionAddedMessageModel; +use Commercetools\Api\Models\Message\PaymentTransactionInterfaceIdSetMessage; +use Commercetools\Api\Models\Message\PaymentTransactionInterfaceIdSetMessageModel; use Commercetools\Api\Models\Message\PaymentTransactionStateChangedMessage; use Commercetools\Api\Models\Message\PaymentTransactionStateChangedMessageModel; use Commercetools\Api\Models\Message\ProductAddedToCategoryMessage; diff --git a/lib/commercetools-api/src/Models/Me/MyTransactionDraft.php b/lib/commercetools-api/src/Models/Me/MyTransactionDraft.php index 875e18a902c..ef154feaa57 100644 --- a/lib/commercetools-api/src/Models/Me/MyTransactionDraft.php +++ b/lib/commercetools-api/src/Models/Me/MyTransactionDraft.php @@ -21,6 +21,7 @@ interface MyTransactionDraft extends JsonObject public const FIELD_AMOUNT = 'amount'; public const FIELD_INTERACTION_ID = 'interactionId'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_INTERFACE_ID = 'interfaceId'; /** *

Date and time (UTC) the Transaction took place.

@@ -64,6 +65,14 @@ public function getInteractionId(); */ public function getCustom(); + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId(); + /** * @param ?DateTimeImmutable $timestamp */ @@ -88,4 +97,9 @@ public function setInteractionId(?string $interactionId): void; * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void; } diff --git a/lib/commercetools-api/src/Models/Me/MyTransactionDraftBuilder.php b/lib/commercetools-api/src/Models/Me/MyTransactionDraftBuilder.php index 00ce40751b5..8f380c15f9a 100644 --- a/lib/commercetools-api/src/Models/Me/MyTransactionDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Me/MyTransactionDraftBuilder.php @@ -55,6 +55,12 @@ final class MyTransactionDraftBuilder implements Builder */ private $custom; + /** + + * @var ?string + */ + private $interfaceId; + /** *

Date and time (UTC) the Transaction took place.

* @@ -112,6 +118,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId() + { + return $this->interfaceId; + } + /** * @param ?DateTimeImmutable $timestamp * @return $this @@ -167,6 +184,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?string $interfaceId + * @return $this + */ + public function withInterfaceId(?string $interfaceId) + { + $this->interfaceId = $interfaceId; + + return $this; + } + /** * @deprecated use withAmount() instead * @return $this @@ -196,7 +224,8 @@ public function build(): MyTransactionDraft $this->type, $this->amount instanceof MoneyBuilder ? $this->amount->build() : $this->amount, $this->interactionId, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->interfaceId ); } diff --git a/lib/commercetools-api/src/Models/Me/MyTransactionDraftModel.php b/lib/commercetools-api/src/Models/Me/MyTransactionDraftModel.php index ef59c749a52..148bcb4508e 100644 --- a/lib/commercetools-api/src/Models/Me/MyTransactionDraftModel.php +++ b/lib/commercetools-api/src/Models/Me/MyTransactionDraftModel.php @@ -54,6 +54,12 @@ final class MyTransactionDraftModel extends JsonObjectModel implements MyTransac */ protected $custom; + /** + * + * @var ?string + */ + protected $interfaceId; + /** * @psalm-suppress MissingParamType @@ -63,13 +69,15 @@ public function __construct( ?string $type = null, ?Money $amount = null, ?string $interactionId = null, - ?CustomFieldsDraft $custom = null + ?CustomFieldsDraft $custom = null, + ?string $interfaceId = null ) { $this->timestamp = $timestamp; $this->type = $type; $this->amount = $amount; $this->interactionId = $interactionId; $this->custom = $custom; + $this->interfaceId = $interfaceId; } /** @@ -180,6 +188,26 @@ public function getCustom() return $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + * + * @return null|string + */ + public function getInterfaceId() + { + if (is_null($this->interfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->interfaceId = (string) $data; + } + + return $this->interfaceId; + } + /** * @param ?DateTimeImmutable $timestamp @@ -221,6 +249,14 @@ public function setCustom(?CustomFieldsDraft $custom): void $this->custom = $custom; } + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void + { + $this->interfaceId = $interfaceId; + } + #[\ReturnTypeWillChange] public function jsonSerialize() diff --git a/lib/commercetools-api/src/Models/Message/MessageModel.php b/lib/commercetools-api/src/Models/Message/MessageModel.php index 8b811a52d50..64ce0dca592 100644 --- a/lib/commercetools-api/src/Models/Message/MessageModel.php +++ b/lib/commercetools-api/src/Models/Message/MessageModel.php @@ -294,6 +294,7 @@ final class MessageModel extends JsonObjectModel implements Message 'PaymentStatusInterfaceCodeSet' => PaymentStatusInterfaceCodeSetMessageModel::class, 'PaymentStatusStateTransition' => PaymentStatusStateTransitionMessageModel::class, 'PaymentTransactionAdded' => PaymentTransactionAddedMessageModel::class, + 'PaymentTransactionInterfaceIdSet' => PaymentTransactionInterfaceIdSetMessageModel::class, 'PaymentTransactionStateChanged' => PaymentTransactionStateChangedMessageModel::class, 'ProductAddedToCategory' => ProductAddedToCategoryMessageModel::class, 'ProductCreated' => ProductCreatedMessageModel::class, diff --git a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php index 03d3610d702..67df04d0f06 100644 --- a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php @@ -225,6 +225,7 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'PaymentStatusInterfaceCodeSet' => PaymentStatusInterfaceCodeSetMessagePayloadModel::class, 'PaymentStatusStateTransition' => PaymentStatusStateTransitionMessagePayloadModel::class, 'PaymentTransactionAdded' => PaymentTransactionAddedMessagePayloadModel::class, + 'PaymentTransactionInterfaceIdSet' => PaymentTransactionInterfaceIdSetMessagePayloadModel::class, 'PaymentTransactionStateChanged' => PaymentTransactionStateChangedMessagePayloadModel::class, 'ProductAddedToCategory' => ProductAddedToCategoryMessagePayloadModel::class, 'ProductCreated' => ProductCreatedMessagePayloadModel::class, diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessage.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessage.php new file mode 100644 index 00000000000..627929bd681 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessage.php @@ -0,0 +1,58 @@ +Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId(); + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getNewInterfaceId(); + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getOldInterfaceId(); + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void; + + /** + * @param ?string $newInterfaceId + */ + public function setNewInterfaceId(?string $newInterfaceId): void; + + /** + * @param ?string $oldInterfaceId + */ + public function setOldInterfaceId(?string $oldInterfaceId): void; +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageBuilder.php new file mode 100644 index 00000000000..6dc19f74f9c --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageBuilder.php @@ -0,0 +1,462 @@ + + */ +final class PaymentTransactionInterfaceIdSetMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var ?string + */ + private $transactionId; + + /** + + * @var ?string + */ + private $newInterfaceId; + + /** + + * @var ?string + */ + private $oldInterfaceId; + + /** + *

Unique identifier of the Message. Can be used to track which Messages have been processed.

+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *

Version of a resource. In case of Messages, this is always 1.

+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *

Date and time (UTC) the Message was generated.

+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *

Value of createdAt.

+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *

IDs and references that last modified the Message.

+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

+ * + + * @return null|int + */ + public function getSequenceNumber() + { + return $this->sequenceNumber; + } + + /** + *

Reference to the resource on which the change or action was performed.

+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

+ * + + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers; + } + + /** + *

Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getNewInterfaceId() + { + return $this->newInterfaceId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getOldInterfaceId() + { + return $this->oldInterfaceId; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?string $transactionId + * @return $this + */ + public function withTransactionId(?string $transactionId) + { + $this->transactionId = $transactionId; + + return $this; + } + + /** + * @param ?string $newInterfaceId + * @return $this + */ + public function withNewInterfaceId(?string $newInterfaceId) + { + $this->newInterfaceId = $newInterfaceId; + + return $this; + } + + /** + * @param ?string $oldInterfaceId + * @return $this + */ + public function withOldInterfaceId(?string $oldInterfaceId) + { + $this->oldInterfaceId = $oldInterfaceId; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): PaymentTransactionInterfaceIdSetMessage + { + return new PaymentTransactionInterfaceIdSetMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->transactionId, + $this->newInterfaceId, + $this->oldInterfaceId + ); + } + + public static function of(): PaymentTransactionInterfaceIdSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageCollection.php new file mode 100644 index 00000000000..5f5a551e465 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method PaymentTransactionInterfaceIdSetMessage current() + * @method PaymentTransactionInterfaceIdSetMessage end() + * @method PaymentTransactionInterfaceIdSetMessage at($offset) + */ +class PaymentTransactionInterfaceIdSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert PaymentTransactionInterfaceIdSetMessage $value + * @psalm-param PaymentTransactionInterfaceIdSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return PaymentTransactionInterfaceIdSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof PaymentTransactionInterfaceIdSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?PaymentTransactionInterfaceIdSetMessage + */ + protected function mapper() + { + return function (?int $index): ?PaymentTransactionInterfaceIdSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var PaymentTransactionInterfaceIdSetMessage $data */ + $data = PaymentTransactionInterfaceIdSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageModel.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageModel.php new file mode 100644 index 00000000000..9fa46636a57 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessageModel.php @@ -0,0 +1,562 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->transactionId = $transactionId; + $this->newInterfaceId = $newInterfaceId; + $this->oldInterfaceId = $oldInterfaceId; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *

Unique identifier of the Message. Can be used to track which Messages have been processed.

+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *

Version of a resource. In case of Messages, this is always 1.

+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *

Date and time (UTC) the Message was generated.

+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *

Value of createdAt.

+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *

IDs and references that last modified the Message.

+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_BY); + if (is_null($data)) { + return null; + } + + $this->lastModifiedBy = LastModifiedByModel::of($data); + } + + return $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CREATED_BY); + if (is_null($data)) { + return null; + } + + $this->createdBy = CreatedByModel::of($data); + } + + return $this->createdBy; + } + + /** + *

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

+ * + * + * @return null|int + */ + public function getSequenceNumber() + { + if (is_null($this->sequenceNumber)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_SEQUENCE_NUMBER); + if (is_null($data)) { + return null; + } + $this->sequenceNumber = (int) $data; + } + + return $this->sequenceNumber; + } + + /** + *

Reference to the resource on which the change or action was performed.

+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *

Message Type of the Message.

+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

+ * + * + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + if (is_null($this->resourceUserProvidedIdentifiers)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS); + if (is_null($data)) { + return null; + } + + $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data); + } + + return $this->resourceUserProvidedIdentifiers; + } + + /** + *

Unique identifier of the Transaction.

+ * + * + * @return null|string + */ + public function getTransactionId() + { + if (is_null($this->transactionId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TRANSACTION_ID); + if (is_null($data)) { + return null; + } + $this->transactionId = (string) $data; + } + + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + * + * @return null|string + */ + public function getNewInterfaceId() + { + if (is_null($this->newInterfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEW_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->newInterfaceId = (string) $data; + } + + return $this->newInterfaceId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + * + * @return null|string + */ + public function getOldInterfaceId() + { + if (is_null($this->oldInterfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->oldInterfaceId = (string) $data; + } + + return $this->oldInterfaceId; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void + { + $this->transactionId = $transactionId; + } + + /** + * @param ?string $newInterfaceId + */ + public function setNewInterfaceId(?string $newInterfaceId): void + { + $this->newInterfaceId = $newInterfaceId; + } + + /** + * @param ?string $oldInterfaceId + */ + public function setOldInterfaceId(?string $oldInterfaceId): void + { + $this->oldInterfaceId = $oldInterfaceId; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayload.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayload.php new file mode 100644 index 00000000000..26985ee6a3a --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayload.php @@ -0,0 +1,58 @@ +Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId(); + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getNewInterfaceId(); + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getOldInterfaceId(); + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void; + + /** + * @param ?string $newInterfaceId + */ + public function setNewInterfaceId(?string $newInterfaceId): void; + + /** + * @param ?string $oldInterfaceId + */ + public function setOldInterfaceId(?string $oldInterfaceId): void; +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..503136eea0c --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadBuilder.php @@ -0,0 +1,121 @@ + + */ +final class PaymentTransactionInterfaceIdSetMessagePayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $transactionId; + + /** + + * @var ?string + */ + private $newInterfaceId; + + /** + + * @var ?string + */ + private $oldInterfaceId; + + /** + *

Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getNewInterfaceId() + { + return $this->newInterfaceId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + + * @return null|string + */ + public function getOldInterfaceId() + { + return $this->oldInterfaceId; + } + + /** + * @param ?string $transactionId + * @return $this + */ + public function withTransactionId(?string $transactionId) + { + $this->transactionId = $transactionId; + + return $this; + } + + /** + * @param ?string $newInterfaceId + * @return $this + */ + public function withNewInterfaceId(?string $newInterfaceId) + { + $this->newInterfaceId = $newInterfaceId; + + return $this; + } + + /** + * @param ?string $oldInterfaceId + * @return $this + */ + public function withOldInterfaceId(?string $oldInterfaceId) + { + $this->oldInterfaceId = $oldInterfaceId; + + return $this; + } + + + public function build(): PaymentTransactionInterfaceIdSetMessagePayload + { + return new PaymentTransactionInterfaceIdSetMessagePayloadModel( + $this->transactionId, + $this->newInterfaceId, + $this->oldInterfaceId + ); + } + + public static function of(): PaymentTransactionInterfaceIdSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadCollection.php new file mode 100644 index 00000000000..9dadfcf7e80 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method PaymentTransactionInterfaceIdSetMessagePayload current() + * @method PaymentTransactionInterfaceIdSetMessagePayload end() + * @method PaymentTransactionInterfaceIdSetMessagePayload at($offset) + */ +class PaymentTransactionInterfaceIdSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert PaymentTransactionInterfaceIdSetMessagePayload $value + * @psalm-param PaymentTransactionInterfaceIdSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return PaymentTransactionInterfaceIdSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof PaymentTransactionInterfaceIdSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?PaymentTransactionInterfaceIdSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?PaymentTransactionInterfaceIdSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var PaymentTransactionInterfaceIdSetMessagePayload $data */ + $data = PaymentTransactionInterfaceIdSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadModel.php new file mode 100644 index 00000000000..128b207625d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/PaymentTransactionInterfaceIdSetMessagePayloadModel.php @@ -0,0 +1,165 @@ +transactionId = $transactionId; + $this->newInterfaceId = $newInterfaceId; + $this->oldInterfaceId = $oldInterfaceId; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *

Unique identifier of the Transaction.

+ * + * + * @return null|string + */ + public function getTransactionId() + { + if (is_null($this->transactionId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TRANSACTION_ID); + if (is_null($data)) { + return null; + } + $this->transactionId = (string) $data; + } + + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) after Set Transaction InterfaceId update action.

+ * + * + * @return null|string + */ + public function getNewInterfaceId() + { + if (is_null($this->newInterfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEW_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->newInterfaceId = (string) $data; + } + + return $this->newInterfaceId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) before the Set Transaction InterfaceId update action.

+ * + * + * @return null|string + */ + public function getOldInterfaceId() + { + if (is_null($this->oldInterfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->oldInterfaceId = (string) $data; + } + + return $this->oldInterfaceId; + } + + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void + { + $this->transactionId = $transactionId; + } + + /** + * @param ?string $newInterfaceId + */ + public function setNewInterfaceId(?string $newInterfaceId): void + { + $this->newInterfaceId = $newInterfaceId; + } + + /** + * @param ?string $oldInterfaceId + */ + public function setOldInterfaceId(?string $oldInterfaceId): void + { + $this->oldInterfaceId = $oldInterfaceId; + } +} diff --git a/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdAction.php b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdAction.php new file mode 100644 index 00000000000..fd658d90ead --- /dev/null +++ b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdAction.php @@ -0,0 +1,45 @@ +Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId(); + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. It must be unique across all transactions. + * If interfaceId is absent, this field will be removed from the specified Transaction, if it exists.

+ * + + * @return null|string + */ + public function getInterfaceId(); + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void; + + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void; +} diff --git a/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionBuilder.php b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionBuilder.php new file mode 100644 index 00000000000..769e2ca48b4 --- /dev/null +++ b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionBuilder.php @@ -0,0 +1,93 @@ + + */ +final class PaymentSetTransactionInterfaceIdActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $transactionId; + + /** + + * @var ?string + */ + private $interfaceId; + + /** + *

Unique identifier of the Transaction.

+ * + + * @return null|string + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. It must be unique across all transactions. + * If interfaceId is absent, this field will be removed from the specified Transaction, if it exists.

+ * + + * @return null|string + */ + public function getInterfaceId() + { + return $this->interfaceId; + } + + /** + * @param ?string $transactionId + * @return $this + */ + public function withTransactionId(?string $transactionId) + { + $this->transactionId = $transactionId; + + return $this; + } + + /** + * @param ?string $interfaceId + * @return $this + */ + public function withInterfaceId(?string $interfaceId) + { + $this->interfaceId = $interfaceId; + + return $this; + } + + + public function build(): PaymentSetTransactionInterfaceIdAction + { + return new PaymentSetTransactionInterfaceIdActionModel( + $this->transactionId, + $this->interfaceId + ); + } + + public static function of(): PaymentSetTransactionInterfaceIdActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionCollection.php b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionCollection.php new file mode 100644 index 00000000000..d4bd0e33c87 --- /dev/null +++ b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionCollection.php @@ -0,0 +1,56 @@ + + * @method PaymentSetTransactionInterfaceIdAction current() + * @method PaymentSetTransactionInterfaceIdAction end() + * @method PaymentSetTransactionInterfaceIdAction at($offset) + */ +class PaymentSetTransactionInterfaceIdActionCollection extends PaymentUpdateActionCollection +{ + /** + * @psalm-assert PaymentSetTransactionInterfaceIdAction $value + * @psalm-param PaymentSetTransactionInterfaceIdAction|stdClass $value + * @throws InvalidArgumentException + * + * @return PaymentSetTransactionInterfaceIdActionCollection + */ + public function add($value) + { + if (!$value instanceof PaymentSetTransactionInterfaceIdAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?PaymentSetTransactionInterfaceIdAction + */ + protected function mapper() + { + return function (?int $index): ?PaymentSetTransactionInterfaceIdAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var PaymentSetTransactionInterfaceIdAction $data */ + $data = PaymentSetTransactionInterfaceIdActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionModel.php b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionModel.php new file mode 100644 index 00000000000..42c0e0d38b6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Payment/PaymentSetTransactionInterfaceIdActionModel.php @@ -0,0 +1,130 @@ +transactionId = $transactionId; + $this->interfaceId = $interfaceId; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *

Unique identifier of the Transaction.

+ * + * + * @return null|string + */ + public function getTransactionId() + { + if (is_null($this->transactionId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TRANSACTION_ID); + if (is_null($data)) { + return null; + } + $this->transactionId = (string) $data; + } + + return $this->transactionId; + } + + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction. It must be unique across all transactions. + * If interfaceId is absent, this field will be removed from the specified Transaction, if it exists.

+ * + * + * @return null|string + */ + public function getInterfaceId() + { + if (is_null($this->interfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->interfaceId = (string) $data; + } + + return $this->interfaceId; + } + + + /** + * @param ?string $transactionId + */ + public function setTransactionId(?string $transactionId): void + { + $this->transactionId = $transactionId; + } + + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void + { + $this->interfaceId = $interfaceId; + } +} diff --git a/lib/commercetools-api/src/Models/Payment/PaymentUpdateActionModel.php b/lib/commercetools-api/src/Models/Payment/PaymentUpdateActionModel.php index 925c485552f..400bfb37dda 100644 --- a/lib/commercetools-api/src/Models/Payment/PaymentUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/Payment/PaymentUpdateActionModel.php @@ -55,6 +55,7 @@ final class PaymentUpdateActionModel extends JsonObjectModel implements PaymentU 'setStatusInterfaceText' => PaymentSetStatusInterfaceTextActionModel::class, 'setTransactionCustomField' => PaymentSetTransactionCustomFieldActionModel::class, 'setTransactionCustomType' => PaymentSetTransactionCustomTypeActionModel::class, + 'setTransactionInterfaceId' => PaymentSetTransactionInterfaceIdActionModel::class, 'transitionState' => PaymentTransitionStateActionModel::class, ]; diff --git a/lib/commercetools-api/src/Models/Payment/Transaction.php b/lib/commercetools-api/src/Models/Payment/Transaction.php index 849377ee9d4..51e8dcae72d 100644 --- a/lib/commercetools-api/src/Models/Payment/Transaction.php +++ b/lib/commercetools-api/src/Models/Payment/Transaction.php @@ -23,6 +23,7 @@ interface Transaction extends JsonObject public const FIELD_INTERACTION_ID = 'interactionId'; public const FIELD_STATE = 'state'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_INTERFACE_ID = 'interfaceId'; /** *

Unique identifier of the Transaction.

@@ -81,6 +82,14 @@ public function getState(); */ public function getCustom(); + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId(); + /** * @param ?string $id */ @@ -115,4 +124,9 @@ public function setState(?string $state): void; * @param ?CustomFields $custom */ public function setCustom(?CustomFields $custom): void; + + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void; } diff --git a/lib/commercetools-api/src/Models/Payment/TransactionBuilder.php b/lib/commercetools-api/src/Models/Payment/TransactionBuilder.php index 2009f472294..931ef687152 100644 --- a/lib/commercetools-api/src/Models/Payment/TransactionBuilder.php +++ b/lib/commercetools-api/src/Models/Payment/TransactionBuilder.php @@ -67,6 +67,12 @@ final class TransactionBuilder implements Builder */ private $custom; + /** + + * @var ?string + */ + private $interfaceId; + /** *

Unique identifier of the Transaction.

* @@ -145,6 +151,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId() + { + return $this->interfaceId; + } + /** * @param ?string $id * @return $this @@ -222,6 +239,17 @@ public function withCustom(?CustomFields $custom) return $this; } + /** + * @param ?string $interfaceId + * @return $this + */ + public function withInterfaceId(?string $interfaceId) + { + $this->interfaceId = $interfaceId; + + return $this; + } + /** * @deprecated use withAmount() instead * @return $this @@ -253,7 +281,8 @@ public function build(): Transaction $this->amount instanceof CentPrecisionMoneyBuilder ? $this->amount->build() : $this->amount, $this->interactionId, $this->state, - $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, + $this->interfaceId ); } diff --git a/lib/commercetools-api/src/Models/Payment/TransactionDraft.php b/lib/commercetools-api/src/Models/Payment/TransactionDraft.php index ed5b99ccf37..9b3ea7661b9 100644 --- a/lib/commercetools-api/src/Models/Payment/TransactionDraft.php +++ b/lib/commercetools-api/src/Models/Payment/TransactionDraft.php @@ -22,6 +22,7 @@ interface TransactionDraft extends JsonObject public const FIELD_INTERACTION_ID = 'interactionId'; public const FIELD_STATE = 'state'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_INTERFACE_ID = 'interfaceId'; /** *

Date and time (UTC) the Transaction took place.

@@ -72,6 +73,14 @@ public function getState(); */ public function getCustom(); + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId(); + /** * @param ?DateTimeImmutable $timestamp */ @@ -101,4 +110,9 @@ public function setState(?string $state): void; * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void; } diff --git a/lib/commercetools-api/src/Models/Payment/TransactionDraftBuilder.php b/lib/commercetools-api/src/Models/Payment/TransactionDraftBuilder.php index 455323b411a..889d71afd25 100644 --- a/lib/commercetools-api/src/Models/Payment/TransactionDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Payment/TransactionDraftBuilder.php @@ -61,6 +61,12 @@ final class TransactionDraftBuilder implements Builder */ private $custom; + /** + + * @var ?string + */ + private $interfaceId; + /** *

Date and time (UTC) the Transaction took place.

* @@ -128,6 +134,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + + * @return null|string + */ + public function getInterfaceId() + { + return $this->interfaceId; + } + /** * @param ?DateTimeImmutable $timestamp * @return $this @@ -194,6 +211,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?string $interfaceId + * @return $this + */ + public function withInterfaceId(?string $interfaceId) + { + $this->interfaceId = $interfaceId; + + return $this; + } + /** * @deprecated use withAmount() instead * @return $this @@ -224,7 +252,8 @@ public function build(): TransactionDraft $this->amount instanceof MoneyBuilder ? $this->amount->build() : $this->amount, $this->interactionId, $this->state, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->interfaceId ); } diff --git a/lib/commercetools-api/src/Models/Payment/TransactionDraftModel.php b/lib/commercetools-api/src/Models/Payment/TransactionDraftModel.php index 010e9678605..f2211bdafb9 100644 --- a/lib/commercetools-api/src/Models/Payment/TransactionDraftModel.php +++ b/lib/commercetools-api/src/Models/Payment/TransactionDraftModel.php @@ -60,6 +60,12 @@ final class TransactionDraftModel extends JsonObjectModel implements Transaction */ protected $custom; + /** + * + * @var ?string + */ + protected $interfaceId; + /** * @psalm-suppress MissingParamType @@ -70,7 +76,8 @@ public function __construct( ?Money $amount = null, ?string $interactionId = null, ?string $state = null, - ?CustomFieldsDraft $custom = null + ?CustomFieldsDraft $custom = null, + ?string $interfaceId = null ) { $this->timestamp = $timestamp; $this->type = $type; @@ -78,6 +85,7 @@ public function __construct( $this->interactionId = $interactionId; $this->state = $state; $this->custom = $custom; + $this->interfaceId = $interfaceId; } /** @@ -207,6 +215,26 @@ public function getCustom() return $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + * + * @return null|string + */ + public function getInterfaceId() + { + if (is_null($this->interfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->interfaceId = (string) $data; + } + + return $this->interfaceId; + } + /** * @param ?DateTimeImmutable $timestamp @@ -256,6 +284,14 @@ public function setCustom(?CustomFieldsDraft $custom): void $this->custom = $custom; } + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void + { + $this->interfaceId = $interfaceId; + } + #[\ReturnTypeWillChange] public function jsonSerialize() diff --git a/lib/commercetools-api/src/Models/Payment/TransactionModel.php b/lib/commercetools-api/src/Models/Payment/TransactionModel.php index b245ee3387a..517e040b475 100644 --- a/lib/commercetools-api/src/Models/Payment/TransactionModel.php +++ b/lib/commercetools-api/src/Models/Payment/TransactionModel.php @@ -66,6 +66,12 @@ final class TransactionModel extends JsonObjectModel implements Transaction */ protected $custom; + /** + * + * @var ?string + */ + protected $interfaceId; + /** * @psalm-suppress MissingParamType @@ -77,7 +83,8 @@ public function __construct( ?CentPrecisionMoney $amount = null, ?string $interactionId = null, ?string $state = null, - ?CustomFields $custom = null + ?CustomFields $custom = null, + ?string $interfaceId = null ) { $this->id = $id; $this->timestamp = $timestamp; @@ -86,6 +93,7 @@ public function __construct( $this->interactionId = $interactionId; $this->state = $state; $this->custom = $custom; + $this->interfaceId = $interfaceId; } /** @@ -235,6 +243,26 @@ public function getCustom() return $this->custom; } + /** + *

Identifier used by the payment service that processes the Payment (for example, a PSP) in the current transaction.

+ * + * + * @return null|string + */ + public function getInterfaceId() + { + if (is_null($this->interfaceId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERFACE_ID); + if (is_null($data)) { + return null; + } + $this->interfaceId = (string) $data; + } + + return $this->interfaceId; + } + /** * @param ?string $id @@ -292,6 +320,14 @@ public function setCustom(?CustomFields $custom): void $this->custom = $custom; } + /** + * @param ?string $interfaceId + */ + public function setInterfaceId(?string $interfaceId): void + { + $this->interfaceId = $interfaceId; + } + #[\ReturnTypeWillChange] public function jsonSerialize() diff --git a/references.txt b/references.txt index 3ca0d272c48..576643a81a9 100644 --- a/references.txt +++ b/references.txt @@ -508,3 +508,4 @@ df77c68a29c7df7e44d197903e5cfd3a2a53c878 246368f5b2d9d7245b2f33c08aedb941a5561623 389daeb97da5433d8f351b71e6c95ff39e74082c 0745b0c41f8f7a40e0b24aa6c28ee65ad2ccb2c4 +946b77339c0aa1f9205ccf4966e26de47cac11f3