Skip to content

Commit fb74b36

Browse files
committed
Forgot the access key parameter.
1 parent 7d950cf commit fb74b36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: flask_fastspring.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def __init__(self, app=None):
2424
self.storefront = None
2525
self.username = None
2626
self.password = None
27-
self.private_key = None
2827
self.openssl = None
28+
self.access_key = None
29+
self.private_key = None
2930
if app is not None:
3031
self.init_app(app)
3132

@@ -39,8 +40,10 @@ def init_app(self, app):
3940
Because FastSpring actually has a testing mode, these
4041
options are all mandatory.
4142
42-
The FASTSPRING_PRIVATE_KEY option is a path to the
43-
RSA private key used for encrypting secured payloads.
43+
For secure payloads, configure the path to the RSA
44+
private key with the FASTSPRING_PRIVATE_KEY option,
45+
and the API access key with the FASTSPRING_ACCESS_KEY
46+
option.
4447
"""
4548
app.extensions['fastspring'] = self
4649
self.storefront = app.config['FASTSPRING_STOREFRONT']
@@ -49,6 +52,7 @@ def init_app(self, app):
4952
private_key = app.config.get('FASTSPRING_PRIVATE_KEY')
5053
if private_key is not None:
5154
self.openssl = openssl_backend()
55+
self.access_key = app.config['FASTSPRING_ACCESS_KEY']
5256
with open(private_key, 'rb') as fp:
5357
self.private_key = load_pem_private_key(
5458
fp.read(), password=None, backend=self.openssl)
@@ -93,6 +97,7 @@ def render_head(self, webhook=None, session=None, payload=None):
9397
html = render_template_string(
9498
HEAD_TEMPLATE,
9599
storefront=self.storefront,
100+
access_key=self.access_key,
96101
webhook=webhook,
97102
session=session,
98103
payload=payload)
@@ -271,6 +276,7 @@ def milliseconds_to_datetime(m):
271276
src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.7.2/fastspring-builder.min.js"
272277
type="text/javascript"
273278
{% if webhook %}data-popup-closed="fastspringOnPopupClosed"{% endif %}
279+
{% if access_key %}data-access-key="{{ access_key }}"{% endif %}
274280
data-storefront="{{ storefront }}">
275281
</script>
276282
"""

0 commit comments

Comments
 (0)