Vouchers
Communication protocol for vouchers.
Utilized REST methods, contract: Comarch.B2.DataService.Contracts.dll
VoucherEntity[] GetInternalVouchers(string numer)
The method should return the current list of vouchers that match an indicated number (usually it will be one voucher).
VoucherResult UpdateVouchers(VoucherEntity[] vouchers);
The method should add/activate/deactivate/update particular vouchers passed as parameters.
The specific action performed for the vouchers depends on data contained in the VoucherEntity entity. Key data sent by POS include:
VoucherEntity | |
---|---|
Id : int | Voucher Id (0 if it should be created) |
TypeId : VoucherKindEnum | Voucher type (Unknown, InternalSold, InternalReleased, External, GiftCard) |
SortId : int | Voucher sort |
CurrencyId : int | Voucher currency |
IsActive : bool | Voucher status True - own voucher (sold, issued, card) to be used (deactivated) or whose Amount state is to be updated (applicable to cards) |
Number : string | Voucher number |
Amount : decimal | Voucher value |
Expected actions, depending on the configuration of VoucherEntity parameters sent to the voucher service (DataService) using the UpdateVouchers method, include:
Id | SortId | IsActive | Action |
---|---|---|---|
- | External | - | Application of an external voucher Saved in the database as used and inactive, with its value defined in Amount, currency in CurrencyId, and number in Number |
0 | InternalReleased | - | Generation of an issued own voucher Saved in the database as active and unused voucher, with its value defined in Amount, currency in CurrencyId, and number in Number |
>0 | InternalReleased InternalSold GiftCard | true | Application of a voucher or update of a gift card’s value |
>0 | InternalReleased | false | Activation of an existing internally-issued voucher |
Bool IsExternalVoucherExists(string numer, int sortId)
The method should verify if an external voucher with the indicated number and sort already exists in the database.