Sha256: 158810d9e5ab177a8bd291a59bd98d51ec621e72eed02ed00340ba05b8de5aa1
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
class MonerisSimulator.CreditCard constructor: (args = {}) -> args = $.extend {}, @defaults(), args @validCreditCards = args.validCreditCards @creditCardNumberInput = args.creditCardNumberInput @setUpMonerisPostback() setUpMonerisPostback: () -> $(window).on 'message onmessage', (e) => window.parent.postMessage @response(), "*" response: () -> JSON.stringify { dataKey: @dataKey(), bin: @bin(), responseCode: @responseCode() } creditCardNumber: () -> @creditCardNumberInput.val().replace /\D/g, "" dataKey: () -> "ot-6mj5lng5b3bnnieo6ccf95p3eap4mjd" bin: () -> @creditCardNumber().substring 0, 6 responseCode: () -> if @validCreditCard() then "1" else "51" validCreditCard: () -> @creditCardNumber() in @validCreditCards defaults: () -> validCreditCards: ["4502285070000007", "4924190000003750", "4551210032790206", "4924190000000145", "4524000000015080", \ "4001272222222222", "5454545454545454", "5191111111111111", "5191222222222224", "5191333333333337", \ "5191444444444440", "5191555555555557", "5191666666666660", "5191777777777773", "5191888888888886"] creditCardNumberInput: $("#monerisDataInput") $(document).ready -> new MonerisSimulator.CreditCard
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
moneris_simulator-0.2.0 | app/assets/javascripts/moneris_simulator/credit_card.coffee |
moneris_simulator-0.1.1 | app/assets/javascripts/moneris_simulator/credit_card.coffee |