Skip to content

Commit

Permalink
Release 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrososa committed Jul 11, 2023
1 parent 7e034d2 commit c8fc5a2
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 69 deletions.
9 changes: 9 additions & 0 deletions Model/Service/Order/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ protected function assembleTransactionDataFromOrder(AbstractTransactionPending $
if ($transactionInfo !== null && $transactionInfo->isExternalPaymentUrl()) {
$successUrl = $this->buildUrl($transactionInfo->getSuccessUrl(), $order, true);
$failureUrl = $this->buildUrl($transactionInfo->getFailureUrl(), $order, true);

//force a particular payment method
$transaction->setAllowedPaymentMethodConfigurations(
[
$order->getPayment()
->getMethodInstance()
->getPaymentMethodConfiguration()
->getConfigurationId()
]);
}
} catch (\Exception $e) {
$this->logger->debug("ORDER-TRANSACTION-SERVICE::assembleTransactionDataFromOrder error: " . $e->getMessage());
Expand Down
97 changes: 61 additions & 36 deletions Model/TransactionInfoManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,36 +76,13 @@ public function update(Transaction $transaction, Order $order)
$info = $this->transactionInfoRepository->getByTransactionId($transaction->getLinkedSpaceId(),
$transaction->getId());

if ($info->getOrderId() != $order->getId() && !$info->isExternalPaymentUrl()) {
throw new \Exception('The wallee transaction info is already linked to a different order.');
if ($info->getOrderId() != $order->getId() && !$info->isExternalPaymentUrl()) {
throw new \Exception('The wallee transaction info is already linked to a different order.');
}
} catch (NoSuchEntityException $e) {
$info = $this->transactionInfoFactory->create();
}
$info->setData(TransactionInfoInterface::TRANSACTION_ID, $transaction->getId());
$info->setData(TransactionInfoInterface::AUTHORIZATION_AMOUNT, $transaction->getAuthorizationAmount());
$info->setData(TransactionInfoInterface::ORDER_ID, $order->getId());
$info->setData(TransactionInfoInterface::STATE, $transaction->getState());
$info->setData(TransactionInfoInterface::SPACE_ID, $transaction->getLinkedSpaceId());
$info->setData(TransactionInfoInterface::SPACE_VIEW_ID, $transaction->getSpaceViewId());
$info->setData(TransactionInfoInterface::LANGUAGE, $transaction->getLanguage());
$info->setData(TransactionInfoInterface::CURRENCY, $transaction->getCurrency());
$info->setData(TransactionInfoInterface::CONNECTOR_ID,
$transaction->getPaymentConnectorConfiguration() != null ? $transaction->getPaymentConnectorConfiguration()
->getConnector() : null);
$info->setData(TransactionInfoInterface::PAYMENT_METHOD_ID,
$transaction->getPaymentConnectorConfiguration() != null &&
$transaction->getPaymentConnectorConfiguration()
->getPaymentMethodConfiguration() != null ? $transaction->getPaymentConnectorConfiguration()
->getPaymentMethodConfiguration()
->getPaymentMethod() : null);
$info->setData(TransactionInfoInterface::IMAGE, $this->getPaymentMethodImage($transaction, $order));
$info->setData(TransactionInfoInterface::LABELS, $this->getTransactionLabels($transaction));
if ($transaction->getState() == TransactionState::FAILED || $transaction->getState() == TransactionState::DECLINE) {
$info->setData(TransactionInfoInterface::FAILURE_REASON,
$transaction->getFailureReason() instanceof FailureReason ? $transaction->getFailureReason()
->getDescription() : null);
}
$info = $this->setTransactionData($transaction, $info, null, $order);
$this->transactionInfoRepository->save($info);
return $info;
}
Expand All @@ -114,7 +91,7 @@ public function update(Transaction $transaction, Order $order)
* Update the transaction info with the success and failure URL to redirect the customer after placing the order
*
* @param Transaction $transaction
* @param int $orderId
* @param int $orderId
* @param string $successUrl
* @param string $failureUrl
* @return TransactionInfoInterface|TransactionInfo
Expand All @@ -131,19 +108,67 @@ public function setRedirectUrls(Transaction $transaction, $orderId, $successUrl,
$info = $this->transactionInfoFactory->create();
}

$info->setData(TransactionInfoInterface::TRANSACTION_ID, $transaction->getId());
$info->setData(TransactionInfoInterface::SPACE_ID, $transaction->getLinkedSpaceId());
$info->setData(TransactionInfoInterface::SPACE_VIEW_ID, $transaction->getSpaceViewId());
$info->setData(TransactionInfoInterface::ORDER_ID, $orderId);
$info->setData(TransactionInfoInterface::STATE, $transaction->getState());
$info->setData(TransactionInfoInterface::LANGUAGE, $transaction->getLanguage());
$info->setData(TransactionInfoInterface::CURRENCY, $transaction->getCurrency());
$info->setData(TransactionInfoInterface::SUCCESS_URL, $successUrl);
$info->setData(TransactionInfoInterface::FAILURE_URL, $failureUrl);
$info = $this->setTransactionData($transaction, $info, $orderId, null, $successUrl, $failureUrl);
$this->transactionInfoRepository->save($info);
return $info;
}

/**
* Update the transaction info
*
* @param Transaction $transaction
* @param TransactionInfo $transactionInfo,
* @param int|null $orderId
* @param Order|null $order
* @param string|null $successUrl
* @param string|null $failureUrl
* @return TransactionInfoInterface|TransactionInfo
*/
private function setTransactionData(
Transaction $transaction,
TransactionInfo $transactionInfo,
$orderId = null,
Order $order = null,
$successUrl = null,
$failureUrl = null
) {
$transactionInfo->setData(TransactionInfoInterface::TRANSACTION_ID, $transaction->getId());
$transactionInfo->setData(TransactionInfoInterface::AUTHORIZATION_AMOUNT, $transaction->getAuthorizationAmount());
$transactionInfo->setData(TransactionInfoInterface::ORDER_ID, $order instanceof Order ? $order->getId() : $orderId);
$transactionInfo->setData(TransactionInfoInterface::STATE, $transaction->getState());
$transactionInfo->setData(TransactionInfoInterface::SPACE_ID, $transaction->getLinkedSpaceId());
$transactionInfo->setData(TransactionInfoInterface::SPACE_VIEW_ID, $transaction->getSpaceViewId());
$transactionInfo->setData(TransactionInfoInterface::LANGUAGE, $transaction->getLanguage());
$transactionInfo->setData(TransactionInfoInterface::CURRENCY, $transaction->getCurrency());
$transactionInfo->setData(TransactionInfoInterface::CONNECTOR_ID,
$transaction->getPaymentConnectorConfiguration() != null
? $transaction->getPaymentConnectorConfiguration()->getConnector() : null);
$transactionInfo->setData(TransactionInfoInterface::PAYMENT_METHOD_ID,
$transaction->getPaymentConnectorConfiguration() != null &&
$transaction->getPaymentConnectorConfiguration()
->getPaymentMethodConfiguration() != null ? $transaction->getPaymentConnectorConfiguration()
->getPaymentMethodConfiguration()
->getPaymentMethod() : null);
$transactionInfo->setData(TransactionInfoInterface::LABELS, $this->getTransactionLabels($transaction));

if (!empty($order) && $order instanceof Order) {
$transactionInfo->setData(TransactionInfoInterface::IMAGE, $this->getPaymentMethodImage($transaction, $order));
}

if (!empty($successUrl) || !empty($failureUrl)) {
$transactionInfo->setData(TransactionInfoInterface::SUCCESS_URL, $successUrl);
$transactionInfo->setData(TransactionInfoInterface::FAILURE_URL, $failureUrl);
}

if ($transaction->getState() == TransactionState::FAILED || $transaction->getState() == TransactionState::DECLINE) {
$transactionInfo->setData(TransactionInfoInterface::FAILURE_REASON,
$transaction->getFailureReason() instanceof FailureReason ? $transaction->getFailureReason()
->getDescription() : null);
}

return $transactionInfo;
}

/**
* Gets an array of the transaction's labels.
*
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This repository contains the Magento 2 extension that enables to process payment

## Documentation

* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html)
* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html)


## Support
Expand All @@ -30,4 +30,4 @@ We do provide special integrations for the following one step checkouts:

## License

Please see the [license file](https://github.com/wallee-payment/magento-2/blob/2.0.4/LICENSE) for more information.
Please see the [license file](https://github.com/wallee-payment/magento-2/blob/2.0.5/LICENSE) for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @package Wallee\Payment\Setup\Patch\Data
*/

class AddSetupData implements DataPatchInterface, PatchVersionInterface
class AddSetupDataState implements DataPatchInterface
{
private $status;

Expand Down Expand Up @@ -51,15 +51,6 @@ public static function getDependencies(){
return [];
}

/**
* @description: Under the version number, it will run (if new version is 1.3.5, put 1.3.6)
* @return int:
*/

public static function getVersion(){
return '1.3.30';
}

/**
* @return array:
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @package Wallee\Payment\Setup\Patch\Data
*/

class UpdateStatusStateData implements DataPatchInterface, PatchVersionInterface
class UpdateStatusState implements DataPatchInterface
{
/**
* @var \Magento\Framework\Setup\ModuleDataSetupInterface
Expand Down Expand Up @@ -44,15 +44,6 @@ public static function getDependencies(){
return [];
}

/**
* @description: Under the version number, it will run (if new version is 1.3.5, put 1.3.6)
* @return int:
*/

public static function getVersion(){
return '1.3.30';
}

/**
* @return array:
*/
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"type" : "magento2-module",
"version" : "2.0.4",
"version" : "2.0.5",
"require" : {
"php" : "~7.1.3||~7.2.0||~7.3.0||~7.4.0||~8.0||~8.1",
"magento/framework" : "^102.0.0||^103.0.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/magento-2/releases/tag/2.0.4/">
<a href="https://github.com/wallee-payment/magento-2/releases/tag/2.0.5/">
Source
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<resource>Wallee_Payment::config</resource>
<group id="information" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Information</label>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<field id="version" translate="label" type="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Module Version</label>
</field>
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<default>
<wallee_payment>
<information>
<version>2.0.4</version>
<version>2.0.5</version>
<sdk_version>3.2.0</sdk_version>
</information>
<general>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Wallee_Payment" setup_version="2.0.4">
<module name="Wallee_Payment" setup_version="2.0.5">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
2 changes: 1 addition & 1 deletion i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Geschenkverpackung"
"Hold Delivery","Lieferung halten"
"ID required","ID erforderlich"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"Inactive","Inaktiv"
"Information","Informationen"
"Invoice","Rechnung"
Expand Down
2 changes: 1 addition & 1 deletion i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Gift Wrap"
"Hold Delivery","Hold Delivery"
"ID required","ID required"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"Inactive","Inactive"
"Information","Information"
"Invoice","Invoice"
Expand Down
2 changes: 1 addition & 1 deletion i18n/fr_CH.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Papier cadeau"
"Hold Delivery","Suspendre la livraison"
"ID required","Pièce d'identité requise"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Si vous avez besoin d'aide pour configurer l'extension wallee, consultez la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Si vous avez besoin d'aide pour configurer l'extension wallee, consultez la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a> an."
"Inactive","Inactif"
"Information","Information"
"Invoice","Facture"
Expand Down
2 changes: 1 addition & 1 deletion i18n/fr_FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Papier cadeau"
"Hold Delivery","Suspendre la livraison"
"ID required","Pièce d'identité requise"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Si vous avez besoin d'aide pour configurer l'extension wallee, consultez la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Si vous avez besoin d'aide pour configurer l'extension wallee, consultez la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a> an."
"Inactive","Inactif"
"Information","Information"
"Invoice","Facture"
Expand Down
2 changes: 1 addition & 1 deletion i18n/it_CH.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Confezione regalo"
"Hold Delivery","Sospendi la consegna"
"ID required","ID richiesto"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Se hai bisogno di aiuto per configurare l'estensione wallee, consulta la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentazione</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Se hai bisogno di aiuto per configurare l'estensione wallee, consulta la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentazione</a> an."
"Inactive","Inattivo"
"Information","Informazione"
"Invoice","Fattura"
Expand Down
2 changes: 1 addition & 1 deletion i18n/it_IT.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Gift Wrap","Confezione regalo"
"Hold Delivery","Sospendi la consegna"
"ID required","ID richiesto"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Se hai bisogno di aiuto per configurare l'estensione wallee, consulta la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.4/docs/en/documentation.html"" target=""_blank"">documentazione</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Se hai bisogno di aiuto per configurare l'estensione wallee, consulta la <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-2/2.0.5/docs/en/documentation.html"" target=""_blank"">documentazione</a> an."
"Inactive","Inattivo"
"Information","Informazione"
"Invoice","Fattura"
Expand Down

0 comments on commit c8fc5a2

Please sign in to comment.