diff --git a/src/Components/TransactionStatus/TransactionStatusService.php b/src/Components/TransactionStatus/TransactionStatusService.php index d4475f44b..4b1ca380b 100644 --- a/src/Components/TransactionStatus/TransactionStatusService.php +++ b/src/Components/TransactionStatus/TransactionStatusService.php @@ -6,6 +6,7 @@ use PayonePayment\Components\ConfigReader\ConfigReaderInterface; use PayonePayment\Components\Currency\CurrencyPrecisionInterface; +use PayonePayment\Configuration\ConfigurationPrefixes; use PayonePayment\Installer\CustomFieldInstaller; use PayonePayment\Struct\PaymentTransaction; use Psr\Log\LoggerInterface; @@ -84,8 +85,10 @@ public function transitionByConfigMapping(SalesChannelContext $salesChannelConte return; } - $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); - $currency = $paymentTransaction->getOrder()->getCurrency(); + $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); + $currency = $paymentTransaction->getOrder()->getCurrency(); + $orderTransaction = $paymentTransaction->getOrderTransaction(); + $paymentMethod = $orderTransaction->getPaymentMethod(); if (null === $currency) { return; @@ -101,27 +104,24 @@ public function transitionByConfigMapping(SalesChannelContext $salesChannelConte $transitionName = $configuration->getString($configurationKey); - if (empty($transitionName)) { - if ($this->isTransactionOpen($transactionData)) { - $transitionName = StateMachineTransitionActions::ACTION_REOPEN; - } elseif ($this->isTransactionPartialPaid($transactionData, $currency)) { - $transitionName = StateMachineTransitionActions::ACTION_PAID_PARTIALLY; - } elseif ($this->isTransactionPaid($transactionData, $currency)) { - $transitionName = StateMachineTransitionActions::ACTION_PAID; - } elseif ($this->isTransactionPartialRefund($transactionData, $currency)) { - $transitionName = StateMachineTransitionActions::ACTION_REFUND_PARTIALLY; - } elseif ($this->isTransactionRefund($transactionData, $currency)) { - $transitionName = StateMachineTransitionActions::ACTION_REFUND; - } elseif ($this->isTransactionCancelled($transactionData)) { - $transitionName = StateMachineTransitionActions::ACTION_CANCEL; - } + if (null !== $paymentMethod) { + $configurationPrefix = ConfigurationPrefixes::CONFIGURATION_PREFIXES[$paymentMethod->getHandlerIdentifier()]; + /** @var string $transitionName */ + $transitionName = $configuration->getByPrefix($configurationKey, $configurationPrefix, $configuration->getString($configurationKey)); } if (empty($transitionName)) { + $this->logger->info('No status transition configured', + [ + 'configurationKey' => $configurationKey, + 'paymentMethod' => (null !== $paymentMethod) ? $paymentMethod->getHandlerIdentifier() : 'unknown', + ] + ); + return; } - $this->executeTransition($salesChannelContext->getContext(), $paymentTransaction->getOrderTransaction()->getId(), strtolower($transitionName), $transactionData); + $this->executeTransition($salesChannelContext->getContext(), $orderTransaction->getId(), strtolower($transitionName), $transactionData); } public function transitionByName(Context $context, string $transactionId, string $transitionName, array $parameter = []): void @@ -161,44 +161,6 @@ private function executeTransition(Context $context, string $transactionId, stri } } - private function isTransactionOpen(array $transactionData): bool - { - return strtolower($transactionData['txaction']) === self::ACTION_APPOINTED; - } - - private function isTransactionPaid(array $transactionData, CurrencyEntity $currency): bool - { - if (in_array(strtolower($transactionData['txaction']), [self::ACTION_PAID, self::ACTION_COMPLETED], true)) { - return true; - } - - if (!in_array(strtolower($transactionData['txaction']), [self::ACTION_DEBIT, self::ACTION_CAPTURE, self::ACTION_INVOICE], true)) { - return false; - } - - if (array_key_exists('transactiontype', $transactionData) && $transactionData['transactiontype'] === self::TRANSACTION_TYPE_GT) { - return false; - } - - $precision = $this->currencyPrecision->getTotalRoundingPrecision($currency); - - if (array_key_exists('price', $transactionData) && array_key_exists('receivable', $transactionData) && - (int) round(((float) $transactionData['receivable'] * (10 ** $precision))) === (int) round(((float) $transactionData['price'] * (10 ** $precision)))) { - return true; - } - - if (array_key_exists('price', $transactionData) && array_key_exists('invoice_grossamount', $transactionData) && - (int) round(((float) $transactionData['invoice_grossamount'] * (10 ** $precision))) === (int) round(((float) $transactionData['price'] * (10 ** $precision)))) { - return true; - } - - if ((int) round(((float) $transactionData['receivable'] * (10 ** $precision))) === 0) { - return true; - } - - return false; - } - private function isTransactionPartialPaid(array $transactionData, CurrencyEntity $currency): bool { if (!in_array(strtolower($transactionData['txaction']), [self::ACTION_DEBIT, self::ACTION_CAPTURE, self::ACTION_INVOICE], true)) { @@ -228,29 +190,6 @@ private function isTransactionPartialPaid(array $transactionData, CurrencyEntity return true; } - private function isTransactionRefund(array $transactionData, CurrencyEntity $currency): bool - { - $precision = $this->currencyPrecision->getTotalRoundingPrecision($currency); - - if (strtolower($transactionData['txaction']) !== self::ACTION_DEBIT) { - return false; - } - - if (!array_key_exists('receivable', $transactionData)) { - return false; - } - - if (array_key_exists('transactiontype', $transactionData) && $transactionData['transactiontype'] !== self::TRANSACTION_TYPE_GT) { - return false; - } - - if ((int) round(((float) $transactionData['receivable'] * (10 ** $precision))) !== 0) { - return false; - } - - return true; - } - private function isTransactionPartialRefund(array $transactionData, CurrencyEntity $currency): bool { $precision = $this->currencyPrecision->getTotalRoundingPrecision($currency); @@ -274,11 +213,6 @@ private function isTransactionPartialRefund(array $transactionData, CurrencyEnti return true; } - private function isTransactionCancelled(array $transactionData): bool - { - return in_array(strtolower($transactionData['txaction']), [self::ACTION_CANCELATION, self::ACTION_FAILED], true); - } - private function isAsyncCancelled(PaymentTransaction $paymentTransaction, array $transactionData): bool { $customFields = $paymentTransaction->getCustomFields(); diff --git a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js index 7a2397bab..2da2f8564 100644 --- a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js @@ -28,6 +28,7 @@ Component.register('payone-settings', { showValidationErrors: false, isSupportModalOpen: false, stateMachineTransitionActions: [], + displayStatusMapping: {}, collapsibleState: { 'status_mapping': true, 'payment_credit_card': true, @@ -106,6 +107,10 @@ Component.register('payone-settings', { ]; }, + isVisiblePaymentMethodCard(card) { + return card.name.startsWith('payment') && !this.isCollapsed(card); + }, + isCollapsible(card) { return card.name in this.collapsibleState; }, diff --git a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig index 7d6ca5cc2..f3592fbe3 100644 --- a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig +++ b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig @@ -142,12 +142,33 @@ /> + + diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json index 8ea6e0405..6c70893ac 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json @@ -57,6 +57,8 @@ "test": "API-Zugangsdaten testen", "titleSuccess": "Erfolg", "titleError": "Fehler", + "labelShowSpecificStatusMapping": "Statusmappingkonfiguration einblenden", + "helpTextShowSpecificStatusMapping": "Sie können für jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zurückgegriffen.", "messageTestSuccess": "Die API-Zugangsdaten wurden erfolgreich validiert.", "messageTestNoTestedPayments": "Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --> Shop --> Zahlungsarten.", "messageTestError": { diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json index b90068ef0..1f72162f1 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json @@ -57,6 +57,8 @@ "test": "Test API Credentials", "titleSuccess": "Success", "titleError": "Error", + "labelShowSpecificStatusMapping": "Display state mapping configuration", + "helpTextShowSpecificStatusMapping": "If not configured the general status mapping config will be applied.", "messageTestSuccess": "The API credentials were verified successfully.", "messageTestNoTestedPayments": "No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --> Shop --> Payment.", "messageTestError": { diff --git a/src/Resources/config/settings.xml b/src/Resources/config/settings.xml index 1bf450154..6e329d561 100644 --- a/src/Resources/config/settings.xml +++ b/src/Resources/config/settings.xml @@ -205,6 +205,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + creditCardPaymentStatusAppointed + + + + + + creditCardPaymentStatusCapture + + + + + + creditCardPaymentStatusPartialCapture + + + + + + creditCardPaymentStatusPaid + + + + + + creditCardPaymentStatusUnderpaid + + + + + + creditCardPaymentStatusCancelation + + + + + + creditCardPaymentStatusRefund + + + + + + creditCardPaymentStatusPartialRefund + + + + + + creditCardPaymentStatusDebit + + + + + + creditCardPaymentStatusReminder + + + + + + creditCardPaymentStatusVauthorization + + + + + + creditCardPaymentStatusVsettlement + + + + + + creditCardPaymentStatusTransfer + + + + + + creditCardPaymentStatusInvoice + + + + + + creditCardPaymentStatusFailed + + + @@ -248,6 +338,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + prepaymentPaymentStatusAppointed + + + + + + prepaymentPaymentStatusCapture + + + + + + prepaymentPaymentStatusPartialCapture + + + + + + prepaymentPaymentStatusPaid + + + + + + prepaymentPaymentStatusUnderpaid + + + + + + prepaymentPaymentStatusCancelation + + + + + + prepaymentPaymentStatusRefund + + + + + + prepaymentPaymentStatusPartialRefund + + + + + + prepaymentPaymentStatusDebit + + + + + + prepaymentPaymentStatusReminder + + + + + + prepaymentPaymentStatusVauthorization + + + + + + prepaymentPaymentStatusVsettlement + + + + + + prepaymentPaymentStatusTransfer + + + + + + prepaymentPaymentStatusInvoice + + + + + + prepaymentPaymentStatusFailed + + + @@ -310,6 +490,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + paypalPaymentStatusAppointed + + + + + + paypalPaymentStatusCapture + + + + + + paypalPaymentStatusPartialCapture + + + + + + paypalPaymentStatusPaid + + + + + + paypalPaymentStatusUnderpaid + + + + + + paypalPaymentStatusCancelation + + + + + + paypalPaymentStatusRefund + + + + + + paypalPaymentStatusPartialRefund + + + + + + paypalPaymentStatusDebit + + + + + + paypalPaymentStatusReminder + + + + + + paypalPaymentStatusVauthorization + + + + + + paypalPaymentStatusVsettlement + + + + + + paypalPaymentStatusTransfer + + + + + + paypalPaymentStatusInvoice + + + + + + paypalPaymentStatusFailed + + + @@ -372,6 +642,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + paypalExpressPaymentStatusAppointed + + + + + + paypalExpressPaymentStatusCapture + + + + + + paypalExpressPaymentStatusPartialCapture + + + + + + paypalExpressPaymentStatusPaid + + + + + + paypalExpressPaymentStatusUnderpaid + + + + + + paypalExpressPaymentStatusCancelation + + + + + + paypalExpressPaymentStatusRefund + + + + + + paypalExpressPaymentStatusPartialRefund + + + + + + paypalExpressPaymentStatusDebit + + + + + + paypalExpressPaymentStatusReminder + + + + + + paypalExpressPaymentStatusVauthorization + + + + + + paypalExpressPaymentStatusVsettlement + + + + + + paypalExpressPaymentStatusTransfer + + + + + + paypalExpressPaymentStatusInvoice + + + + + + paypalExpressPaymentStatusFailed + + + @@ -409,31 +769,121 @@ - debitAuthorizationMethod - - - Use this option to set the authorization method for this payment type. - Legt die Autorisierungsmethode für diese Zahlungsart fest. - - - - + debitAuthorizationMethod + + + Use this option to set the authorization method for this payment type. + Legt die Autorisierungsmethode für diese Zahlungsart fest. + + + + + + + + debitProvideNarrativeText + + + Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal + Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + + debitPaymentStatusAppointed + + + + + + debitPaymentStatusCapture + + + + + + debitPaymentStatusPartialCapture + + + + + + debitPaymentStatusPaid + + + + + + debitPaymentStatusUnderpaid + + + + + + debitPaymentStatusCancelation + + + + + + debitPaymentStatusRefund + + + + + + debitPaymentStatusPartialRefund + + + + + + debitPaymentStatusDebit + + + + + + debitPaymentStatusReminder + + + + + + debitPaymentStatusVauthorization + + + + + + debitPaymentStatusVsettlement + + + + + + debitPaymentStatusTransfer + + - - debitProvideNarrativeText - - - Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal - Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + debitPaymentStatusInvoice + + + + + + debitPaymentStatusFailed + + @@ -497,6 +947,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + sofortPaymentStatusAppointed + + + + + + sofortPaymentStatusCapture + + + + + + sofortPaymentStatusPartialCapture + + + + + + sofortPaymentStatusPaid + + + + + + sofortPaymentStatusUnderpaid + + + + + + sofortPaymentStatusCancelation + + + + + + sofortPaymentStatusRefund + + + + + + sofortPaymentStatusPartialRefund + + + + + + sofortPaymentStatusDebit + + + + + + sofortPaymentStatusReminder + + + + + + sofortPaymentStatusVauthorization + + + + + + sofortPaymentStatusVsettlement + + + + + + sofortPaymentStatusTransfer + + + + + + sofortPaymentStatusInvoice + + + + + + sofortPaymentStatusFailed + + + @@ -559,6 +1099,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + epsPaymentStatusAppointed + + + + + + epsPaymentStatusCapture + + + + + + epsPaymentStatusPartialCapture + + + + + + epsPaymentStatusPaid + + + + + + epsPaymentStatusUnderpaid + + + + + + epsPaymentStatusCancelation + + + + + + epsPaymentStatusRefund + + + + + + epsPaymentStatusPartialRefund + + + + + + epsPaymentStatusDebit + + + + + + epsPaymentStatusReminder + + + + + + epsPaymentStatusVauthorization + + + + + + epsPaymentStatusVsettlement + + + + + + epsPaymentStatusTransfer + + + + + + epsPaymentStatusInvoice + + + + + + epsPaymentStatusFailed + + + @@ -614,12 +1244,102 @@ - - iDealProvideNarrativeText - - - Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal - Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + iDealProvideNarrativeText + + + Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal + Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + + iDealPaymentStatusAppointed + + + + + + iDealPaymentStatusCapture + + + + + + iDealPaymentStatusPartialCapture + + + + + + iDealPaymentStatusPaid + + + + + + iDealPaymentStatusUnderpaid + + + + + + iDealPaymentStatusCancelation + + + + + + iDealPaymentStatusRefund + + + + + + iDealPaymentStatusPartialRefund + + + + + + iDealPaymentStatusDebit + + + + + + iDealPaymentStatusReminder + + + + + + iDealPaymentStatusVauthorization + + + + + + iDealPaymentStatusVsettlement + + + + + + iDealPaymentStatusTransfer + + + + + + iDealPaymentStatusInvoice + + + + + + iDealPaymentStatusFailed + + @@ -708,6 +1428,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + payolutionInstallmentPaymentStatusAppointed + + + + + + payolutionInstallmentPaymentStatusCapture + + + + + + payolutionInstallmentPaymentStatusPartialCapture + + + + + + payolutionInstallmentPaymentStatusPaid + + + + + + payolutionInstallmentPaymentStatusUnderpaid + + + + + + payolutionInstallmentPaymentStatusCancelation + + + + + + payolutionInstallmentPaymentStatusRefund + + + + + + payolutionInstallmentPaymentStatusPartialRefund + + + + + + payolutionInstallmentPaymentStatusDebit + + + + + + payolutionInstallmentPaymentStatusReminder + + + + + + payolutionInstallmentPaymentStatusVauthorization + + + + + + payolutionInstallmentPaymentStatusVsettlement + + + + + + payolutionInstallmentPaymentStatusTransfer + + + + + + payolutionInstallmentPaymentStatusInvoice + + + + + + payolutionInstallmentPaymentStatusFailed + + + @@ -801,6 +1611,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + payolutionInvoicingPaymentStatusAppointed + + + + + + payolutionInvoicingPaymentStatusCapture + + + + + + payolutionInvoicingPaymentStatusPartialCapture + + + + + + payolutionInvoicingPaymentStatusPaid + + + + + + payolutionInvoicingPaymentStatusUnderpaid + + + + + + payolutionInvoicingPaymentStatusCancelation + + + + + + payolutionInvoicingPaymentStatusRefund + + + + + + payolutionInvoicingPaymentStatusPartialRefund + + + + + + payolutionInvoicingPaymentStatusDebit + + + + + + payolutionInvoicingPaymentStatusReminder + + + + + + payolutionInvoicingPaymentStatusVauthorization + + + + + + payolutionInvoicingPaymentStatusVsettlement + + + + + + payolutionInvoicingPaymentStatusTransfer + + + + + + payolutionInvoicingPaymentStatusInvoice + + + + + + payolutionInvoicingPaymentStatusFailed + + + @@ -852,31 +1752,121 @@ - payolutionDebitAuthorizationMethod - - - Use this option to set the authorization method for this payment type. - Legt die Autorisierungsmethode für diese Zahlungsart fest. - - - - + payolutionDebitAuthorizationMethod + + + Use this option to set the authorization method for this payment type. + Legt die Autorisierungsmethode für diese Zahlungsart fest. + + + + + + + + payolutionDebitProvideNarrativeText + + + Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal + Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + + payolutionDebitPaymentStatusAppointed + + + + + + payolutionDebitPaymentStatusCapture + + + + + + payolutionDebitPaymentStatusPartialCapture + + + + + + payolutionDebitPaymentStatusPaid + + + + + + payolutionDebitPaymentStatusUnderpaid + + + + + + payolutionDebitPaymentStatusCancelation + + + + + + payolutionDebitPaymentStatusRefund + + + + + + payolutionDebitPaymentStatusPartialRefund + + + + + + payolutionDebitPaymentStatusDebit + + + + + + payolutionDebitPaymentStatusReminder + + + + + + payolutionDebitPaymentStatusVauthorization + + + + + + payolutionDebitPaymentStatusVsettlement + + + + + + payolutionDebitPaymentStatusTransfer + + + + + + payolutionDebitPaymentStatusInvoice + + - - payolutionDebitProvideNarrativeText - - - Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal - Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + payolutionDebitPaymentStatusFailed + + @@ -940,6 +1930,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + paydirektPaymentStatusAppointed + + + + + + paydirektPaymentStatusCapture + + + + + + paydirektPaymentStatusPartialCapture + + + + + + paydirektPaymentStatusPaid + + + + + + paydirektPaymentStatusUnderpaid + + + + + + paydirektPaymentStatusCancelation + + + + + + paydirektPaymentStatusRefund + + + + + + paydirektPaymentStatusPartialRefund + + + + + + paydirektPaymentStatusDebit + + + + + + paydirektPaymentStatusReminder + + + + + + paydirektPaymentStatusVauthorization + + + + + + paydirektPaymentStatusVsettlement + + + + + + paydirektPaymentStatusTransfer + + + + + + paydirektPaymentStatusInvoice + + + + + + paydirektPaymentStatusFailed + + + @@ -1002,6 +2082,96 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + trustlyPaymentStatusAppointed + + + + + + trustlyPaymentStatusCapture + + + + + + trustlyPaymentStatusPartialCapture + + + + + + trustlyPaymentStatusPaid + + + + + + trustlyPaymentStatusUnderpaid + + + + + + trustlyPaymentStatusCancelation + + + + + + trustlyPaymentStatusRefund + + + + + + trustlyPaymentStatusPartialRefund + + + + + + trustlyPaymentStatusDebit + + + + + + trustlyPaymentStatusReminder + + + + + + trustlyPaymentStatusVauthorization + + + + + + trustlyPaymentStatusVsettlement + + + + + + trustlyPaymentStatusTransfer + + + + + + trustlyPaymentStatusInvoice + + + + + + trustlyPaymentStatusFailed + + + @@ -1065,5 +2235,95 @@ Indicates whether the order number should be transferred in the payment method's narrative text. If the option is deactivated, the narrative text is deducted from the corresponding field in your PMI payment portal Gibt an, ob bei Zahlungen die Bestellnummer im Verwendungszweck der Zahlart übertragen werden soll. Ist die Option deaktiviert, greift die Einstellung für den Verwendungszweck aus dem Zahlungsportal im PMI + + + secureInvoicePaymentStatusAppointed + + + + + + secureInvoicePaymentStatusCapture + + + + + + secureInvoicePaymentStatusPartialCapture + + + + + + secureInvoicePaymentStatusPaid + + + + + + secureInvoicePaymentStatusUnderpaid + + + + + + secureInvoicePaymentStatusCancelation + + + + + + secureInvoicePaymentStatusRefund + + + + + + secureInvoicePaymentStatusPartialRefund + + + + + + secureInvoicePaymentStatusDebit + + + + + + secureInvoicePaymentStatusReminder + + + + + + secureInvoicePaymentStatusVauthorization + + + + + + secureInvoicePaymentStatusVsettlement + + + + + + secureInvoicePaymentStatusTransfer + + + + + + secureInvoicePaymentStatusInvoice + + + + + + secureInvoicePaymentStatusFailed + + + diff --git a/src/Resources/public/administration/js/payone-payment.js b/src/Resources/public/administration/js/payone-payment.js index 95ffb37bb..5ccf0af17 100644 --- a/src/Resources/public/administration/js/payone-payment.js +++ b/src/Resources/public/administration/js/payone-payment.js @@ -1 +1 @@ -(this.webpackJsonp=this.webpackJsonp||[]).push([["payone-payment"],{"/hP7":function(e,t){e.exports='{% block payone_payment_plugin_icon %}\n \n{% endblock %}\n'},"2MhV":function(e,t){e.exports='{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'},"35DV":function(e,t,n){},"4oQF":function(e,t,n){var a=n("bhoq");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("835ea6d0",a,!0,{})},"67JB":function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},"7RQK":function(e,t,n){},"9CHL":function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},B7Qk:function(e,t,n){var a=n("MB5G");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("7a5a719e",a,!0,{})},CRGm:function(e,t){e.exports='{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n'},CzIc:function(e,t){e.exports='{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n'},GRpm:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for Credit Card are not valid.","prepayment":"The API credentials for Prepayment are not valid.","debit":"The API credentials for Debit are not valid.","paypalExpress":"The API credentials for PayPal Express are not valid.","paypal":"The API credentials for PayPal are not valid.","payolutionInstallment":"The API credentials for Paysafe Pay Later Installment are not valid.","payolutionInvoicing":"The API credentials for Paysafe Pay Later Invoicing are not valid.","payolutionDebit":"The API credentials for Paysafe Pay Later Debit are not valid.","sofort":"The API credentials for SOFORT are not valid.","eps":"The API credentials for EPS are not valid.","iDeal":"The API credentials for iDEAL are not valid.","secureInvoice":"The API credentials for secure invoice payment are not valid.","paydirekt":"The API credentials for Paydirekt payment are not valid.","trustly":"The API credentials for Trustly payment are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},"Hh0+":function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone"){super(e,t,n)}capturePayment(e){const t=`_action/${this.getApiBasePath()}/capture-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((e=>a.handleResponse(e)))}refundPayment(e){const t=`_action/${this.getApiBasePath()}/refund-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((e=>a.handleResponse(e)))}}n.addServiceProvider("PayonePaymentService",(e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)}))},I32p:function(e,t,n){var a=n("KOKV");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3e8d3ce2",a,!0,{})},KDI0:function(e,t,n){},KOKV:function(e,t,n){},MB5G:function(e,t,n){},OQqF:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},RLQU:function(e,t,n){var a=n("KDI0");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("fe558ee0",a,!0,{})},"WFC+":function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für Kreditkarte sind nicht korrekt.","prepayment":"Die API-Zugangsdaten für Vorkasse sind nicht korrekt.","debit":"Die API-Zugangsdaten für Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für Paysafe Pay Later Ratenzahlung sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für Paysafe Pay Later Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für Paysafe Pay Later Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für SOFORT sind nicht korrekt.","eps":"Die API-Zugangsdaten für EPS sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für den gesicherten Rechnungskauf sind nicht korrekt.","paydirekt":"Die API-Zugangsdaten für Paydirekt sind nicht korrekt.","trustly":"Die API-Zugangsdaten für Trustly sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren technischen Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen auf GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},WrlN:function(e,t){const{Filter:n}=Shopware,{currency:a}=Shopware.Utils.format;n.register("payone_currency",((e,t,n,i)=>null===e?"-":(n||(n=0),a(e/=10**n,t,i))))},YvZz:function(e,t,n){var a=n("35DV");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("5e8e25f2",a,!0,{})},ZPgu:function(e,t){e.exports='{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},bhoq:function(e,t,n){},"eI/6":function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone_payment"){super(e,t,n)}validateApiCredentials(e){const t=this.getBasicHeaders();return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-api-credentials`,{credentials:e},{headers:t}).then((e=>a.handleResponse(e)))}getStateMachineTransitionActions(){const e=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/get-state-machine-transition-actions`,{headers:e}).then((e=>a.handleResponse(e)))}}n.addServiceProvider("PayonePaymentSettingsService",(e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)}))},n0Dh:function(e,t,n){},ne7N:function(e,t,n){var a=n("n0Dh");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3177b9d2",a,!0,{})},vcYr:function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},yhSi:function(e,t,n){"use strict";n.r(t);var a=n("OQqF"),i=n.n(a);n("I32p");const{Component:s,Mixin:o,Context:r}=Shopware;s.register("payone-capture-button",{template:i.a,mixins:[o.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{decimalPrecision(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},totalTransactionAmount(){return Math.round(this.transaction.amount.totalPrice*10**this.decimalPrecision,0)},capturedAmount(){return this.transaction.customFields&&void 0!==this.transaction.customFields.payone_captured_amount?this.transaction.customFields.payone_captured_amount:0},remainingAmount(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount(){return this.remainingAmount/10**this.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.customFields.payone_allow_capture)},isItemSelected(){let e=!1;return this.selection.forEach((t=>{t.selected&&(e=!0)})),e}},data:()=>({isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0}),methods:{calculateCaptureAmount(){let e=0;this.selection.forEach((t=>{t.selected&&(e+=t.unit_price*t.quantity)})),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal(){this.showCaptureModal=!1},onCaptureFinished(){this.isCaptureSuccessful=!1},captureOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount};this.isLoading=!0,this.selection.forEach((t=>{this.order.lineItems.forEach((n=>{if(n.id===t.id&&t.selected&&0{this.order.lineItems.forEach((n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.capture.successTitle"),message:this.$tc("payone-payment.capture.successMessage")}),this.isCaptureSuccessful=!0})).catch((e=>{this.createNotificationError({title:this.$tc("payone-payment.capture.errorTitle"),message:e.message}),this.isCaptureSuccessful=!1})).finally((()=>{this.isLoading=!1,this.closeCaptureModal(),this.$nextTick().then((()=>{this.$emit("reload")}))}))},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach((n=>{n.id===e&&(n.selected=t)})),this.calculateCaptureAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach((n=>{n.id===e&&(n.quantity=t)})),this.calculateCaptureAmount()},_populateSelectionProperty(){this.order.lineItems.forEach((e=>{let t=e.quantity;e.customFields&&e.customFields.payone_captured_quantity&&0({isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0}),computed:{decimalPrecision(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},remainingAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_captured_amount?0:this.transaction.customFields.payone_captured_amount-this.refundedAmount},refundedAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_refunded_amount?0:this.transaction.customFields.payone_refunded_amount},maxRefundAmount(){return this.remainingAmount/10**this.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.customFields.payone_allow_refund)}},methods:{calculateRefundAmount(){let e=0;this.selection.forEach((t=>{t.selected&&(e+=t.unit_price*t.quantity)})),Math.round(e*10**this.decimalPrecision>this.remainingAmount)&&(e=this.remainingAmount/10**this.decimalPrecision),this.refundAmount=e},openRefundModal(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal(){this.showRefundModal=!1},onRefundFinished(){this.isRefundSuccessful=!1},refundOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount};this.isLoading=!0,this.selection.forEach((t=>{this.order.lineItems.forEach((n=>{if(n.id===t.id&&t.selected&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0})).catch((e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1})).finally((()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then((()=>{this.$emit("reload")}))}))},refundFullOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.maxRefundAmount,orderLines:[],complete:!0};this.isLoading=!0,this._populateSelectionProperty(),this.selection.forEach((t=>{this.order.lineItems.forEach((n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0})).catch((e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1})).finally((()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then((()=>{this.$emit("reload")}))}))},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach((n=>{n.id===e&&(n.selected=t)})),this.calculateRefundAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach((n=>{n.id===e&&(n.quantity=t)})),this.calculateRefundAmount()},_populateSelectionProperty(){this.order.lineItems.forEach((e=>{let t=e.quantity;e.customFields&&e.customFields.payone_refunded_quantity&&0{const n=this.$options.filters.currency(t.totalPrice,this.order.currency.shortName,this.order.decimal_precision);let a=!1,i=t.quantity;t.customFields&&("refund"===this.mode?(t.customFields.payone_captured_quantity&&0>t.customFields.payone_captured_quantity&&(i=t.customFields.payone_captured_quantity),t.customFields.payone_refunded_quantity&&(i-=t.customFields.payone_refunded_quantity)):"capture"===this.mode&&t.customFields.payone_captured_quantity&&0i&&(a=!0),e.push({id:t.id,product:t.label,quantity:i,disabled:a,selected:!1,price:n,orderItem:t})})),e},orderItemColumns(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity(e,t){this.$emit("change-quantity",t,e)}}});var h=n("2MhV"),f=n.n(h);const{Component:g}=Shopware;g.extend("payone-data-grid","sw-data-grid",{template:f.a});var b=n("/hP7"),_=n.n(b);n("B7Qk");const{Component:P}=Shopware;P.register("payone-payment-plugin-icon",{template:_.a});var v=n("ZPgu"),w=n.n(v);n("RLQU");const{Component:S,Mixin:A}=Shopware,{object:C,types:k}=Shopware.Utils;S.register("payone-settings",{template:w.a,mixins:[A.getByName("notification"),A.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:()=>({isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_trustly:!0,payment_secure_invoice:!0}}),created(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo(){return{title:this.$createTitle()}},methods:{createdComponent(){let e=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then((t=>{t.data.forEach((t=>{let n="payone-payment.transitionActionNames."+t.label,a=e.$t(n);a===n&&(a=t.label),e.stateMachineTransitionActions.push({label:a,value:t.value})}))}))},paymentMethodPrefixes:()=>["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","trustly","secureInvoice"],isCollapsible(e){return e.name in this.collapsibleState},displayField(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed(e){return this.collapsibleState[e.name]},toggleCollapsible(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish(){this.isSaveSuccessful=!1},testFinish(){this.isTestSuccessful=!1},onConfigChange(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config[`PayonePayment.settings.${e}`]:this.config[`PayonePayment.settings.${e}`]||t[`PayonePayment.settings.${e}`]},getPaymentConfigValue(e,t){let n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave(){this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then((()=>{this.isLoading=!1,this.isSaveSuccessful=!0})).catch((()=>{this.isLoading=!1})))},onTest(){this.isTesting=!0,this.isTestSuccessful=!1;let e={};this.paymentMethodPrefixes().forEach((t=>{e[t]={merchantId:this.getPaymentConfigValue("merchantId",t),accountId:this.getPaymentConfigValue("accountId",t),portalId:this.getPaymentConfigValue("portalId",t),portalKey:this.getPaymentConfigValue("portalKey",t)}})),this.PayonePaymentSettingsService.validateApiCredentials(e).then((e=>{const t=e.testCount,n=e.credentialsValid,a=e.errors;if(n)this.createNotificationSuccess({title:this.$tc("payone-payment.settingsForm.titleSuccess"),message:t>0?this.$tc("payone-payment.settingsForm.messageTestSuccess"):this.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),this.isTestSuccessful=!0;else for(let e in a)a.hasOwnProperty(e)&&this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError."+e)});this.isTesting=!1})).catch((e=>{this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError.general")}),this.isTesting=!1}))},getBind(e,t){let n;return t!==this.config&&(this.config=t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),this.$refs.systemConfig.config.forEach((t=>{t.elements.forEach((t=>{t.name!==e.name||(n=t)}))})),n||e},getElementBind(e){const t=C.deepCopyObject(e);return null!==this.currentSalesChannelId&&this.inherit&&this.actualConfigData.hasOwnProperty("null")&&null!==this.actualConfigData.null[t.name]&&("single-select"===t.type||"sw-entity-single-select"===t.config.componentName?t.placeholder=this.$tc("sw-settings.system-config.inherited"):"bool"===t.type?t.config.inheritedValue=this.actualConfigData.null[t.name]||!1:"password"===t.type?(t.placeholderIsPassword=!0,t.placeholder=`${this.actualConfigData.null[t.name]}`):"multi-select"===t.type||k.isUndefined(this.actualConfigData.null[t.name])||(t.placeholder=`${this.actualConfigData.null[t.name]}`)),["single-select","multi-select"].includes(t.type)&&(t.config.labelProperty="name",t.config.valueProperty="id"),t}}});var I=n("CzIc"),T=n.n(I);n("ne7N");const{Component:E,Mixin:x}=Shopware;E.override("sw-order-detail-base",{template:T.a,inject:["PayonePaymentService","acl"],mixins:[x.getByName("notification")],data:()=>({disableButtons:!1}),computed:{payoneTransactions:function(){return this.order.transactions.filter((e=>this.isPayoneTransaction(e))).sort(((e,t)=>e.createdAtt.createdAt?-1:0))}},methods:{isPayoneTransaction:e=>!!e.customFields&&e.customFields.payone_transaction_id,can:function(e){try{return this.acl.can(e)}catch(e){return!0}},isActiveTransaction:e=>"cancelled"!==e.stateMachineState.technicalName,hasPayoneTransaction(e){let t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});var F=n("67JB"),$=n.n(F);n("ynXU");const{Component:M}=Shopware,q=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);q&&6===parseInt(q[2])&&parseInt(q[3])<4&&M.override("sw-settings-index",{template:$.a});n("WrlN");var N=n("WFC+"),R=n("GRpm");const{Module:L}=Shopware;let O={type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":N,"en-GB":R},routeMiddleware(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}};const D=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);D&&6===parseInt(D[2])&&parseInt(D[3])>3&&(O.settingsItem=[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]),L.register("payone-payment",O);n("Hh0+"),n("eI/6"),n("vcYr")},ynXU:function(e,t,n){var a=n("7RQK");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3405da95",a,!0,{})}},[["yhSi","runtime","vendors-node"]]]); \ No newline at end of file +(this.webpackJsonp=this.webpackJsonp||[]).push([["payone-payment"],{"/hP7":function(e,t){e.exports='{% block payone_payment_plugin_icon %}\n \n{% endblock %}\n'},"2MhV":function(e,t){e.exports='{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'},"35DV":function(e,t,n){},"4oQF":function(e,t,n){var a=n("bhoq");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("835ea6d0",a,!0,{})},"67JB":function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},"7RQK":function(e,t,n){},"9CHL":function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},B7Qk:function(e,t,n){var a=n("MB5G");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("7a5a719e",a,!0,{})},CRGm:function(e,t){e.exports='{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n'},CzIc:function(e,t){e.exports='{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n'},GRpm:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","labelShowSpecificStatusMapping":"Display state mapping configuration","helpTextShowSpecificStatusMapping":"If not configured the general status mapping config will be applied.","messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for Credit Card are not valid.","prepayment":"The API credentials for Prepayment are not valid.","debit":"The API credentials for Debit are not valid.","paypalExpress":"The API credentials for PayPal Express are not valid.","paypal":"The API credentials for PayPal are not valid.","payolutionInstallment":"The API credentials for Paysafe Pay Later Installment are not valid.","payolutionInvoicing":"The API credentials for Paysafe Pay Later Invoicing are not valid.","payolutionDebit":"The API credentials for Paysafe Pay Later Debit are not valid.","sofort":"The API credentials for SOFORT are not valid.","eps":"The API credentials for EPS are not valid.","iDeal":"The API credentials for iDEAL are not valid.","secureInvoice":"The API credentials for secure invoice payment are not valid.","paydirekt":"The API credentials for Paydirekt payment are not valid.","trustly":"The API credentials for Trustly payment are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},"Hh0+":function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"payone";return a(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"capturePayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/capture-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"refundPayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/refund-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}}])&&i(t.prototype,n),r&&i(t,r),l}(u);l.addServiceProvider("PayonePaymentService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},I32p:function(e,t,n){var a=n("KOKV");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3e8d3ce2",a,!0,{})},KDI0:function(e,t,n){},KOKV:function(e,t,n){},MB5G:function(e,t,n){},OQqF:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},RLQU:function(e,t,n){var a=n("KDI0");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("fe558ee0",a,!0,{})},"WFC+":function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","labelShowSpecificStatusMapping":"Statusmappingkonfiguration einblenden","helpTextShowSpecificStatusMapping":"Sie können für jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zurückgegriffen.","messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für Kreditkarte sind nicht korrekt.","prepayment":"Die API-Zugangsdaten für Vorkasse sind nicht korrekt.","debit":"Die API-Zugangsdaten für Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für Paysafe Pay Later Ratenzahlung sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für Paysafe Pay Later Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für Paysafe Pay Later Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für SOFORT sind nicht korrekt.","eps":"Die API-Zugangsdaten für EPS sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für den gesicherten Rechnungskauf sind nicht korrekt.","paydirekt":"Die API-Zugangsdaten für Paydirekt sind nicht korrekt.","trustly":"Die API-Zugangsdaten für Trustly sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren technischen Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen auf GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},WrlN:function(e,t){var n=Shopware.Filter,a=Shopware.Utils.format.currency;n.register("payone_currency",(function(e,t,n,i){return null===e?"-":(n||(n=0),e/=Math.pow(10,n),a(e,t,i))}))},YvZz:function(e,t,n){var a=n("35DV");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("5e8e25f2",a,!0,{})},ZPgu:function(e,t){e.exports='{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},bhoq:function(e,t,n){},"eI/6":function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"payone_payment";return a(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"validateApiCredentials",value:function(e){var t=this.getBasicHeaders();return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/validate-api-credentials"),{credentials:e},{headers:t}).then((function(e){return u.handleResponse(e)}))}},{key:"getStateMachineTransitionActions",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/get-state-machine-transition-actions"),{headers:e}).then((function(e){return u.handleResponse(e)}))}}])&&i(t.prototype,n),r&&i(t,r),l}(u);l.addServiceProvider("PayonePaymentSettingsService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},n0Dh:function(e,t,n){},ne7N:function(e,t,n){var a=n("n0Dh");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3177b9d2",a,!0,{})},vcYr:function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},yhSi:function(e,t,n){"use strict";n.r(t);var a=n("OQqF"),i=n.n(a);n("I32p");function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t0&&this.capturedAmount>0||this.transaction.customFields.payone_allow_capture)},isItemSelected:function(){var e=!1;return this.selection.forEach((function(t){t.selected&&(e=!0)})),e}},data:function(){return{isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0}},methods:{calculateCaptureAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal:function(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal:function(){this.showCaptureModal=!1},onCaptureFinished:function(){this.isCaptureSuccessful=!1},captureOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(e){if(e.id===n.id&&n.selected&&00&&this.refundedAmount>0||this.transaction.customFields.payone_allow_refund)}},methods:{calculateRefundAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),Math.round(e*Math.pow(10,this.decimalPrecision)>this.remainingAmount)&&(e=this.remainingAmount/Math.pow(10,this.decimalPrecision)),this.refundAmount=e},openRefundModal:function(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal:function(){this.showRefundModal=!1},onRefundFinished:function(){this.isRefundSuccessful=!1},refundOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(a){if(a.id===n.id&&n.selected&&0n.customFields.payone_captured_quantity&&(o=n.customFields.payone_captured_quantity),n.customFields.payone_refunded_quantity&&(o-=n.customFields.payone_refunded_quantity)):"capture"===e.mode&&n.customFields.payone_captured_quantity&&0o&&(i=!0),t.push({id:n.id,product:n.label,quantity:o,disabled:i,selected:!1,price:a,orderItem:n})})),t},orderItemColumns:function(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem:function(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity:function(e,t){this.$emit("change-quantity",t,e)}}});var w=n("2MhV"),P=n.n(w);Shopware.Component.extend("payone-data-grid","sw-data-grid",{template:P.a});var S=n("/hP7"),k=n.n(S);n("B7Qk");Shopware.Component.register("payone-payment-plugin-icon",{template:k.a});var A=n("ZPgu"),C=n.n(A),I=(n("RLQU"),Shopware),E=I.Component,T=I.Mixin,x=Shopware.Utils,O=x.object,M=x.types;E.register("payone-settings",{template:C.a,mixins:[T.getByName("notification"),T.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:function(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{},collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_trustly:!0,payment_secure_invoice:!0}}},created:function(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo:function(){return{title:this.$createTitle()}},methods:{createdComponent:function(){var e=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then((function(t){t.data.forEach((function(t){var n="payone-payment.transitionActionNames."+t.label,a=e.$t(n);a===n&&(a=t.label),e.stateMachineTransitionActions.push({label:a,value:t.value})}))}))},paymentMethodPrefixes:function(){return["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","trustly","secureInvoice"]},isVisiblePaymentMethodCard:function(e){return e.name.startsWith("payment")&&!this.isCollapsed(e)},isCollapsible:function(e){return e.name in this.collapsibleState},displayField:function(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed:function(e){return this.collapsibleState[e.name]},toggleCollapsible:function(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish:function(){this.isSaveSuccessful=!1},testFinish:function(){this.isTestSuccessful=!1},onConfigChange:function(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled:function(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue:function(e){var t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config["PayonePayment.settings.".concat(e)]:this.config["PayonePayment.settings.".concat(e)]||t["PayonePayment.settings.".concat(e)]},getPaymentConfigValue:function(e,t){var n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave:function(){var e=this;this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then((function(){e.isLoading=!1,e.isSaveSuccessful=!0})).catch((function(){e.isLoading=!1})))},onTest:function(){var e=this;this.isTesting=!0,this.isTestSuccessful=!1;var t={};this.paymentMethodPrefixes().forEach((function(n){t[n]={merchantId:e.getPaymentConfigValue("merchantId",n),accountId:e.getPaymentConfigValue("accountId",n),portalId:e.getPaymentConfigValue("portalId",n),portalKey:e.getPaymentConfigValue("portalKey",n)}})),this.PayonePaymentSettingsService.validateApiCredentials(t).then((function(t){var n=t.testCount,a=t.credentialsValid,i=t.errors;if(a)e.createNotificationSuccess({title:e.$tc("payone-payment.settingsForm.titleSuccess"),message:n>0?e.$tc("payone-payment.settingsForm.messageTestSuccess"):e.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),e.isTestSuccessful=!0;else for(var o in i)i.hasOwnProperty(o)&&e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError."+o)});e.isTesting=!1})).catch((function(t){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError.general")}),e.isTesting=!1}))},getBind:function(e,t){var n;return t!==this.config&&(this.config=t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),this.$refs.systemConfig.config.forEach((function(t){t.elements.forEach((function(t){t.name!==e.name||(n=t)}))})),n||e},getElementBind:function(e){var t=O.deepCopyObject(e);return null!==this.currentSalesChannelId&&this.inherit&&this.actualConfigData.hasOwnProperty("null")&&null!==this.actualConfigData.null[t.name]&&("single-select"===t.type||"sw-entity-single-select"===t.config.componentName?t.placeholder=this.$tc("sw-settings.system-config.inherited"):"bool"===t.type?t.config.inheritedValue=this.actualConfigData.null[t.name]||!1:"password"===t.type?(t.placeholderIsPassword=!0,t.placeholder="".concat(this.actualConfigData.null[t.name])):"multi-select"===t.type||M.isUndefined(this.actualConfigData.null[t.name])||(t.placeholder="".concat(this.actualConfigData.null[t.name]))),["single-select","multi-select"].includes(t.type)&&(t.config.labelProperty="name",t.config.valueProperty="id"),t}}});var F=n("CzIc"),R=n.n(F),$=(n("ne7N"),Shopware),N=$.Component,q=$.Mixin;N.override("sw-order-detail-base",{template:R.a,inject:["PayonePaymentService","acl"],mixins:[q.getByName("notification")],data:function(){return{disableButtons:!1}},computed:{payoneTransactions:function(){var e=this;return this.order.transactions.filter((function(t){return e.isPayoneTransaction(t)})).sort((function(e,t){return e.createdAtt.createdAt?-1:0}))}},methods:{isPayoneTransaction:function(e){return!!e.customFields&&e.customFields.payone_transaction_id},can:function(e){try{return this.acl.can(e)}catch(e){return!0}},isActiveTransaction:function(e){return"cancelled"!==e.stateMachineState.technicalName},hasPayoneTransaction:function(e){var t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});var L=n("67JB"),D=n.n(L),B=(n("ynXU"),Shopware.Component),j=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);j&&6===parseInt(j[2])&&parseInt(j[3])<4&&B.override("sw-settings-index",{template:D.a});n("WrlN");var Z=n("WFC+"),V=n("GRpm"),Y=Shopware.Module,z={type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":Z,"en-GB":V},routeMiddleware:function(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}},K=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);K&&6===parseInt(K[2])&&parseInt(K[3])>3&&(z.settingsItem=[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]),Y.register("payone-payment",z);n("Hh0+"),n("eI/6"),n("vcYr")},ynXU:function(e,t,n){var a=n("7RQK");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3405da95",a,!0,{})}},[["yhSi","runtime","vendors-node"]]]); \ No newline at end of file diff --git a/tests/Components/TransactionStatusTest.php b/tests/Components/TransactionStatusTest.php index fdb98aae6..997953d59 100644 --- a/tests/Components/TransactionStatusTest.php +++ b/tests/Components/TransactionStatusTest.php @@ -6,6 +6,7 @@ use PayonePayment\Components\TransactionStatus\TransactionStatusService; use PayonePayment\Components\TransactionStatus\TransactionStatusServiceInterface; +use PayonePayment\Configuration\ConfigurationPrefixes; use PayonePayment\Installer\CustomFieldInstaller; use PayonePayment\PaymentHandler\PayoneCreditCardPaymentHandler; use PayonePayment\Struct\PaymentTransaction; @@ -156,7 +157,7 @@ public function testTransactionStatusWithMapping(array $transactionData, string /** * @dataProvider dataProvider */ - public function testTransactionStatusWithoutMapping(array $transactionData, string $expectedTransitionName): void + public function testTransactionStatusWithMethodSpecificMapping(array $transactionData, string $expectedTransitionName): void { $salesChannelContext = $this->getSalesChannelContext(); $paymentTransaction = $this->getPaymentTransaction(); @@ -171,6 +172,32 @@ public function testTransactionStatusWithoutMapping(array $transactionData, stri $salesChannelContext->getContext() ); + $configuration = [ + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_APPOINTED) => StateMachineTransitionActions::ACTION_REOPEN, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_CANCELATION) => StateMachineTransitionActions::ACTION_CANCEL, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_FAILED) => StateMachineTransitionActions::ACTION_CANCEL, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_DEBIT) => StateMachineTransitionActions::ACTION_REFUND, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_PARTIAL_DEBIT) => StateMachineTransitionActions::ACTION_REFUND_PARTIALLY, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_PARTIAL_CAPTURE) => StateMachineTransitionActions::ACTION_PAID_PARTIALLY, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_CAPTURE) => StateMachineTransitionActions::ACTION_PAID, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_PAID) => StateMachineTransitionActions::ACTION_PAID, + ConfigurationPrefixes::CONFIGURATION_PREFIX_CREDITCARD . ucfirst(TransactionStatusService::STATUS_PREFIX) . ucfirst(TransactionStatusService::ACTION_COMPLETED) => StateMachineTransitionActions::ACTION_PAID, + ]; + + $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService($stateMachineRegistry, $configuration, $paymentTransaction->getOrderTransaction()); + $transactionStatusService->transitionByConfigMapping($salesChannelContext, $paymentTransaction, $transactionData); + } + + /** + * @dataProvider dataProvider + */ + public function testTransactionStatusWithoutMapping(array $transactionData, string $expectedTransitionName): void + { + $salesChannelContext = $this->getSalesChannelContext(); + $paymentTransaction = $this->getPaymentTransaction(); + $stateMachineRegistry = $this->createMock(StateMachineRegistry::class); + $stateMachineRegistry->expects($this->never())->method('transition'); + $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService($stateMachineRegistry, [], $paymentTransaction->getOrderTransaction()); $transactionStatusService->transitionByConfigMapping($salesChannelContext, $paymentTransaction, $transactionData); } diff --git a/tests/Controller/WebhookControllerTest.php b/tests/Controller/WebhookControllerTest.php index 73d7514fd..1e583e126 100644 --- a/tests/Controller/WebhookControllerTest.php +++ b/tests/Controller/WebhookControllerTest.php @@ -5,6 +5,7 @@ namespace PayonePayment\Test\Controller; use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; +use PayonePayment\Components\TransactionStatus\TransactionStatusService; use PayonePayment\Controller\WebhookController; use PayonePayment\Installer\CustomFieldInstaller; use PayonePayment\PaymentHandler\PayoneCreditCardPaymentHandler; @@ -182,9 +183,21 @@ private function createWebhookController(string $transition, array $transactionD $stateMachineState->setTechnicalName(''); $orderTransactionEntity->setStateMachineState($stateMachineState); + $configuration = [ + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_APPOINTED) => StateMachineTransitionActions::ACTION_REOPEN, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_CANCELATION) => StateMachineTransitionActions::ACTION_CANCEL, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_FAILED) => StateMachineTransitionActions::ACTION_CANCEL, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_DEBIT) => StateMachineTransitionActions::ACTION_REFUND, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_PARTIAL_DEBIT) => StateMachineTransitionActions::ACTION_REFUND_PARTIALLY, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_PARTIAL_CAPTURE) => StateMachineTransitionActions::ACTION_PAID_PARTIALLY, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_CAPTURE) => StateMachineTransitionActions::ACTION_PAID, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_PAID) => StateMachineTransitionActions::ACTION_PAID, + TransactionStatusService::STATUS_PREFIX . ucfirst(TransactionStatusService::ACTION_COMPLETED) => StateMachineTransitionActions::ACTION_PAID, + ]; + $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService( $stateMachineRegistry, - [], + $configuration, $orderTransactionEntity ); diff --git a/tests/Payone/Webhook/Handler/TransactionStatusWebhookHandlerTest.php b/tests/Payone/Webhook/Handler/TransactionStatusWebhookHandlerTest.php index 636659517..2a1939988 100644 --- a/tests/Payone/Webhook/Handler/TransactionStatusWebhookHandlerTest.php +++ b/tests/Payone/Webhook/Handler/TransactionStatusWebhookHandlerTest.php @@ -39,7 +39,94 @@ protected function setUp(): void $this->transactionStateHandler = $this->createMock(OrderTransactionStateHandler::class); } - public function testCreditcardAppointed(): void + public function testCreditcardAppointedWithoutMapping(): void + { + $context = Context::createDefaultContext(); + $salesChannelContext = Generator::createSalesChannelContext($context); + $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + + $stateMachineRegistry = $this->createMock(StateMachineRegistry::class); + $stateMachineRegistry->expects($this->never())->method('transition'); + + $orderTransactionEntity = new OrderTransactionEntity(); + $orderTransactionEntity->setId(Constants::ORDER_TRANSACTION_ID); + + $currency = new CurrencyEntity(); + $currency->setId(Constants::CURRENCY_ID); + + if (method_exists($currency, 'setDecimalPrecision')) { + $currency->setDecimalPrecision(Constants::CURRENCY_DECIMAL_PRECISION); + } else { + $currency->setItemRounding( + new CashRoundingConfig( + Constants::CURRENCY_DECIMAL_PRECISION, + Constants::ROUNDING_INTERVAL, + true) + ); + + $currency->setTotalRounding( + new CashRoundingConfig( + Constants::CURRENCY_DECIMAL_PRECISION, + Constants::ROUNDING_INTERVAL, + true) + ); + } + + $orderEntity = new OrderEntity(); + $orderEntity->setId(Constants::ORDER_ID); + $orderEntity->setSalesChannelId(Defaults::SALES_CHANNEL); + $orderEntity->setAmountTotal(100); + $orderEntity->setCurrencyId(Constants::CURRENCY_ID); + $orderEntity->setCurrency($currency); + + $paymentMethodEntity = new PaymentMethodEntity(); + $paymentMethodEntity->setHandlerIdentifier(PayoneCreditCardPaymentHandler::class); + $orderTransactionEntity->setPaymentMethod($paymentMethodEntity); + + $orderTransactionEntity->setOrder($orderEntity); + + $customFields = [ + CustomFieldInstaller::TRANSACTION_ID => Constants::PAYONE_TRANSACTION_ID, + CustomFieldInstaller::SEQUENCE_NUMBER => 0, + CustomFieldInstaller::LAST_REQUEST => 'authorization', + CustomFieldInstaller::AUTHORIZATION_TYPE => 'authorization', + ]; + $orderTransactionEntity->setCustomFields($customFields); + + $stateMachineState = new StateMachineStateEntity(); + $stateMachineState->setTechnicalName(''); + $orderTransactionEntity->setStateMachineState($stateMachineState); + + $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService( + $stateMachineRegistry, + [], + $orderTransactionEntity + ); + + $paymentTransaction = PaymentTransaction::fromOrderTransaction($orderTransactionEntity, $orderEntity); + + $transactionData = [ + 'txid' => Constants::PAYONE_TRANSACTION_ID, + 'txaction' => 'appointed', + 'sequencenumber' => '0', + ]; + + $transactionDataHandler = $this->createMock(TransactionDataHandlerInterface::class); + $transactionDataHandler->expects($this->once())->method('getPaymentTransactionByPayoneTransactionId')->willReturn($paymentTransaction); + $transactionDataHandler->expects($this->once())->method('getCustomFieldsFromWebhook')->willReturn($transactionData); + + $transactionStatusHandler = TransactionStatusWebhookHandlerFactory::createHandler( + $transactionStatusService, + $transactionDataHandler + ); + + $transactionStatusHandler->process( + $salesChannelContext, + $transactionData + ); + } + + public function testCreditcardAppointedWithMapping(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); @@ -50,7 +137,7 @@ public function testCreditcardAppointed(): void new Transition( OrderTransactionDefinition::ENTITY_NAME, Constants::ORDER_TRANSACTION_ID, - 'reopen', + 'paid', 'stateId' ), $context @@ -107,7 +194,9 @@ public function testCreditcardAppointed(): void $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService( $stateMachineRegistry, - [], + [ + 'paymentStatusAppointed' => 'paid', + ], $orderTransactionEntity ); @@ -134,7 +223,7 @@ public function testCreditcardAppointed(): void ); } - public function testCreditcardAppointedWithMapping(): void + public function testCreditcardAppointedWithSpecificMapping(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); @@ -203,7 +292,7 @@ public function testCreditcardAppointedWithMapping(): void $transactionStatusService = TransactionStatusWebhookHandlerFactory::createTransactionStatusService( $stateMachineRegistry, [ - 'paymentStatusAppointed' => 'paid', + 'creditCardPaymentStatusAppointed' => 'paid', ], $orderTransactionEntity );