Amount sent to Adyen is wrong unless it has exactly two decimal places (e.g. 10 is charged as 0.10)

Aperta
#152 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend, payments

Direzione di ricerca

Start by reading the amount conversion in src/main/java/org/killbill/billing/plugin/adyen/client/AdyenSDKClientImpl.java around lines 133–138, then check how sessions, refunds, and purchases use it. Verify the conversion against the CHF examples in the issue, including amounts with zero or more than two decimal places and currencies with different minor units; done means Adyen receives the correct minor-unit value for all three flows.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

The plugin converts the Kill Bill amount to Adyen minor units by removing the decimal point from the amount's string form. The result is correct only when the amount has exactly two decimals. Any other scale changes the amount sent to Adyen: 10 is sent as 10 minor units (0.10), and 10.5 as 105 (1.05). Currencies whose minor unit is not 2 decimals (e.g. JPY, KWD) are always converted incorrectly. Checkout sessions, purchases and refunds are affected.

Environment

  • killbill-adyen-plugin 0.10.x (maint-for-0-24-x) and 0.11.0 (master)
  • Kill Bill 0.24.x, Adyen TEST

Steps to reproduce

  1. Create a payment through the plugin with an amount that has no decimals:
    POST /1.0/kb/accounts/{accountId}/payments with {"transactionType":"PURCHASE","amount":10,"currency":"CHF"}
  2. Check the amount on the Adyen side (Customer Area or the AUTHORISATION webhook amount.value).

Expected

Adyen receives amount.value = 1000 (CHF 10.00). Kill Bill and Adyen amounts match.

Actual

Adyen receives amount.value = 10 (CHF 0.10). Kill Bill records 10.00.

Kill Bill amount Sent to Adyen (amount.value) Charged
10.00 1000 10.00
10 10 0.10
10.5 105 1.05
1.000000000 1000000000 10,000,000.00

Evidence

  • Conversion: AdyenSDKClientImpl.java#L133-L138
    String minorUnit = amount.toString().replace(".", "");
    return Long.valueOf(minorUnit);
    
  • Used for:
  • Observed:
    • Local test: a demo-app checkout of 20 was recorded in Kill Bill as 20.00 USD, while the Adyen AUTHORISATION webhook showed amount.value = 20.
Lingua principale
Java
Stelle
11
Fork
31
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di killbill/killbill-adyen-plugin

Tutte le issue di killbill/killbill-adyen-plugin

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.