diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml
new file mode 100644
index 0000000..ec147dc
--- /dev/null
+++ b/.github/workflows/sonarqube.yml
@@ -0,0 +1,24 @@
+name: SonarQube Analysis
+
+on:
+ push:
+ branches:
+ - master
+ - develop
+ - "releases/**"
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: SonarQube Analysis
+ runs-on: ubuntu-latest
+ permissions: read-all
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ - uses: sonarsource/sonarqube-scan-action@master
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
diff --git a/Magewire/Payment/Method/Afterpay20.php b/Magewire/Payment/Method/Afterpay20.php
index ef8e90a..d0c6e0d 100644
--- a/Magewire/Payment/Method/Afterpay20.php
+++ b/Magewire/Payment/Method/Afterpay20.php
@@ -30,7 +30,7 @@ class Afterpay20 extends Component\Form implements EvaluationInterface
public ?bool $tos = true;
- public ?string $dateOfBirth = null;
+ public string $dateOfBirth = '';
public string $fullName = '';
@@ -93,7 +93,7 @@ public function mount(): void
$this->coc = $payment->getAdditionalInformation('customer_coc');
$this->phone = $payment->getAdditionalInformation('customer_telephone');
$this->identificationNumber = $payment->getAdditionalInformation('customer_identificationNumber');
- $this->dateOfBirth = $payment->getAdditionalInformation('customer_DoB');
+ $this->dateOfBirth = (string)$payment->getAdditionalInformation('customer_DoB');
$this->fullName = $this->getFullName();
}
@@ -136,6 +136,7 @@ public function updatedCoc(string $value): ?string
['coc.digits_between' => 'Invalid COC number']
);
+ $this->updatePaymentField('customer_DoB', '', '');
$this->updatePaymentField('customer_coc', $value);
return $value;
}
@@ -194,9 +195,9 @@ private function getPhoneRules(): array
*
* @return void
*/
- private function updatePaymentField(string $name, $value): void
+ private function updatePaymentField(string $name, $value, $default = null): void
{
- $value = empty($value) ? null : $value;
+ $value = empty($value) ? $default : $value;
try {
$quote = $this->sessionCheckout->getQuote();
diff --git a/Magewire/Payment/Method/Giftcards.php b/Magewire/Payment/Method/Giftcards.php
index a4cd20d..331620c 100644
--- a/Magewire/Payment/Method/Giftcards.php
+++ b/Magewire/Payment/Method/Giftcards.php
@@ -67,10 +67,11 @@ public function mount(): void
public function evaluateCompletion(EvaluationResultFactory $resultFactory): EvaluationResultInterface
{
- if ($this->canSubmit === false) {
+
+ if ($this->canSubmit === false && !$this->isRedirect()) {
return $resultFactory->createErrorMessageEvent()
->withCustomEvent('payment:method:error')
- ->withMessage('Cannot complete payment with voucher');
+ ->withMessage('Cannot complete payment with giftcards');
}
return $resultFactory->createSuccess();
diff --git a/Magewire/Payment/Method/PayPerEmail.php b/Magewire/Payment/Method/PayPerEmail.php
index fa9140a..ac99729 100644
--- a/Magewire/Payment/Method/PayPerEmail.php
+++ b/Magewire/Payment/Method/PayPerEmail.php
@@ -69,7 +69,8 @@ public function __construct(
*/
public function mount(): void
{
- $payment = $this->getPayment();
+ $quote = $this->getQuote();
+ $payment = $quote->getPayment();
$firstName = $payment->getAdditionalInformation('customer_billingFirstName');
$lastName = $payment->getAdditionalInformation('customer_billingLastName');
@@ -77,7 +78,7 @@ public function mount(): void
$email = $payment->getAdditionalInformation('customer_email');
$this->gender = $payment->getAdditionalInformation('customer_gender');
- $billingAddress = $this->getBillingAddress();
+ $billingAddress = $quote->getBillingAddress();
if ($firstName === null) {
$firstName = $billingAddress->getFirstname();
@@ -103,6 +104,7 @@ public function mount(): void
$this->lastName = $lastName;
$this->middleName = $middleName;
$this->email = $email;
+ $this->quoteRepository->save($quote);
}
@@ -139,24 +141,26 @@ public function hydrateEmail()
}
/**
- * Get payment from quote
+ * Get billing address from quote
*
- * @return Payment
+ * @return Address
*/
- private function getPayment()
+ private function getBillingAddress(): Address
{
- return $this->sessionCheckout->getQuote()->getPayment();
+ return $this->sessionCheckout->getQuote()->getBillingAddress();
}
+
/**
- * Get billing address from quote
+ * Get payment from quote
*
- * @return Address
+ * @return Payment
*/
- private function getBillingAddress(): Address
+ private function getPayment()
{
- return $this->sessionCheckout->getQuote()->getBillingAddress();
+ return $this->sessionCheckout->getQuote()->getPayment();
}
+
/**
* Validate single field with rules
*
diff --git a/Model/Form/Eav/Customer/Idin.php b/Model/Form/Eav/Customer/Hide.php
similarity index 89%
rename from Model/Form/Eav/Customer/Idin.php
rename to Model/Form/Eav/Customer/Hide.php
index 01d54a2..ab72044 100644
--- a/Model/Form/Eav/Customer/Idin.php
+++ b/Model/Form/Eav/Customer/Hide.php
@@ -6,7 +6,7 @@
use Hyva\Checkout\Model\Form\EntityField\EavAttributeField;
-class Idin extends EavAttributeField
+class Hide extends EavAttributeField
{
public function canRender(): bool
{
diff --git a/Model/Magewire/Payment/PlaceOrderService.php b/Model/Magewire/Payment/PlaceOrderService.php
index c63f693..253d43d 100644
--- a/Model/Magewire/Payment/PlaceOrderService.php
+++ b/Model/Magewire/Payment/PlaceOrderService.php
@@ -49,4 +49,4 @@ private function hasRedirect(): bool
$response = $this->getResponse();
return !empty($response->RequiredAction->RedirectURL);
}
-}
\ No newline at end of file
+}
diff --git a/Model/Validation/Rules/Iban.php b/Model/Validation/Rules/Iban.php
index f31d6ae..20cf248 100644
--- a/Model/Validation/Rules/Iban.php
+++ b/Model/Validation/Rules/Iban.php
@@ -41,7 +41,7 @@ public function check($value): bool
$checksum %= 97;
}
- return ((98 - $checksum) == $check);
+ return (98 - $checksum) == $check;
} else {
return false;
}
diff --git a/README.md b/README.md
index fc310e0..763929e 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,11 @@
# Buckaroo Magento Hyva Checkout
+## Requirements
+
+Buckaroo Magento 2 plugin version 1.46 or heigher
+Hyvä Checkout version 1.1.3 or heigher
+
## Installation
```
mkdir app/code/Buckaroo
@@ -11,7 +16,7 @@ cd app/code/Buckaroo
git clone https://github.com/buckaroo-it/Magento2_Hyva_Checkout.git
mv Magento2_Hyva_Checkout HyvaCheckout
cd HyvaCheckout
-git checkout 1.0.0-RC1
+git checkout 1.0.0
php bin/magento module:enable Buckaroo_HyvaCheckout
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml
index e2e7895..a0c18c6 100644
--- a/etc/frontend/di.xml
+++ b/etc/frontend/di.xml
@@ -41,8 +41,9 @@
- \Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Idin
- \Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Idin
+ \Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide
+ \Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide
+ \Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide
diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv
new file mode 100644
index 0000000..e69de29
diff --git a/i18n/es_ES.csv b/i18n/es_ES.csv
new file mode 100644
index 0000000..e69de29
diff --git a/i18n/fr_FR.csv b/i18n/fr_FR.csv
new file mode 100644
index 0000000..b629c34
--- /dev/null
+++ b/i18n/fr_FR.csv
@@ -0,0 +1,7 @@
+"MM/YY","MM/AA"
+"Expiration:","Expiration :"
+"Billing Middle Name:","Deuxième prénom (facturation):"
+"Select giftcard issuer:","Sélectionner l'émetteur de la carte-cadeau:"
+"PIN / Security code:","Code PIN / Code de sécurité:"
+"Please select issuer","Veuillez sélectionner l'émetteur:"
+"Voucher code:","Code du bon d'achat:"
\ No newline at end of file
diff --git a/i18n/nl_BE.csv b/i18n/nl_BE.csv
new file mode 100644
index 0000000..9c8fa18
--- /dev/null
+++ b/i18n/nl_BE.csv
@@ -0,0 +1,7 @@
+"MM/YY","MM/JJ"
+"Expiration:","Vervaldatum:"
+"Billing Middle Name:","Tussenvoegsel voor facturatienaam:"
+"Select giftcard issuer:","Selecteer Cadeaukaart:"
+"PIN / Security code:","PIN-/beveiligingscode:"
+"Please select issuer","Selecteer de uitgever"
+"Voucher code:","Voucher code:"
\ No newline at end of file
diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv
new file mode 100644
index 0000000..9c8fa18
--- /dev/null
+++ b/i18n/nl_NL.csv
@@ -0,0 +1,7 @@
+"MM/YY","MM/JJ"
+"Expiration:","Vervaldatum:"
+"Billing Middle Name:","Tussenvoegsel voor facturatienaam:"
+"Select giftcard issuer:","Selecteer Cadeaukaart:"
+"PIN / Security code:","PIN-/beveiligingscode:"
+"Please select issuer","Selecteer de uitgever"
+"Voucher code:","Voucher code:"
\ No newline at end of file
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000..4b10ff8
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,9 @@
+# Unique key for the project
+sonar.projectKey=Hyva-Checkout
+
+# Display name and version for the SonarQube UI
+sonar.projectName=Hyva Checkout
+sonar.projectVersion=1.0
+
+# Path to the source code, relative to the sonar-project.properties file
+sonar.sources=.
\ No newline at end of file
diff --git a/view/frontend/layout/hyva_checkout_components.xml b/view/frontend/layout/hyva_checkout_components.xml
index 44e7300..69f5457 100644
--- a/view/frontend/layout/hyva_checkout_components.xml
+++ b/view/frontend/layout/hyva_checkout_components.xml
@@ -3,12 +3,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/component/payment/before.phtml b/view/frontend/templates/component/payment/after.phtml
similarity index 66%
rename from view/frontend/templates/component/payment/before.phtml
rename to view/frontend/templates/component/payment/after.phtml
index af96475..0210427 100644
--- a/view/frontend/templates/component/payment/before.phtml
+++ b/view/frontend/templates/component/payment/after.phtml
@@ -1,17 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/view/frontend/templates/component/payment/method/afterpay.phtml b/view/frontend/templates/component/payment/method/afterpay.phtml
index b91f1e4..34d6062 100644
--- a/view/frontend/templates/component/payment/method/afterpay.phtml
+++ b/view/frontend/templates/component/payment/method/afterpay.phtml
@@ -21,7 +21,13 @@ use Magento\Framework\Escaper;
= $escaper->escapeHtml(__('Date of Birth:')); ?>
*
-
+
hasError('dateOfBirth')) : ?>