| Field | Value |
|---|---|
| Request ID | 6413c676-e547-45be-948e-ab491b4060d1 |
| Endpoint | POST /api/v1/digital_cash/exchange |
| Time | 2026-02-04 09:53:12 UTC |
| User | Basit Masood (Customer) |
| User ID | 958a4910-a20f-4a06-81d6-d458dcc3bf57 |
| Status | 500 Internal Server Error |
- Amount: 36.00 USDC
- Custom Rate: 280.00 PKR
- Local Currency: PKR
- Ad ID:
null(quick exchange, no ad)
NoMethodError - undefined method `business_name' for nil
Stack trace:
/rails/app/services/digital_cash/exchange_note/create/service.rb:76 in `ad_snapshot`
/rails/app/services/digital_cash/exchange_note/create/service.rb:95 in `deposit_callback_arguments`
/rails/app/services/digital_cash/create/service.rb:213 in `build_commitment_callbacks`
In backend/app/services/digital_cash/exchange_note/create/service.rb:76:
def ad_snapshot
@ad_snapshot ||= {
'rate' => (custom_rate || ad&.rate)&.to_f,
'currency' => local_currency || ad&.currency,
'merchant_name' => user.merchant_onboarding_submission.business_name # ← BUG
}.compact
endThe code assumes all users have a merchant_onboarding_submission record, but this user (a Customer type) does not have one. The association returns nil, causing the NoMethodError.
Change line 76 from:
'merchant_name' => user.merchant_onboarding_submission.business_nameTo:
'merchant_name' => user.merchant_onboarding_submission&.business_nameThis allows .compact to remove the merchant_name key when nil.