Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #40 from heidelpay/develop
Browse files Browse the repository at this point in the history
Release version 1.0.3
  • Loading branch information
Simon Gabriel authored Mar 3, 2022
2 parents 7a39e31 + a405ab7 commit 24e4b2f
Show file tree
Hide file tree
Showing 29 changed files with 4,190 additions and 4,108 deletions.
86 changes: 43 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components
/vendor

# IDEs and editors
/.idea
/.vscode

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
*.log
/plugin-interface
/.phan
plenty.php

# should be fixed in VM
/ui-backend

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db

# ignore builds
*.tar.gz
.branchname
build.properties
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components
/vendor

# IDEs and editors
/.idea
/.vscode

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
*.log
/plugin-interface
/.phan
plenty.php

# should be fixed in VM
/ui-backend

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db

# ignore builds
*.tar.gz
.branchname
build.properties
102 changes: 51 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
[![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net)
[![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net)
[![PHP 7.3](https://img.shields.io/badge/php-7.3-blue.svg)](http://www.php.net)

![Logo](http://dev.heidelpay.com/devHeidelpay_400_180.jpg)

# Payment extension for Plentymarkets and heidelpay merchant gateway (MGW)

This extension for Plentymarkets provides a direct integration of the heidelpay payment methods to your Plentymarkets shop.

Currently supported payment methods are:
* Cards (Credit and Debit)
* Direct Debit (guaranteed) B2C
* FlexiPay direct®
* iDEAL
* Invoice (guaranteed) B2C
* Invoice guaranteed B2B
* PayPal
* Sofort

## SYSTEM REQUIREMENTS
This extension requires:
- Plentymarkets 7
- Plugin Ceres version 5.0 or above
- Plugin IO version 5.0 or above

## LICENSE
Copyright (C) 2020 heidelpay GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## User Guide
### English
* [User Guide](meta/documents/user_guide_en.md)
* [Changelog](meta/documents/changelog_en.md)
* [Support Contacts](meta/documents/support_contact_en.md)

### Deutsch
* [User Guide](meta/documents/user_guide_de.md)
* [Changelog](meta/documents/changelog_de.md)
* [Supportkontakte](meta/documents/support_contact_de.md)
[![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net)
[![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net)
[![PHP 7.3](https://img.shields.io/badge/php-7.3-blue.svg)](http://www.php.net)

![Logo](http://dev.heidelpay.com/devHeidelpay_400_180.jpg)

# Payment extension for Plentymarkets and heidelpay merchant gateway (MGW)

This extension for Plentymarkets provides a direct integration of the heidelpay payment methods to your Plentymarkets shop.

Currently supported payment methods are:
* Cards (Credit and Debit)
* Direct Debit (guaranteed) B2C
* FlexiPay direct®
* iDEAL
* Invoice (guaranteed) B2C
* Invoice guaranteed B2B
* PayPal
* Sofort

## SYSTEM REQUIREMENTS
This extension requires:
- Plentymarkets 7
- Plugin Ceres version 5.0 or above
- Plugin IO version 5.0 or above

## LICENSE
Copyright (C) 2020 heidelpay GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## User Guide
### English
* [User Guide](meta/documents/user_guide_en.md)
* [Changelog](meta/documents/changelog_en.md)
* [Support Contacts](meta/documents/support_contact_en.md)

### Deutsch
* [User Guide](meta/documents/user_guide_de.md)
* [Changelog](meta/documents/changelog_de.md)
* [Supportkontakte](meta/documents/support_contact_de.md)
4 changes: 4 additions & 0 deletions meta/documents/changelog_de.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Sämtliche relevanten Änderungen an diesem Projekt werden in dieser Datei dokum

Das Format basiert auf [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) und dieses Projekt hält sich an [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.3][1.0.3]
### Fix
- Die Sprache des Kunden wird nun im Redirect in den Shop berücksichtigt.

## [1.0.2][1.0.2]
### Fix
- Der Link zum Handbuch wurde korrigiert
Expand Down
4 changes: 4 additions & 0 deletions meta/documents/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.3][1.0.3]
### Fix
- use correct language after redirect

## [1.0.2][1.0.2]
### Fix
- changed the link to the manual
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"namespace": "HeidelpayMGW",

"type": "payment",
"version": "1.0.2",
"version": "1.0.3",
"license": "Apache-2.0",
"isClosedSource": false,
"price": 0.00,
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/menu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginSettings = "Plugin Settings"
invoiceSettings = "Invoice"
invoiceGuaranteedSettings = "Invoice Guaranteed"
invoiceGuaranteedB2bSettings = "Invoice Guaranteed B2B"
cardSettings = "Credit/Debit Card"
cardsSettings = "Credit/Debit Card"
sepaDirectDebitSettings = "SEPA Direct Debit"
sepaDirectDebitGuaranteedSettings = "SEPA Direct Debit Guaranteed"
paypalSettings = "PayPal"
Expand Down
8 changes: 5 additions & 3 deletions resources/views/content/BuyNowButton.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function prepareHeidelpayPayment() {
document.getElementById('checkoutButtonHeidelpayArrow').className = 'fa fa-circle-o-notch fa-spin';
const placeOrderComponent = getHeidelpayPlaceOrderComponent();
if (placeOrderComponent.validateCheckout()) {
var heidelpayInstance = new heidelpay('{{publicKey}}');
var heidelpayInstance = new heidelpay('{{publicKey}}', {locale: App.language});
for (mop of mopList) {
if (mop.id === getHeidelpayBasketMOP() && mop.paymentKey === '{{invoice}}') {
heidelpayPayment(placeOrderComponent, heidelpayInstance.Invoice());
Expand Down Expand Up @@ -238,12 +238,14 @@ function heidelpayPayment(placeOrderComponent, paymentInstance) {
paymentInstance.createResource()
.then(data => {
let post;
const lang = App.language;
if (window.b2bCustomer) {
let heidelpayB2bCustomer = gatherHeidelpayB2bData(window.b2bCustomer);
post = {data, heidelpayBirthDate, heidelpayB2bCustomer};
post = {data, heidelpayBirthDate, heidelpayB2bCustomer, lang};
} else {
post = {data, heidelpayBirthDate};
post = {data, heidelpayBirthDate, lang};
}
fetch('/{{routeName}}/payment-type/', {
method: 'POST',
body: JSON.stringify(post),
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/PluginConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PluginConfiguration
{
// Plugin
const PLUGIN_NAME = 'HeidelpayMGW';
const PLUGIN_VERSION = '1.0.2';
const PLUGIN_VERSION = '1.0.3';
const PLUGIN_KEY = 'HeidelpayMGWPaymentPlugin';

// Plugin payment methods
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/PaymentTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function heidelpayMGWPaymentType(Response $response, Request $request, Se
$sessionHelper->setValue('paymentResource', $data);
$sessionHelper->setValue('heidelpayBirthDate', $heidelpayBirthDate);
$sessionHelper->setValue('heidelpayB2bCustomer', $heidelpayB2bCustomer);
$sessionHelper->setValue('frontendLocale', $frontendData['lang']);

return $response->json([
'success' => true
Expand Down
8 changes: 5 additions & 3 deletions src/Controllers/RedirectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace HeidelpayMGW\Controllers;

use IO\Helper\RouteConfig;
use Plenty\Plugin\Controller;
use Plenty\Plugin\Http\Response;
use HeidelpayMGW\Helpers\Loggable;
use HeidelpayMGW\Helpers\UrlHelper;
use HeidelpayMGW\Helpers\SessionHelper;
use HeidelpayMGW\Configuration\PluginConfiguration;
use HeidelpayMGW\Repositories\PluginSettingRepository;
Expand Down Expand Up @@ -95,16 +97,16 @@ public function processRedirect(Response $response): BaseResponse
'libResponse' => $libResponse,
]
);
return $response->redirectTo('checkout');
return $response->redirectTo(pluginApp(UrlHelper::class)->getRedirectUrl(RouteConfig::CHECKOUT));
}
if ($libResponse['status'] == 'canceled') {
return $response->redirectTo('checkout');
return $response->redirectTo(pluginApp(UrlHelper::class)->getRedirectUrl(RouteConfig::CHECKOUT));
}
$paymentInformation['transaction']['status'] = $libResponse['status'];
unset($paymentInformation['transaction']['redirectUrl']);
$this->sessionHelper->setValue('paymentInformation', $paymentInformation);
$this->sessionHelper->setValue('paymentResource', $libResponse);

return $response->redirectTo('place-order');
return $response->redirectTo(pluginApp(UrlHelper::class)->getRedirectUrl(RouteConfig::PLACE_ORDER));
}
}
3 changes: 2 additions & 1 deletion src/Helpers/PaymentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace HeidelpayMGW\Helpers;

use IO\Helper\RouteConfig;
use HeidelpayMGW\Helpers\Loggable;
use HeidelpayMGW\Helpers\OrderHelper;
use Plenty\Modules\Order\Models\Order;
Expand Down Expand Up @@ -314,7 +315,7 @@ public function executeCharge(array $heidelpayPaymentResource, int $mopId): arra
}

return [
'value' => null,
'value' => pluginApp(UrlHelper::class)->getRedirectUrl(RouteConfig::PLACE_ORDER),
'type' => GetPaymentMethodContent::RETURN_TYPE_CONTINUE
];
}
Expand Down
58 changes: 58 additions & 0 deletions src/Helpers/UrlHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace HeidelpayMGW\Helpers;

use IO\Services\UrlBuilder\UrlQuery;

/**
* Returns the API keys
*
* Copyright (C) 2020 heidelpay GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://docs.heidelpay.com/
*
* @author Rimantas <[email protected]>
*
* @package heidelpayMGW/helpers
*/
class UrlHelper
{
/** @var SessionHelper $sessionHelper */
private $sessionHelper;

public function __construct(SessionHelper $sessionHelper)
{
$this->sessionHelper = $sessionHelper;
}

/**
* Get public API key from settings
*
* @return string Public key
*/
public function getRedirectUrl(string $url): string
{
$language = $this->sessionHelper->getValue('frontendLocale');

$query = pluginApp(UrlQuery::class, ['path' => $url, 'lang' => $language]);

$includeLanguage = false;
if ($language != 'de') {
$includeLanguage = true;
}

return $query->toRelativeUrl($includeLanguage);
}
}
Loading

0 comments on commit 24e4b2f

Please sign in to comment.