Skip to content

Commit b15dbe4

Browse files
Merge branch 'hotfix/1.0.11'
2 parents cfb04af + 2713d21 commit b15dbe4

File tree

11 files changed

+85
-137
lines changed

11 files changed

+85
-137
lines changed

.gitlab-ci.yml

+21-70
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
image: hipay/gitlab-ci-base:jessie
1+
image: gcr.io/pi-dev-sandbox/gitlab-ci-base:jessie
22

33
stages:
44
- build-test
55
- test
6-
- clean-stack
7-
- analysis
86
- package
97
- build
108
- deploy
11-
- sync
129

1310
variables:
14-
PROJECT_NAME_TEST: ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_PIPELINE_ID}
11+
DOCKER_HOST: tcp://localhost:2375/
12+
DOCKER_DRIVER: overlay2
13+
DOCKER_TLS_CERTDIR: ""
14+
GIT_DEPTH: 10
15+
16+
services:
17+
- docker:19.03.1-dind
1518

1619
#########################
1720
#### JOBS ####
@@ -20,63 +23,21 @@ build-test:
2023
stage: build-test
2124
script:
2225
- docker-compose -f docker-compose.test.yml build
26+
- docker-compose -f docker-compose.test.yml push
2327
tags:
24-
- pi-commerce-no-overlay
28+
- gcp-default-runner
2529

2630
test:
2731
stage: test
28-
before_script:
29-
- sed -i -e "s/{DB_HOST\}/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_database/" ./bin/docker/conf/test/env
30-
- sed -i -e "s/{PS_DOMAIN\}/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-17/" ./bin/docker/conf/test/env17
31-
- sed -i -e "s/{PS_DOMAIN\}/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-16/" ./bin/docker/conf/test/env16
3232
script:
33-
- docker-compose -p $PROJECT_NAME_TEST -f docker-compose.test.yml stop
34-
- docker-compose -p $PROJECT_NAME_TEST -f docker-compose.test.yml rm -fv
35-
- docker-compose -p $PROJECT_NAME_TEST -f docker-compose.test.yml up -d
33+
- docker-compose -f docker-compose.test.yml pull -q
34+
- docker-compose -f docker-compose.test.yml up -d
3635
- sleep 250
37-
- docker-compose -p $PROJECT_NAME_TEST -f docker-compose.test.yml logs
38-
- curl --retry 10 --retry-delay 20 -v http:\/\/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-16/
39-
- curl --retry 10 --retry-delay 20 -v http:\/\/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-17/
40-
after_script:
41-
- /tools/clean-job.sh $PROJECT_NAME_TEST docker-compose.test.yml prestashop ${DOCKER_STACK}-${DOCKER_SERVICE}_web17:${CI_COMMIT_REF_SLUG}
42-
- /tools/clean-job.sh $PROJECT_NAME_TEST docker-compose.test.yml prestashop ${DOCKER_STACK}-${DOCKER_SERVICE}_web16:${CI_COMMIT_REF_SLUG}
36+
- docker-compose -f docker-compose.test.yml logs
37+
- curl --retry 10 --retry-delay 20 -v localhost:8076
38+
- curl --retry 10 --retry-delay 20 -v localhost:8077
4339
tags:
44-
- pi-commerce-no-overlay
45-
46-
clean-stack-test:
47-
stage: clean-stack
48-
script:
49-
- echo "Clean remaining containers, network and images"
50-
after_script:
51-
- /tools/clean-job.sh $PROJECT_NAME_TEST docker-compose.test.yml prestashop ${DOCKER_STACK}-${DOCKER_SERVICE}_web17:${CI_COMMIT_REF_SLUG}
52-
- /tools/clean-job.sh $PROJECT_NAME_TEST docker-compose.test.yml prestashop ${DOCKER_STACK}-${DOCKER_SERVICE}_web16:${CI_COMMIT_REF_SLUG}
53-
tags:
54-
- pi-commerce-no-overlay
55-
when: always
56-
57-
sonarqube:
58-
stage: analysis
59-
image: ciricihq/gitlab-sonar-scanner
60-
variables:
61-
SONAR_URL: http://172.17.0.1:19000
62-
SONAR_ANALYSIS_MODE: preview
63-
SONAR_TOKEN: $SONAR_LOGIN
64-
script:
65-
- /usr/bin/sonar-scanner-run.sh
66-
tags:
67-
- pi-commerce-no-overlay
68-
69-
sonarqube-reports:
70-
stage: analysis
71-
image: ciricihq/gitlab-sonar-scanner
72-
variables:
73-
SONAR_URL: http://172.17.0.1:19000
74-
SONAR_ANALYSIS_MODE: "publish"
75-
SONAR_TOKEN: $SONAR_LOGIN
76-
script:
77-
- unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh
78-
tags:
79-
- pi-commerce-no-overlay
40+
- gcp-high-load-runner
8041

8142
package:
8243
stage: package
@@ -85,16 +46,15 @@ package:
8546
script:
8647
- echo "Package module $CI_COMMIT_REF_SLUG"
8748
- ./package-ready-for-prestashop/builder/module_builder.sh -v $CI_COMMIT_REF_SLUG
88-
- chmod u+x bin/deployment/deploy_package.sh
89-
- ./bin/deployment/deploy_package.sh
9049
artifacts:
9150
paths:
9251
- ./package-ready-for-prestashop
9352
tags:
94-
- pi-commerce-no-overlay
53+
- gcp-default-runner
9554

9655
build:
9756
stage: build
57+
when: manual
9858
before_script:
9959
- /tools/docker-rmi.sh ${REGISTRY_URL}/${DOCKER_STACK}-${DOCKER_SERVICE}_web-16:${CI_COMMIT_REF_SLUG}
10060
- /tools/docker-rmi.sh ${REGISTRY_URL}/${DOCKER_STACK}-${DOCKER_SERVICE}_web-17:${CI_COMMIT_REF_SLUG}
@@ -105,9 +65,10 @@ build:
10565
- docker rmi ${REGISTRY_URL}/${DOCKER_STACK}-${DOCKER_SERVICE}_web-16:${CI_COMMIT_REF_SLUG}
10666
- docker rmi ${REGISTRY_URL}/${DOCKER_STACK}-${DOCKER_SERVICE}_web-17:${CI_COMMIT_REF_SLUG}
10767
tags:
108-
- pi-commerce-no-overlay
68+
- gcp-default-runner
10969

11070
deploy2recette:
71+
when: manual
11172
stage: deploy
11273
before_script:
11374
- sed -i -e "s/{DB_HOST\}/${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_database/" ./bin/docker/conf/acceptance/env
@@ -123,14 +84,4 @@ deploy2recette:
12384
- bash /tools/deployToDockerMachine.sh -e ./bin/docker/conf/acceptance/env -e ./bin/docker/conf/acceptance/env16 -e ./bin/docker/conf/acceptance/env17 -s docker-compose.acceptance.yml -n $DOCKER_STACK-$DOCKER_SERVICE-$CI_COMMIT_REF_SLUG
12485
allow_failure: true
12586
tags:
126-
- pi-commerce-no-overlay
127-
128-
sync:
129-
stage: sync
130-
script:
131-
- git clone --mirror https://$GITLAB_USER:[email protected]/pi-ecommerce/hipay-professional-sdk-prestashop.git
132-
- cd hipay-professional-sdk-prestashop.git
133-
- git push --mirror https://$GITHUB_USER:[email protected]/hipay/hipay-professional-sdk-prestashop.git
134-
allow_failure: true
135-
tags:
136-
- pi-commerce-no-overlay
87+
- gcp-default-runner

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Version 1.0.11
2+
3+
- **Fix**: PHP warning on order page
4+
15
# Version 1.0.10
26

37
- Switch to old array syntax

bin/deployment/deploy_package.sh

-15
This file was deleted.

bin/docker/conf/test/env

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PS_DEV_MODE=1
88
PS_FOLDER_ADMIN=admin-hipay
99
PS_FOLDER_INSTALL=installOLD
1010
PS_HANDLE_DYNAMIC_DOMAIN=0
11-
DB_SERVER={DB_HOST}
11+
DB_SERVER=database
1212
DB_USER=root
1313
DB_PASSWD=admin
1414
MYSQL_ROOT_PASSWORD=admin

bin/docker/conf/test/env16

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
PS_DOMAIN={PS_DOMAIN}
1+
PS_DOMAIN=localhost:8076
22
DB_NAME=prestashop16

bin/docker/conf/test/env17

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
PS_DOMAIN={PS_DOMAIN}
1+
PS_DOMAIN=localhost:8077
22
DB_NAME=prestashop17

bin/docker/images/prestashop/Dockerfile16

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ FROM prestashop/prestashop:1.6-7.1-apache
33
MAINTAINER support.wallet <[email protected]>
44

55
RUN apt-get update \
6-
&& apt-get install -y ssmtp vim git cron \
6+
&& apt-get install -y curl gnupg \
7+
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
8+
&& apt-get install -y msmtp vim git cron \
9+
&& apt-get install -y nodejs \
10+
&& npm install -g bower \
11+
&& echo '{ "allow_root": true }' > /root/.bowerrc \
712
&& curl -sS https://getcomposer.org/installer | php -- --filename=composer -- --install-dir=/usr/local/bin \
8-
&& echo "sendmail_path = /usr/sbin/ssmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini \
9-
&& echo '' \
10-
&& echo "mailhub=smtp:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf \
13+
&& echo "sendmail_path = /usr/sbin/msmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini \
14+
&& echo "mailhub=common-smtp:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/msmtprc \
1115
&& rm -rf /var/lib/apt/lists/*
1216

1317
COPY bin/docker /tmp

bin/docker/images/prestashop/Dockerfile17

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
FROM prestashop/prestashop:1.7-7.1-apache
1+
FROM prestashop/prestashop:1.7-7.2-apache
22

33
MAINTAINER support.wallet <[email protected]>
44

55
RUN apt-get update \
6-
&& apt-get install -y ssmtp vim git cron \
7-
&& curl -sS https://getcomposer.org/installer | php -- --filename=composer -- --install-dir=/usr/local/bin \
8-
&& echo "sendmail_path = /usr/sbin/ssmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini \
9-
&& echo '' \
10-
&& echo "mailhub=smtp:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf \
11-
&& rm -rf /var/lib/apt/lists/*
6+
&& apt-get install -y curl gnupg \
7+
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
8+
&& apt-get install -y msmtp vim git cron \
9+
&& apt-get install -y nodejs \
10+
&& npm install -g bower \
11+
&& echo '{ "allow_root": true }' > /root/.bowerrc \
12+
&& curl -sS https://getcomposer.org/installer | php -- --filename=composer -- --install-dir=/usr/local/bin \
13+
&& echo "sendmail_path = /usr/sbin/msmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini \
14+
&& echo "mailhub=common-smtp:1025\nUseTLS=NO\nFromLineOverride=YES" > /etc/msmtprc \
15+
&& rm -rf /var/lib/apt/lists/*
1216

1317
COPY bin/docker /tmp
1418

bin/docker/images/prestashop/entrypoint.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@
44
# CALL PARENT ENTRYPOINT
55
#===================================#
66
echo "\n Execution PRESTASHOP Entrypoint \n";
7+
8+
# wait until MySQL is really available
9+
maxcounter=45
10+
counter=1
11+
while ! mysql --protocol TCP -h $DB_SERVER -P $DB_PORT -u $DB_USER -p$DB_PASSWD -e "show databases;" > /dev/null 2>&1; do
12+
sleep 1
13+
counter=`expr $counter + 1`
14+
if [ $counter -gt $maxcounter ]; then
15+
>&2 echo "We have been waiting for MySQL too long already; failing."
16+
exit 1
17+
fi;
18+
done
19+
720
/tmp/docker_run.sh
821

922
if [ $ACTIVE_XDEBUG ];then
1023
# INSTALL X DEBUG
11-
echo '' | pecl install xdebug-2.5.0
24+
echo '' | pecl install xdebug-2.6.1
25+
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
1226
echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini
1327
echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
1428
fi

docker-compose.test.yml

+11-32
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
version: "3.3"
22

3-
networks:
4-
prestashop:
5-
internal: true
6-
outside:
7-
external: true
8-
93
services:
104
web17:
11-
container_name: ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_web-17
12-
image: ${DOCKER_STACK}-${DOCKER_SERVICE}_web17:${CI_COMMIT_REF_SLUG}
5+
container_name: prestashop_web_17
6+
image: gcr.io/pi-dev-sandbox/test-jobs-${DOCKER_STACK}-${DOCKER_SERVICE}_web17:${CI_COMMIT_REF_SLUG}
137
build:
148
context: .
159
dockerfile: ./bin/docker/images/prestashop/Dockerfile17
@@ -18,14 +12,12 @@ services:
1812
env_file:
1913
- ./bin/docker/conf/test/env
2014
- ./bin/docker/conf/test/env17
21-
networks:
22-
prestashop:
23-
outside:
24-
aliases:
25-
- ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-17
15+
ports:
16+
- "8077:80"
17+
2618
web16:
27-
container_name: ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_web-16
28-
image: ${DOCKER_STACK}-${DOCKER_SERVICE}_web16:${CI_COMMIT_REF_SLUG}
19+
container_name: prestashop_web_17_16
20+
image: gcr.io/pi-dev-sandbox/test-jobs-${DOCKER_STACK}-${DOCKER_SERVICE}_web16:${CI_COMMIT_REF_SLUG}
2921
build:
3022
context: .
3123
dockerfile: ./bin/docker/images/prestashop/Dockerfile16
@@ -34,28 +26,15 @@ services:
3426
env_file:
3527
- ./bin/docker/conf/test/env
3628
- ./bin/docker/conf/test/env16
37-
networks:
38-
prestashop:
39-
outside:
40-
aliases:
41-
- ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}-web-16
29+
ports:
30+
- "8076:80"
31+
4232
database:
4333
image: mysql:5.7
44-
container_name: ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_database
45-
networks:
46-
prestashop:
47-
aliases:
48-
- ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_database
34+
container_name: prestashop_database
4935
env_file:
5036
- ./bin/docker/conf/test/env
5137
healthcheck:
5238
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
5339
timeout: 20s
5440
retries: 10
55-
smtp:
56-
image: schickling/mailcatcher
57-
container_name: ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_smtp
58-
networks:
59-
prestashop:
60-
aliases:
61-
- ${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}_smtp

src/hipay_professional/hipay_professional.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct()
4848
{
4949
$this->name = 'hipay_professional';
5050
$this->tab = 'payments_gateways';
51-
$this->version = '1.0.10';
51+
$this->version = '1.0.11';
5252
$this->module_key = 'ab188f639335535838c7ee492a2e89f8';
5353
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
5454
$this->currencies = true;
@@ -433,8 +433,11 @@ public function hookDisplayAdminOrderLeft($params)
433433
$messages = CustomerThread::getCustomerMessagesOrder($order->getCustomer()->id, $order->id);
434434
}
435435

436-
$message = array_pop($messages);
437-
$details = Tools::jsonDecode($message['message']);
436+
do {
437+
$message = array_pop($messages);
438+
$details = Tools::jsonDecode($message['message']);
439+
} while ($details === null && !empty($messages));
440+
438441
$params = http_build_query(array(
439442
'id_order' => $order->id,
440443
'sandbox' => (isset($details->Environment) && ($details->Environment != 'PRODUCTION') ? 1 : 0),
@@ -1570,8 +1573,12 @@ public function getAdminOrderRefundBlockDetails($order)
15701573
} else {
15711574
$messages = CustomerThread::getCustomerMessagesOrder($order->getCustomer()->id, $order->id);
15721575
}
1573-
$message = array_pop($messages);
1574-
$details = Tools::jsonDecode($message['message']);
1576+
1577+
do {
1578+
$message = array_pop($messages);
1579+
$details = Tools::jsonDecode($message['message']);
1580+
} while ($details === null && !empty($messages));
1581+
15751582
$id_transaction = $this->getTransactionId($details);
15761583

15771584
$params = http_build_query(array(

0 commit comments

Comments
 (0)