Skip to content

Commit 39150e5

Browse files
committed
Wire up new EdgeTxActionGiftCard fields from edge-core-js
Populate quoteId, productId, and orderId correctly in the saved action now that the core type has explicit fields. Update GiftCardDetailsCard with backward-compat detection: if quoteId is absent, treat orderId as the quoteId per legacy behavior.
1 parent 49d0d66 commit 39150e5

5 files changed

Lines changed: 46 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- added: Nym (NYM) wallet support
1010
- added: opBNB (BNB) support
1111
- added: Register SwapKit V3 as a separate exchange plugin
12+
- added: Gift card account information scene with Get Help access from kebab menu and failed cards
13+
- added: Quote ID display in gift card transaction details with card-level copy
14+
- changed: Distinguish network vs service errors in gift card scenes
15+
- changed: Lock network fee to high priority for gift card purchases
1216
- changed: Manage tokens scene saves changes on explicit save instead of live toggling
1317
- changed: Unify split wallet scene titles and add chain-specific descriptions for EVM and UTXO splits
1418
- fixed: Missing 2-factor approve / deny scene on login

src/components/cards/GiftCardDetailsCard.tsx

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ export const GiftCardDetailsCard: React.FC<Props> = ({ action }) => {
3333
const theme = useTheme()
3434
const styles = getStyles(theme)
3535

36-
// Backward compat: Prior versions stored the quoteId in the `orderId` field
37-
// of EdgeTxActionGiftCard. Once edge-core-js adds an explicit `quoteId`
38-
// field, prefer that and fall back to `orderId` for older transactions.
39-
const quoteId = action.orderId
36+
// Backward compat: Prior versions stored the quoteId in the orderId field.
37+
// Detect legacy transactions by checking whether the explicit quoteId field
38+
// is populated. If missing, fall back to orderId which held the quoteId.
39+
const quoteId = action.quoteId ?? action.orderId
40+
const productId = action.productId
41+
// orderId is only meaningful when quoteId is separately populated (new format)
42+
const orderId = action.quoteId != null ? action.orderId : undefined
4043

4144
const handleRedeemPress = useHandler(() => {
4245
if (redemption?.url != null) {
@@ -67,11 +70,17 @@ export const GiftCardDetailsCard: React.FC<Props> = ({ action }) => {
6770
`${lstrings.string_amount}: ${amountDisplay}`,
6871
`${lstrings.gift_card_quote_id_label}: ${quoteId}`
6972
]
73+
if (productId != null) {
74+
lines.push(`${lstrings.gift_card_product_id_label}: ${productId}`)
75+
}
76+
if (orderId != null) {
77+
lines.push(`${lstrings.gift_card_order_id_label}: ${orderId}`)
78+
}
7079
if (redemption?.code != null) {
7180
lines.push(`${lstrings.gift_card_security_code}: ${redemption.code}`)
7281
}
7382
return lines.join('\n')
74-
}, [card.name, amountDisplay, quoteId, redemption?.code])
83+
}, [card.name, amountDisplay, quoteId, productId, orderId, redemption?.code])
7584

7685
const handleCopyAll = useHandler(() => {
7786
triggerHaptic('impactLight')
@@ -96,6 +105,26 @@ export const GiftCardDetailsCard: React.FC<Props> = ({ action }) => {
96105

97106
<EdgeRow title={lstrings.gift_card_quote_id_label} body={quoteId} />
98107

108+
{productId != null ? (
109+
<>
110+
<DividerLineUi4 />
111+
<EdgeRow
112+
title={lstrings.gift_card_product_id_label}
113+
body={productId}
114+
/>
115+
</>
116+
) : null}
117+
118+
{orderId != null ? (
119+
<>
120+
<DividerLineUi4 />
121+
<EdgeRow
122+
title={lstrings.gift_card_order_id_label}
123+
body={orderId}
124+
/>
125+
</>
126+
) : null}
127+
99128
{redemption?.code != null ? (
100129
<>
101130
<DividerLineUi4 />

src/components/scenes/GiftCardPurchaseScene.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,12 @@ export const GiftCardPurchaseScene: React.FC<Props> = props => {
572572
const order = pendingOrderRef.current
573573

574574
// Save the gift card action to the transaction (synced via edge-core)
575+
const cartItem = order.cart[0]
575576
const savedAction: EdgeTxActionGiftCard = {
576577
actionType: 'giftCard',
577-
orderId: order.quoteId,
578+
orderId: cartItem.orderId,
579+
quoteId: order.quoteId,
580+
productId: cartItem.productId,
578581
provider: {
579582
providerId: 'phaze',
580583
displayName: 'Phaze'

src/locales/en_US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,8 @@ const strings = {
19671967
gift_card_pending: 'Pending Delivery, Please Wait...',
19681968
gift_card_pending_toast:
19691969
'Your gift card is being delivered. Please wait for a few minutes for it to arrive.',
1970+
gift_card_order_id_label: 'Order ID',
1971+
gift_card_product_id_label: 'Product ID',
19701972
gift_card_quote_id_label: 'Quote ID',
19711973
gift_card_quote_id_label_1s: 'QuoteID: %1$s',
19721974
gift_card_quote_expired_toast: 'Your quote has expired. Please try again.',

src/locales/strings/enUS.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,8 @@
15291529
"gift_card_account_info_user_id": "Phaze User ID",
15301530
"gift_card_pending": "Pending Delivery, Please Wait...",
15311531
"gift_card_pending_toast": "Your gift card is being delivered. Please wait for a few minutes for it to arrive.",
1532+
"gift_card_order_id_label": "Order ID",
1533+
"gift_card_product_id_label": "Product ID",
15321534
"gift_card_quote_id_label": "Quote ID",
15331535
"gift_card_quote_id_label_1s": "QuoteID: %1$s",
15341536
"gift_card_quote_expired_toast": "Your quote has expired. Please try again.",

0 commit comments

Comments
 (0)