Skip to content

Commit f609453

Browse files
authored
fix: Add public payment gateway key in settings (#7197)
1 parent 3d85419 commit f609453

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

app/api/schema/settings.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,34 @@ class Meta:
7474
is_omise_activated = fields.Bool(dump_only=True)
7575
is_alipay_activated = fields.Bool(dump_only=True)
7676

77+
#
78+
# Payment Gateways
79+
#
80+
81+
# Stripe Credantials
82+
stripe_client_id = fields.Str(dump_only=True)
83+
stripe_publishable_key = fields.Str(dump_only=True)
84+
stripe_test_client_id = fields.Str(dump_only=True)
85+
stripe_test_publishable_key = fields.Str(dump_only=True)
86+
87+
# PayPal Credentials
88+
paypal_mode = fields.Str(dump_only=True)
89+
paypal_client = fields.Str(dump_only=True)
90+
paypal_sandbox_client = fields.Str(dump_only=True)
91+
92+
# Omise Credentials
93+
omise_mode = fields.Str(dump_only=True)
94+
omise_test_public = fields.Str(dump_only=True)
95+
omise_live_public = fields.Str(dump_only=True)
96+
97+
# Alipay Credentials
98+
alipay_publishable_key = fields.Str(dump_only=True)
99+
100+
# payTM credentials
101+
paytm_mode = fields.Str(dump_only=True)
102+
paytm_live_merchant = fields.Str(dump_only=True)
103+
paytm_sandbox_merchant = fields.Str(dump_only=True)
104+
77105

78106
class SettingSchemaNonAdmin(SettingSchemaPublic):
79107
"""
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import json
2+
3+
4+
def test_payment_gateway(db, client):
5+
response = client.get('/v1/settings')
6+
assert response.status_code == 200
7+
data = json.loads(response.data)["data"]["attributes"]
8+
assert "stripe-client-id" in data
9+
assert "stripe-publishable-key" in data
10+
assert "stripe-test-client-id" in data
11+
assert "stripe-test-publishable-key" in data
12+
assert "paypal-client" in data
13+
14+
# Negative test cases
15+
assert "stripe_secret_key" not in data
16+
assert "stripe_test_secret_key" not in data

0 commit comments

Comments
 (0)