Skip to content

Commit

Permalink
Merge pull request #143 from margud/support
Browse files Browse the repository at this point in the history
3.4.7 release
  • Loading branch information
margud authored Nov 29, 2019
2 parents 62734e2 + a67acc6 commit 5363552
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 51 deletions.
2 changes: 1 addition & 1 deletion controllers/front/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function initContent()
}

$method = Tools::getValue('method');
if (in_array($method, array('cartasi', 'cartesbancaires'))) {
if (in_array($method, array('cartesbancaires'))) {
$method = 'creditcard';
}
$issuer = Tools::getValue('issuer') ?: null;
Expand Down
17 changes: 6 additions & 11 deletions mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class Mollie extends PaymentModule
'banktransfer' => array('eur'),
'belfius' => array('eur'),
'bitcoin' => array('eur'),
'cartasi' => array('eur'),
'cartesbancaires' => array('eur'),
'creditcard' => array('aud', 'bgn', 'cad', 'chf', 'czk', 'dkk', 'eur', 'gbp', 'hkd', 'hrk', 'huf', 'ils', 'isk', 'jpy', 'pln', 'ron', 'sek', 'usd'),
'directdebit' => array('eur'),
Expand Down Expand Up @@ -125,7 +124,6 @@ class Mollie extends PaymentModule
'bitcoin' => array(),
'paysafecard' => array(),
'banktransfer' => array(),
'cartasi' => array('it'),
'cartesbancaires' => array('fr'),
'directdebit' => array(
'fi', 'at', 'pt', 'be', 'bg', 'es', 'hr', 'cy', 'cz', 'dk', 'ee', 'fr', 'gf', 'de', 'gi', 'gr', 'gp', 'gg', 'hu',
Expand Down Expand Up @@ -239,7 +237,6 @@ class Mollie extends PaymentModule
'banktransfer' => 'Bank',
'belfius' => 'Belfius',
'bitcoin' => 'Bitcoin',
'cartasi' => 'CartaSi',
'cartesbancaires' => 'Cartes Bancaires',
'creditcard' => 'Credit Card',
'directdebit' => 'Direct Debit',
Expand Down Expand Up @@ -270,7 +267,7 @@ public function __construct()
{
$this->name = 'mollie';
$this->tab = 'payments_gateways';
$this->version = '3.4.6';
$this->version = '3.4.7';
$this->author = 'Mollie B.V.';
$this->need_instance = 1;
$this->bootstrap = true;
Expand Down Expand Up @@ -361,7 +358,6 @@ public function __construct()
'Awaiting Mollie payment' => $this->l('Awaiting Mollie payment'),
'Mollie partially refunded' => $this->l('Mollie partially refunded'),
'iDEAL' => $this->l('iDEAL'),
'CartaSi' => $this->l('CartaSi'),
'Cartes Bancaires' => $this->l('Cartes Bancaires'),
'Credit card' => $this->l('Credit card'),
'Bancontact' => $this->l('Bancontact'),
Expand Down Expand Up @@ -1445,7 +1441,6 @@ protected function getConfigFieldsValues()
static::MOLLIE_STATUS_OPEN => Configuration::get(static::MOLLIE_STATUS_OPEN),
static::MOLLIE_STATUS_PAID => Configuration::get(static::MOLLIE_STATUS_PAID),
static::MOLLIE_STATUS_CANCELED => Configuration::get(static::MOLLIE_STATUS_CANCELED),
static::MOLLIE_STATUS_CANCELED => Configuration::get(static::MOLLIE_STATUS_CANCELED),
static::MOLLIE_STATUS_EXPIRED => Configuration::get(static::MOLLIE_STATUS_EXPIRED),
static::MOLLIE_STATUS_PARTIAL_REFUND => Configuration::get(static::MOLLIE_STATUS_PARTIAL_REFUND),
static::MOLLIE_STATUS_REFUNDED => Configuration::get(static::MOLLIE_STATUS_REFUNDED),
Expand Down Expand Up @@ -3665,7 +3660,7 @@ public function getMethodsForConfig($active = false)
return (array) $apiMethod;
}, $apiMethods), 'id');
if (in_array('creditcard', $availableApiMethods)) {
foreach (array('cartasi' => 'CartaSi', 'cartesbancaires' => 'Cartes Bancaires') as $id => $name) {
foreach (array('cartesbancaires' => 'Cartes Bancaires') as $id => $name) {
if (!in_array($id, array_column($dbMethods, 'id'))) {
$deferredMethods[] = array(
'id' => $id,
Expand Down Expand Up @@ -4626,18 +4621,18 @@ public function validateMollieOrder(
$amountPaid = !$dontTouchAmount ? Tools::ps_round((float) $amountPaid, 2) : $amountPaid;
$order->total_paid_real = 0;
$order->total_products = (float) $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $order->product_list, $idCarrier);
$order->total_products_wt = (float) $this->context->cart->getOrderTotal($withTaxes, Cart::ONLY_PRODUCTS, $order->product_list, $idCarrier);
$order->total_products_wt = (float) $this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS, $order->product_list, $idCarrier);
$order->total_discounts_tax_excl = (float) abs($this->context->cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS, $order->product_list, $idCarrier));
$order->total_discounts_tax_incl = (float) abs($this->context->cart->getOrderTotal($withTaxes, Cart::ONLY_DISCOUNTS, $order->product_list, $idCarrier));
$order->total_discounts_tax_incl = (float) abs($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $order->product_list, $idCarrier));
$order->total_discounts = $order->total_discounts_tax_incl;
$order->total_shipping_tax_excl = (float) $this->context->cart->getPackageShippingCost((int) $idCarrier, false, null, $order->product_list);
$order->total_shipping_tax_incl = (float) $this->context->cart->getPackageShippingCost((int) $idCarrier, $withTaxes, null, $order->product_list);
$order->total_shipping_tax_incl = (float) $this->context->cart->getPackageShippingCost((int) $idCarrier, true, null, $order->product_list);
$order->total_shipping = $order->total_shipping_tax_incl;
if (!is_null($carrier) && Validate::isLoadedObject($carrier)) {
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address((int) $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
}
$order->total_wrapping_tax_excl = (float) abs($this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $order->product_list, $idCarrier));
$order->total_wrapping_tax_incl = (float) abs($this->context->cart->getOrderTotal($withTaxes, Cart::ONLY_WRAPPING, $order->product_list, $idCarrier));
$order->total_wrapping_tax_incl = (float) abs($this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $order->product_list, $idCarrier));
$order->total_wrapping = $order->total_wrapping_tax_incl;
$order->total_paid_tax_excl = (float) Tools::ps_round((float) $this->context->cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $idCarrier), self::PS_PRICE_COMPUTE_PRECISION);
$order->total_paid_tax_incl = (float) Tools::ps_round((float) $this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $idCarrier), self::PS_PRICE_COMPUTE_PRECISION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @package Mollie
* @link https://www.mollie.nl
*/
import React, { ReactElement, useCallback } from 'react';
import React, {ReactElement, useCallback, useState} from 'react';
import styled from 'styled-components';

import OrderLinesTable from '@transaction/components/orderlines/OrderLinesTable';
Expand All @@ -53,11 +53,11 @@ const Div = styled.div`
` as any;

export default function OrderLinesInfo(): ReactElement<{}> {
const { translations, order, config: { legacy } }: IProps = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, order, config: { legacy } }: IProps = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
order: state.order,
config: state.config,
})), []);
}));

if (legacy) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ const TableContainer = styled.div`

export default function OrderLinesTable(): ReactElement<{}> {
const [loading, setLoading] = useState<boolean>(false);
const { translations, order, currencies, config: { legacy }, config, viewportWidth }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, order, currencies, config: { legacy }, config, viewportWidth }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
order: state.order,
currencies: state.currencies,
translations: state.translations,
config: state.config,
viewportWidth: state.viewportWidth,
})), []);
}));
const dispatch = useDispatch();
const _dispatchUpdateOrder = (order: IMollieApiOrder) => useCallback(() => dispatch(updateOrder(order)), []);

async function _ship(origLines: Array<IMollieOrderLine>): Promise<void> {
let lines = null;
Expand Down Expand Up @@ -131,7 +130,7 @@ export default function OrderLinesTable(): ReactElement<{}> {
setLoading(true);
const { success, order: newOrder } = await shipOrder(order.id, lines, tracking);
if (success) {
_dispatchUpdateOrder(newOrder);
dispatch(updateOrder(newOrder));
} else {
import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert').then(({ default: swal }) => {
swal({
Expand Down Expand Up @@ -185,7 +184,7 @@ export default function OrderLinesTable(): ReactElement<{}> {
setLoading(true);
const { success, order: newOrder } = await refundOrder(order.id, lines);
if (success) {
_dispatchUpdateOrder(newOrder);
dispatch(updateOrder(newOrder));
} else {
import(/* webpackPrefetch: true, webpackChunkName: "sweetalert" */ 'sweetalert').then(({ default: swal }) => {
swal({
Expand Down Expand Up @@ -239,7 +238,7 @@ export default function OrderLinesTable(): ReactElement<{}> {
setLoading(true);
const { success, order: newOrder } = await cancelOrder(order.id, lines);
if (success) {
_dispatchUpdateOrder(newOrder);
dispatch(updateOrder(newOrder));
} else {
swal({
icon: 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ interface IProps {
}

export default function OrderLinesTableFooter({ loading, ship, cancel, refund }: IProps): ReactElement<{}> {
const { translations, order, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, order, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
order: state.order,
config: state.config,
})), []);
}));

function isCancelable(): boolean {
for (let line of Object.values(order.lines.filter(line => line.type !== 'discount'))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ const Div = styled.div`
` as any;

export default function PaymentInfo(): ReactElement<{}> {
const { translations, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
order: state.order,
currencies: state.currencies,
config: state.config,
})), []);
}));

if (legacy) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ import { formatCurrency } from '@shared/tools';
import { useMappedState } from 'redux-react-hook';

export default function PaymentInfoContent(): ReactElement<{}> {
const { translations, order, currencies, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, order, currencies, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
order: state.order,
currencies: state.currencies,
translations: state.translations,
config: state.config,
})), []);
}));

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import RefundTableHeader from '@transaction/components/refund/RefundTableHeader'
import { useMappedState } from 'redux-react-hook';

export default function EmptyRefundTable(): ReactElement<{}> {
const { translations }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations
})), []);
}));

return (
<div className="table-responsive">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ interface IProps {
}

export default function PartialRefundButton({ loading, disabled, refundPayment }: IProps): ReactElement<{}> {
const { translations, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
config: state.config,
})), []);
}));

const content = (
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const Div = styled.div`
` as any;

export default function PaymentInfo(): ReactElement<{}> {
const { translations, config: { legacy } } = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, config: { legacy } } = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
config: state.config,
})), []);
}));

if (legacy) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ import { useMappedState } from 'redux-react-hook';
import { formatCurrency } from '@shared/tools';

export default function PaymentInfoContent(): ReactElement<{}> {
const { translations, payment, currencies, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, payment, currencies, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
payment: state.payment,
currencies: state.currencies,
translations: state.translations,
config: state.config,
})), []);
}));

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ interface IProps {
}

export default function RefundButton({ loading, disabled, refundPayment }: IProps): ReactElement<{}> {
const { translations, }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
})), []);
}));

return (
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ import { useDispatch, useMappedState } from 'redux-react-hook';
export default function RefundForm(): ReactElement<{}> {
const [loading, setLoading] = useState<boolean>(false);
const [refundInput, setRefundInput] = useState<string>('');
const { translations, payment: { id: transactionId }, payment, currencies, config: { legacy } }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, payment: { id: transactionId }, payment, currencies, config: { legacy } }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
config: state.config,
payment: state.payment,
currencies: state.currencies,
}),), []);
}),);
const dispatch = useDispatch();
const _dispatchUpdatePayment = (payment: IMollieApiPayment) => useCallback(() => dispatch(updatePayment(payment)), []);

async function _refundPayment(partial = false): Promise<boolean> {
let amount;
Expand Down Expand Up @@ -94,7 +93,7 @@ export default function RefundForm(): ReactElement<{}> {
const { success = false, payment = null } = await refundPaymentAjax(transactionId, amount);
if (success) {
if (payment) {
_dispatchUpdatePayment(payment);
dispatch(updatePayment(payment));
setRefundInput('');
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import EmptyRefundTable from '@transaction/components/refund/EmptyRefundTable';
import RefundTable from '@transaction/components/refund/RefundTable';

export default function RefundHistory(): ReactElement<{}> {
const { translations, payment }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations, payment }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
payment: state.payment,
})), []);
}));

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ const Div = styled.div`
` as any;

export default function RefundInfo(): ReactElement<{}> {
const { translations, config: { legacy }, payment }: Partial<IMollieOrderState> = useCallback(useMappedState( (state: IMollieOrderState): any => ({
const { translations, config: { legacy }, payment }: Partial<IMollieOrderState> = useMappedState( (state: IMollieOrderState): any => ({
payment: state.payment,
translations: state.translations,
config: state.config,
})), []);
}));

if (legacy) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import RefundInfo from '@transaction/components/refund/RefundInfo';
import LoadingDots from '@shared/components/LoadingDots';

export default function RefundPanel(): ReactElement<{}> {
const { payment, config }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { payment, config }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
config: state.config,
payment: state.payment,
}),), []);
}),);

if (Object.keys(config).length <= 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ import { formatCurrency } from '@shared/tools';
import { IMollieApiRefund } from '@shared/globals';

export default function RefundTable(): ReactElement<{}> {
const { payment, currencies }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { payment, currencies }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
payment: state.payment,
currencies: state.currencies,
})), []);
}));

return (
<div className="table-responsive">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import React, { ReactElement, useCallback } from 'react';
import { useMappedState } from 'redux-react-hook';

export default function RefundTableHeader(): ReactElement<{}> {
const { translations }: Partial<IMollieOrderState> = useCallback(useMappedState((state: IMollieOrderState): any => ({
const { translations }: Partial<IMollieOrderState> = useMappedState((state: IMollieOrderState): any => ({
translations: state.translations,
})), []);
}));

return (
<thead>
Expand Down

0 comments on commit 5363552

Please sign in to comment.