Skip to content

Commit

Permalink
Merge pull request #32 from logeecom/add-Satispay
Browse files Browse the repository at this point in the history
Update QR code pop up. Add Satispay payment method.
  • Loading branch information
hwysoszynski authored Oct 31, 2024
2 parents 700208c + f3f3ad4 commit e79f4ff
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0 || ~1.13.0",
"symfony/messenger": "^4.4 || ^5.2 || ^6.0",
"mollie/mollie-api-php": "^v2.71.0",
"mollie/mollie-api-php": "^v2.73.0",
"sylius/refund-plugin": "^1.0",
"sylius/admin-order-creation-plugin": "^0.12 || ^0.13 || v0.14 || v0.15.0",
"ext-json": "*",
Expand Down
17 changes: 17 additions & 0 deletions src/Payments/Methods/Satispay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace SyliusMolliePlugin\Payments\Methods;

use Mollie\Api\Types\PaymentMethod;

final class Satispay extends AbstractMethod
{
public function getMethodId(): string
{
return PaymentMethod::SATISPAY;
}
public function getPaymentType(): string
{
return self::PAYMENT_API;
}
}
4 changes: 3 additions & 1 deletion src/Payments/MethodsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use SyliusMolliePlugin\Payments\Methods\PayPal;
use SyliusMolliePlugin\Payments\Methods\Przelewy24;
use SyliusMolliePlugin\Payments\Methods\Riverty;
use SyliusMolliePlugin\Payments\Methods\Satispay;
use SyliusMolliePlugin\Payments\Methods\SofortBanking;
use Mollie\Api\Resources\Method;
use SyliusMolliePlugin\Payments\Methods\Trustly;
Expand Down Expand Up @@ -65,7 +66,8 @@ interface MethodsInterface
Riverty::class,
Trustly::class,
Bancomatpay::class,
Payconiq::class
Payconiq::class,
Satispay::class
];

public function getAllEnabled(): array;
Expand Down
14 changes: 9 additions & 5 deletions src/Resources/assets/shop/js/mollie/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ $(function () {
}

if (qrCode) {
createPopup(qrCode);
let qrCodeMethod = 'Bancontact';
if (qrCode.indexOf('ideal') !== -1) {
qrCodeMethod = 'iDeal';
}
createPopup(qrCode, qrCodeMethod);
qrCodeInterval = setInterval(() => checkQrCode(url + '?orderId=' + orderId), 1000);
}
});
Expand Down Expand Up @@ -209,7 +213,7 @@ $(function () {

showQrCodePopUp();

function createPopup(qrCode) {
function createPopup(qrCode, qrCodeMethod) {
// Create popup container
var popupContainer = document.createElement('div');
popupContainer.id = 'popup-container';
Expand All @@ -232,7 +236,7 @@ $(function () {
var popupContent = document.createElement('div');
popupContent.classList.add('popup-content');
var paragraph = document.createElement('p');
paragraph.textContent = 'Open your Bancontact app to scan the QR code.';
paragraph.textContent = 'Open your ' + qrCodeMethod + ' app to scan the QR code.';
var qrCodeImg = document.createElement('img');
qrCodeImg.src = qrCode;
qrCodeImg.width = 180;
Expand Down Expand Up @@ -265,12 +269,12 @@ $(function () {
// Add event listeners to buttons
cancelButton.addEventListener('click', function (event) {
closePopup();
clearInterval(qrCodeInterval);
window.location.href = 'select-payment';
});

continueButton.addEventListener('click', function (event) {
closePopup();
window.location.href = 'select-payment';
clearInterval(qrCodeInterval);
});

// Append popup container to body
Expand Down

0 comments on commit e79f4ff

Please sign in to comment.