Skip to content

Commit e189980

Browse files
committed
Update mollie icon to SVG (support dark-mode through fill="currentColor").
Show direct debit details instead of the credit card data when direct debit is used as GatewayToken.
1 parent c068335 commit e189980

File tree

5 files changed

+83
-20
lines changed

5 files changed

+83
-20
lines changed
-4.19 KB
Binary file not shown.

src/common/interfaces/client.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,27 @@ import { GroupSettings } from './group-settings';
1414
import { Location } from './location';
1515
import { TaxInfo } from './tax-info';
1616
import { Timestamps } from './timestamps';
17+
import { GatewayType } from '$app/common/enums/gateway-type';
1718

18-
interface Meta {
19+
interface BaseMeta {
1920
brand: string;
21+
type: GatewayType;
22+
}
23+
24+
interface CreditCardMeta extends BaseMeta {
2025
exp_month: string;
2126
exp_year: string;
2227
last4: string;
23-
type: number;
2428
}
2529

30+
interface DirectDebitMeta extends BaseMeta {
31+
bank_account_name: string;
32+
bank_account_number: string;
33+
bank_account_bic?: string;
34+
}
35+
36+
type Meta = CreditCardMeta | DirectDebitMeta;
37+
2638
interface GatewayToken {
2739
id: string;
2840
archived_at: number;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Invoice Ninja (https://invoiceninja.com).
3+
*
4+
* @link https://github.com/invoiceninja/invoiceninja source repository
5+
*
6+
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
7+
*
8+
* @license https://www.elastic.co/licensing/elastic-license
9+
*/
10+
11+
interface Props {
12+
size?: string;
13+
color?: string;
14+
}
15+
16+
export function MollieIcon(props: Props) {
17+
const { size = '2rem', color = 'currentColor' } = props;
18+
19+
return (
20+
<svg
21+
version="1.1"
22+
xmlns="http://www.w3.org/2000/svg"
23+
xmlnsXlink="http://www.w3.org/1999/xlink"
24+
x="0px"
25+
y="0px"
26+
viewBox="0 0 320 94"
27+
style={{
28+
width: size,
29+
height: 'auto',
30+
aspectRatio: '320/94',
31+
}}
32+
xmlSpace="preserve"
33+
>
34+
<path
35+
fillRule="evenodd"
36+
clipRule="evenodd"
37+
fill={color}
38+
d="M289.3,44.3c6.9,0,13.2,4.5,15.4,11h-30.7C276.1,48.9,282.3,44.3,289.3,44.3z M320,60.9c0-8-3.1-15.6-8.8-21.4c-5.7-5.8-13.3-9-21.3-9h-0.4c-8.3,0.1-16.2,3.4-22.1,9.3c-5.9,5.9-9.2,13.7-9.3,22c-0.1,8.5,3.2,16.5,9.2,22.6c6.1,6.1,14.1,9.5,22.6,9.5h0c11.2,0,21.7-6,27.4-15.6l0.7-1.2l-12.6-6.2l-0.6,1c-3.1,5.2-8.6,8.2-14.7,8.2c-7.7,0-14.4-5.1-16.5-12.5H320V60.9z M241.2,19.8c-5.5,0-9.9-4.4-9.9-9.9c0-5.5,4.4-9.9,9.9-9.9s9.9,4.4,9.9,9.9C251.2,15.3,246.7,19.8,241.2,19.8z M233.6,92.7h15.2V31.8h-15.2V92.7z M204.5,1.3h15.2v91.5h-15.2V1.3z M175.4,92.7h15.2V1.3h-15.2V92.7z M135.3,79c-9.2,0-16.8-7.5-16.8-16.7c0-9.2,7.5-16.7,16.8-16.7s16.8,7.5,16.8,16.7C152.1,71.5,144.6,79,135.3,79z M135.3,30.5c-17.6,0-31.8,14.2-31.8,31.7S117.8,94,135.3,94c17.5,0,31.8-14.2,31.8-31.7S152.9,30.5,135.3,30.5z M70.4,30.6c-0.8-0.1-1.6-0.1-2.4-0.1c-7.7,0-15,3.1-20.2,8.7c-5.2-5.5-12.5-8.7-20.1-8.7C12.4,30.5,0,42.9,0,58v34.7h14.9V58.5c0-6.3,5.2-12.1,11.3-12.7c0.4,0,0.9-0.1,1.3-0.1c6.9,0,12.5,5.6,12.5,12.5v34.6h15.2V58.4c0-6.3,5.2-12.1,11.3-12.7c0.4,0,0.9-0.1,1.3-0.1c6.9,0,12.5,5.6,12.6,12.4v34.7h15.2V58.5c0-7-2.6-13.6-7.2-18.8C83.7,34.4,77.3,31.2,70.4,30.6z"
39+
/>
40+
</svg>
41+
);
42+
}

src/pages/clients/show/components/GatewayTypeIcon.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import paypalLogo from '/gateway-card-images/paypal.png';
1717
import braintreeLogo from '/gateway-card-images/braintree.svg.png';
1818
import checkoutcomLogo from '/gateway-card-images/checkout.jpg';
1919
import goCardlessLogo from '/gateway-card-images/gocardless.png';
20-
import mollieLogo from '/gateway-card-images/mollie.png';
20+
import { MollieIcon } from '$app/components/icons/MollieIcon';
2121
import payfastLogo from '/gateway-card-images/payfast.png';
2222
import paytraceLogo from '/gateway-card-images/paytrace.svg';
2323
import razorpayLogo from '/gateway-card-images/razorpay.png';
@@ -175,11 +175,9 @@ export function GatewayTypeIcon(props: Props) {
175175

176176
case 'mollie':
177177
return (
178-
<img
179-
src={mollieLogo}
180-
alt="Mollie"
181-
style={props.style || { width: 40, height: 40 }}
182-
/>
178+
<div style={props.style || { width: 40, height: 40, display: 'flex' }}>
179+
<MollieIcon />
180+
</div>
183181
);
184182

185183
case 'payfast':

src/pages/clients/show/components/Gateways.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,34 @@ export function Gateways(props: Props) {
173173
</Link>
174174
</div>
175175
</div>
176-
177176
<div className="flex items-center space-x-2">
178177
<GatewayTypeIcon
179178
name={token.meta.brand as GatewayLogoName}
180179
/>
181180

182-
<div
183-
className="flex items-center"
184-
style={{ color: colors.$17 }}
185-
>
186-
<span className="mt-1">****</span>
187-
<span className="ml-1">{token.meta.last4}</span>
188-
</div>
189-
190-
<span style={{ color: colors.$17 }}>
191-
{token.meta.exp_month}/{token.meta.exp_year}
192-
</span>
181+
{('bank_account_number' in token.meta) ? (
182+
// Direct Debit display
183+
<div style={{ color: colors.$17 }}>
184+
<span>{token.meta.bank_account_name}<br/>{token.meta.bank_account_number}</span>
185+
</div>
186+
) : ('last4' in token.meta) ? (
187+
// Credit Card display
188+
<>
189+
<div
190+
className="flex items-center"
191+
style={{ color: colors.$17 }}
192+
>
193+
<span className="mt-1">****</span>
194+
<span className="ml-1">{token.meta.last4}</span>
195+
</div>
196+
<span style={{ color: colors.$17 }}>
197+
{token.meta.exp_month}/{token.meta.exp_year}
198+
</span>
199+
</>
200+
) : (
201+
<>
202+
</>
203+
)}
193204
</div>
194205
</div>
195206

0 commit comments

Comments
 (0)