-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #1219 redirect thank you page url * Fix #1219 added new route for thank you URL * wip #1219 adding a form to change the thankyou page url * adding the custom_thank_you_page database column * Fix #1219 updated page text I updated the text on the "add custom thank you page" * FIX #1219 adding url validation * #1219 adding tests * black formatting * Update custom_thank_you_page.html Added bold text and reworded the instructions * Fix #1236 Updated the Shop Settings Heading in the dashboard Added Donations & Thank you Page URL in the heading of Shop Settings * fixing wording * Fix #1219 improve wording on Custom Thank You page URL #1219 added heading to settings page Custom Thank You page URL #1219 less vuage "Your URL" to -> "Custom Thank You page URL:" * #1219 require require_tld=True customThankYouUrlForm * #1219 Please enter a valid URL -> Please enter a valid URL. e.g https://example.com/thankyou * #1219 add form error help feedback * Ref #1219 dont assume form is present, error handling * satify black format error * #1219 remove redundant cudtom thankyou url logic * adding the redirect-to-custom-url test * adding default url button * fixing enable custom url test * renaming file and adding waitForURL after redirect * #1219 spacing * #1219 use custom_thank_you_url, no need for redirect_thankyou_page * #1219 if a custom_thank_you_url is already set, show it to the shop admin * #1219 clarified wording 'once their payment is complete' -> 'once they have completed sign-up for a plan' -m 'because free plans exist, payment is not always taken.' * #1219 remove dead "Click here to reset your shop to use the default Thank You page" text * #1219 Test: no need to order plan. Use free plan for test We're not testing the payment flow there, we're testing the custom thankyou page url' ' * #1219 drop .toMatchSnapshot we dont use that * #1219 remove unecessery entries in the test DAG * Ref #1219 remove uneeded timeout & renamed: e2e/1219_shop_owner_enable_custom_url.spec.js -> e2e/1219_custom_thank_you_url.spec.js * Create pull_request_template.md * #1219 redirect thank you page url * Fix #1219 added new route for thank you URL * wip #1219 adding a form to change the thankyou page url * adding the custom_thank_you_page database column * Fix #1219 updated page text I updated the text on the "add custom thank you page" * FIX #1219 adding url validation * Ref #1219 adding tests * black formatting * Update custom_thank_you_page.html Added bold text and reworded the instructions * Fix #1236 Updated the Shop Settings Heading in the dashboard Added Donations & Thank you Page URL in the heading of Shop Settings * fixing wording * Fix #1219 improve wording on Custom Thank You page URL #1219 added heading to settings page Custom Thank You page URL #1219 less vuage "Your URL" to -> "Custom Thank You page URL:" * #1219 require require_tld=True customThankYouUrlForm * #1219 Please enter a valid URL -> Please enter a valid URL. e.g https://example.com/thankyou * #1219 add form error help feedback * Ref #1219 dont assume form is present, error handling * #1219 remove redundant cudtom thankyou url logic * adding the redirect-to-custom-url test * adding default url button * renaming file and adding waitForURL after redirect * #1219 spacing * #1219 use custom_thank_you_url, no need for redirect_thankyou_page * #1219 if a custom_thank_you_url is already set, show it to the shop admin * #1219 clarified wording 'once their payment is complete' -> 'once they have completed sign-up for a plan' -m 'because free plans exist, payment is not always taken.' * #1219 remove dead "Click here to reset your shop to use the default Thank You page" text * #1219 remove unecessery entries in the test DAG --------- Co-authored-by: Joel <joel@karmacomputing.co.uk> Co-authored-by: chrisjsimpson <chris.j.simpson@live.co.uk>
- Loading branch information
1 parent
c2031a8
commit 29fa7c5
Showing
13 changed files
with
208 additions
and
10 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
migrations/versions/207556b3039b_add_custom_thank_you_url_column.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""add custom thank you url column | ||
Revision ID: 207556b3039b | ||
Revises: 7640c2a9be5b | ||
Create Date: 2023-09-01 19:35:12.241628 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "207556b3039b" | ||
down_revision = "7640c2a9be5b" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column( | ||
"setting", sa.Column("custom_thank_you_url", sa.String(), nullable=True) | ||
) | ||
|
||
|
||
def downgrade(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
subscribie/blueprints/admin/templates/admin/settings/custom_thank_you_page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% extends "admin/layout.html" %} | ||
{% block title %} Add Custom Thank you page{% endblock %} | ||
|
||
{% block body %} | ||
|
||
<h2 class="text-center text-dark mb-3">Custom Thank You Page url</h2> | ||
|
||
<div class="container"> | ||
<ul class="breadcrumb"> | ||
<li class="breadcrumb-item"><a href="/">Shop</a></li> | ||
<li class="breadcrumb-item"><a href="{{ url_for('admin.dashboard') }}">Manage My Shop</a></li> | ||
<li class="breadcrumb-item active" aria-current="page">Custom Thank You Page URL</li> | ||
</ul> | ||
</div> | ||
|
||
<main> | ||
<div class="section"> | ||
<div class="container"> | ||
|
||
<div class="row row-cols-1 row-cols-md-2"> | ||
<div class="col-md-7"> | ||
<h2>Custom Thank You page URL</h2> | ||
<p> | ||
By default, your Subscribers get sent to the default thank you page '/thankyou'.<br /> | ||
For most shop owners the default is perfect and no change is needed.<br/><br /> | ||
Some shop owners, however, prefer to direct their Subscribers <em>somehwere else</em> after they | ||
have subscribed.</p> | ||
<p>If you would like to set a custom thank you page URL, set one below.</p> | ||
<p>Otherwise, keep the default.</p> | ||
<p> | ||
Please type the exact URL you want your subscribers taken to automatically after subscribing to a plan. Your subscribers will be taken to this page once they have completed sign-up for a plan. | ||
</p> | ||
|
||
<form action="" method="POST" action="/"> | ||
{{ form.csrf_token }} | ||
<div class="form-group"> | ||
<label for="custom_thank_you_url"><b>Custom Thank You page URL:</b></label> | ||
<input type="url" name="custom_thank_you_url" class="form-control" | ||
id="custom_thank_you_url" aria-describedby="custom_thank_you_url" | ||
value="{{ settings.custom_thank_you_url or '' }}" | ||
placeholder="https://example.com/thankyou" required> | ||
</div> | ||
<button name="Save" type="submit" class="btn btn-primary btn-block mb-3">Save</button> | ||
</form> | ||
<form action="" method="POST" action="/"> | ||
{{ form.csrf_token }} | ||
<button for="default_thank_you_url" value = "default" name="default" type="submit" class="btn btn-info btn-block mb-3">Use default thank you page</button> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> <!-- end container--> | ||
</div> <!-- end section--> | ||
</main> | ||
|
||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/browser-automated-tests-playwright/e2e/1219_custom_thank_you_url.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; | ||
const { admin_login } = require('./features/admin_login'); | ||
test.describe("order free plan tests:", () => { | ||
test("@1219 @shop-owner @1219_custom_thank_you_url @1219_shop-owner_enable_custom_url", async ({ page }) => { | ||
|
||
await admin_login(page); | ||
await page.goto('/admin/change-thank-you-url'); | ||
await page.fill('#custom_thank_you_url', 'https://www.google.com'); | ||
await page.click('role=button[name="Save"]'); | ||
const custom_url = await page.textContent('text="Custom thank you url changed to: https://www.google.com"'); | ||
expect(custom_url === 'Custom thank you url changed to: https://www.google.com'); | ||
|
||
console.log("Ordering plan with only recurring charge..."); | ||
// Buy item with subscription & upfront fee | ||
await page.goto("/"); // Go to home before selecting product | ||
await page.click('[name="Free plan"]'); | ||
|
||
// Fill in order form | ||
await page.fill('#given_name', 'John'); | ||
await page.fill('#family_name', 'Smith'); | ||
await page.fill('#email', SUBSCRIBER_EMAIL_USER); | ||
await page.fill('#mobile', '07123456789'); | ||
await page.fill('#address_line_one', '123 Short Road'); | ||
await page.fill('#city', 'London'); | ||
await page.fill('#postcode', 'L01 T3U'); | ||
await page.click('.btn-primary-lg'); | ||
|
||
// Verify get to the thank you page order complete | ||
await page.waitForURL('https://www.google.com'); | ||
//changing it back to the default | ||
await page.goto('/admin/change-thank-you-url'); | ||
await page.getByRole('button', { name: 'default'}).click(); | ||
await new Promise(x => setTimeout(x, 2000)); | ||
const default_custom_url = await page.textContent('text="Custom thank you url changed to default"'); | ||
expect(default_custom_url === 'Custom thank you url changed to default'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters