Class: Paynow::PaymentBuilder
- Inherits:
-
Object
- Object
- Paynow::PaymentBuilder
- Defined in:
- lib/paynow/payment_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(params) ⇒ Object
5 6 7 |
# File 'lib/paynow/payment_builder.rb', line 5 def self.build(params) new.build(params) end |
Instance Method Details
#build(attrs) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/paynow/payment_builder.rb', line 9 def build(attrs) payment = { id: id, returnurl: returnurl, resulturl: resulturl, status: "Message"} payment.merge!( required_info(attrs), optional_info(attrs) ) payment.tap do |p| p.delete(:method) if p[:method] == pay_with_paynow p.merge!(card_info(attrs), optional_card_info(attrs)) if p[:method] == visa_or_mastercard p.merge!(mobile_info(attrs)) if p[:method] == mobile_money end end |