Class: ActiveMerchant::Billing::Integrations::Bill99Card::Helper
- Inherits:
-
Helper
- Object
- Helper
- ActiveMerchant::Billing::Integrations::Bill99Card::Helper
- Defined in:
- lib/active_merchant/billing/integrations/bill99_card/helper.rb
Instance Method Summary collapse
- #form_fields ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
- #sign ⇒ Object
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_merchant/billing/integrations/bill99_card/helper.rb', line 16 def initialize(order, account, = {}) [:amount] = ([:amount] * 100).to_i super(order, account, ) add_field('version', 'v2.0') add_field('language', '1') add_field('signType', '1') add_field('payType', '42') add_field('fullAmountFlag', '0') add_field('orderTime', DateTime.now.strftime("%Y%m%d%H%M%S")) end |
Instance Method Details
#form_fields ⇒ Object
27 28 29 |
# File 'lib/active_merchant/billing/integrations/bill99_card/helper.rb', line 27 def form_fields @fields.merge('signMsg' => sign) end |
#sign ⇒ Object
31 32 33 34 35 36 |
# File 'lib/active_merchant/billing/integrations/bill99_card/helper.rb', line 31 def sign Digest::MD5.hexdigest(%w(inputCharset bgUrl pageUrl version language signType merchantAcctId payerName payerContactType payerContact orderId orderAmount payType fullAmountFlag orderTime productName productNum productId productDesc ext1 ext2 bossType).collect{ |name| @fields[name].blank? ? "" : "#{name}=#{@fields[name]}" }.select{|s| !s.blank? }.join('&') + "&key=#{KEY[@fields['bossType']]}").upcase end |