Skip to content

Commit 720b43e

Browse files
committed
AC-1228::BN code attribute into Paypal JSSDK script
1 parent 202bd44 commit 720b43e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

app/code/Magento/Paypal/Model/SmartButtonConfig.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public function getConfig(string $page): array
8181
'styles' => $this->getButtonStyles($page),
8282
'isVisibleOnProductPage' => (bool)$this->config->getValue('visible_on_product'),
8383
'isGuestCheckoutAllowed' => $isGuestCheckoutAllowed,
84-
'sdkUrl' => $this->sdkUrl->getUrl()
84+
'sdkUrl' => $this->sdkUrl->getUrl(),
85+
'dataAttributes' => [
86+
'data-partner-attribution-id' => 'BN_CODE'
87+
]
8588
];
8689
}
8790

app/code/Magento/Paypal/view/frontend/web/js/in-context/express-checkout-smart-buttons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ define([
6464
}
6565

6666
return function (clientConfig, element) {
67-
paypalSdk(clientConfig.sdkUrl).done(function (paypal) {
67+
paypalSdk(clientConfig.sdkUrl, clientConfig.dataAttributes).done(function (paypal) {
6868
paypal.Buttons({
6969
style: clientConfig.styles,
7070

app/code/Magento/Paypal/view/frontend/web/js/in-context/paypal-sdk.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define([
1313
* Loads the PayPal SDK object
1414
* @param {String} paypalUrl - the url of the PayPal SDK
1515
*/
16-
return function loadPaypalScript(paypalUrl) {
16+
return function loadPaypalScript(paypalUrl, dataAttributes) {
1717
//configuration for loaded PayPal script
1818
require.config({
1919
paths: {
@@ -23,6 +23,11 @@ define([
2323
paypalSdk: {
2424
exports: 'paypal'
2525
}
26+
},
27+
onNodeCreated: function(node, config, name, url){
28+
$.each(dataAttributes, function (index, elem) {
29+
node.setAttribute( index, elem);
30+
});
2631
}
2732
});
2833

0 commit comments

Comments
 (0)