Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sonarqube #1

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/checkout@v2 - here I think should be v3, because sonarqube-scan-action@master it is the latest version that use v3

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 }}
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
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=.
47 changes: 39 additions & 8 deletions view/frontend/templates/component/payment/before.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
});

hyva.formValidation.addRule('bk-validateCardCvc', (value, options, field, context) => {
if (!BuckarooClientSideEncryption.V001.validateCvc(value, context.determineIssuer(context.cardNumber))) {
if (!BuckarooClientSideEncryption.V001.validateCvc(
value,
context.determineIssuer(context.cardNumber)
)
) {
return '<?= $escaper->escapeJs(__('Please enter a valid Cvc number.')) ?>';
};
return true;
Expand Down Expand Up @@ -106,17 +110,37 @@
})
}
}" x-init="initModal()">
<div id="bk-modal" tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 justify-center w-full p-4 items-center overflow-x-hidden overflow-y-auto md:inset-0 max-h-full h-full" x-bind:class="showModal ? 'flex': 'hidden'">
<div
id="bk-modal"
tabindex="-1"
aria-hidden="true"
class="fixed top-0 left-0 right-0 z-50 justify-center w-full p-4 items-center overflow-x-hidden overflow-y-auto md:inset-0 max-h-full h-full"
x-bind:class="showModal ? 'flex': 'hidden'">
<div class="relative w-full max-w-md max-h-full" @click.outside="close()">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<!-- Modal header -->
<div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white" x-text="title">
</h3>
<button type="button" @click="close()" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="defaultModal">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
<button
type="button"
@click="close()"
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
data-modal-hide="defaultModal"
>
<svg
aria-hidden="true"
class="w-5 h-5"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd">
</path>
</svg>
<span class="sr-only">Close modal</span>
</button>
Expand All @@ -131,14 +155,21 @@
<div class="flex items-center p-2 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
<template x-if="Array.isArray(buttons)">
<template x-for="(button, index) in buttons" :key="index">
<button @click="typeof button.action === 'function' ? button.action() : close()" type="button" class="btn btn primary" x-text="button.label"></button>
<button
@click="typeof button.action === 'function' ? button.action() : close()"
type="button"
class="btn btn primary"
x-text="button.label"
></button>
</template>
</template>
<template x-if="showClose">
<button @click="close()" type="button" class="btn btn primary"><?= $escaper->escapeHtml(__('Close')); ?></button>
<button @click="close()" type="button" class="btn btn primary">
<?= $escaper->escapeHtml(__('Close')); ?>
</button>
</template>
</div>
</div>
</div>
</div>
</div>
</div>
29 changes: 23 additions & 6 deletions view/frontend/templates/component/payment/method/afterpay.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ use Magento\Framework\Escaper;
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
</label>
<input type="date" x-data value="<?= $magewire->dateOfBirth ?>" @blur="$wire.call('updatedDateOfBirth', $event.target.value)" id="buckaroo_afterpay_dob">
<input
type="date"
x-data
value="<?= $magewire->dateOfBirth ?>"
@blur="$wire.call('updatedDateOfBirth', $event.target.value)"
id="buckaroo_afterpay_dob"
>
<?php if ($magewire->hasError('dateOfBirth')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
Expand All @@ -47,8 +53,15 @@ use Magento\Framework\Escaper;
<?php if ($magewire->showBusinessSelector()) {
?>
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_magento2_afterpay_selectedBusiness"><?= $escaper->escapeHtml(__('Business Model:')); ?></label>
<select name="issuer" id="buckaroo_magento2_afterpay_selectedBusiness" wire:model="selectedBusiness" class="form-select">
<label for="buckaroo_magento2_afterpay_selectedBusiness">
<?= $escaper->escapeHtml(__('Business Model:')); ?>
</label>
<select
name="issuer"
id="buckaroo_magento2_afterpay_selectedBusiness"
wire:model="selectedBusiness"
class="form-select"
>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how SonarQube recommend to put the > on the next line? because my opinion is that it looks worse

<option value="1"><?= $escaper->escapeHtml(__('B2C - Business to Consumer')) ?></option>
<option value="2"><?= $escaper->escapeHtml(__('B2B - Business to Business')) ?></option>
</select>
Expand All @@ -59,7 +72,7 @@ use Magento\Framework\Escaper;
?>
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_iban">
<?= $escaper->escapeHtml(__( 'Bank Account Number:')); ?>
<?= $escaper->escapeHtml(__('Bank Account Number:')); ?>
<span class="text-red">*</span>
</label>
<input type="text" wire:model.lazy="iban" id="buckaroo_afterpay_iban">
Expand Down Expand Up @@ -99,10 +112,14 @@ use Magento\Framework\Escaper;
<label for="buckaroo_afterpay_tos"><?= $escaper->escapeHtml(__('Terms and Conditions:')); ?></label>
<div class="flex flex-row gap-x-2">
<input class="mt-1" type="checkbox" wire:model.lazy="tos" id="buckaroo_afterpay_tos">
<a class="grow" href="<?= $escaper->escapeUrl($magewire->getTosLink()) ?>"><?= $escaper->escapeHtml(__('Yes, I accept the terms and condition for the use of Riverty | Afterpay.')) ?></a>
<a class="grow" href="<?= $escaper->escapeUrl($magewire->getTosLink()) ?>">
<?= $escaper->escapeHtml(
__('Yes, I accept the terms and condition for the use of Riverty | Afterpay.')
) ?>
</a>
</div>
<?php if ($magewire->hasError('tos')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<?php endif; ?>
</div>
</div>
</div>
20 changes: 17 additions & 3 deletions view/frontend/templates/component/payment/method/afterpay20.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ use Magento\Framework\Escaper;
<label for="buckaroo_afterpay20_tos_fullname">
<?= $escaper->escapeHtml(__('Billing Name:')); ?>
</label>
<input type="text" wire:model.lazy="fullName" disabled id="buckaroo_afterpay20_tos_fullname" class="bg-gray-200">
<input
type="text"
wire:model.lazy="fullName"
disabled id="buckaroo_afterpay20_tos_fullname"
class="bg-gray-200"
>
</div>

<?php if ($magewire->showBirth()) {
Expand All @@ -21,7 +26,12 @@ use Magento\Framework\Escaper;
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
</label>
<input type="date" x-data value="<?=$magewire->dateOfBirth ?>" @blur="$wire.call('updatedDateOfBirth', $event.target.value)" id="buckaroo_afterpay20_dob">
<input type="date"
x-data
value="<?=$magewire->dateOfBirth ?>"
@blur="$wire.call('updatedDateOfBirth', $event.target.value)"
id="buckaroo_afterpay20_dob"
>
<?php if ($magewire->hasError('dateOfBirth')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
Expand Down Expand Up @@ -80,7 +90,11 @@ use Magento\Framework\Escaper;
<label for="buckaroo_afterpay20_tos"><?= $escaper->escapeHtml(__('Terms and Conditions:')); ?></label>
<div class="flex flex-row gap-x-2">
<input class="mt-1" type="checkbox" wire:model.lazy="tos" id="buckaroo_afterpay20_tos">
<a class="grow" href="<?= $escaper->escapeUrl($magewire->getTosLink()) ?>"><?= $escaper->escapeHtml(__('Yes, I accept the terms and condition for the use of Riverty | Afterpay.')) ?></a>
<a class="grow" href="<?= $escaper->escapeUrl($magewire->getTosLink()) ?>">
<?= $escaper->escapeHtml(
__('Yes, I accept the terms and condition for the use of Riverty | Afterpay.')
) ?>
</a>
</div>
<?php if ($magewire->hasError('tos')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ use Magento\Framework\Escaper;
this.loadSdk().then(async () => {
this.canDisplay = await BuckarooApplePay.checkPaySupport();
const v = async () => {
if(this.canDisplay) {
await this.beginPayment();
}
if(this.canDisplay)
await this.beginPayment();
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
Expand All @@ -104,4 +103,4 @@ use Magento\Framework\Escaper;
<?= $escaper->escapeHtml(__('Place Order')) ?>
</button>
</template>
</form>
</form>
16 changes: 13 additions & 3 deletions view/frontend/templates/component/payment/method/billink.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ use Magento\Framework\Escaper;
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
</label>
<input type="date" x-data value="<?= $magewire->dateOfBirth ?>" @blur="$wire.call('updatedDateOfBirth', $event.target.value)" id="buckaroo_billink_dob">
<input
type="date"
x-data
value="<?= $magewire->dateOfBirth ?>" @blur="$wire.call('updatedDateOfBirth', $event.target.value)"
id="buckaroo_billink_dob"
>
<?php if ($magewire->hasError('dateOfBirth')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
Expand Down Expand Up @@ -89,10 +94,15 @@ use Magento\Framework\Escaper;
<label for="buckaroo_billink_tos"><?= $escaper->escapeHtml(__('Terms and Conditions:')); ?></label>
<div class="flex flex-row gap-x-2">
<input class="mt-1" type="checkbox" wire:model.lazy="tos" id="buckaroo_billink_tos">
<a class="grow" href="https://www.billink.nl/app/uploads/2021/05/Gebruikersvoorwaarden-Billink_V11052021.pdf"><?= $escaper->escapeHtml(__('Accept terms of use')) ?></a>
<a
class="grow"
href="https://www.billink.nl/app/uploads/2021/05/Gebruikersvoorwaarden-Billink_V11052021.pdf"
>
<?= $escaper->escapeHtml(__('Accept terms of use')) ?>
</a>
</div>
<?php if ($magewire->hasError('tos')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<?php endif; ?>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ $issuers = $magewire->getIssuers();
<div class="col-span-6">
<div class="flex flex-col gap-y-2">
<?php if ($magewire->displayAsSelect()) { ?>
<label for="buckaroo_magento2_creditcard_issuer"><?= $escaper->escapeHtml(__('Select a Credit Card or Debit Card:')); ?></label>
<label for="buckaroo_magento2_creditcard_issuer">
<?= $escaper->escapeHtml(__('Select a Credit Card or Debit Card:')); ?>
</label>
<select name="issuer" id="buckaroo_magento2_creditcard_issuer" wire:model="cardType" class="form-select">
<?php
foreach ($issuers as $issuer) {
?>
<option
value="<?= $escaper->escapeHtmlAttr($issuer["code"]) ?>">
<option value="<?= $escaper->escapeHtmlAttr($issuer["code"]) ?>">
<?= $escaper->escapeHtml($issuer["name"]) ?>
</option>
<?php
Expand All @@ -40,8 +41,7 @@ $issuers = $magewire->getIssuers();
<label
for="bk_credicard_issuer_<?= $escaper->escapeHtmlAttr($issuer["code"]) ?>"
class="flex flex-row grow gap-x-2 items-center">
<img
src="<?= $escaper->escapeUrl($issuer["img"]) ?>"
<img src="<?= $escaper->escapeUrl($issuer["img"]) ?>"
alt="<?= $issuer["name"] ?>"
style="max-height:25px;"
/>
Expand All @@ -53,4 +53,4 @@ $issuers = $magewire->getIssuers();
?>
<?php } ?>
</div>
</div>
</div>
Loading
Loading