Skip to content

Commit

Permalink
[Fix] Persist customer record when transaction_id is used (#1403)
Browse files Browse the repository at this point in the history
### Description

This commit fixes the customer callback endpoints behavior when the
`transaction_id` is included in the request.

### Context

Previously, the `transaction_id` was ignored.

### Testing

- `./gradlew test`
- Testing with demo wallet.

### Documentation

N/A

### Known limitations

N/A
  • Loading branch information
philipliu authored Jun 27, 2024
1 parent a8db42a commit 0fe2802
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ class CustomerService(
return convertCustomerToResponse(customer, request.type, emptyList())
}

fun upsertCustomer(request: PutCustomerRequest): PutCustomerResponse {
suspend fun upsertCustomer(request: PutCustomerRequest): PutCustomerResponse {
log.info("Upserting customer: $request")
val customer =
when {
request.transactionId != null -> {
val transaction = sepHelper.getTransaction(request.transactionId)
val sender = transaction.customers!!.sender
val memoType = if (sender!!.memo != null) "id" else null

customerRepository.get(sender.account!!, sender.memo, memoType)
}
request.id != null -> customerRepository.get(request.id)
request.account != null ->
customerRepository.get(request.account, request.memo, request.memoType)
Expand Down

0 comments on commit 0fe2802

Please sign in to comment.