Skip to content

Commit e51a9e6

Browse files
authored
Merge pull request #1014 from commercelayer/pending-transactions
Improve async capture check
2 parents 62ff833 + f6e0173 commit e51a9e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/app-elements/src/helpers/transactions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ import isEmpty from "lodash-es/isEmpty"
99
export function orderTransactionIsAnAsyncCapture(
1010
transaction: Authorization | Void | Capture | Refund,
1111
): boolean {
12+
const isAsyncMessage =
13+
isEmpty(transaction.message) ||
14+
["pending", "received"].includes(transaction.message?.toLowerCase() ?? "")
15+
1216
return (
1317
transaction.type === "captures" &&
1418
!transaction.succeeded &&
15-
isEmpty(transaction.message) &&
19+
isAsyncMessage &&
1620
isEmpty(transaction.error_code)
1721
)
1822
}

0 commit comments

Comments
 (0)