Module Maintenance + création du module Recette

This commit is contained in:
2021-04-01 20:44:45 +02:00
parent a887f6892b
commit 8d8ca3fe2f
92 changed files with 6334 additions and 6 deletions

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<!-- sample definition
<loop name="MySuperLoop" class="PayPlugModule\Loop\MySuperLoop" />
-->
</loops>
<forms>
<form name="payplugmodule_configuration_form" class="PayPlugModule\Form\ConfigurationForm" />
<form name="payplugmodule_order_action_form" class="PayPlugModule\Form\OrderActionForm" />
<form name="payplugmodule_order_action_form_refund" class="PayPlugModule\Form\OrderRefundForm" />
</forms>
<commands>
<command class="PayPlugModule\Command\TreatOrderMultiPaymentCommand" />
</commands>
<services>
<service id="payplugmodule_payment_service" class="PayPlugModule\Service\PaymentService">
<argument type="service" id="event_dispatcher"/>
</service>
<service id="payplugmodule_order_status_service" class="PayPlugModule\Service\OrderStatusService">
<argument type="service" id="event_dispatcher"/>
</service>
<service id="payplugmodule_notification_listener" class="PayPlugModule\EventListener\NotificationListener">
<argument type="service" id="event_dispatcher"/>
<argument type="service" id="payplugmodule_order_status_service"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="payplugmodule_payment_listener" class="PayPlugModule\EventListener\PaymentListener">
<argument type="service" id="event_dispatcher"/>
<argument type="service" id="payplugmodule_order_status_service"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="payplugmodule_order_listener" class="PayPlugModule\EventListener\OrderListener">
<argument type="service" id="payplugmodule_payment_service"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="payplugmodule_form_extend_order_listener" class="PayPlugModule\EventListener\FormExtend\OrderFormListener">
<argument type="service" id="request_stack"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="payplugmodule_conformation_emil_listener" class="PayPlugModule\EventListener\ConfirmationEmailListener">
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
<hooks>
<hook id="payplugmodule_back_hook" class="PayPlugModule\Hook\BackHookManager">
<tag name="hook.event_listener" event="order-edit.payment-module-bottom" type="back" method="onOrderEditPaymentModuleBottom"/>
<tag name="hook.event_listener" event="order.edit-js " type="back" templates="js:PayPlugModule/order_pay_plug.js"/>
</hook>
<hook id="payplugmodule_front_hook" class="PayPlugModule\Hook\FrontHookManager">
<argument type="service" id="thelia.taxengine"/>
<tag name="hook.event_listener" event="order-invoice.after-javascript-include" type="front" method="onOrderInvoiceAfterJsInclude"/>
<tag name="hook.event_listener" event="order-invoice.payment-extra" type="front" method="onOrderInvoicePaymentExtra"/>
</hook>
</hooks>
<!--
<exports>
</exports>
-->
<!--
<imports>
</imports>
-->
</config>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>PayPlugModule\PayPlugModule</fullnamespace>
<descriptive locale="en_US">
<title>PayPlug payment module</title>
<subtitle>https://www.payplug.com</subtitle>
</descriptive>
<descriptive locale="fr_FR">
<title>Module de paiement PayPlug</title>
<subtitle>https://www.payplug.com/fr</subtitle>
</descriptive>
<logo>payplug.png</logo>
<images-folder>images</images-folder>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0.5</version>
<authors>
<author>
<name>Vincent Lopes-Vicente</name>
<email>vlopes@openstudio.fr</email>
</author>
</authors>
<type>payment</type>
<thelia>2.4.0</thelia>
<stability>other</stability>
<mandatory>0</mandatory>
<hidden>0</hidden>
</module>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="admin.payplugmodule.config" path="/admin/module/PayPlugModule">
<default key="_controller">PayPlugModule\Controller\Admin\ConfigurationController::viewAction</default>
</route>
<route id="admin.payplugmodule.config.save" path="/admin/module/payplugmodule/configuration" methods="POST">
<default key="_controller">PayPlugModule\Controller\Admin\ConfigurationController::saveAction</default>
</route>
<route id="admin.payplugmodule.order.refund" path="/admin/payplugmodule/order/refund" methods="POST">
<default key="_controller">PayPlugModule\Controller\Admin\OrderController::refundAction</default>
</route>
<route id="admin.payplugmodule.order.capture" path="/admin/payplugmodule/order/capture" methods="POST">
<default key="_controller">PayPlugModule\Controller\Admin\OrderController::captureAction</default>
</route>
<route id="payplugmodule_notification" path="/payplug/notification">
<default key="_controller">PayPlugModule\Controller\NotificationController::entryPoint</default>
</route>
<route id="payplugmodule_delete_card" path="/payplug/card/delete">
<default key="_controller">PayPlugModule\Controller\CardController::deleteCurrentCustomerCard</default>
</route>
</routes>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<table name="order_pay_plug_data" namespace="PayPlugModule\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true"/>
<column name="amount_refunded" scale="6" size="16" type="DECIMAL" />
<column name="need_capture" type="TINYINT" default="0"/>
<column name="capture_expire_at" type="TIMESTAMP" />
<column name="captured_at" type="TIMESTAMP" />
<foreign-key foreignTable="order" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="id" foreign="id" />
</foreign-key>
</table>
<table name="pay_plug_card" namespace="PayPlugModule\Model">
<column name="uuid" type="VARCHAR" size="150" primaryKey="true"/>
<column name="customer_id" type="INTEGER"/>
<column name="brand" type="VARCHAR" size="255" />
<column name="last_4" type="VARCHAR" size="255" />
<column name="expire_month" type="INTEGER" />
<column name="expire_year" type="INTEGER" />
<foreign-key foreignTable="customer" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="customer_id" foreign="id" />
</foreign-key>
</table>
<table name="order_pay_plug_multi_payment" namespace="PayPlugModule\Model">
<column autoIncrement="true" name="id" type="INTEGER" required="true" primaryKey="true"/>
<column name="order_id" type="INTEGER" required="true" primaryKey="true"/>
<column name="amount" scale="6" size="16" type="DECIMAL" />
<column name="is_first_payment" type="TINYINT" default="0"/>
<column name="planned_at" type="TIMESTAMP" />
<column name="payment_method" type="VARCHAR" size="255" />
<column name="payment_id" type="VARCHAR" size="255" />
<column name="paid_at" type="TIMESTAMP" />
<column name="amount_refunded" scale="6" size="16" type="DECIMAL" default="0"/>
<foreign-key foreignTable="order" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="order_id" foreign="id" />
</foreign-key>
</table>
<table name="pay_plug_module_delivery_type" namespace="PayPlugModule\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="module_id" type="integer" />
<column name="delivery_type" size="255" type="VARCHAR" />
<foreign-key foreignTable="module" name="fk_pay_plug_module_delivery_type_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="module_id" />
</foreign-key>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -0,0 +1,97 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- order_pay_plug_data
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_pay_plug_data`;
CREATE TABLE `order_pay_plug_data`
(
`id` INTEGER NOT NULL,
`amount_refunded` DECIMAL(16,6),
`need_capture` TINYINT DEFAULT 0,
`capture_expire_at` DATETIME,
`captured_at` DATETIME,
PRIMARY KEY (`id`),
CONSTRAINT `order_pay_plug_data_fk_19ea48`
FOREIGN KEY (`id`)
REFERENCES `order` (`id`)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- pay_plug_card
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `pay_plug_card`;
CREATE TABLE `pay_plug_card`
(
`uuid` VARCHAR(150) NOT NULL,
`customer_id` INTEGER,
`brand` VARCHAR(255),
`last_4` VARCHAR(255),
`expire_month` INTEGER,
`expire_year` INTEGER,
PRIMARY KEY (`uuid`),
INDEX `pay_plug_card_fi_7e8f3e` (`customer_id`),
CONSTRAINT `pay_plug_card_fk_7e8f3e`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_pay_plug_multi_payment
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_pay_plug_multi_payment`;
CREATE TABLE `order_pay_plug_multi_payment`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_id` INTEGER NOT NULL,
`amount` DECIMAL(16,6),
`is_first_payment` TINYINT DEFAULT 0,
`planned_at` DATETIME,
`payment_method` VARCHAR(255),
`payment_id` VARCHAR(255),
`paid_at` DATETIME,
`amount_refunded` DECIMAL(16,6) DEFAULT 0,
PRIMARY KEY (`id`,`order_id`),
INDEX `order_pay_plug_multi_payment_fi_75704f` (`order_id`),
CONSTRAINT `order_pay_plug_multi_payment_fk_75704f`
FOREIGN KEY (`order_id`)
REFERENCES `order` (`id`)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- pay_plug_module_delivery_type
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `pay_plug_module_delivery_type`;
CREATE TABLE `pay_plug_module_delivery_type`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`module_id` INTEGER,
`delivery_type` VARCHAR(255),
PRIMARY KEY (`id`),
INDEX `fi_pay_plug_module_delivery_type_module_id` (`module_id`),
CONSTRAINT `fk_pay_plug_module_delivery_type_module_id`
FOREIGN KEY (`module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,9 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
ALTER TABLE `order_pay_plug_multi_payment` ADD COLUMN `amount_refunded` DECIMAL(16,6) DEFAULT 0;
ALTER TABLE `order_pay_plug_multi_payment` DROP COLUMN `refunded_at`;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,27 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- pay_plug_module_delivery_type
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `pay_plug_module_delivery_type`;
CREATE TABLE `pay_plug_module_delivery_type`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`module_id` INTEGER,
`delivery_type` VARCHAR(255),
PRIMARY KEY (`id`),
INDEX `fi_pay_plug_module_delivery_type_module_id` (`module_id`),
CONSTRAINT `fk_pay_plug_module_delivery_type_module_id`
FOREIGN KEY (`module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;