sap-labs-france / ev-server

The Open e-Mobility Charging Station management backend server (check also ev-dashboard and ev-mobile)
https://open-e-mobility.fr/
Apache License 2.0
141 stars 132 forks source link

Invoice Unit price! #4218

Open UBT-FJ opened 9 months ago

UBT-FJ commented 9 months ago
Screenshot 2023-10-06 at 11 11 47

Hello, been testing the system and set the pricing in Integration Settings>Pricing Dimesions>Energy as per kWh, and the calcs are correct but the unit price is not showing in the invoice!

This was done with the ev-simulator.

UBT-FJ commented 7 months ago

anybody? I also tried in stripe but cant get it to work!

Zakichanu commented 7 months ago

Hi, can i see your pricing definition?

UBT-FJ commented 7 months ago
Screenshot 2023-12-06 at 11 03 27 Screenshot 2023-12-06 at 11 03 21

I tried also the step size but it didnt work!

Zakichanu commented 7 months ago

I think the unit price is associated to the flat fee. If you add a flat fee of test, the unit price might return the flat fee

UBT-FJ commented 7 months ago

but I want to use the Enrgy, isnt that possible?

Zakichanu commented 7 months ago

What I am telling you is, the first row of the stripe invoice is exclusively for the flat fee on your Price dimension.

If you want to have the energy price, you can change the code to put it in the first line

UBT-FJ commented 7 months ago

What I am telling you is, the first row of the stripe invoice is exclusively for the flat fee on your Price dimension.

If you want to have the energy price, you can change the code to put it in the first line

Do you happen to know where should I change it? :(

UBT-FJ commented 7 months ago

What I am telling you is, the first row of the stripe invoice is exclusively for the flat fee on your Price dimension.

If you want to have the energy price, you can change the code to put it in the first line

I have just tested with the flat fee and it doesnt show either!

Screenshot 2023-12-06 at 13 19 15
Zakichanu commented 6 months ago

Did you figured it out, or are you confronting the same issue?

UBT-FJ commented 6 months ago

Did you figured it out, or are you confronting the same issue?

Hello @Zakichanu , thanks for getting back to this thread.

I read and followed a lot of code to found out that the unitPrice doesnt get with the other values in one of the functions!

Instead I ended up getting that value from the Transactions class.

In StripeBillingIntegration.ts, in this function buildLineItemDescription4PricedDimension() there is also this const unitPrice = Utils.createDecimal(pricedData.unitPrice).toNumber().toLocaleString(userLocale); which returns 0!

So I had to make it like this const unitPrice = transaction.pricingModel.pricingDefinitions[0].dimensions.energy.pricedData.unitPrice; to get something like what you can see in the screenshot.

If you know a better way please let me know.

Screenshot 2023-12-14 at 21 04 31
Zakichanu commented 6 months ago

Hi @UBT-FJ,

That's a great way to modify this in my opinion. I never use this part in my case so I don't know if there is a better way for this.

I think we can close this issue then