Sale charges example

Overview

This example shows how a posps client might use the sale operations addSaleCharge and deleteSaleCharge. See Examples for an explanation of the elements shown here.

Example

Charge for night duty

In Germany, the pharmacist may charge a customer EUR2.50 night duty charge if the pharmacy is serving customers outside the closing time and the physician has not disallowed this on the prescription. It is, however, up to the pharmacist if he really charges the customer. Therefore, the server cannot determine automatically if the customer is charged, the client has to call addSaleCharge.

This example starts with an empty sale with operator:


    <sale:setSaleOperatorResponse>
        <sale>
            <saleId code="example-2" />
            
            <!-- The server has added the operator element sent by the client. -->
            <operator>
                <displayName>Mr. Doe</displayName>
                <fullName>John Doe</fullName>
                <operatorId code="014a65c7-bf7a-47f6-a542-d085d70060f7" />
                <organization>Example visavia Services Ltd.</organization>
                <organizationId code="95a07944-347d-4f9f-8bea-8b1c2211b799" />
            </operator>

            <total>
                <total>0</total>
            </total>
            
        </sale>
    </sale:setSaleOperatorResponse>

The pharmacist clicks on the button which enables the night duty charge for this sale. This triggers a call to addSaleCharge. Since the amount of the night duty charge is fixed by law, the client does not set the amount element.


addSaleCharge

Request

        <sale:addSaleCharge>
            <saleId code="example-2" />
            
            <!-- the amount of the night duty charge is fixed and set by the
                 server -->
            <kind>night_duty</kind>

        </sale:addSaleCharge>

Response

        <sale:addSaleChargeResponse>
            <sale>
                <saleId code="example-2" />

                <operator>
                    <displayName>Mr. Doe</displayName>
                    <fullName>John Doe</fullName>
                    <operatorId code="014a65c7-bf7a-47f6-a542-d085d70060f7" />
                    <organization>Example visavia Services Ltd.</organization>
                    <organizationId code="95a07944-347d-4f9f-8bea-8b1c2211b799" />
                </operator>
    
                <!-- the total now includes the night duty charge -->
                <total>
                    <charge>
                        <amount>250</amount>
                        <kind>night_duty</kind>
                    </charge>
                    <total>250</total>
                </total>
                
            </sale>
        </sale:addSaleChargeResponse>

The pharmacist can also delete a night duty charge which he has added earlier.


deleteSaleCharge

Request

        <sale:deleteSaleCharge>
            <saleId code="example-2" />

            <kind>night_duty</kind>

        </sale:deleteSaleCharge>

Response

        <sale:deleteSaleChargeResponse>
            <sale>
                <saleId code="example-2" />

                <operator>
                    <displayName>Mr. Doe</displayName>
                    <fullName>John Doe</fullName>
                    <operatorId code="014a65c7-bf7a-47f6-a542-d085d70060f7" />
                    <organization>Example visavia Services Ltd.</organization>
                    <organizationId code="95a07944-347d-4f9f-8bea-8b1c2211b799" />
                </operator>
    
                <!-- the night duty charge is removed from the total -->
                <total>
                    <total>0</total>
                </total>
                
            </sale>
        </sale:deleteSaleChargeResponse>

Adding charges advanced examples

This example shows how adding charges of the same kind several times is handled. It assumes that the pharmacy has handed out vouchers which the customer can redeem at the visavia to get rebates of varying amounts.

The customer has already added an article to the sale:


    <sale:addSalePositionResponse>
        <sale>
            <saleId code="example-1" />

            <!-- The following position was created by the server in response
                to the addSalePosition request. -->
            <position>
                <positionId code="position-1" />
                
                <positionData>
                    <articleId code="4479146" />
                    <name>EBENOL Creme</name>
                    <packaging>
                        <size>25</size>
                        <unit>g</unit>
                    </packaging>
                    <manufacturer>STRATHMANN GMBH&amp;CO KG</manufacturer>
                    <amount>1</amount>
                    <delivered>0</delivered>
                    <articlePrice>749</articlePrice>
                    <positionPrice>749</positionPrice>
                    <vatRate>19</vatRate>
                    <pharmaceutic>
                        <countrySpecific xsi:type="pptype:PharmaceuticPositionDE">
                            <!-- 
                                While the elements of PharmaceuticPositionDE
                                are defined as optional, the visavia needs the
                                data of the following elements to work properly.
                                The server may also send the other elements,
                                which are left out in this example for brevity.
                            -->
                            <pzn>1275791</pzn>
                            <apothekenpflicht>true</apothekenpflicht>
                            <rezeptpflicht>false</rezeptpflicht>
                        </countrySpecific>
                    </pharmaceutic>
                </positionData>
            </position>

            <!-- the total now includes the price of the newly added article -->
            <total>
                <vat>
                    <vatRate>19</vatRate>
                    <price>120</price>
                </vat>
                <total>749</total>
            </total>

        </sale>
    </sale:addSalePositionResponse>

He then redeems a voucher for EUR1.00. The visavia calls addSaleCharge.


addSaleCharge

Request

        <sale:addSaleCharge>
            <saleId code="example-2" />
            
            <amount>-100</amount>
            <kind>voucher</kind>

        </sale:addSaleCharge>

Response

        <sale:addSaleChargeResponse>
            <sale>
                <saleId code="example-1" />

                <position>
                    <positionId code="position-1" />
                    
                    <positionData>
                        <articleId code="4479146" />
                        <name>EBENOL Creme</name>
                        <packaging>
                            <size>25</size>
                            <unit>g</unit>
                        </packaging>
                        <manufacturer>STRATHMANN GMBH&amp;CO KG</manufacturer>
                        <amount>1</amount>
                        <delivered>0</delivered>
                        <articlePrice>749</articlePrice>
                        <positionPrice>749</positionPrice>
                        <vatRate>19</vatRate>
                        <pharmaceutic>
                            <countrySpecific xsi:type="pptype:PharmaceuticPositionDE">
                                <pzn>1275791</pzn>
                                <apothekenpflicht>true</apothekenpflicht>
                                <rezeptpflicht>false</rezeptpflicht>
                            </countrySpecific>
                        </pharmaceutic>
                    </positionData>
                </position>
    
                <!-- the total now includes the added charge -->
                <total>
                    <charge>
                        <amount>-100</amount>
                        <kind>voucher</kind>
                    </charge>
                    <vat>
                        <vatRate>19</vatRate>
                        <price>120</price>
                    </vat>
                    <total>649</total>
                </total>
    
            </sale>
        </sale:addSaleChargeResponse>

He might also add another voucher, e. g. for EUR0.50.


addSaleCharge

Request

        <sale:addSaleCharge>
            <saleId code="example-2" />
            
            <amount>-50</amount>
            <kind>voucher</kind>

        </sale:addSaleCharge>

Response

        <sale:addSaleChargeResponse>
            <sale>
                <saleId code="example-1" />

                <position>
                    <positionId code="position-1" />
                    
                    <positionData>
                        <articleId code="4479146" />
                        <name>EBENOL Creme</name>
                        <packaging>
                            <size>25</size>
                            <unit>g</unit>
                        </packaging>
                        <manufacturer>STRATHMANN GMBH&amp;CO KG</manufacturer>
                        <amount>1</amount>
                        <delivered>0</delivered>
                        <articlePrice>749</articlePrice>
                        <positionPrice>749</positionPrice>
                        <vatRate>19</vatRate>
                        <pharmaceutic>
                            <countrySpecific xsi:type="pptype:PharmaceuticPositionDE">
                                <pzn>1275791</pzn>
                                <apothekenpflicht>true</apothekenpflicht>
                                <rezeptpflicht>false</rezeptpflicht>
                            </countrySpecific>
                        </pharmaceutic>
                    </positionData>
                </position>
    
                <!-- the charge for the two vouchers is added -->
                <total>
                    <charge>
                        <amount>-150</amount>
                        <kind>voucher</kind>
                    </charge>
                    <vat>
                        <vatRate>19</vatRate>
                        <price>120</price>
                    </vat>
                    <total>599</total>
                </total>
    
            </sale>
        </sale:addSaleChargeResponse>

There is also the option to change the charge afterwards, e. g. reducing the rebate.


addSaleCharge

Request

        <sale:addSaleCharge>
            <saleId code="example-2" />
            
            <amount>75</amount>
            <kind>voucher</kind>

        </sale:addSaleCharge>

Response

        <sale:addSaleChargeResponse>
            <sale>
                <saleId code="example-1" />

                <position>
                    <positionId code="position-1" />
                    
                    <positionData>
                        <articleId code="4479146" />
                        <name>EBENOL Creme</name>
                        <packaging>
                            <size>25</size>
                            <unit>g</unit>
                        </packaging>
                        <manufacturer>STRATHMANN GMBH&amp;CO KG</manufacturer>
                        <amount>1</amount>
                        <delivered>0</delivered>
                        <articlePrice>749</articlePrice>
                        <positionPrice>749</positionPrice>
                        <vatRate>19</vatRate>
                        <pharmaceutic>
                            <countrySpecific xsi:type="pptype:PharmaceuticPositionDE">
                                <pzn>1275791</pzn>
                                <apothekenpflicht>true</apothekenpflicht>
                                <rezeptpflicht>false</rezeptpflicht>
                            </countrySpecific>
                        </pharmaceutic>
                    </positionData>
                </position>
    
                <!-- the charge for the two vouchers is added -->
                <total>
                    <charge>
                        <amount>-75</amount>
                        <kind>voucher</kind>
                    </charge>
                    <vat>
                        <vatRate>19</vatRate>
                        <price>120</price>
                    </vat>
                    <total>674</total>
                </total>
    
            </sale>
        </sale:addSaleChargeResponse>

The total price of the sale can never be less that 0. Paying out of credit is not supported by the posps interface.


addSaleCharge

Request

        <sale:addSaleCharge>
            <saleId code="example-2" />
            
            <amount>-1000</amount>
            <kind>voucher</kind>

        </sale:addSaleCharge>

Response

        <sale:addSaleChargeResponse>
            <sale>
                <saleId code="example-1" />

                <position>
                    <positionId code="position-1" />
                    
                    <positionData>
                        <articleId code="4479146" />
                        <name>EBENOL Creme</name>
                        <packaging>
                            <size>25</size>
                            <unit>g</unit>
                        </packaging>
                        <manufacturer>STRATHMANN GMBH&amp;CO KG</manufacturer>
                        <amount>1</amount>
                        <delivered>0</delivered>
                        <articlePrice>749</articlePrice>
                        <positionPrice>749</positionPrice>
                        <vatRate>19</vatRate>
                        <pharmaceutic>
                            <countrySpecific xsi:type="pptype:PharmaceuticPositionDE">
                                <pzn>1275791</pzn>
                                <apothekenpflicht>true</apothekenpflicht>
                                <rezeptpflicht>false</rezeptpflicht>
                            </countrySpecific>
                        </pharmaceutic>
                    </positionData>
                </position>
    
                <total>
                    <charge>
                        <!-- the charge for the vouchers is added -->
                        <amount>-1075</amount>
                        <kind>voucher</kind>
                    </charge>
                    <vat>
                        <vatRate>19</vatRate>
                        <price>120</price>
                    </vat>
                    <!-- The total can never be less that 0, even if the rebates
                         exceed the prices of the articles. -->
                    <total>0</total>
                </total>
    
            </sale>
        </sale:addSaleChargeResponse>