Skip to content

Commit 3fb6ada

Browse files
committed
Add Subscription and update test case of payment screen
1 parent 255cffd commit 3fb6ada

File tree

11 files changed

+201
-103
lines changed

11 files changed

+201
-103
lines changed

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def run(self):
7979
'translations/*.ts', 'translations/*.qm', 'default.ini', 'sql/*.sql',
8080
'images/*.png', 'images/*.ico', 'images/*.icns',
8181
'bitmessagekivy/main.kv', 'bitmessagekivy/screens_data.json',
82-
'bitmessagekivy/kv/*.kv'
82+
'bitmessagekivy/kv/*.kv', 'images/kivy/payment/*.png', 'images/kivy/*.gif',
83+
'images/kivy/text_images*.png'
8384
]}
8485

8586
if sys.version_info[0] == 3:

src/bitmessagekivy/kv/payment.kv

Lines changed: 145 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,144 @@
1-
#:import get_color_from_hex kivy.utils.get_color_from_hex
2-
31
<Payment>:
42
name: "payment"
5-
BoxLayout:
6-
ScrollView:
7-
bar_width:0
8-
do_scroll_x: False
9-
#scroll_y:0
10-
3+
id: id_payment_screen
4+
payment_plan_id: ""
5+
MDTabs:
6+
id: tab_panel
7+
tab_display_mode:'text'
8+
Tab:
9+
title: app.tr._("Payment")
10+
id: id_payment plan
11+
padding: "12dp"
12+
spacing: "12dp"
1113
BoxLayout:
12-
spacing: dp(8)
13-
padding: dp(5)
14-
size_hint_y: None
15-
height: self.minimum_height
16-
orientation: "vertical"
17-
18-
ProductCategoryLayout:
19-
category_text: "Monthly-Subscriptions"
20-
21-
ProductLayout:
22-
heading_text: "Gas (Play Billing Codelab)"
23-
price_text: "$0.99"
24-
source: app.image_path + "/payment/buynew1.png"
25-
description_text: "Buy gasoline to ride!"
26-
product_id: "SKUGASBILLING"
27-
28-
ProductLayout:
29-
heading_text: "Upgrade your car (Play Billing Codelab)"
30-
price_text: "$1.49"
31-
source: app.image_path + "/payment/buynew1.png"
32-
description_text: "Buy a premium outfit for your car!"
33-
product_id: "SKUUPGRADECAR"
34-
35-
ProductLayout:
36-
heading_text: "Month in gold status (Play Billing Codelab)"
37-
price_text: "$0.99"
38-
source: app.image_path + "/payment/buynew1.png"
39-
description_text: "Enjoy a gold status for a month!"
40-
product_id: "SKUMONTHLYGOLD"
41-
42-
ProductCategoryLayout:
43-
category_text: "One-time payment"
44-
45-
ProductLayout:
46-
heading_text: "Gas (Play Billing Codelab)"
47-
price_text: "$0.99"
48-
source: app.image_path + "/payment/buynew1.png"
49-
description_text: "Buy gasoline to ride!"
50-
product_id: "SKUONETIMEGAS"
51-
52-
ProductCategoryLayout:
53-
category_text: "Annual-Subscriptions"
54-
55-
ProductLayout:
56-
heading_text: "Gas (Play Billing Codelab)"
57-
price_text: "$0.99"
58-
source: app.image_path + "/payment/buynew1.png"
59-
description_text: "Buy gasoline to ride!"
60-
product_id: "SKUANNUALGAS"
61-
62-
ProductLayout:
63-
heading_text: "Year in gold status (Play Billing Codelab)"
64-
price_text: "$10.99"
65-
source: app.image_path + "/payment/buynew1.png"
66-
description_text: "Enjoy a gold status for a year!"
67-
product_id: "SKUANNUALGOLD"
14+
ScrollView:
15+
bar_width:0
16+
do_scroll_x: False
17+
BoxLayout:
18+
spacing: dp(5)
19+
padding: dp(5)
20+
size_hint_y: None
21+
height: self.minimum_height
22+
orientation: "vertical"
23+
ProductCategoryLayout:
24+
MDCard:
25+
orientation: "vertical"
26+
padding: "8dp"
27+
spacing: "12dp"
28+
size_hint: None, None
29+
size: "560dp", "40dp"
30+
pos_hint: {"center_x": .5, "center_y": .5}
31+
MDLabel:
32+
text: f"You have {app.encrypted_messages_per_month} messages left"
33+
bold: True
34+
halign:'center'
35+
size_hint_y: None
36+
pos_hint: {"center_x": .5, "center_y": .5}
6837

38+
MDCard:
39+
orientation: "vertical"
40+
padding: "8dp"
41+
spacing: "12dp"
42+
size_hint: None, None
43+
size: "560dp", "300dp"
44+
md_bg_color: [1, 0.6, 0,0.5]
45+
pos_hint: {"center_x": .5, "center_y": .5}
46+
MDLabel:
47+
text: "Free"
48+
bold: True
49+
halign:'center'
50+
size_hint_y: None
51+
pos_hint: {"center_x": .5, "center_y": .5}
52+
MDRectangleFlatIconButton:
53+
text: "[Currently this plan is active.]"
54+
icon: 'shield-check'
55+
line_color: 0, 0, 0, 0
56+
text_color: 'ffffff'
57+
pos_hint: {"center_x": .5, "center_y": .5}
58+
font_size: '18sp'
59+
MDSeparator:
60+
height: "1dp"
61+
MDLabel:
62+
text: "You can get zero encrypted message per month"
63+
halign:'center'
64+
bold: True
65+
MDCard:
66+
orientation: "vertical"
67+
padding: "8dp"
68+
spacing: "12dp"
69+
size_hint: None, None
70+
size: "560dp", "300dp"
71+
md_bg_color: [0, 0.6, 0.8,0.8]
72+
pos_hint: {"center_x": .5, "center_y": .5}
73+
payment_plan_id: "sub_standard"
74+
MDLabel:
75+
text: "Standard"
76+
bold: True
77+
halign:'center'
78+
size_hint_y: None
79+
MDSeparator:
80+
height: "1dp"
81+
MDLabel:
82+
text: "You can get 100 encrypted message per month"
83+
halign:'center'
84+
MDRaisedButton:
85+
text: "Get it now"
86+
theme_text_color: 'Primary'
87+
md_bg_color: [1, 1, 1,1]
88+
pos_hint: {'center_x': .5}
89+
on_release:app.open_payment_layout(root.payment_plan_id)
90+
MDCard:
91+
orientation: "vertical"
92+
padding: "8dp"
93+
spacing: "12dp"
94+
size_hint: None, None
95+
size: "560dp", "300dp"
96+
md_bg_color: [1, 0.6, 0.8,0.5]
97+
pos_hint: {"center_x": .5, "center_y": .5}
98+
payment_plan_id: "sub_premium"
99+
MDLabel:
100+
text: "Premium"
101+
bold: True
102+
halign:'center'
103+
size_hint_y: None
104+
MDSeparator:
105+
height: "1dp"
106+
MDLabel:
107+
text: "You can get 1000 encrypted message per month"
108+
halign:'center'
109+
MDRaisedButton:
110+
text: "Get it now"
111+
theme_text_color: 'Primary'
112+
md_bg_color: [1, 1, 1,1]
113+
pos_hint: {'center_x': .5}
114+
on_release:app.open_payment_layout(root.payment_plan_id)
115+
Tab:
116+
title: app.tr._("Extra-Messages")
117+
id: id_payment_tab
118+
BoxLayout:
119+
ScrollView:
120+
bar_width:0
121+
do_scroll_x: False
122+
BoxLayout:
123+
spacing: dp(8)
124+
padding: dp(5)
125+
size_hint_y: None
126+
height: self.minimum_height
127+
orientation: "vertical"
128+
ProductCategoryLayout:
129+
category_text: "Extra-Messages"
130+
ProductLayout:
131+
heading_text: "100 Encrypted messages "
132+
price_text: "$0.99"
133+
source: app.image_path + "/payment/buynew1.png"
134+
description_text: "Buy extra one hundred encrypted messages!"
135+
product_id: "SKUGASBILLING"
136+
ProductLayout:
137+
heading_text: "1000 Encrypted messages "
138+
price_text: "$1.49"
139+
source: app.image_path + "/payment/buynew1.png"
140+
description_text: "Buy extra one thousand encrypted messages!"
141+
product_id: "SKUUPGRADECAR"
69142
<ProductCategoryLayout@BoxLayout>:
70143
size_hint_y: None
71144
height: self.minimum_height
@@ -94,7 +167,6 @@
94167
MDLabel:
95168
text: root.text_
96169
font_size: sp(15)
97-
98170
<ProductLayout>:
99171
heading_text: ""
100172
price_text: ""
@@ -117,7 +189,6 @@
117189
#heading area
118190
BoxLayout:
119191
size_hint_y: 0.3
120-
121192
#text heading
122193
BoxLayout:
123194
Widget:
@@ -169,7 +240,6 @@
169240
MDLabel:
170241
text: root.description_text
171242
font_size: sp(15)
172-
173243
#Button Area
174244
BoxLayout:
175245
size_hint_y: 0.4
@@ -201,7 +271,7 @@
201271
RightLabel:
202272
text: root.right_label_text
203273
theme_text_color: "Custom"
204-
text_color: 0,0,0,.4
274+
text_color: 0,0,0,0.5
205275
font_size: sp(12)
206276

207277
<PaymentMethodLayout>:
@@ -239,15 +309,17 @@
239309

240310
ListItemWithLabel:
241311
source: app.image_path + "/payment/btc.png"
242-
text: "BTC"
312+
text: "BTC (Currently this feature is not available)"
243313
method_name: "btc"
244-
314+
theme_text_color: 'Secondary'
315+
md_bg_color: [0, 0, 0,1]
245316
ListItemWithLabel:
246317
source: app.image_path + "/payment/paypal.png"
247-
text: "Paypal"
318+
text: "Paypal (Currently this feature is not available)"
248319
method_name: "som"
249-
320+
theme_text_color: 'Secondary'
321+
md_bg_color: [0, 0, 0,1]
250322
ListItemWithLabel:
251323
source: app.image_path + "/payment/buy.png"
252324
text: "One more method"
253-
method_name: "omm"
325+
method_name: "omm"

src/bitmessagekivy/main.kv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
on_release: app.root.ids.scr_mngr.current = 'set'
186186
on_release: root.parent.set_state()
187187
NavigationItem:
188-
text: app.tr._('Purchase')
188+
text: app.tr._('Payment plan')
189189
icon: 'shopping'
190190
divider: None
191191
on_release: app.root.ids.scr_mngr.current = 'payment'

src/bitmessagekivy/mpybit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from pybitmessage.bitmessagekivy.baseclass.login import * # noqa: F401, F403
4646
from pybitmessage.bitmessagekivy.uikivysignaler import UIkivySignaler
4747

48-
from pybitmessage.mock.helper_startup import loadConfig
48+
from pybitmessage.mock.helper_startup import loadConfig, total_encrypted_messages_per_month
4949

5050
logger = logging.getLogger('default')
5151

@@ -93,6 +93,7 @@ class NavigateApp(MDApp):
9393
identity_list = get_identity_list()
9494
image_path = load_image_path()
9595
app_platform = platform
96+
encrypted_messages_per_month = total_encrypted_messages_per_month()
9697
tr = Lang("en") # for changing in franch replace en with fr
9798

9899
def __init__(self):
Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from .telenium_process import TeleniumTestProcess
2-
from .common import skip_screen_checks
32
from .common import ordered
43

54

65
class PaymentScreen(TeleniumTestProcess):
7-
"""SubscriptionPayment Screen Functionality Testing"""
6+
"""Payment Plan Screen Functionality Testing"""
87

98
@ordered
10-
def test_select_subscription(self):
11-
"""Select Subscription From List of Subscriptions"""
9+
def test_select_payment_plan(self):
10+
"""Select Payment plan From List of payments"""
1211
# This is for checking Current screen
1312
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
1413
# Method to open the side navbar
@@ -18,35 +17,54 @@ def test_select_subscription(self):
1817
# assert for checking scroll function
1918
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
2019
# this is for opening Payment screen
21-
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5)
20+
self.cli.wait_click('//NavigationItem[@text=\"Payment plan\"]', timeout=5)
2221
# Checking the navbar is in closed state
2322
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
2423
# Assert for checking Current Screen
2524
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)
26-
# Scrolling Down Product list
25+
# Checking state of Current tab Payment plan
26+
self.assertExists(
27+
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Payment\"][@state=\"down\"]', timeout=5
28+
)
29+
# Scrolling Down Payment plan Cards
2730
self.drag(
28-
'//ProductCategoryLayout[0]/ProductLayout[0]',
29-
'//ProductCategoryLayout[0]/ProductLayout[1]')
30-
# assert for checking scroll function
31-
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5)
32-
# Scrolling Up Product list
33-
self.drag(
34-
'//ProductCategoryLayout[0]/ProductLayout[1]',
35-
'//ProductCategoryLayout[0]/ProductLayout[0]')
36-
# assert for checking scroll function
37-
self.assertCheckScrollUp('//Payment//ScrollView[0]', timeout=10)
38-
39-
@skip_screen_checks
40-
@ordered
41-
def test_buy_option(self):
42-
"""Check subscription"""
43-
# Click on BUY Button
44-
self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=5)
31+
'//Payment//MDTabs[0]//MDCard[2]//MDLabel[@text=\"Standard\"]',
32+
'//Payment//MDTabs[0]//MDCard[1]//MDLabel[@text=\"You can get zero encrypted message per month\"]'
33+
)
34+
# Checking the subscription offer cards
35+
self.assertExists(
36+
'//Payment/MDTabs[0]//MDCard[3]//MDLabel[@text=\"Premium\"]',
37+
timeout=10
38+
)
39+
# Checking the get it now button
40+
self.assertExists(
41+
'//Payment/MDTabs[0]//MDCard[3]//MDRaisedButton[@text=\"Get it now\"]',
42+
timeout=10
43+
)
44+
# Clicking on the get it now button
45+
self.cli.wait_click(
46+
'//Payment/MDTabs[0]//MDCard[3]//MDRaisedButton[@text=\"Get it now\"]',
47+
timeout=10
48+
)
49+
# Checking the Payment method popup
50+
self.assertExists('//PaymentMethodLayout//ScrollView[0]//ListItemWithLabel[0]', timeout=10)
4551
# CLick on the Payment Method
46-
self.cli.click_on('//ScrollView[0]//ListItemWithLabel[0]')
52+
self.cli.wait_click(
53+
'//PaymentMethodLayout//ScrollView[0]//ListItemWithLabel[0]',
54+
timeout=10
55+
)
4756
# Check pop up is opened
4857
self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=10)
4958
# Click out side to dismiss the popup
50-
self.cli.wait_click('//MDRaisedButton[5]', timeout=5)
51-
# Checking Current screen(Payment screen)
52-
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)
59+
self.cli.wait_click('//MDRaisedButton[1]', timeout=10)
60+
# Checking state of next tab Payment
61+
self.assertExists(
62+
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"][@state=\"normal\"]', timeout=5
63+
)
64+
# Clicking on Payment tab
65+
self.cli.wait_click('//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"]', timeout=5)
66+
# Checking state of payment tab after click
67+
self.assertExists(
68+
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"][@state=\"down\"]', timeout=5
69+
)
70+
self.cli.sleep(1)

src/images/kivy/payment/btc.png

3.45 KB
Loading

src/images/kivy/payment/buy.png

3.85 KB
Loading

src/images/kivy/payment/buynew1.png

4.14 KB
Loading

src/images/kivy/payment/gplay.png

27.1 KB
Loading

src/images/kivy/payment/paypal.png

3.29 KB
Loading

0 commit comments

Comments
 (0)