Skip to content

Commit

Permalink
Merge pull request #5 from buckaroo-it/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
harli91 authored Nov 8, 2023
2 parents a911f73 + f4502f0 commit 8601a0e
Show file tree
Hide file tree
Showing 35 changed files with 462 additions and 202 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -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 }}
9 changes: 5 additions & 4 deletions Magewire/Payment/Method/Afterpay20.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions Magewire/Payment/Method/Giftcards.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 14 additions & 10 deletions Magewire/Payment/Method/PayPerEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@ 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');
$middleName = $payment->getAdditionalInformation('customer_billingMiddleName');
$email = $payment->getAdditionalInformation('customer_email');
$this->gender = $payment->getAdditionalInformation('customer_gender');

$billingAddress = $this->getBillingAddress();
$billingAddress = $quote->getBillingAddress();

if ($firstName === null) {
$firstName = $billingAddress->getFirstname();
Expand All @@ -103,6 +104,7 @@ public function mount(): void
$this->lastName = $lastName;
$this->middleName = $middleName;
$this->email = $email;
$this->quoteRepository->save($quote);
}


Expand Down Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Hyva\Checkout\Model\Form\EntityField\EavAttributeField;

class Idin extends EavAttributeField
class Hide extends EavAttributeField
{
public function canRender(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion Model/Magewire/Payment/PlaceOrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ private function hasRedirect(): bool
$response = $this->getResponse();
return !empty($response->RequiredAction->RedirectURL);
}
}
}
2 changes: 1 addition & 1 deletion Model/Validation/Rules/Iban.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function check($value): bool
$checksum %= 97;
}

return ((98 - $checksum) == $check);
return (98 - $checksum) == $check;
} else {
return false;
}
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@

# 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
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
Expand Down
5 changes: 3 additions & 2 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
<arguments>
<!-- Hide idin customer fields -->
<argument name="customFields" xsi:type="array">
<item name="buckaroo_idin_iseighteenorolder" xsi:type="string">\Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Idin</item>
<item name="buckaroo_idin" xsi:type="string">\Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Idin</item>
<item name="buckaroo_idin_iseighteenorolder" xsi:type="string">\Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide</item>
<item name="buckaroo_idin" xsi:type="string">\Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide</item>
<item name="buckaroo_last_paybybank_issuer" xsi:type="string">\Buckaroo\HyvaCheckout\Model\Form\Eav\Customer\Hide</item>
</argument>
</arguments>
</type>
Expand Down
Empty file added i18n/de_DE.csv
Empty file.
Empty file added i18n/es_ES.csv
Empty file.
7 changes: 7 additions & 0 deletions i18n/fr_FR.csv
Original file line number Diff line number Diff line change
@@ -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:"
7 changes: 7 additions & 0 deletions i18n/nl_BE.csv
Original file line number Diff line number Diff line change
@@ -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:"
7 changes: 7 additions & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
@@ -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:"
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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=.
6 changes: 0 additions & 6 deletions view/frontend/layout/hyva_checkout_components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<body>
<referenceContainer name="checkout.payment.methods.before">
<block name="checkout.payment.method.buckaroo_before_payments"
as="buckaroo_before_payments"
template="Buckaroo_HyvaCheckout::component/payment/before.phtml">
</block>
</referenceContainer>
<referenceBlock name="checkout.payment.methods">
<!-- Payment Renderer: iDEAL -->
<block name="checkout.payment.method.buckaroo_magento2_ideal"
Expand Down
14 changes: 14 additions & 0 deletions view/frontend/layout/hyva_checkout_index_index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="checkout"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<body>
<referenceContainer name="hyva.checkout.api-v1.after">
<block name="checkout.buckaroo_after_api-v1"
as="buckaroo_after_api-v1"
template="Buckaroo_HyvaCheckout::component/payment/after.phtml">
</block>
</referenceContainer>
</body>
</page>
Loading

0 comments on commit 8601a0e

Please sign in to comment.