Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JBaptisteLvt committed Sep 8, 2023
2 parents 8f94e61 + 41c1d84 commit 7a0e242
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include:

variables:
SAST_EXCLUDED_ANALYZERS: 'eslint,semgrep'
DOCKWARE_VERSION: '6.4.19.0'
DOCKWARE_VERSION: '6.4.20.2'
GIT_DEPTH: 10
RELEASE_NAME: ${DOCKER_STACK}-${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}

Expand Down Expand Up @@ -102,6 +102,7 @@ build-test:
--cache=true
--context "dir://${CI_PROJECT_DIR}"
--dockerfile "./bin/docker/images/shopware/Dockerfile"
--build-arg DOCKWARE_VERSION=$DOCKWARE_VERSION
--destination "$REGISTRY_CI/test-jobs-${DOCKER_STACK}-${DOCKER_SERVICE}_web:${CI_COMMIT_REF_SLUG}"
except:
variables:
Expand Down Expand Up @@ -330,6 +331,7 @@ build:
--cache=true
--context "dir://${CI_PROJECT_DIR}"
--dockerfile "./bin/docker/images/shopware/Dockerfile"
--build-arg DOCKWARE_VERSION=$DOCKWARE_VERSION
--destination "${REGISTRY_CD}/${DOCKER_STACK}-${DOCKER_SERVICE}-web:${CI_COMMIT_REF_SLUG}"
tags:
- small
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# CHANGELOG

## Version 1.1.0

- **Add** : Add cancel button option to hosted page
- **Add** : Update Giropay Logo
- **Fixed** : Add `iDeal` bank choice when submitting checkout

## Version 1.0.3

- **Fix** : EC-3315 - Fixed Database definition
- **Fix** : Fixed Database definition

## Version 1.0.2

Expand Down
10 changes: 0 additions & 10 deletions bin/docker/kubernetes/helm/templates/shopware-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ spec:
name: shopware-{{ .Release.Name }}
resources:
requests:
memory: "4G"
cpu: "1000m"
limits:
memory: "5G"
cpu: "1200m"
envFrom:
Expand All @@ -92,10 +89,3 @@ spec:
ports:
- containerPort: 80
name: shopware
nodeSelector:
node_type: default
tolerations:
- key: cd_service
operator: Equal
value: only
effect: NoExecute
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hipay/hipay-enterprise-shopware-6",
"description": "HiPay enterprise plugin for Shopware 6",
"license": "Apache-2.0",
"version": "1.0.3",
"version": "1.1.0",
"authors": [
{
"email": "support.tpp@hipay.com",
Expand Down Expand Up @@ -49,7 +49,7 @@
}
},
"require": {
"hipay/hipay-fullservice-sdk-php": "^2.11",
"hipay/hipay-fullservice-sdk-php": "^2.14.0",
"giggsey/libphonenumber-for-php": "^8.13"
},
"require-dev": {
Expand Down
2 changes: 2 additions & 0 deletions src/PaymentMethod/AbstractPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ private function generateRequestHostedPage(
$orderRequest = $this->hydrateGenericOrderRequest(new HostedPaymentPageRequest(), $transaction, $locale);
$orderRequest->payment_product_list = static::getProductCode();

$orderRequest->display_cancel_button = $this->config->isCancelButtonDisplayed();

return $this->hydrateHostedPage($orderRequest, $transaction);
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ export default class HipayHostedFieldsPlugin extends Plugin {
errorClass: 'is-invalid',
errorPrefix: 'error',
styles: null
}
};

/**
* Plugin initialisation
*/
init() {
// ensure is a abstract class
if (this.constructor === HipayHostedFieldsPlugin) {
throw new TypeError('Class "HipayHostedFieldsPlugin" cannot be instantiated directly');
throw new TypeError(
'Class "HipayHostedFieldsPlugin" cannot be instantiated directly'
);
}

this.options = {
...this.getPaymentDefaultOption(),
...this.options
}
};

this._configHostedFields = this.getConfigHostedFields();
this._form = document.querySelector('#' + this.options.idResponse).form;
Expand All @@ -53,10 +55,10 @@ export default class HipayHostedFieldsPlugin extends Plugin {

let valid = false;
// Generate
this._cardInstance.on('change', (response) => {
this._cardInstance.on('change', response => {
valid = response.valid;
if (valid) {
this._cardInstance.getPaymentData().then((result) => {
this._cardInstance.getPaymentData().then(result => {
inputResponse.setAttribute('value', JSON.stringify(result));
});
} else {
Expand All @@ -65,19 +67,29 @@ export default class HipayHostedFieldsPlugin extends Plugin {
});

// handle errors on form validation
inputResponse.addEventListener('invalid', (e) => {
inputResponse.addEventListener('invalid', e => {
if (!valid) {
this._cardInstance.getPaymentData().then(
() => {},
(result) => {
result => {
inputResponse.setAttribute('value', '');
result.forEach((element) =>
result.forEach(element =>
this._errorHandler(element.field, true, element.error)
);
}
);
}
});

this._form.addEventListener('submit', e => {
e.preventDefault();
const target = e.currentTarget;

this._cardInstance.getPaymentData().then(result => {
inputResponse.setAttribute('value', JSON.stringify(result));
target.submit();
});
});
});
}

Expand All @@ -99,9 +111,11 @@ export default class HipayHostedFieldsPlugin extends Plugin {
node.classList.remove(this.options.errorClass);
}

const errorNode = document.querySelector('#' + this.options.errorPrefix + '-' + targetId);
if(errorNode) {
errorNode.innerHTML= errorMessage;
const errorNode = document.querySelector(
'#' + this.options.errorPrefix + '-' + targetId
);
if (errorNode) {
errorNode.innerHTML = errorMessage;
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/Resources/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
<label lang="de-DE">One-Click-Zahlung</label>
</input-field>

<input-field type="bool">
<name>cancelButton</name>
<label>Display cancel button</label>
<label lang="de-DE">Die Schaltfläche "Abbrechen" anzeigen</label>
</input-field>

<!--<input-field
type="bool">
<name>rememberCart</name>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/public/administration/media/giropay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/Service/ReadHipayConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ public function isOneClickPayment(): bool
return $this->configHipay->getBool(HiPayPaymentPlugin::getModuleName().'.config.oneClickPayment');
}

/**
* Check if the cancel button is displayed.
*/
public function isCancelButtonDisplayed(): bool
{
return $this->configHipay->getBool(HiPayPaymentPlugin::getModuleName().'.config.cancelButton');
}

/**
* Check if cart remembering is activated.
*/
Expand Down
1 change: 1 addition & 0 deletions tests/Tools/PaymentMethodMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ protected function getHostedPagePaymentRequest(string $classname, $redirectUri =
$config = [
'operationMode' => 'hostedPage',
'captureMode' => 'auto',
'cancelButton' => true
];

if (null === $redirectUri) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/PaymentMethod/AbstractPaymentMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ public function testPayValidWithHostedPage()
$config = [
'operationMode' => 'hostedPage',
'captureMode' => 'auto',
'cancelButton' => true
];

$hostedPaymentPageRequest = new HostedPaymentPageRequest();
Expand Down Expand Up @@ -521,6 +522,7 @@ public function testPayFail()
$config = [
'operationMode' => 'hostedPage',
'captureMode' => 'auto',
'cancelButton' => true
];

$responses = [
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Service/NotificationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ public function testDispatchExpiredNotification($notificationStatus, $hipayStatu
],
'sort' => [
[
'extensions' => [],
'field' => 'status',
'naturalSorting' => false,
'extensions' => [],
'order' => 'ASC',
],
],
Expand Down Expand Up @@ -909,9 +909,9 @@ public function testDispatchNotification($notificationStatus, $hipayStatus, $ini
],
'sort' => [
[
'extensions' => [],
'field' => 'status',
'naturalSorting' => false,
'extensions' => [],
'order' => 'ASC',
],
],
Expand Down Expand Up @@ -1218,9 +1218,9 @@ public function testDispatchNotificationAuthorizeAndSaveCard()
],
'sort' => [
[
'extensions' => [],
'field' => 'status',
'naturalSorting' => false,
'extensions' => [],
'order' => 'ASC',
],
],
Expand Down
11 changes: 11 additions & 0 deletions tests/Unit/Service/ReadHipayConfigServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,17 @@ public function testIsOneClickPayment()
);
}

public function testIsCancelButtonDisplayed()
{
$cancelButton = 0 === random_int(0, 1);
$mock = $this->generateService(['cancelButton' => $cancelButton]);

$this->assertEquals(
$cancelButton,
$mock->isCancelButtonDisplayed()
);
}

public function testIsRememberCart()
{
$rembemberCart = 0 === random_int(0, 1);
Expand Down

0 comments on commit 7a0e242

Please sign in to comment.