UnionInternationalCheminsdeFer / OSDM

Projects related to an open sales & distribution API for public transportation.
https://osdm.io
Apache License 2.0
53 stars 21 forks source link

Exposing refund value and refund fees in an AbstractOfferPart #593

Closed rolandkla closed 2 months ago

rolandkla commented 2 months ago

While introducing another operator in Sweden to the OSDM landscape we are analysing the refund values.

There are 2 options to expose the amount refunded during an after sales operation:

The refundAmount property in the AbstractOfferPart can expose the refunded value. It is however not clear how the refund information can be exposed.

The refundAmount value itself Is this the nett or gross value? And if it is nett, how should after sales booking fee's or ticket fee's be calculated? Example:

When these 3 fulfillments are cancelled in the same refundOffer operation, what value should be exposed in the refundAmount for each offerPart?

Technically it is not correct to divide an overarching fee since there is no direct relation between a fee and the offerParts. Therefor our working assumption is that the refundAmount is gross

Exposing applies after sales fees And how should the after sales fees be exposed? there is a feeRef but the fee's itself has no indication wether it was applied during booking creation or during after sales. Since we have a bookedOffers[].offerPart.price for the sales value, I expect the bookedOffers[].offerPart.feeRefs[] +bookedOffers[].fees[] to be sales fees. And the bookedOffers[].offerPart.refundAmount to be the refund value (gross) and have a bookedOffers[].offerPart.refundFeeRefs + bookedOffers[].refundFees for the refund financial data.

This way the client can determine:

Is it indeed intended to have different ways to expose refund values, both through refundOffers and offerParts? Is it recommended to favour the refundOffer since that is the actual refund operation?

Linus-Turnit commented 2 months ago

I would suggest that the operation fee is a new confirmed offer in the booking and refundAmount amount is omitted and replaced with offerPart.price since it always is 100% anyway and distributor must calculate the amount.

Eg. This use case gives 80% back of the price and have a refund operation fee of 50 SEK

{
    "bookedOffers": [
        {
            "offerId": "offer1",
            "summary": "2nd, class Stockholm C - Gothenburg C",
            "admissions": [
                {
                    "objectType": "Admission",
                    "id": "offerPart1",
                    "price": "1000 SEK",
                    "refundFee": "200 SEK",
                    "status": "REFUNDED",
                    "summary": "2nd, class Stockholm C - Gothenburg C",
                    "reservationRefs": [
                        {
                            "id": "offerPart2"
                        }
                    ]
                }
            ],
            "reservations": [
                {
                    "id": "offerPart2",
                    "summary": "Seat reserved in carriage 5 seat 21",
                                        "price": "0 SEK",
                    "refundFee": "0 SEK",
                    "status": "REFUNDED"
                }
            ]
        },
        {
            "offerId": "refundFeeOffer1",
            "summary": "Refund operation fee",
            "fees": [
                {
                    "objectType": "Fee",
                    "id": "fee1",
                    "price": "50 SEK",
                    "status": "CONFIRMED"
                }
            ]
        }
    ]
}
rolandkla commented 2 months ago

Updated the PR with the changes discussed: