Skip to content

Commit 73bdde1

Browse files
author
Sami Rmili
committed
fix(reimbursement): introduce reimbursementbreakdown
1 parent e27be86 commit 73bdde1

3 files changed

Lines changed: 126 additions & 0 deletions

File tree

docs/reimbursement-breakdown.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Reviewer note — #1369 reimbursement breakdown
2+
3+
> **Temporary.** This file documents the diff for reviewers and will be **deleted
4+
> before merge**. It is not meant to ship.
5+
6+
Issue [#1369](https://github.com/UnionInternationalCheminsdeFer/OSDM/issues/1369) ·
7+
branch `1369-reimbursement-breakdown` · **purely additive, non-breaking.**
8+
9+
## Why
10+
11+
A refund/exchange today can't say **how** money comes back to the passenger *with
12+
amounts*: `ReimbursementMethod.paymentMethod` is a single value (no split) and
13+
`issuedVouchers` carries issuer+code but **no amount**. So neither "€80 voucher +
14+
€40 to card" nor "several vouchers re-credited individually" is expressible.
15+
16+
## What changed
17+
18+
| File | Change |
19+
|---|---|
20+
| `schemas/aftersales.yml` | New `ReimbursementBreakdownItem` (`additionalProperties:false`; required `type``PaymentType`; optional `reimbursementAmount``Price`, `voucherInformation`). New `reimbursementBreakdown` array on `RefundOffer`, `ExchangeOperation`, `ExchangeOffer`. New `usedPaymentMethods` (array of `PaymentMethod`) on `ExchangeOperationPatchRequest`. |
21+
| `OSDM-online-api.yml` | Hub `$ref` for `ReimbursementBreakdownItem`. |
22+
23+
Nothing is deprecated, renamed, or removed. `ReimbursementMethod`, `issuedVouchers`
24+
and `complaint.yml` are **untouched**.
25+
26+
## Review notes
27+
28+
- **`reimbursementBreakdown` = the realized per-channel split.** Per-item `type`
29+
(one entry per channel) is what lets it express a mix; single-channel is a
30+
one-element array.
31+
- **`reimbursementAmount` is optional on purpose.** It's authoritative for the
32+
`VOUCHER` channel (system knows the credited amount, like `appliedVoucherAmount`
33+
on `PaymentMethod`); for other channels it's declarative and may be omitted. So
34+
"sum of items = total" holds only when every item carries an amount.
35+
- **No new voucher-issuance flag.** A voucher in `issuedVouchers` is newly issued;
36+
one in the breakdown but not in `issuedVouchers` is a re-credit — membership
37+
already encodes it. The breakdown's `voucherInformation` is just the key to
38+
attach a per-voucher amount.
39+
- **`usedPaymentMethods` on the exchange PATCH** settles the exchange surcharge
40+
(`ExchangeOffer.amountToBePaid`), mirroring `BookingPatchRequest`. The exchange
41+
PATCH is idempotency-key protected, so payment is retry-safe.
42+
43+
## Scope / out of scope
44+
45+
Voucher consolidation (`issuedVoucherRefs`/`VoucherRef` already on `dev-osdm-v4`),
46+
target-instrument identity for non-voucher items, and first-class
47+
eligible-methods + customer choice (EU Reg 2021/782) are **deferred to the v4
48+
payment module** — not introduced here.
49+
50+
Ships identically to **3.8, 3.9 and master** (three additive PRs).
51+
52+
## Validation
53+
54+
`redocly lint specification/OSDM-online-api.yml` — passes (only pre-existing
55+
`houseNumber` example warnings). Don't commit `OSDM-online-api.bundled.yml` (CI
56+
regenerates it).

specification/OSDM-online-api.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,8 @@ components:
10371037
$ref: ./schemas/_common.yml#/RegulatoryCondition
10381038
Reimbursement:
10391039
$ref: ./schemas/complaint.yml#/Reimbursement
1040+
ReimbursementBreakdownItem:
1041+
$ref: ./schemas/aftersales.yml#/ReimbursementBreakdownItem
10401042
ReimbursementDecision:
10411043
$ref: ./schemas/complaint.yml#/ReimbursementDecision
10421044
ReimbursementMethod:

specification/schemas/aftersales.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,15 @@ ExchangeOffer:
291291
type: array
292292
items:
293293
$ref: '#/ExchangeBreakdownItem'
294+
reimbursementBreakdown:
295+
description: |
296+
Per-channel breakdown of the amount to be reimbursed to the purchaser
297+
(the refundableAmount), supporting split reimbursements (e.g. part to a
298+
voucher, part to the original payment mean). Lets the reimbursable split
299+
be seen at quotation stage, before the exchange is confirmed.
300+
type: array
301+
items:
302+
$ref: '#/ReimbursementBreakdownItem'
294303
admissionOfferParts:
295304
type: array
296305
items:
@@ -443,6 +452,15 @@ ExchangeOperation:
443452
type: array
444453
items:
445454
$ref: ./_common.yml#/VoucherInformation
455+
reimbursementBreakdown:
456+
description: |
457+
Per-channel breakdown of the amount reimbursed to the purchaser,
458+
supporting split reimbursements (e.g. part to a voucher, part to the
459+
original payment mean). Each voucher channel carries its voucher
460+
information and amount inline.
461+
type: array
462+
items:
463+
$ref: '#/ReimbursementBreakdownItem'
446464
trips:
447465
type: array
448466
items:
@@ -461,6 +479,13 @@ ExchangeOperationPatchRequest:
461479
$ref: ./fulfillment.yml#/FulfillmentType
462480
preferredFulfillmentMedia:
463481
$ref: ./fulfillment.yml#/FulfillmentMediaType
482+
usedPaymentMethods:
483+
description: |
484+
Payment methods used to settle the exchange surcharge (the
485+
amountToBePaid of the selected exchange offer).
486+
type: array
487+
items:
488+
$ref: ./_common.yml#/PaymentMethod
464489
embed:
465490
description: |
466491
Influences whether referenced resources are returned in full or as references only.
@@ -599,6 +624,17 @@ RefundOffer:
599624
type: array
600625
items:
601626
$ref: '#/RefundOfferBreakdownItem'
627+
reimbursementBreakdown:
628+
description: |
629+
Per-channel breakdown of the amount reimbursed to the purchaser (the
630+
refundableAmount), supporting split reimbursements (e.g. part to a
631+
voucher, part to the original payment mean). Each voucher channel
632+
carries its voucher information and amount inline. This is authoritative
633+
for the realized per-channel amounts; reimbursementMethod only states
634+
the offer's headline channel.
635+
type: array
636+
items:
637+
$ref: '#/ReimbursementBreakdownItem'
602638
reimbursementMethod:
603639
$ref: ./complaint.yml#/ReimbursementMethod
604640
_links:
@@ -727,6 +763,38 @@ RefundType:
727763
- 'YES'
728764
- 'NO'
729765
- WITH_CONDITION
766+
ReimbursementBreakdownItem:
767+
type: object
768+
additionalProperties: false
769+
description: |
770+
One channel through which (part of) the reimbursable amount is returned to
771+
the purchaser. A list of these expresses split reimbursements (e.g. part to
772+
a voucher, part to the original payment mean), which the singular
773+
reimbursementMethod cannot represent.
774+
required:
775+
- type
776+
properties:
777+
type:
778+
$ref: ./_common.yml#/PaymentType
779+
reimbursementAmount:
780+
description: |
781+
Amount returned to the purchaser through this channel. Authoritative for
782+
the VOUCHER channel, where the system knows the credited amount (mirroring
783+
appliedVoucherAmount on PaymentMethod). For other channels such as
784+
ORIGINAL_ACCOUNT the amount is declarative and may be omitted when the
785+
system cannot state it.
786+
allOf:
787+
- $ref: ./_common.yml#/Price
788+
voucherInformation:
789+
description: |
790+
Identifies the voucher this amount is credited to when type is VOUCHER.
791+
This is the per-voucher key that lets a specific amount be attached to a
792+
specific voucher (which issuedVouchers cannot express). A voucher that
793+
also appears in issuedVouchers is newly issued; one that appears here but
794+
not in issuedVouchers is a re-credit of an existing voucher. Provided once
795+
the voucher is known; not available at quotation stage.
796+
allOf:
797+
- $ref: ./_common.yml#/VoucherInformation
730798
ReleaseOffer:
731799
type: object
732800
additionalProperties: false

0 commit comments

Comments
 (0)