-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
238 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ package com.api.admin.controller.dto | |
|
||
data class WithdrawERC721Request( | ||
val nftId: Long, | ||
val accountLogId: Long, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/api/admin/rabbitMQ/event/dto/AdminTransferDetailResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.api.admin.rabbitMQ.event.dto | ||
|
||
import com.api.admin.enums.TransferType | ||
import java.math.BigDecimal | ||
|
||
data class AdminTransferDetailResponse( | ||
val nftId: Long?, | ||
val transferType: TransferType, | ||
val balance: BigDecimal?, | ||
) |
39 changes: 32 additions & 7 deletions
39
src/main/kotlin/com/api/admin/rabbitMQ/event/dto/AdminTransferResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
package com.api.admin.rabbitMQ.event.dto | ||
|
||
import com.api.admin.domain.transfer.Transfer | ||
import com.api.admin.domain.transferFailLog.TransferFailLog | ||
import com.api.admin.enums.AccountType | ||
import com.api.admin.enums.ChainType | ||
import com.api.admin.enums.TransactionStatusType | ||
import com.api.admin.enums.TransferType | ||
import com.api.admin.rabbitMQ.event.dto.AdminTransferResponse.Companion.toResponse | ||
import java.math.BigDecimal | ||
|
||
|
||
data class AdminTransferResponse( | ||
val id: Long, | ||
val walletAddress: String, | ||
val nftId: Long?, | ||
val timestamp: Long, | ||
val accountLogId: Long, | ||
val accountType: AccountType, | ||
val transferType: TransferType, | ||
val balance: BigDecimal?, | ||
val chainType: ChainType, | ||
) | ||
val transactionStatusType: TransactionStatusType, | ||
val adminTransferDetailResponse: AdminTransferDetailResponse? | ||
) { | ||
companion object { | ||
fun Transfer.toResponse(accountId: Long) = AdminTransferResponse( | ||
accountLogId = accountId, | ||
accountType = this.accountType, | ||
transferType = this.transferType, | ||
transactionStatusType = TransactionStatusType.SUCCESS, | ||
adminTransferDetailResponse = AdminTransferDetailResponse( | ||
nftId = this.nftId, | ||
transferType =this.transferType, | ||
balance = this.balance | ||
) | ||
) | ||
|
||
fun TransferFailLog.toResponse(accountId: Long,accountType: AccountType) = AdminTransferResponse( | ||
accountLogId = accountId, | ||
accountType = accountType, | ||
transferType = this.transferType, | ||
transactionStatusType = TransactionStatusType.FAILURE, | ||
adminTransferDetailResponse = null | ||
|
||
) | ||
|
||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
src/main/kotlin/com/api/admin/service/TransferFailLogService.kt
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/com/api/admin/service/TransferFailService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.api.admin.service | ||
|
||
import com.api.admin.domain.transferFailLog.TransferFailLog | ||
import com.api.admin.domain.transferFailLog.TransferFailLogRepository | ||
import com.api.admin.enums.AccountType | ||
import com.api.admin.enums.TransferType | ||
import com.api.admin.rabbitMQ.event.dto.AdminTransferCreatedEvent | ||
import com.api.admin.rabbitMQ.event.dto.AdminTransferResponse.Companion.toResponse | ||
import org.springframework.context.ApplicationEventPublisher | ||
import org.springframework.stereotype.Service | ||
import reactor.core.publisher.Mono | ||
|
||
@Service | ||
class TransferFailService( | ||
private val transferFailLogRepository: TransferFailLogRepository, | ||
private val eventPublisher: ApplicationEventPublisher, | ||
) { | ||
|
||
fun save(accountId: Long, | ||
address: String, | ||
transactionHash: String?, | ||
message: String, | ||
transferType: TransferType, | ||
accountType: AccountType | ||
): Mono<Void> { | ||
return transferFailLogRepository.save( | ||
TransferFailLog( | ||
wallet = address, | ||
transactionHash = transactionHash, | ||
errorMessage = message, | ||
transferType = transferType | ||
) | ||
).doOnSuccess { | ||
eventPublisher.publishEvent(AdminTransferCreatedEvent(this, it.toResponse(accountId,accountType))) | ||
}.then() | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.