Skip to content

Commit b447222

Browse files
authored
Add TTP fees information to timeline view (#5550)
1 parent ab1d16c commit b447222

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

changelog/add-5376-ttp-timeline-view

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: add
3+
4+
Display tap to pay fees in transaction timeline view

client/payment-details/timeline/map-events.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,18 @@ export const feeBreakdown = ( event ) => {
415415
'Subscription transaction fee: %1$s%%',
416416
'woocommerce-payments'
417417
),
418+
'additional-device':
419+
0 !== fixedRate
420+
? __(
421+
/* translators: %1$s% is the fee amount and %2$s is the fixed rate */
422+
'Tap to pay transaction fee: %1$s%% + %2$s',
423+
'woocommerce-payments'
424+
)
425+
: __(
426+
/* translators: %1$s% is the fee amount */
427+
'Tap to pay transaction fee: %1$s%%',
428+
'woocommerce-payments'
429+
),
418430
discount: __( 'Discount', 'woocommerce-payments' ),
419431
} );
420432

client/payment-details/timeline/test/__snapshots__/map-events.js.snap

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,56 @@ Array [
693693
]
694694
`;
695695

696+
exports[`mapTimelineEvents single currency events in person payments - tap to pay 1`] = `
697+
Array [
698+
Object {
699+
"body": Array [],
700+
"date": 2020-04-01T14:37:54.000Z,
701+
"headline": "Payment status changed to Paid.",
702+
"icon": <SyncIcon />,
703+
},
704+
Object {
705+
"body": Array [],
706+
"date": 2020-04-01T14:37:54.000Z,
707+
"headline": <React.Fragment>
708+
$19.19 USD was added to your
709+
<Link
710+
href="admin.php?page=wc-admin&path=%2Fpayments%2Fdeposits%2Fdetails&id=dummy_po_5eaada696b281"
711+
type="wc-admin"
712+
>
713+
Apr 2, 2020 deposit
714+
</Link>
715+
.
716+
</React.Fragment>,
717+
"icon": <PlusIcon />,
718+
},
719+
Object {
720+
"body": Array [
721+
undefined,
722+
"Fee (2.6% + $0.20): $-0.61",
723+
<ul
724+
className="fee-breakdown-list"
725+
>
726+
727+
<li>
728+
Base fee: 2.6% + $0.10
729+
</li>
730+
<li>
731+
Tap to pay transaction fee: 0% + $0.10
732+
</li>
733+
734+
</ul>,
735+
"Net deposit: $19.19 USD",
736+
],
737+
"date": 2020-04-01T14:37:54.000Z,
738+
"headline": "A payment of $19.80 USD was successfully charged.",
739+
"icon": <CheckmarkIcon
740+
className="is-success"
741+
/>,
742+
},
743+
]
744+
`;
745+
696746
exports[`mapTimelineEvents single currency events should not render fee breakup when fee history is not present 1`] = `
697747
Array [
698748
Object {

client/payment-details/timeline/test/map-events.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,44 @@ describe( 'mapTimelineEvents', () => {
395395
] )
396396
).toMatchSnapshot();
397397
} );
398+
399+
test( 'in person payments - tap to pay', () => {
400+
expect(
401+
mapTimelineEvents( [
402+
{
403+
amount: 1980,
404+
currency: 'USD',
405+
datetime: 1585751874,
406+
deposit: {
407+
arrival_date: 1585838274,
408+
id: 'dummy_po_5eaada696b281',
409+
},
410+
fee: 61,
411+
fee_rates: {
412+
percentage: 0.026,
413+
fixed: 20,
414+
fixed_currency: 'USD',
415+
history: [
416+
{
417+
type: 'base',
418+
percentage_rate: 0.026,
419+
fixed_rate: 10,
420+
currency: 'usd',
421+
},
422+
{
423+
type: 'additional',
424+
additional_type: 'device',
425+
percentage_rate: 0,
426+
fixed_rate: 10,
427+
currency: 'usd',
428+
},
429+
],
430+
},
431+
type: 'captured',
432+
},
433+
] )
434+
).toMatchSnapshot();
435+
} );
398436
} );
399437

400438
describe( 'Multi-Currency events', () => {

0 commit comments

Comments
 (0)