carlos / platform Public

billingstripe: record stripe_fx_fee movements as fees

Final review finding B (Astra 2): Stripe's currency-conversion fee fell
through to MovementOther, so the reconcile logged and skipped it and the
money record undercounted provider fees. It now maps to MovementFee with
stripe_fee and tax_fee; TestMoneyMovementsMapsTypes and
TestMoneyMovementKinds cover it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6ebfb6eecaa6eaa9de40be6886465f4a2a3a66ef parent e58becd
2 files changed, +4 −2
  • internal/billingstripe/money.go +1 −1
  • internal/billingstripe/money_test.go +3 −1
diff --git a/internal/billingstripe/money.go b/internal/billingstripe/money.go
index fb4038d29..385eebd39 100644
--- a/internal/billingstripe/money.go
+++ b/internal/billingstripe/money.go
@@ -200,7 +200,7 @@ func movementKindOf(typ string) billing.MovementKind {
return billing.MovementRefund
case "refund_failure", "payment_failure_refund":
return billing.MovementRefundFailure
- case "stripe_fee", "tax_fee":
+ case "stripe_fee", "stripe_fx_fee", "tax_fee":
return billing.MovementFee
default:
return billing.MovementOther
diff --git a/internal/billingstripe/money_test.go b/internal/billingstripe/money_test.go
index 776ebae0a..fd57d8d8b 100644
--- a/internal/billingstripe/money_test.go
+++ b/internal/billingstripe/money_test.go
@@ -28,6 +28,7 @@ func TestMoneyMovementsMapsTypes(t *testing.T) {
failed := `{"id":"re_2","object":"refund","amount":1000,"charge":"ch_1","currency":"eur","status":"failed"}`
// Stripe lists newest first.
page := []string{
+ txnJSON("txn_7", "stripe_fx_fee", -12, 0, "eur", moneyT0.Add(7*time.Hour), `null`),
txnJSON("txn_6", "payout", -5000, 0, "eur", moneyT0.Add(6*time.Hour), `"po_1"`),
txnJSON("txn_5", "stripe_fee", -45, 0, "eur", moneyT0.Add(5*time.Hour), `null`),
txnJSON("txn_4", "refund_failure", 1000, 0, "eur", moneyT0.Add(4*time.Hour), failed),
@@ -61,6 +62,7 @@ func TestMoneyMovementsMapsTypes(t *testing.T) {
{ID: "txn_4", Kind: billing.MovementRefundFailure, Type: "refund_failure", Source: "re_2", Charge: "ch_1", Amount: 1000, Currency: "eur", At: moneyT0.Add(4 * time.Hour)},
{ID: "txn_5", Kind: billing.MovementFee, Type: "stripe_fee", Amount: -45, Currency: "eur", At: moneyT0.Add(5 * time.Hour)},
{ID: "txn_6", Kind: billing.MovementOther, Type: "payout", Source: "po_1", Amount: -5000, Currency: "eur", At: moneyT0.Add(6 * time.Hour)},
+ {ID: "txn_7", Kind: billing.MovementFee, Type: "stripe_fx_fee", Amount: -12, Currency: "eur", At: moneyT0.Add(7 * time.Hour)},
}
if len(ms) != len(want) {
t.Fatalf("got %d movements: %+v", len(ms), ms)
@@ -137,7 +139,7 @@ func TestMoneyMovementKinds(t *testing.T) {
"charge": billing.MovementCharge, "payment": billing.MovementCharge,
"refund": billing.MovementRefund, "payment_refund": billing.MovementRefund,
"refund_failure": billing.MovementRefundFailure, "payment_failure_refund": billing.MovementRefundFailure,
- "stripe_fee": billing.MovementFee, "tax_fee": billing.MovementFee,
+ "stripe_fee": billing.MovementFee, "tax_fee": billing.MovementFee, "stripe_fx_fee": billing.MovementFee,
"payout": billing.MovementOther, "adjustment": billing.MovementOther, "": billing.MovementOther,
} {
if got := movementKindOf(typ); got != want {