|
als_insert_voucher.cgi |
Top Previous Next |
|
Description The als_insert_voucher.cgi interface inserts a new voucher just like if a user was entering a voucher using the AL-Desk client. There is quite a bit of data validation contained in the als_insert_voucher.cgi call in order to make sure that only clean data is processed and accepted by AL-Desk.
Voucher Numbering AL-Desk numbers the vouchers using the Client Code along with a voucher number that is incremented for each client for each new voucher. Thus a customer with number 103205 would have her first voucher numbered as 103205-1 and subsequent vouchers would be numbered as 103205-NN where NN is an incremental counter.
Issued vouchers and Payments The default mode for als_insert_voucher.cgi will issue the voucher and automatically post a payment as described in als_insert_payment.cgi. In this mode, when a voucher is inserted, it is automatically issued and a payment is created and posted with a payment control number issued.
Multiple Vouchers with a Single Payment If you have a shopping cart and are processing multiple vouchers which you want to process in just one payment you can use the custompayment=true parameter. In this case the vouchers will NOT be tagged as issued. It then becomes your responsibility to issue a call to als_insert_voucher_payment.cgi which can handle multiple voucher numbers for one client.
Note: Since these are separate API calls the Web Portal cannot guarantee that als_insert_voucher.cgi calls with the custompayment parameter used are ever issued! They will show as un-issued in AL-Desk until a payment is recorded.
Products on Vouchers Since vouchers can contain multiple products and rates, the als_insert_voucher.cgi allows for multiple pricing codes and quantities to be processed. All products MUST be from the same vendor and a check is done to insure that any pricing codes all come from the same vendor.
As is normal for all Put calls a valid webusercode is required.
Note on Block Usage: Block usage is represented by vouchers that are tagged to be "offblock", have been issued and have not been canceled, so voucher calls will directly affect any activities that have active blocks defined ONLY if the voucher is created with with the block=true parameter set
If a call to write a voucher includes the block=true switch, a check will be made to see if a block is available for the product, and date for the total given quantities requested by the write voucher call. If that check fails, the voucher will NOT be inserted and an error message will be returned. This check insures that block reservations are valid.
See als_get_block_availability.cgi for more information.
Description of Required Inputs A webusercode:Integer must be included that represents the Web Interface user code supplied to you by your Activity Link System Administrator. A client:Integer must be included that represents the client code:integer from the clients table. An activitydate:Date must be included that represents the date of the activity. An activitytime:time must be included that represents the time of the activity.
Description of Optional Inputs An optional notes:string field is allowed for description and informational text. agency:Integer. Each Voucher can have an agency tied to it when it is created. The Agency as defined in the AL-Desk Web Interface Users will be used as the default agency.
Description of Variable Rate Inputs Any activity has an associated vendor rate with it. These rates can be gathered from the als_get_rates.cgi. Rates may vary for adults, children and infants for instance so there may indeed be multiple rates on a single voucher.
The count:Integer param must be included that signifies the number of rates included on the voucher.
For each rate included there must be 2 other params of pricingcode and quantity (abbreviated as qty).
To identify each pricing code and quality an ordinal number must be appended to it. An example of valid inputs is presented below showing 2 rates for a party of 3.
Count=2 pricingcode1=358 qty1=2 pricingcode2=360 qty2=1
Note:When count=XX there must be 1..Count number of pricingCodeXX and qtyXX pairs or an error will be returned.
Example Usage http://127.0.0.1/als_insert_voucher.cgi?pricingcode1=358&pricingcode2=360&count=2&client=100437&webusercode=1&activitydate=2005-05-31&activitytime=10:00&qty1=1&qty2=3
Inputs
Returned Fields
XML Example
<?xml version="1.0" encoding="utf-8" ?> - <root> - <vouchers> <row seq="20610" product="1" issued="True" productname="Hana/Haleakala- A Star" quantity="2" actdate="2/2/2006" clientname="smith,roger" agencyname="" prodrate="2" prodratename="Child 2&Up" locationname="Maui" agency="" client="102813" voucher="7" blockno="" issuedate="" total="406.36" retailrate="189" tax="14.18" vendorrate="189" grossrate="0" giftdiscount="" netrate="155.93" /> <row seq="20610" product="1" issued="True" productname="Hana/Haleakala- A Star" quantity="1" actdate="2/2/2006" clientname="smith,roger" agencyname="" prodrate="1" prodratename="Adult" locationname="Maui" agency="" client="102813" voucher="7" blockno="" issuedate="" total="203.18" retailrate="189" tax="14.18" vendorrate="189" grossrate="0" giftdiscount="" netrate="155.93" /> </vouchers> </root> |