Skip to content

Commit 8724369

Browse files
authored
fix: Manual capture fails in the transaction detail screen with a customized order number (#10435)
1 parent 738ce6a commit 8724369

File tree

12 files changed

+52
-35
lines changed

12 files changed

+52
-35
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: fix
3+
4+
Manual capture fails in the transaction detail screen with a customized order number

client/data/payment-intents/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function* refundCharge(
5555
charge_id: charge.id,
5656
amount: charge.amount,
5757
reason: reason,
58-
order_id: charge?.order?.number,
58+
order_id: charge?.order?.id,
5959
},
6060
} );
6161

client/data/payment-intents/test/hooks.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export const chargeMock: Charge = {
5454
dispute: null,
5555
disputed: false,
5656
order: {
57-
number: Number( '67' ),
57+
id: 123,
58+
number: 'custom-67',
5859
url: 'http://order.url',
5960
customer_url: 'customer.url',
6061
customer_name: '',
@@ -88,7 +89,8 @@ export const paymentIntentMock: PaymentIntent = {
8889
payment_method: 'pm_mock',
8990
status: 'requires_capture',
9091
order: {
91-
number: 123,
92+
id: 123,
93+
number: 'custom-123',
9294
url: 'http://order.url',
9395
customer_url: 'customer.url',
9496
customer_name: '',

client/payment-details/order-details/test/__snapshots__/index.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ exports[`Order details page should match the snapshot - Charge without payment i
203203
data-link-type="external"
204204
href="http://wcpay.test/wp-admin/post.php?post=776&action=edit"
205205
>
206-
776
206+
custom-776
207207
</a>
208208
</span>
209209
</div>

client/payment-details/order-details/test/index.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const chargeFromOrderMock = {
6363
disputed: false,
6464
outcome: null,
6565
order: {
66-
number: 776,
66+
id: 776,
67+
number: 'custom-776',
6768
url: 'http://wcpay.test/wp-admin/post.php?post=776&action=edit',
6869
customer_url:
6970
'admin.php?page=wc-admin&path=/customers&filter=single_customer&customers=55',

client/payment-details/summary/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
199199

200200
const { authorization } = useAuthorization(
201201
charge.payment_intent as string,
202-
charge.order?.number as number,
202+
charge.order?.id as number,
203203
shouldFetchAuthorization
204204
);
205205

@@ -458,7 +458,7 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
458458
{ ! isLoading && isFraudOutcomeReview && (
459459
<div className="payment-details-summary__fraud-outcome-action">
460460
<CancelAuthorizationButton
461-
orderId={ charge.order?.number || 0 }
461+
orderId={ charge.order?.id || 0 }
462462
paymentIntentId={
463463
charge.payment_intent || ''
464464
}
@@ -484,7 +484,7 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
484484

485485
<CaptureAuthorizationButton
486486
buttonIsPrimary
487-
orderId={ charge.order?.number || 0 }
487+
orderId={ charge.order?.id || 0 }
488488
paymentIntentId={
489489
charge.payment_intent || ''
490490
}
@@ -599,7 +599,7 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
599599
charge.payment_intent,
600600
order_id:
601601
charge.order
602-
?.number,
602+
?.id,
603603
}
604604
);
605605
window.location =
@@ -679,7 +679,7 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
679679
actions={
680680
! isFraudOutcomeReview ? (
681681
<CaptureAuthorizationButton
682-
orderId={ charge.order?.number || 0 }
682+
orderId={ charge.order?.id || 0 }
683683
paymentIntentId={
684684
charge.payment_intent || ''
685685
}

client/payment-details/summary/test/__snapshots__/index.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2264,7 +2264,7 @@ exports[`PaymentDetailsSummary renders a charge with subscriptions 1`] = `
22642264
data-link-type="external"
22652265
href="https://example.com/subscription/246"
22662266
>
2267-
246
2267+
custom-246
22682268
</a>
22692269
</span>
22702270
</div>

client/payment-details/summary/test/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ describe( 'PaymentDetailsSummary', () => {
287287
if ( charge.order ) {
288288
charge.order.subscriptions = [
289289
{
290-
number: 246,
290+
number: 'custom-246',
291291
url: 'https://example.com/subscription/246',
292292
},
293293
];

client/transactions/list/test/__snapshots__/index.tsx.snap

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ exports[`Transactions list renders correctly when can filter by several currenci
568568
data-link-type="external"
569569
href="https://example.com/order/123"
570570
>
571-
123
571+
custom-123
572572
</a>
573573
</td>
574574
<td
@@ -749,7 +749,7 @@ exports[`Transactions list renders correctly when can filter by several currenci
749749
data-link-type="external"
750750
href="https://example.com/order/125"
751751
>
752-
125
752+
custom-125
753753
</a>
754754
</td>
755755
<td
@@ -897,7 +897,7 @@ exports[`Transactions list renders correctly when can filter by several currenci
897897
data-link-type="external"
898898
href="https://example.com/order/335"
899899
>
900-
335
900+
custom-335
901901
</a>
902902
</td>
903903
<td
@@ -1561,7 +1561,7 @@ exports[`Transactions list renders correctly when filtered by currency 1`] = `
15611561
data-link-type="external"
15621562
href="https://example.com/order/123"
15631563
>
1564-
123
1564+
custom-123
15651565
</a>
15661566
</td>
15671567
<td
@@ -1742,7 +1742,7 @@ exports[`Transactions list renders correctly when filtered by currency 1`] = `
17421742
data-link-type="external"
17431743
href="https://example.com/order/125"
17441744
>
1745-
125
1745+
custom-125
17461746
</a>
17471747
</td>
17481748
<td
@@ -1890,7 +1890,7 @@ exports[`Transactions list renders correctly when filtered by currency 1`] = `
18901890
data-link-type="external"
18911891
href="https://example.com/order/335"
18921892
>
1893-
335
1893+
custom-335
18941894
</a>
18951895
</td>
18961896
<td
@@ -2558,7 +2558,7 @@ exports[`Transactions list renders correctly when filtered by payout 1`] = `
25582558
data-link-type="external"
25592559
href="https://example.com/order/125"
25602560
>
2561-
125
2561+
custom-125
25622562
</a>
25632563
</td>
25642564
<td
@@ -3248,7 +3248,7 @@ exports[`Transactions list subscription column renders correctly 1`] = `
32483248
data-link-type="external"
32493249
href="https://example.com/order/123"
32503250
>
3251-
123
3251+
custom-123
32523252
</a>
32533253
</td>
32543254
<td
@@ -3258,7 +3258,7 @@ exports[`Transactions list subscription column renders correctly 1`] = `
32583258
data-link-type="external"
32593259
href="https://example.com/subscription/246"
32603260
>
3261-
246
3261+
custom-246
32623262
</a>
32633263
</td>
32643264
<td
@@ -3439,7 +3439,7 @@ exports[`Transactions list subscription column renders correctly 1`] = `
34393439
data-link-type="external"
34403440
href="https://example.com/order/125"
34413441
>
3442-
125
3442+
custom-125
34433443
</a>
34443444
</td>
34453445
<td
@@ -3590,7 +3590,7 @@ exports[`Transactions list subscription column renders correctly 1`] = `
35903590
data-link-type="external"
35913591
href="https://example.com/order/335"
35923592
>
3593-
335
3593+
custom-335
35943594
</a>
35953595
</td>
35963596
<td
@@ -4299,7 +4299,7 @@ exports[`Transactions list when not filtered by payout renders correctly 1`] = `
42994299
data-link-type="external"
43004300
href="https://example.com/order/123"
43014301
>
4302-
123
4302+
custom-123
43034303
</a>
43044304
</td>
43054305
<td
@@ -4480,7 +4480,7 @@ exports[`Transactions list when not filtered by payout renders correctly 1`] = `
44804480
data-link-type="external"
44814481
href="https://example.com/order/125"
44824482
>
4483-
125
4483+
custom-125
44844484
</a>
44854485
</td>
44864486
<td
@@ -4628,7 +4628,7 @@ exports[`Transactions list when not filtered by payout renders correctly 1`] = `
46284628
data-link-type="external"
46294629
href="https://example.com/order/335"
46304630
>
4631-
335
4631+
custom-335
46324632
</a>
46334633
</td>
46344634
<td
@@ -5334,7 +5334,7 @@ exports[`Transactions list when not filtered by payout renders table summary onl
53345334
data-link-type="external"
53355335
href="https://example.com/order/123"
53365336
>
5337-
123
5337+
custom-123
53385338
</a>
53395339
</td>
53405340
<td
@@ -5515,7 +5515,7 @@ exports[`Transactions list when not filtered by payout renders table summary onl
55155515
data-link-type="external"
55165516
href="https://example.com/order/125"
55175517
>
5518-
125
5518+
custom-125
55195519
</a>
55205520
</td>
55215521
<td
@@ -5663,7 +5663,7 @@ exports[`Transactions list when not filtered by payout renders table summary onl
56635663
data-link-type="external"
56645664
href="https://example.com/order/335"
56655665
>
5666-
335
5666+
custom-335
56675667
</a>
56685668
</td>
56695669
<td

client/transactions/list/test/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ const getMockTransactions: () => Transaction[] = () => [
108108
type: 'refund',
109109
source: 'visa',
110110
order: {
111-
number: 123,
111+
id: 123,
112+
number: 'custom-123',
112113
url: 'https://example.com/order/123',
113114
// eslint-disable-next-line camelcase
114115
customer_url: 'https://example.com/customer/my-name',
@@ -139,7 +140,8 @@ const getMockTransactions: () => Transaction[] = () => [
139140
type: 'charge',
140141
source: 'mastercard',
141142
order: {
142-
number: 125,
143+
id: 123,
144+
number: 'custom-125',
143145
url: 'https://example.com/order/125',
144146
// eslint-disable-next-line camelcase
145147
customer_url: 'https://example.com/customer/my-name',
@@ -170,7 +172,8 @@ const getMockTransactions: () => Transaction[] = () => [
170172
type: 'charge',
171173
source: 'visa',
172174
order: {
173-
number: 335,
175+
id: 123,
176+
number: 'custom-335',
174177
url: 'https://example.com/order/335',
175178
// eslint-disable-next-line camelcase
176179
customer_url: 'https://example.com/customer/my-name',
@@ -424,7 +427,7 @@ describe( 'Transactions list', () => {
424427
const mockTransactions = getMockTransactions();
425428
mockTransactions[ 0 ].order.subscriptions = [
426429
{
427-
number: 246,
430+
number: 'custom-246',
428431
url: 'https://example.com/subscription/246',
429432
},
430433
];

0 commit comments

Comments
 (0)