From ddc8329e60dd994905fbf93730e23d994ab92dd2 Mon Sep 17 00:00:00 2001 From: carnage Date: Sun, 21 Oct 2018 11:59:55 +0100 Subject: [PATCH 1/4] Create StripeKey.php --- src/View/Helper/StripeKey.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/View/Helper/StripeKey.php diff --git a/src/View/Helper/StripeKey.php b/src/View/Helper/StripeKey.php new file mode 100644 index 0000000..1ae54ee --- /dev/null +++ b/src/View/Helper/StripeKey.php @@ -0,0 +1,24 @@ +publishableKey = $publishableKey; + } + + public function __invoke() + { + return sprintf("Stripe.setPublishableKey('%s');", $this->publishableKey); + } +} From 3a346abcf4edd88b4e450243aa0925ac7a26f116 Mon Sep 17 00:00:00 2001 From: carnage Date: Sun, 21 Oct 2018 12:50:12 +0100 Subject: [PATCH 2/4] Create StripeKeyFactory --- src/View/Helper/StripeKeyFactory | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/View/Helper/StripeKeyFactory diff --git a/src/View/Helper/StripeKeyFactory b/src/View/Helper/StripeKeyFactory new file mode 100644 index 0000000..96f4988 --- /dev/null +++ b/src/View/Helper/StripeKeyFactory @@ -0,0 +1,15 @@ +get('Config'); + return new StripeKey($config['zfr_stripe']['publishable_key']); + } +} From e31460520f8eb207ff20b452ff29211131e85cb8 Mon Sep 17 00:00:00 2001 From: carnage Date: Sun, 21 Oct 2018 12:51:30 +0100 Subject: [PATCH 3/4] Update zfr_stripe.local.php.dist --- config/zfr_stripe.local.php.dist | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/zfr_stripe.local.php.dist b/config/zfr_stripe.local.php.dist index 60b3240..2f56fb2 100755 --- a/config/zfr_stripe.local.php.dist +++ b/config/zfr_stripe.local.php.dist @@ -24,7 +24,10 @@ return array( * Secret key */ // 'secret_key' => '', - + /** + * Publishable key + */ + // 'publishable_key' => '', /** * Stripe SDK version to use */ From 998ba1a210e7e5993f90d57232871b144bc677b9 Mon Sep 17 00:00:00 2001 From: carnage Date: Sun, 21 Oct 2018 12:52:48 +0100 Subject: [PATCH 4/4] Update Module.php --- Module.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Module.php b/Module.php index fd387b2..5679f8f 100755 --- a/Module.php +++ b/Module.php @@ -35,6 +35,11 @@ public function getConfig() return [ 'service_manager' => $configProvider->getDependencies(), + 'view_helpers' => [ + 'factories' => [ + 'stripeKey' => \ZfrStripeModule\View\Helper\StripeKeyFactory::class, + ], + ], ]; } }