starsirius/allpay — pull request #3 by starsirius (2014-11-16 05:40:03+00:00)
Title: @beamjet Checkout form html, checkout data validation

You can see the specs for how to use this lib. Let me know if you have any questions.

Current specs:

```
#initialization
✓ has default attribute values for AllPay testing environment
✓ overrides default attribute values with options passed in

#genCheckMacValue
✓ generates correct Check Mac Value

#createFormHtml
✓ generates correct HTML form

#validateCheckout
required fields
✓ requires MerchantID
✓ requires MerchantID to be no more than 10 chars
- requires MerchantTradeNo
- requires MerchantTradeNo to be no more than 200 chars
- requires PaymentType
- requires PaymentType to be "aio"
- requires TotalAmount
- requires TradeDesc
- requires TradeDesc to be no more than 200 chars
- requires ItemName
- requires ItemName to be no more than 200 chars
- requires ReturnURL
- requires ReturnURL to be no more than 200 chars
- requires ChoosePayment
- requires ChoosePayment to be one of the supported payment moethods
payment methods
ALL
✓ keeps all the required fields
✓ discards invalid options
✓ keeps all options except options of credit card
✓ discards options of ignored payment methods
✓ keeps overlapped fields if not all of the payment methods are ignored
✓ discards ClientRedirectURL option if it is blank
Credit
✓ keeps all the required fields
✓ returns errors if passed in both installment and periodic options
✓ keeps only installment credit card and ALL options besides required fields
✓ keeps only periodic credit card and ALL options besides required fields
WebATM
✓ keeps all the required fields
✓ keeps only ALL options besides required fields
ATM
✓ keeps all the required fields
✓ keeps only ATM and ALL options besides required fields and discards IgnorePayment
✓ discards ClientRedirectURL option if it is blank
CVS
✓ keeps all the required fields
✓ keeps only CVS and ALL options besides required fields and discards IgnorePayment
✓ discards ClientRedirectURL option if it is blank
BARCODE
✓ keeps all the required fields
✓ keeps only BARCODE and ALL options besides required fields and discards IgnorePayment
✓ discards ClientRedirectURL option if it is blank
unsupported payment method
✓ returns unsupported errors
```