Skip to content

Commit

Permalink
Merge pull request #114 from logeecom/3.5-4.0
Browse files Browse the repository at this point in the history
Release version 1.0.19
  • Loading branch information
ivan-logeecom authored Oct 30, 2024
2 parents 8aafc37 + ec5d534 commit adc0c87
Show file tree
Hide file tree
Showing 24 changed files with 577 additions and 26 deletions.
1 change: 1 addition & 0 deletions GXModules/Mollie/Mollie/Components/Mappers/OrderMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function getPayment($orderId)
$email = $sourceOrder->getCustomerEmail();
$phone = $sourceOrder->getCustomerTelephone();
$payment->setShippingAddress($this->getAddressData($sourceOrder->getDeliveryAddress(), $email, $phone));
$payment->setBillingAddress($this->getAddressData($sourceOrder->getBillingAddress(), $email, $phone));

$daysToExpire = $this->getDaysToExpirePayment($sourceOrder->getPaymentType()->getModule());
if (!empty($daysToExpire)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ private function displayIssuers()
private function renderIssuerList()
{
$template = PathProvider::getShopTemplatePath('mollie_issuer_list.html');
$issuers = $this->_formatIssuers();

if ($this->paymentMethod->getId() === 'ideal') {
$issuers = array();
}

return mollie_render_template(
$template,
[
'isLegacy' => $this->versionCompatibilityProvider->isLegacyVersion(),
'payment_method' => $this->code,
'issuers' => $this->_formatIssuers(),
'issuers' => $issuers,
'list_type' => $this->issuerListType,
]
);
Expand Down
39 changes: 37 additions & 2 deletions GXModules/Mollie/Mollie/Shop/Javascripts/mollie-issuers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
(function() {
(function () {
document.addEventListener("DOMContentLoaded", function () {
let issuerListWrappers = document.querySelectorAll('.mollie-issuer-list-wrapper');
const paymentMethods = document.querySelectorAll('input[type="radio"]');

//switch to iDeal 2.0 without issuers
paymentMethods.forEach(function (method) {
if (method.value.includes('mollie_')) {
if (method.value === 'mollie_ideal') {
if (method.checked) {
hideIdealCheckoutPaymentForm();
}
method.addEventListener('click', function () {
hideIdealCheckoutPaymentForm();
});
}
}
});

//in case if ideal is the only available payment method, it won't be shown as radio button but as li element
const issuerMethod = document.querySelector('li.mollie_ideal');
if (issuerMethod) {
hideIdealCheckoutPaymentForm();
}

for (let i = 0; i < issuerListWrappers.length; i++) {
addIssuerListListeners(issuerListWrappers[i]);
}

let checkoutForm = document.querySelector('#checkout_payment');
checkoutForm.addEventListener('submit', async event => {
//skip checking issuer selection for iDeal 2.0 payment method
let activeMethod = getActiveMethod();
if (activeMethod.classList.contains('mollie_ideal')) {
return;
}

if (!isIssuersSelected()) {
showIssuerErrorMessage();
event.preventDefault();
Expand Down Expand Up @@ -96,5 +124,12 @@
return document.querySelector('.list-group-item.active');
}

function hideIdealCheckoutPaymentForm() {
let checkoutPaymentForm = document.querySelector('.checkout-payment-form');
if (checkoutPaymentForm) {
checkoutPaymentForm.style.display = 'none';
}
}

});
})();
})();
4 changes: 2 additions & 2 deletions GXModules/Mollie/Mollie/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "mollie/gambio",
"version": "1.0.18",
"version": "1.0.19",
"require": {
"php": ">=5.4",
"mollie/integration-core": "1.3.9"
"mollie/integration-core": "1.3.10"
},
"repositories": [
{
Expand Down
12 changes: 6 additions & 6 deletions GXModules/Mollie/Mollie/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions GXModules/Mollie/Mollie/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "mollie/integration-core",
"version": "1.3.9",
"version_normalized": "1.3.9.0",
"version": "1.3.10",
"version_normalized": "1.3.10.0",
"source": {
"type": "git",
"url": "[email protected]:mollie/orocore.git",
"reference": "8a07e5e317dfbffeaa552820ee843701a24a8fd5"
"reference": "c651e7ca353219121dbe13cca34fc02393a9cb2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mollie/orocore/zipball/8a07e5e317dfbffeaa552820ee843701a24a8fd5",
"reference": "8a07e5e317dfbffeaa552820ee843701a24a8fd5",
"url": "https://api.github.com/repos/mollie/orocore/zipball/c651e7ca353219121dbe13cca34fc02393a9cb2c",
"reference": "c651e7ca353219121dbe13cca34fc02393a9cb2c",
"shasum": ""
},
"require": {
Expand All @@ -24,7 +24,7 @@
"phpunit/phpunit": "^4.8.35",
"symfony/console": "^5.1"
},
"time": "2024-09-16T12:55:55+00:00",
"time": "2024-09-27T09:30:33+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
Expand Down
14 changes: 7 additions & 7 deletions GXModules/Mollie/Mollie/vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php return array(
'root' => array(
'pretty_version' => '1.0.18',
'version' => '1.0.18.0',
'pretty_version' => '1.0.19',
'version' => '1.0.19.0',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -11,21 +11,21 @@
),
'versions' => array(
'mollie/gambio' => array(
'pretty_version' => '1.0.18',
'version' => '1.0.18.0',
'pretty_version' => '1.0.19',
'version' => '1.0.19.0',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => null,
'dev_requirement' => false,
),
'mollie/integration-core' => array(
'pretty_version' => '1.3.9',
'version' => '1.3.9.0',
'pretty_version' => '1.3.10',
'version' => '1.3.10.0',
'type' => 'library',
'install_path' => __DIR__ . '/../mollie/integration-core',
'aliases' => array(),
'reference' => '8a07e5e317dfbffeaa552820ee843701a24a8fd5',
'reference' => 'c651e7ca353219121dbe13cca34fc02393a9cb2c',
'dev_requirement' => false,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class Payment extends BaseDto
* @var Address
*/
protected $shippingAddress;
/**
* @var Address
*/
protected $billingAddress;
/**
* @var array
*/
Expand Down Expand Up @@ -134,10 +138,15 @@ public static function fromArray(array $raw)
$result->expiresAt = \DateTime::createFromFormat(DATE_ATOM, static::getValue($raw, 'expiresAt'));

$shippingAddress = static::getValue($raw, 'shippingAddress', array());
$billingAddress = static::getValue($raw, 'billingAddress', array());
if (!empty($shippingAddress)) {
$result->shippingAddress = Address::fromArray($shippingAddress);
}

if (!empty($billingAddress)) {
$result->billingAddress = Address::fromArray($billingAddress);
}

foreach ((array)static::getValue($raw, '_links', array()) as $linkKey => $linkData) {
$result->links[$linkKey] = Link::fromArray((array)$linkData);
}
Expand Down Expand Up @@ -200,6 +209,10 @@ public function toArray()
$result['shippingAddress'] = $this->shippingAddress->toArray();
}

if ($this->billingAddress) {
$result['billingAddress'] = $this->billingAddress->toArray();
}

return $result;
}

Expand Down Expand Up @@ -428,6 +441,22 @@ public function setShippingAddress($shippingAddress)
$this->shippingAddress = $shippingAddress;
}

/**
* @return Address
*/
public function getBillingAddress()
{
return $this->billingAddress;
}

/**
* @param Address $billingAddress
*/
public function setBillingAddress($billingAddress)
{
$this->billingAddress = $billingAddress;
}

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public function transformPayment(Payment $payment)
);

$shippingAddress = $payment->getShippingAddress();
$billingAddress = $payment->getBillingAddress();

if ($shippingAddress && $method === PaymentMethods::PayPal) {
$result['shippingAddress'] = array(
'streetAndNumber' => $shippingAddress->getStreetAndNumber(),
Expand All @@ -69,6 +71,20 @@ public function transformPayment(Payment $payment)
);
}

if ($billingAddress && $method === PaymentMethods::Alma) {
$result['billingAddress'] = array(
'streetAndNumber' => $billingAddress->getStreetAndNumber(),
'streetAdditional' => $billingAddress->getStreetAdditional(),
'city' => $billingAddress->getCity(),
'region' => $billingAddress->getRegion(),
'postalCode' => $billingAddress->getPostalCode(),
'country' => $billingAddress->getCountry(),
'givenName' => $billingAddress->getGivenName(),
'familyName' => $billingAddress->getFamilyName(),
'email' => $billingAddress->getEmail() ?: null
);
}

$result = array_merge($result, $this->getCommonPaymentParameters($payment));

return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class PaymentMethodConfig extends Entity
PaymentMethods::Klarna => self::API_METHOD_ORDERS,
PaymentMethods::Vouchers => self::API_METHOD_ORDERS,
PaymentMethods::Billie => self::API_METHOD_ORDERS,
PaymentMethods::Riverty => self::API_METHOD_ORDERS
PaymentMethods::Riverty => self::API_METHOD_ORDERS,
PaymentMethods::Alma => self::API_METHOD_PAYMENT
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ class PaymentMethods
const Klarna = 'klarna';
const Riverty = 'riverty';
const Trustly = 'trustly';
const Twint = 'twint';
const Alma = 'alma';
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Read more about the integration configuration on [our Wiki](https://github.com/m

# Release notes

*1.0.19*
- Add Twint payment method
- Add Alma payment method
- Change from iDeal 1.0 to iDeal 2.0 payment method

*1.0.18*
- Add Billie payment method
- Add Klarna One payment method
Expand Down
Binary file added images/icons/payment/mollie_alma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/payment/mollie_twint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions includes/modules/payment/mollie_alma.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Mollie\BusinessLogic\PaymentMethod\Model\PaymentMethodConfig;

require_once __DIR__ . '/mollie/mollie.php';

/**
* Class mollie_alma
*/
class mollie_alma extends mollie
{
public $title = 'Alma';

/**
* @inheritDoc
* @return array
*/
public function keys()
{
$keys = parent::keys();
$hidden = ['MODULE_PAYMENT_' . strtoupper($this->code) . '_API_METHOD'];
return array_values(array_diff($keys, $hidden));
}

/**
* @return string
*/
protected function _getDefaultApi()
{
return PaymentMethodConfig::API_METHOD_PAYMENT;
}
}
34 changes: 34 additions & 0 deletions includes/modules/payment/mollie_twint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Mollie\BusinessLogic\PaymentMethod\Model\PaymentMethodConfig;

require_once __DIR__ . '/mollie/mollie.php';

/**
* Class mollie_twint
*/
class mollie_twint extends mollie
{
public $title = 'Twint';

/**
* @inheritDoc
*
* @return array
*/
public function keys()
{
$keys = parent::keys();
$hidden = ['MODULE_PAYMENT_' . strtoupper($this->code) . '_API_METHOD'];

return array_values(array_diff($keys, $hidden));
}

/**
* @return string
*/
protected function _getDefaultApi()
{
return PaymentMethodConfig::API_METHOD_PAYMENT;
}
}
Loading

0 comments on commit adc0c87

Please sign in to comment.