-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into EP-2261-bco-premiums
- Loading branch information
Showing
266 changed files
with
14,155 additions
and
6,604 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [staging, master] | ||
pull_request: | ||
branches: [staging, master] | ||
workflow_dispatch: | ||
# Allows manual build and deploy of any branch/ref | ||
inputs: | ||
auto-deploy: | ||
type: boolean | ||
description: Deploy image after building? | ||
required: true | ||
default: 'false' | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.10.0 | ||
|
||
- name: Install Dependencies | ||
run: yarn install --immutable --immutable-cache | ||
|
||
- name: Lint Check | ||
run: yarn lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Help Codecov detect commit SHA | ||
fetch-depth: 2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.10.0 | ||
|
||
- name: Install Dependencies | ||
run: yarn install --immutable --immutable-cache | ||
|
||
- name: Run Tests | ||
run: yarn test | ||
|
||
- name: Upload Codecov Reports | ||
uses: codecov/codecov-action@v2 | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ (github.ref == 'refs/heads/master' && 'production') || 'staging' }} | ||
needs: [lint, test] | ||
if: (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.auto-deploy == 'true') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.10.0 | ||
|
||
- name: Install Dependencies | ||
run: yarn install --immutable --immutable-cache | ||
|
||
- name: Build App | ||
env: | ||
S3_GIVE_DOMAIN: //${{ secrets.GIVE_WEB_HOSTNAME }} | ||
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }} | ||
DATADOG_RUM_CLIENT_TOKEN: ${{ secrets.DATADOG_RUM_CLIENT_TOKEN }} | ||
run: yarn run build | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@036a4a1ddf2c0e7a782dca6e083c6c53e5d90321 | ||
with: | ||
aws-region: us-east-1 | ||
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | ||
|
||
# Deploying to S3 with the --delete flag can be problematic if a cached file references a deleted file | ||
# Solution: deploy once without deleting old files, invalidate the Cloudfront cache, then deploy a second time with the flag to delete previous files | ||
- name: Deploy to S3 | ||
run: aws s3 sync dist s3://${{ secrets.AWS_WEB_STATIC_BUCKET_NAME }} --region us-east-1 --acl public-read --cache-control 'public, max-age=300' | ||
|
||
- name: AWS Cloudfront | ||
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" | ||
|
||
- name: Deploy to S3 and Delete Previous Files | ||
run: aws s3 sync dist s3://${{ secrets.AWS_WEB_STATIC_BUCKET_NAME }} --region us-east-1 --acl public-read --cache-control 'public, max-age=300' --delete |
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,20 @@ | ||
name: Update staging | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [labeled, synchronize] | ||
|
||
jobs: | ||
update-staging: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'On Staging') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: 🖇️ Merge current branch into staging | ||
uses: devmasx/[email protected] | ||
with: | ||
type: now | ||
target_branch: 'staging' | ||
github_token: ${{ github.token }} |
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 |
---|---|---|
|
@@ -4,9 +4,12 @@ dist | |
.DS_STORE | ||
coverage | ||
*.iml | ||
.vscode | ||
|
||
*.log | ||
*.back.* | ||
.sass-cache | ||
stats.json | ||
*.iml | ||
|
||
# asdf | ||
.tool-versions |
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,2 @@ | ||
nodejs 16.10.0 | ||
yarn 1.22.17 |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# give-web | ||
## Angular front-end components for use in AEM on [give.cru.org](https://give.cru.org) | ||
|
||
[![Build Status](https://travis-ci.org/CruGlobal/give-web.svg?branch=master)](https://travis-ci.org/CruGlobal/give-web) | ||
[![Build Status](https://github.com/CruGlobal/give-web/actions/workflows/build.yml/badge.svg)](https://github.com/CruGlobal/give-web/actions) | ||
[![codecov](https://codecov.io/gh/CruGlobal/give-web/branch/master/graph/badge.svg)](https://codecov.io/gh/CruGlobal/give-web) | ||
|
||
## Usage | ||
|
@@ -57,7 +57,9 @@ Add the following code to your page where appropriate. See the [Branded checkout | |
donor-details="<window variable containing default values for donor's name and contact info>" | ||
show-cover-fees="true" | ||
on-order-completed="$event.$window.onOrderCompleted($event.purchase)" | ||
on-order-failed="$event.$window.onOrderFailed($event.donorDetails)"> | ||
on-order-failed="$event.$window.onOrderFailed($event.donorDetails)" | ||
radio-station-api-url="https://api.domain.com/getStations" | ||
radio-station-radius="100"> | ||
</branded-checkout> | ||
|
||
<script src="https://give-static.cru.org/branded-checkout.v2.js"></script> | ||
|
@@ -131,28 +133,32 @@ The `<branded-checkout>` element is where the branded checkout Angular app will | |
- `on-order-completed` - an Angular expression that is executed when the order was submitted successfully - *Optional* - provides 2 variables: | ||
- `$event.$window` - Provides access to the browser's global `window` object. This allows you to call a custom callback function like `onOrderCompleted` in the example. | ||
- `$event.purchase` - contains the order's details that are loaded for the thank you page | ||
- `radio-station-api-url` - Provides a URL path for fetching a list of radio stations in the donor's vicinity. If you plan to use this feature, contact Cru's Digital Products and Services (DPS) department ([help@cru.org](mailto:help@cru.org)) to have your URL domain whitelisted to interact with our API - *Optional* | ||
- `radio-station-radius` - Provides a radius (in miles) for fetching a list of radio stations in the donor's vicinity - *Optional* | ||
#### Server-side configuration for a new branded checkout domain | ||
1. Figure out what domain you will be hosting the branded checkout form on. For example, `myministry.org` | ||
2. Make sure HTTPS is enabled on that domain | ||
3. You will need to setup a subdomain for the give.cru.org API. We've experienced cross-domain cookie issues trying to hit the give.cru.org API directly from a custom domain. Create a CNAME record for `brandedcheckout.myministry.org` (the subdomain could be different but using that suggested subdomain makes it consistent with other sites) and point it at `give.cru.org`. | ||
4. In order to accept credit cards on your own domain, you will need to setup a TSYS merchant account. Contact the Cru's Financial Services Group ([chad.vaughan@cru.org](mailto:chad.vaughan@cru.org)) if you don't already have one. You will need a TSYS device id (a numeric id around 14 digits) to complete step 6. | ||
3. You will need to setup a subdomain for the give.cru.org API. We've experienced cross-domain cookie issues trying to hit the give.cru.org API directly from a custom domain. Create a CNAME record for `brandedcheckout.myministry.org` (the subdomain could be different but using that suggested subdomain makes it consistent with other sites) and point it at `cortex-gateway-production-alb-425941461.us-east-1.elb.amazonaws.com`. | ||
4. In order to accept credit cards on your own domain, you will need a new TSYS device id (a numeric id around 14 digits) associated with one of our Merchant Accounts. Contact the Cru's Financial Services Group ([hazel.mcpherson@cru.org](mailto:hazel.mcpherson@cru.org)) and request one. You will use the device id to complete step 6. | ||
5. To prepare for the next step, think of a unique identifier like `"jesusfilm"` or `"aia"` that uniquely identifies your ministry and domain. We can create this for you but we need enough information about your ministry to do so. | ||
6. Once you have completed the steps above, contact Cru's Digital Products and Services (DPS) department ([help@cru.org](mailto:help@cru.org)). Below is an example email: (replace the `{{}}`s with the info for your site) | ||
|
||
> I'm working on implementing branded checkout for {{my ministry}}. I would like to host the branded checkout form on {{myminsitry.org}}. HTTPS is setup on my domain and I have created a CNAME record for the subdomain {{brandedcheckout.myministry.org}} that points to give.cru.org. (DPS may be able to help with the CNAME record configuration if the domain is hosted with us.) | ||
> I'm working on implementing branded checkout for {{my ministry}}. I would like to host the branded checkout form on {{myminsitry.org}}. HTTPS is setup on my domain and I have created a CNAME record for the subdomain {{brandedcheckout.myministry.org}} that points to cortex-gateway-production-alb-425941461.us-east-1.elb.amazonaws.com. (DPS may be able to help with the CNAME record configuration if the domain is hosted with us.) | ||
> | ||
> I need help configuring the give.cru.org API to work on my domain. Can you: | ||
> - Add an SSL certificate to cruorg-alb for my subdomain {{brandedcheckout.myministry.org}} | ||
> - Add that same subdomain to cortex_gateway's AUTH_PROXY_VALID_ORIGINS environment variable | ||
> - Add the user facing domain to the maintenence app's cortex_gateway CORS Whitelist | ||
> - Add the user facing domain to the maintenance app's cortex_gateway CORS Whitelist | ||
> | ||
> I also need help setting up a my TSYS merchant account with the give.cru.org API to be able to proccess credit cards on my site. Can you: | ||
> - Add my TSYS device id to the give.cru.org API configuration. My device id is {{12345678901234}} and the url I would like to use for the branded checkout form is {{https://myministry.org}}. I would like to use a identifier of "{{myministry}}". (Or uniquely describe your ministry and domain if you want DPS to create the identifier. We can't have multiple sites that use the same identifier.) | ||
> - Whitelist my site {{https://myministry.org}} with TSYS so their TSEP credit card tokenization services will work on my domain. | ||
> - Whitelist my domain {{myminisry.org}} with Recaptcha. | ||
|
||
7. Test the subdomain configured to point to the give.cru.org API. https://brandedcheckout.myministry.org/cortex/nextdrawdate is a good test url. There should be no certificate errors and you should get a response that looks like this `{"next-draw-date":"2018-09-27"}`. If there are errors, please get in touch with ([[email protected]](mailto:[email protected])) again and provide details as to what is happening. | ||
8. Add the `<branded-checkout>` tag to a page on the domain you've configured above. You can follow the documentation above for all the possible attributes and the required style and script tags. The email conversations above should have provided the values for the `api-url` (the subdomain that has a CNAME to give.cru.org) and `tsys-device` (the unique string identifier created by you or by DPS) attributes. You can add them like this: | ||
8. Add the `<branded-checkout>` tag to a page on the domain you've configured above. You can follow the documentation above for all the possible attributes and the required style and script tags. The email conversations above should have provided the values for the `api-url` (the subdomain that has a CNAME to cortex-gateway-production-alb-425941461.us-east-1.elb.amazonaws.com) and `tsys-device` (the unique string identifier created by you or by DPS) attributes. You can add them like this: | ||
```html | ||
<branded-checkout | ||
designation-number="0763355" | ||
|
@@ -161,7 +167,7 @@ The `<branded-checkout>` element is where the branded checkout Angular app will | |
</branded-checkout> | ||
<script src="https://give-static.cru.org/branded-checkout.v2.js"></script> | ||
``` | ||
9. If you go to this page in a browser, you should see the `<branded-checkout>` tag fill with content. There should also be no errors in the browser's console. If you see errors that appear to be caused by branded checkout please contact us. | ||
9. If you go to this page in a browser, you should see the `<branded-checkout>` tag fill with content. There should also be no errors in the browser's console. If you see errors that appear to be caused by branded checkout please contact us at [help@cru.org](mailto:help@cru.org). | ||
|
||
## Development | ||
|
||
|
@@ -191,7 +197,7 @@ Note: For session cookies to work correctly, add an entry to your hosts file for | |
Use the `cortexApiService` which provides convenience methods for sending requests to Cortex. For more documentation see the [cortexApiService docs](docs/cortexApiService.md). | ||
|
||
### Staging Environment | ||
Replace `https://give-static.cru.org` with `https://cru-givestage.s3.amazonaws.com` to use the staging environment. | ||
Replace `https://give-static.cru.org` with `https://give-stage-static.cru.org` to use the staging environment. | ||
|
||
### Deployments | ||
|
||
|
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
Oops, something went wrong.