Class: OffsitePayments::Integrations::PayflowLink::Helper
- Includes:
- ActiveUtils::PostsData
- Defined in:
- lib/offsite_payments/integrations/payflow_link.rb
Direct Known Subclasses
OffsitePayments::Integrations::PaypalPaymentsAdvanced::Helper
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #billing_address(params = {}) ⇒ Object
- #customer(params = {}) ⇒ Object
- #description(value) ⇒ Object
- #form_fields ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #form_method, inherited, mapping, #raw_html_fields, #shipping_address, #test?
Methods included from MoneyCompatibility
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/offsite_payments/integrations/payflow_link.rb', line 18 def initialize(order, account, = {}) super add_field('login', account) add_field('echodata', 'True') add_field('user2', self.test?) add_field('invoice', order) add_field('vendor', account) add_field('user', [:credential4].presence || account) add_field('trxtype', [:transaction_type] || 'S') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OffsitePayments::Helper
Instance Method Details
#billing_address(params = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/offsite_payments/integrations/payflow_link.rb', line 56 def billing_address(params = {}) # Get the country code in the correct format # Use what we were given if we can't find anything country_code = lookup_country_code(params.delete(:country)) add_field(mappings[:billing_address][:country], country_code) add_field(mappings[:billing_address][:address], [params.delete(:address1), params.delete(:address2)].compact.join(' ')) province_code = params.delete(:state) add_field(mappings[:billing_address][:state], province_code.blank? ? 'N/A' : province_code.upcase) # Everything else params.each do |k, v| field = mappings[:billing_address][k] add_field(field, v) unless field.nil? end end |
#customer(params = {}) ⇒ Object
51 52 53 54 |
# File 'lib/offsite_payments/integrations/payflow_link.rb', line 51 def customer(params = {}) add_field(mappings[:customer][:first_name], params[:first_name]) add_field(mappings[:customer][:last_name], params[:last_name]) end |
#description(value) ⇒ Object
47 48 49 |
# File 'lib/offsite_payments/integrations/payflow_link.rb', line 47 def description(value) add_field('description', normalize("#{value}").delete("#")) end |
#form_fields ⇒ Object
74 75 76 77 78 |
# File 'lib/offsite_payments/integrations/payflow_link.rb', line 74 def form_fields token, token_id = request_secure_token {"securetoken" => token, "securetokenid" => token_id, "mode" => test? ? "test" : "live"} end |