Sha256: 9fec857c8d0a930f261cddff980ee3f76c1bad963237a10520dcdb55d0d033b7
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Workarea module Storefront module PaypalHelper def set_paypal_client_token return unless Workarea::Paypal.gateway.configured? @paypal_client_token = if Workarea.config.use_paypal_hosted_fields request = Workarea::Paypal.gateway.generate_token(user: current_user) request.result.client_token end end def include_paypal_javascript_tag(params: {}, data: {}) return unless Workarea::Paypal.gateway.configured? params = Workarea.config.paypal_sdk_params .merge('client-id' => Workarea::Paypal.gateway.client_id) .merge(params) .compact components = params['components'].to_s.split(',') components << 'buttons' components << 'hosted-fields' if Workarea.config.use_paypal_hosted_fields params['components'] = components.compact.uniq.join(',') javascript_include_tag( "https://www.paypal.com/sdk/js?#{params.to_query}", async: true, data: { partner_attribution_id: 'Workarea_SP', # Do not change this client_token: @paypal_client_token }.merge(data) ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-paypal-3.0.6 | app/helpers/workarea/storefront/paypal_helper.rb |
workarea-paypal-3.0.5 | app/helpers/workarea/storefront/paypal_helper.rb |