14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/helpers/workarea/storefront/paypal_helper.rb', line 14
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}",
data: {
partner_attribution_id: 'Workarea_SP', client_token: @paypal_client_token
}.merge(data)
)
end
|