12
12
use Magento \Framework \Locale \ResolverInterface ;
13
13
use Magento \Store \Model \ScopeInterface ;
14
14
use Magento \Store \Model \StoreManagerInterface ;
15
+ use Magento \Paypal \Model \Payflowpro ;
15
16
16
17
/**
17
18
* Provides configuration values for PayPal in-context checkout
@@ -43,18 +44,25 @@ class SmartButtonConfig
43
44
*/
44
45
private $ sdkUrl ;
45
46
47
+ /**
48
+ * @var Payflowpro
49
+ */
50
+ private $ payflowpro ;
51
+
46
52
/**
47
53
* @param ResolverInterface $localeResolver
48
54
* @param ConfigFactory $configFactory
49
55
* @param ScopeConfigInterface $scopeConfig
50
56
* @param SdkUrl $sdkUrl
57
+ * @param Payflowpro $payflowpro
51
58
* @param array $defaultStyles
52
59
*/
53
60
public function __construct (
54
61
ResolverInterface $ localeResolver ,
55
62
ConfigFactory $ configFactory ,
56
63
ScopeConfigInterface $ scopeConfig ,
57
64
SdkUrl $ sdkUrl ,
65
+ Payflowpro $ payflowpro ,
58
66
$ defaultStyles = []
59
67
) {
60
68
$ this ->localeResolver = $ localeResolver ;
@@ -63,6 +71,7 @@ public function __construct(
63
71
$ this ->scopeConfig = $ scopeConfig ;
64
72
$ this ->defaultStyles = $ defaultStyles ;
65
73
$ this ->sdkUrl = $ sdkUrl ;
74
+ $ this ->payflowpro = $ payflowpro ;
66
75
}
67
76
68
77
/**
@@ -77,13 +86,15 @@ public function getConfig(string $page): array
77
86
Data::XML_PATH_GUEST_CHECKOUT ,
78
87
ScopeInterface::SCOPE_STORE
79
88
);
89
+ $ config = $ this ->payflowpro ->getConfig ();
80
90
return [
81
91
'styles ' => $ this ->getButtonStyles ($ page ),
82
92
'isVisibleOnProductPage ' => (bool )$ this ->config ->getValue ('visible_on_product ' ),
83
93
'isGuestCheckoutAllowed ' => $ isGuestCheckoutAllowed ,
84
94
'sdkUrl ' => $ this ->sdkUrl ->getUrl (),
85
95
'dataAttributes ' => [
86
- 'data-partner-attribution-id ' => 'BN_CODE '
96
+ 'data-partner-attribution-id ' => $ config ->getBuildNotationCode () != '' ?
97
+ $ config ->getBuildNotationCode () : ''
87
98
]
88
99
];
89
100
}
0 commit comments