mirror of
https://github.com/vr-payment/shopware-6.git
synced 2026-06-05 03:19:49 +00:00
Release 6.1.10
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1590156974PaymentMethodConfigurationEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1590156974PaymentMethodConfigurationEntity extends MigrationStep {
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1590156974;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
$connection->executeStatement('
|
||||
CREATE TABLE IF NOT EXISTS `vrpayment_payment_method_configuration` (
|
||||
`id` BINARY(16) NOT NULL,
|
||||
`data` JSON NOT NULL,
|
||||
`payment_method_configuration_id` INT UNSIGNED NOT NULL,
|
||||
`payment_method_id` BINARY(16) NOT NULL,
|
||||
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||
`space_id` INT UNSIGNED NOT NULL,
|
||||
`state` VARCHAR(255) NOT NULL,
|
||||
`created_at` DATETIME(3) NOT NULL,
|
||||
`updated_at` DATETIME(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `payment_method_configuration_id_space_id_UNIQUE` (`payment_method_configuration_id`,`space_id`),
|
||||
KEY `fk.vrp_payment_method_configuration.payment_method_id` (`payment_method_id`),
|
||||
CONSTRAINT `fk.vrp_payment_method_configuration.payment_method_id` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_method` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1590156974TransactionEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1590156974TransactionEntity extends MigrationStep {
|
||||
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1590156974;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
$connection->executeStatement('
|
||||
CREATE TABLE IF NOT EXISTS `vrpayment_transaction` (
|
||||
`id` BINARY(16) NOT NULL,
|
||||
`data` JSON NOT NULL,
|
||||
`payment_method_id` BINARY(16) NOT NULL,
|
||||
`order_id` BINARY(16) NOT NULL,
|
||||
`order_transaction_id` BINARY(16) NOT NULL,
|
||||
`space_id` INT UNSIGNED NOT NULL,
|
||||
`state` VARCHAR(255) NOT NULL,
|
||||
`sales_channel_id` BINARY(16) NOT NULL,
|
||||
`transaction_id` INT UNSIGNED NOT NULL,
|
||||
`created_at` DATETIME(3) NOT NULL,
|
||||
`updated_at` DATETIME(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `transaction_id_UNIQUE` (`transaction_id`),
|
||||
KEY `fk.vrp_transaction.order_id` (`order_id`),
|
||||
KEY `fk.vrp_transaction.order_transaction_id` (`order_transaction_id`),
|
||||
KEY `fk.vrp_transaction.payment_method_id` (`payment_method_id`),
|
||||
KEY `fk.vrp_transaction.sales_channel_id` (`sales_channel_id`),
|
||||
CONSTRAINT `fk.vrp_transaction.order_id` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk.vrp_transaction.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk.vrp_transaction.payment_method_id` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_method` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk.vrp_transaction.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1590646356OrderEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1590646356OrderEntity extends MigrationStep {
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1590646356;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
try {
|
||||
$connection->executeStatement('ALTER TABLE `order` ADD COLUMN `vrpayment_lock` DATETIME DEFAULT NULL;');
|
||||
}catch (\Exception $exception){
|
||||
echo $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1590646356RefundEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1590646356RefundEntity extends MigrationStep {
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1590646356;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
$connection->executeStatement('
|
||||
CREATE TABLE IF NOT EXISTS `vrpayment_refund` (
|
||||
`id` BINARY(16) NOT NULL,
|
||||
`data` JSON NOT NULL,
|
||||
`refund_id` INT UNSIGNED NOT NULL,
|
||||
`space_id` INT UNSIGNED NOT NULL,
|
||||
`state` VARCHAR(255) NOT NULL,
|
||||
`transaction_id` INT UNSIGNED NOT NULL,
|
||||
`created_at` DATETIME(3) NOT NULL,
|
||||
`updated_at` DATETIME(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `refund_id_UNIQUE` (`refund_id`),
|
||||
KEY `fk.vrp_refund.transaction_id` (`transaction_id`),
|
||||
CONSTRAINT `fk.vrp_refund.transaction_id` FOREIGN KEY (`transaction_id`) REFERENCES `vrpayment_transaction` (`transaction_id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1590646356TransactionEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1590646356TransactionEntity extends MigrationStep {
|
||||
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1590646356;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
try {
|
||||
$connection->executeStatement('ALTER TABLE `vrpayment_transaction` ADD COLUMN `confirmation_email_sent` TINYINT(1) NOT NULL DEFAULT 0 AFTER `id`;');
|
||||
}catch (\Exception $exception){
|
||||
// column probably exists
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1605701047PaymentMethodConfigurationEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1605701047PaymentMethodConfigurationEntity extends MigrationStep {
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1605701047;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
$connection->executeStatement('ALTER TABLE `vrpayment_payment_method_configuration` CHANGE `payment_method_configuration_id` `payment_method_configuration_id` bigint unsigned NOT NULL AFTER `data`;');
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1605701048TransactionEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1605701048TransactionEntity extends MigrationStep
|
||||
{
|
||||
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1605701048;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
|
||||
try {
|
||||
$connection->executeStatement('
|
||||
ALTER TABLE `vrpayment_transaction`
|
||||
ADD `order_version_id` binary(16) NOT NULL AFTER `transaction_id`;
|
||||
');
|
||||
|
||||
$connection->executeStatement('
|
||||
UPDATE `vrpayment_transaction` t1
|
||||
INNER JOIN `order` t2
|
||||
ON t1.order_id = t2.id
|
||||
SET t1.order_version_id = t2.version_id;
|
||||
');
|
||||
|
||||
$connection->executeStatement('
|
||||
ALTER TABLE `vrpayment_transaction`
|
||||
DROP FOREIGN KEY `fk.vrp_transaction.order_id`,
|
||||
DROP FOREIGN KEY `fk.vrp_transaction.order_transaction_id`,
|
||||
DROP FOREIGN KEY `fk.vrp_transaction.payment_method_id`,
|
||||
DROP FOREIGN KEY `fk.vrp_transaction.sales_channel_id`;
|
||||
');
|
||||
|
||||
$connection->executeStatement('
|
||||
ALTER TABLE `vrpayment_transaction`
|
||||
ADD CONSTRAINT `fk.vrp_transaction_order_id` FOREIGN KEY (`order_id`, `order_version_id`)
|
||||
REFERENCES `order` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk.vrp_transaction_payment_method_id` FOREIGN KEY (`payment_method_id`)
|
||||
REFERENCES `payment_method` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
ADD CONSTRAINT `fk.vrp_transaction_sales_channel_id` FOREIGN KEY (`sales_channel_id`)
|
||||
REFERENCES `sales_channel` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
');
|
||||
} catch (\Exception $exception) {
|
||||
// column probably exists
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
use Shopware\Core\Framework\Uuid\Uuid;
|
||||
use Shopware\Core\System\StateMachine\Aggregation\StateMachineState\StateMachineStateDefinition;
|
||||
use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionDefinition;
|
||||
use Shopware\Core\System\StateMachine\StateMachineDefinition;
|
||||
|
||||
/**
|
||||
* Class Migration1605701049StateMachineEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1605701049StateMachineEntity extends MigrationStep
|
||||
{
|
||||
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1605701049;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
try {
|
||||
// Enable mark transaction as paid when it's on status reminded
|
||||
$table = StateMachineDefinition::ENTITY_NAME;
|
||||
$stateMachineId = $connection->fetchOne(
|
||||
"SELECT id FROM `$table` WHERE `technical_name` = :technical_name",
|
||||
[
|
||||
'technical_name' => 'order_transaction.state',
|
||||
]
|
||||
);
|
||||
|
||||
$table = StateMachineStateDefinition::ENTITY_NAME;
|
||||
$remindedStateId = $connection->fetchOne(
|
||||
"SELECT id FROM `$table` WHERE `technical_name` = :technical_name AND `state_machine_id` = :state_machine_id",
|
||||
[
|
||||
'technical_name' => 'reminded',
|
||||
'state_machine_id' => $stateMachineId,
|
||||
]
|
||||
);
|
||||
|
||||
$paidStateId = $connection->fetchOne(
|
||||
"SELECT id FROM `$table` WHERE `technical_name` = :technical_name AND `state_machine_id` = :state_machine_id",
|
||||
[
|
||||
'technical_name' => 'paid',
|
||||
'state_machine_id' => $stateMachineId,
|
||||
]
|
||||
);
|
||||
|
||||
$id = Uuid::randomBytes();
|
||||
$connection->insert(StateMachineTransitionDefinition::ENTITY_NAME,
|
||||
[
|
||||
'id' => $id,
|
||||
'action_name' => 'paid',
|
||||
'state_machine_id' => $stateMachineId,
|
||||
'from_state_id' => $remindedStateId,
|
||||
'to_state_id' => $paidStateId,
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
);
|
||||
} catch (\Exception $exception) {
|
||||
// column probably exists
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace VRPaymentPayment\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Shopware\Core\Framework\Migration\MigrationStep;
|
||||
|
||||
/**
|
||||
* Class Migration1684240994TransactionEntity
|
||||
*
|
||||
* @package VRPaymentPayment\Migration
|
||||
*/
|
||||
class Migration1684240994TransactionEntity extends MigrationStep {
|
||||
|
||||
/**
|
||||
* get creation timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCreationTimestamp(): int
|
||||
{
|
||||
return 1684240994;
|
||||
}
|
||||
|
||||
/**
|
||||
* update non-destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
try {
|
||||
$connection->executeStatement('ALTER TABLE `vrpayment_transaction` ADD COLUMN `erp_merchant_id` VARCHAR(255) DEFAULT NULL AFTER `confirmation_email_sent`;');
|
||||
}catch (\Exception $exception){
|
||||
// column probably exists
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update destructive changes
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function updateDestructive(Connection $connection): void
|
||||
{
|
||||
// implement update destructive
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user