Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction breakdown component for the Payment Details page #10283

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
29810cd
Draft implementation of the transaction breakdown
dmvrtx Jan 29, 2025
7544293
Updates to keep consistency between displayed currencies
dmvrtx Jan 31, 2025
6c13873
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Jan 31, 2025
1a8e8e4
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 3, 2025
64c7030
Implement suggestions from the review and from the AI analysis
dmvrtx Feb 3, 2025
051cac7
Return `null` if capture event is not present
dmvrtx Feb 3, 2025
781d908
Add a clarification about capture event
dmvrtx Feb 3, 2025
f47257e
Component tests and related fixes
dmvrtx Feb 3, 2025
4498a50
Changelog entry
dmvrtx Feb 3, 2025
08540f8
Clarify type definitions with comments
dmvrtx Feb 4, 2025
7f9135c
Update imports in JavaScript tests
dmvrtx Feb 4, 2025
350c152
Update comments
dmvrtx Feb 4, 2025
56840fc
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 4, 2025
8bb43ef
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 5, 2025
7a1920d
Updated test snapshot
dmvrtx Feb 5, 2025
dbbc447
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 7, 2025
11df746
Merge remote-tracking branch 'origin/develop' into add/1342-transacti…
dmvrtx Feb 7, 2025
d1bd94d
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 10, 2025
06bfc90
Apply suggestions from code review
dmvrtx Feb 11, 2025
5092a11
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 11, 2025
23a859d
Restore transactionAmounts assignment to allow for undefined check ea…
dmvrtx Feb 11, 2025
bcd8374
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 12, 2025
bab1822
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 13, 2025
433e235
Extract FeesBreakdown component and include a handling of the discoun…
dmvrtx Feb 14, 2025
b1d1841
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 14, 2025
30695d1
Improve percentage rates display
dmvrtx Feb 14, 2025
e8adf91
Properly calculate discount on fees, spreading across fees when needed
dmvrtx Feb 14, 2025
a9c32f0
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 14, 2025
587103a
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 24, 2025
32a283e
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 25, 2025
4af77f6
Remove superfluous dependency on `jest`
dmvrtx Feb 25, 2025
9954c95
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 26, 2025
c32819d
Remove unused import
dmvrtx Feb 26, 2025
d917aee
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 26, 2025
1f659c2
Merge branch 'develop' into add/1342-transaction-breakdown-block
dmvrtx Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions client/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,14 @@ export * from './payment-intents/hooks';
export * from './authorizations/hooks';
export * from './files/hooks';
export * from './payment-activity/hooks';

import { TimelineItem } from './timeline/types';
import { ApiError } from '../types/errors';

export declare function useTimeline(
transactionId: string
): {
timeline: Array< TimelineItem >;
timelineError: ApiError | undefined;
isLoading: boolean;
};
63 changes: 63 additions & 0 deletions client/data/timeline/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
export interface TimelineFeeRate {
type: string;
additional_type?: string;
fee_id: string;
percentage_rate: number;
fixed_rate: number;
currency: string;
}

export interface TimelineFeeExchangeRate {
from_currency: string;
to_currency: string;
from_amount: number;
to_amount: number;
rate: number;
}

export interface TimelineFeeRates {
percentage: number;
fixed: number;
fixed_currency: string;
history: Array< TimelineFeeRate >;
fee_exchange_rate?: TimelineFeeExchangeRate;
}

export interface TimelineTransactionDetails {
customer_currency: string;
customer_amount: number;
customer_amount_captured: number;
customer_fee: number;
store_currency: string;
store_amount: number;
store_amount_captured: number;
store_fee: number;
}

export interface TimelineDeposit {
id: string;
arrival_date: number;
}

export interface TimelineItem {
type: string;
datetime: number;
acquirer_reference_number?: string;
acquirer_reference_number_status?: string;
amount?: number;
amount_captured?: number;
amount_refunded?: number;
currency?: string;
deposit?: TimelineDeposit;
dispute_id?: string;
evidence_due_by?: number;
failure_reason?: string;
failure_transaction_id?: string;
fee?: number;
fee_rates?: TimelineFeeRates;
loan_id?: string;
reason?: string;
transaction_details?: TimelineTransactionDetails;
transaction_id?: string;
user_id?: number;
}
5 changes: 5 additions & 0 deletions client/payment-details/payment-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ErrorBoundary from '../../components/error-boundary';
import PaymentDetailsSummary from '../summary';
import PaymentDetailsTimeline from '../timeline';
import PaymentDetailsPaymentMethod from '../payment-method';
import PaymentTransactionBreakdown from '../transaction-breakdown';
import { ApiError } from '../../types/errors';
import { Charge } from '../../types/charges';
import { PaymentIntent } from '../../types/payment-intents';
Expand Down Expand Up @@ -72,6 +73,10 @@ const PaymentDetails: React.FC< PaymentDetailsProps > = ( {
</ErrorBoundary>
) }

<ErrorBoundary>
<PaymentTransactionBreakdown paymentIntentId={ id } />
</ErrorBoundary>

<ErrorBoundary>
<PaymentDetailsPaymentMethod
charge={ charge }
Expand Down
Loading
Loading