94 lines
2.9 KiB
Markdown
94 lines
2.9 KiB
Markdown
# 1. Goal
|
|
The order desk of a florist prices bouquet orders. The shop counter, the web
|
|
shop and the telephone desk must all use the same contract. Create the interface
|
|
{{P}}IF_BOUQUET_PRICING in package $TMP. The interface fixes the types, the
|
|
constants and the methods of the contract.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The interface {{P}}IF_BOUQUET_PRICING does not exist yet.
|
|
- The interface is in package $TMP.
|
|
- Every pricing module of the florist implements this interface. The pricing
|
|
modules are not part of this task.
|
|
- The hidden tests use a class that implements the interface. That class only
|
|
compiles when every type, every constant and every method signature matches.
|
|
|
|
# 4. Contract
|
|
- Create the interface {{P}}IF_BOUQUET_PRICING in package $TMP.
|
|
- The interface is global and public.
|
|
- The interface contains the types, the constants and the methods of section 5.
|
|
- Do not add other components to the interface.
|
|
|
|
# 5. Business rules
|
|
## 5.1 Types
|
|
The interface defines these five types.
|
|
| Type | Definition |
|
|
| --- | --- |
|
|
| ty_size | TYPE c LENGTH 1 |
|
|
| ty_zone | TYPE c LENGTH 2 |
|
|
| ty_reason | TYPE c LENGTH 12 |
|
|
| ty_amount | TYPE p LENGTH 8 DECIMALS 2 |
|
|
| ty_stems | TYPE i |
|
|
|
|
## 5.2 Constants
|
|
The interface defines these five constant structures.
|
|
|
|
c_size has the type ty_size. The components are:
|
|
- small = 'S'. A small bouquet.
|
|
- medium = 'M'. A medium bouquet.
|
|
- large = 'L'. A large bouquet.
|
|
|
|
c_zone has the type ty_zone. The components are:
|
|
- town = 'T1'. A delivery inside the town.
|
|
- nearby = 'N1'. A delivery in the near area.
|
|
- far = 'F1'. A delivery in the far area.
|
|
|
|
c_reason has the type ty_reason. The components are:
|
|
- ok = 'OK'.
|
|
- no_stems = 'NO_STEMS'.
|
|
- too_many = 'TOO_MANY'.
|
|
- bad_size = 'BAD_SIZE'.
|
|
- bad_zone = 'BAD_ZONE'.
|
|
|
|
c_limit has the type ty_stems. The components are:
|
|
- min_stems = 5.
|
|
- max_stems = 60.
|
|
|
|
c_fee has the type ty_amount. The components are:
|
|
- vase = '4.50'. The fee for a vase.
|
|
- town = '0.00'. The delivery fee inside the town.
|
|
- nearby = '6.00'. The delivery fee in the near area.
|
|
- far = '12.00'. The delivery fee in the far area.
|
|
|
|
## 5.3 Methods
|
|
The interface defines these three methods.
|
|
|
|
1. check_order
|
|
IMPORTING iv_size TYPE ty_size
|
|
iv_stems TYPE ty_stems
|
|
iv_zone TYPE ty_zone
|
|
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
|
|
|
2. delivery_fee
|
|
IMPORTING iv_zone TYPE ty_zone
|
|
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
|
|
|
3. bouquet_price
|
|
IMPORTING iv_size TYPE ty_size
|
|
iv_stems TYPE ty_stems
|
|
iv_vase TYPE abap_bool
|
|
RETURNING VALUE(rv_price) TYPE ty_amount.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.58.
|
|
- Coding standards: Clean ABAP. No comment that restates the code.
|
|
- Out of scope: no other repository object. Do not change other objects of
|
|
package $TMP.
|
|
|
|
# 7. Acceptance
|
|
- The interface {{P}}IF_BOUQUET_PRICING is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests in a global test class in package $TMP.
|