Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions src/subdomains/core/history/mappers/transaction-dto.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,13 @@ function getTransactionStateDetails(entity: BuyFiat | BuyCrypto | RefReward | Tr
case CheckStatus.FAIL:
if (
entity.chargebackDate &&
(entity.chargebackCryptoTxId || entity.checkoutTx || entity.chargebackOutput?.isTransmittedDate)
(Util.daysDiff(entity.chargebackDate) > 7 ||
entity.chargebackCryptoTxId ||
entity.checkoutTx ||
entity.chargebackOutput?.isTransmittedDate)
)
return { state: TransactionState.RETURNED, reason };
if (entity.chargebackAllowedDateUser || entity.chargebackAllowedDate)
if (entity.chargebackAllowedDateUser || entity.chargebackAllowedDate || entity.chargebackDate)
return { state: TransactionState.RETURN_PENDING, reason };
return {
state: TransactionState.FAILED,
Expand Down Expand Up @@ -463,8 +466,10 @@ function getTransactionStateDetails(entity: BuyFiat | BuyCrypto | RefReward | Tr
return { state: TransactionState.CHECK_PENDING, reason };

case CheckStatus.FAIL:
if (entity.chargebackDate && entity.chargebackTxId) return { state: TransactionState.RETURNED, reason };
if (entity.chargebackAllowedDateUser) return { state: TransactionState.RETURN_PENDING, reason };
if (entity.chargebackDate && (Util.daysDiff(entity.chargebackDate) > 7 || entity.chargebackTxId))
return { state: TransactionState.RETURNED, reason };
if (entity.chargebackAllowedDateUser || entity.chargebackDate)
return { state: TransactionState.RETURN_PENDING, reason };
return { state: TransactionState.FAILED, reason, chargebackTxId: entity.chargebackTxId };

case CheckStatus.PASS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ export class LayerZeroBridgeAdapter extends LiquidityActionAdapter {

// Find transfer from the Citrea OFT contract matching the expected amount (with 5% tolerance)
const expectedAmount = order.inputAmount;
const zeroAddress = '0x0000000000000000000000000000000000000000';
const matchingTransfer = transfers.find((t) => {
const receivedAmount = EvmUtil.fromWeiAmount(t.value, asset.decimals);
return (
t.contractAddress?.toLowerCase() === asset.chainId.toLowerCase() &&
t.from?.toLowerCase() === oftAdapter.citrea.toLowerCase() &&
t.from?.toLowerCase() === zeroAddress &&
Math.abs(receivedAmount - expectedAmount) / expectedAmount < 0.05
);
});
Expand Down
Loading