Skip to content

Commit

Permalink
Release 1.1.27
Browse files Browse the repository at this point in the history
  • Loading branch information
vttn committed Nov 18, 2020
1 parent d1841af commit c310cbc
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 77 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.1.27
- Retry orders on unavailable payment method

# 1.1.26
- Fix locales and translations

# 1.1.25
- Fix Email sending

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ account dashboard.

## Documentation

[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/1.1.26/docs/en/documentation.html)
[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/1.1.27/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"postfinancecheckout/sdk": "2.1.4"
},
"type": "shopware-platform-plugin",
"version": "1.1.26"
"version": "1.1.27"
}
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/pfpayments/shopware-6/releases/tag/1.1.26/">
<a href="https://github.com/pfpayments/shopware-6/releases/tag/1.1.27/">
Source
</a>
</li>
Expand Down
70 changes: 48 additions & 22 deletions src/Core/Storefront/Checkout/Controller/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function __construct(

/**
* @param \Psr\Log\LoggerInterface $logger
*
* @internal
* @required
*
Expand All @@ -107,6 +108,7 @@ public function setLogger(LoggerInterface $logger): void
/**
* @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return \Symfony\Component\HttpFoundation\Response
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
Expand All @@ -130,7 +132,12 @@ public function pay(SalesChannelContext $salesChannelContext, Request $request):
// Configuration
$this->settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId());

$transaction = $this->getTransaction($orderId, $salesChannelContext->getContext());
$transaction = $this->getTransaction($orderId, $salesChannelContext->getContext());
$recreateCartUrl = $this->generateUrl(
'frontend.postfinancecheckout.checkout.recreate-cart',
['orderId' => $orderId,],
UrlGeneratorInterface::ABSOLUTE_URL
);

if (in_array(
$transaction->getState(),
Expand All @@ -155,9 +162,6 @@ public function pay(SalesChannelContext $salesChannelContext, Request $request):
}
}

$page = $this->load($request, $salesChannelContext);
$javascriptUrl = '';

$possiblePaymentMethods = $this->settings->getApiClient()
->getTransactionService()
->fetchPaymentMethods(
Expand All @@ -166,20 +170,13 @@ public function pay(SalesChannelContext $salesChannelContext, Request $request):
$this->settings->getIntegration()
);

switch ($this->settings->getIntegration()) {
case Integration::IFRAME:
$javascriptUrl = $this->settings->getApiClient()->getTransactionIframeService()
->javascriptUrl($this->settings->getSpaceId(), $transaction->getId());
break;
case Integration::LIGHTBOX:
$javascriptUrl = $this->settings->getApiClient()->getTransactionLightboxService()
->javascriptUrl($this->settings->getSpaceId(), $transaction->getId());
break;
default:
$this->logger->critical(strtr('invalid integration : :integration', [':integration' => $this->settings->getIntegration()]));

if (empty($possiblePaymentMethods)) {
$this->addFlash('danger', $this->trans('postfinancecheckout.paymentMethod.notAvailable'));
return $this->redirect($recreateCartUrl, Response::HTTP_MOVED_PERMANENTLY);
}

$javascriptUrl = $this->getTransactionJavaScriptUrl($transaction->getId());

// Set Checkout Page Data
$checkoutPageData = (new CheckoutPageData())
->setIntegration($this->settings->getIntegration())
Expand All @@ -191,12 +188,8 @@ public function pay(SalesChannelContext $salesChannelContext, Request $request):
['orderId' => $orderId,],
UrlGeneratorInterface::ABSOLUTE_URL
))
->setCartRecreateUrl($this->generateUrl(
'frontend.postfinancecheckout.checkout.recreate-cart',
['orderId' => $orderId,],
UrlGeneratorInterface::ABSOLUTE_URL
));

->setCartRecreateUrl($recreateCartUrl);
$page = $this->load($request, $salesChannelContext);
$page->addExtension('postFinanceCheckoutData', $checkoutPageData);

return $this->renderStorefront(
Expand All @@ -205,9 +198,39 @@ public function pay(SalesChannelContext $salesChannelContext, Request $request):
);
}

/**
* Get transaction Javascript URL
*
* @param int $transactionId
*
* @return string
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
* @throws \PostFinanceCheckout\Sdk\VersioningException
*/
private function getTransactionJavaScriptUrl(int $transactionId): string
{
$javascriptUrl = '';
switch ($this->settings->getIntegration()) {
case Integration::IFRAME:
$javascriptUrl = $this->settings->getApiClient()->getTransactionIframeService()
->javascriptUrl($this->settings->getSpaceId(), $transactionId);
break;
case Integration::LIGHTBOX:
$javascriptUrl = $this->settings->getApiClient()->getTransactionLightboxService()
->javascriptUrl($this->settings->getSpaceId(), $transactionId);
break;
default:
$this->logger->critical(strtr('invalid integration : :integration', [':integration' => $this->settings->getIntegration()]));

}
return $javascriptUrl;
}

/**
* @param $orderId
* @param \Shopware\Core\Framework\Context $context
*
* @return \PostFinanceCheckout\Sdk\Model\Transaction
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
Expand All @@ -222,6 +245,7 @@ private function getTransaction($orderId, Context $context): Transaction
/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext
*
* @return \Shopware\Storefront\Page\Checkout\Finish\CheckoutFinishPage
*/
protected function load(Request $request, SalesChannelContext $salesChannelContext): CheckoutFinishPage
Expand All @@ -235,6 +259,7 @@ protected function load(Request $request, SalesChannelContext $salesChannelConte
/**
* @param string $orderId
* @param \Shopware\Core\Framework\Context $context
*
* @return \Shopware\Core\Checkout\Order\OrderEntity
*/
private function getOrder(string $orderId, Context $context): OrderEntity
Expand Down Expand Up @@ -268,6 +293,7 @@ private function getOrder(string $orderId, Context $context): OrderEntity
* @param \Shopware\Core\Checkout\Cart\Cart $cart
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext
*
* @return \Symfony\Component\HttpFoundation\Response
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php declare(strict_types=1);

namespace PostFinanceCheckoutPayment\Migration;

use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Migration\MigrationStep;

/**
* Class Migration1605701047PaymentMethodConfigurationEntity
*
* @package PostFinanceCheckoutPayment\Migration
*/
class Migration1605701047PaymentMethodConfigurationEntity extends MigrationStep {
/**
* get creation timestamp
*
* @return int
*/
public function getCreationTimestamp(): int
{
return 1605701047;
}

/**
* update non-destructive changes
*
* @param \Doctrine\DBAL\Connection $connection
* @throws \Doctrine\DBAL\DBALException
*/
public function update(Connection $connection): void
{
$connection->executeUpdate('ALTER TABLE `postfinancecheckout_payment_method_configuration` CHANGE `payment_method_configuration_id` `payment_method_configuration_id` bigint unsigned NOT NULL AFTER `data`;');
}

/**
* update destructive changes
*
* @param \Doctrine\DBAL\Connection $connection
*/
public function updateDestructive(Connection $connection): void
{
// implement update destructive
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"payload": {
"adjustmentLineItem": "Anpassung Einzelposten",
"shipping": {
"name": "Versand",
"lineItem": "Versand-Einzelposten"
"lineItem": "Versand-Einzelposten",
"name": "Versand"
},
"taxes": "Steuern"
},
"paymentMethod": {
"notAvailable": "Die Zahlungsmethode ist derzeit nicht verfügbar. Bitte wählen Sie eine andere Zahlungsmethode."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"payload": {
"adjustmentLineItem": "Adjustment Line Item",
"shipping": {
"name": "Shipping",
"lineItem": "Shipping Line Item"
"lineItem": "Shipping Line Item",
"name": "Shipping"
},
"taxes": "Taxes"
},
"paymentMethod": {
"notAvailable": "Payment method is not currently available. Please choose another payment method."
}
}
}

0 comments on commit c310cbc

Please sign in to comment.