mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
Add 'publishable_key' property to Stripe module (enables stubbing)
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
= @obfuscated_secret_key
|
||||
.publishable_key
|
||||
%strong= t('.instance_publishable_key') + ":"
|
||||
= ENV["STRIPE_INSTANCE_PUBLISHABLE_KEY"]
|
||||
= Stripe.publishable_key
|
||||
- if !@stripe_account[:charges_enabled]
|
||||
.alert-box.warning
|
||||
= t(".charges_enabled_warning")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%fieldset#payment
|
||||
:javascript
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{ENV['STRIPE_INSTANCE_PUBLISHABLE_KEY']}"))
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{Stripe.publishable_key}"))
|
||||
%ng-form{"ng-controller" => "PaymentCtrl", name: "payment"}
|
||||
|
||||
%h5{"ng-class" => "{valid: payment.$valid, dirty: payment.$dirty || submitted}"}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
= inject_saved_credit_cards
|
||||
|
||||
:javascript
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{ENV['STRIPE_INSTANCE_PUBLISHABLE_KEY']}"))
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{Stripe.publishable_key}"))
|
||||
|
||||
.row.pad-top
|
||||
.small-12.columns.pad-top
|
||||
|
||||
@@ -1,2 +1,13 @@
|
||||
# Add the :publishable_key property, to allow us to access this
|
||||
# property from the object, rather than calling from ENV directly.
|
||||
# This is mostly useful for stubbing when testing, but also feels
|
||||
# a bit cleaner than accessing keys in different ways.
|
||||
module Stripe
|
||||
class << self
|
||||
attr_accessor :publishable_key
|
||||
end
|
||||
end
|
||||
|
||||
Stripe.api_key = ENV['STRIPE_INSTANCE_SECRET_KEY']
|
||||
Stripe.publishable_key = ENV['STRIPE_INSTANCE_PUBLISHABLE_KEY']
|
||||
Stripe.client_id = ENV['STRIPE_CLIENT_ID']
|
||||
|
||||
Reference in New Issue
Block a user