Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier506 committed Jan 19, 2022
2 parents 5a4e4a5 + e75424f commit d832283
Show file tree
Hide file tree
Showing 19 changed files with 261 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push-dev-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
environment: dev
steps:
- name: Checkout Repo
uses: actions/checkout@v1
uses: actions/checkout@v2.4.0

- name: Setup Docker
uses: docker-practice/actions-setup-docker@0.0.1
uses: docker-practice/actions-setup-docker@1.0.8

- name: Log in to docker registry
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-prod-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
environment: production
steps:
- name: Checkout Repo
uses: actions/checkout@v1
uses: actions/checkout@v2.4.0

- name: Setup Docker
uses: docker-practice/actions-setup-docker@0.0.1
uses: docker-practice/actions-setup-docker@1.0.8

- name: Log in to docker registry
run: |
Expand Down
14 changes: 13 additions & 1 deletion hapi/src/routes/add-join-request.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const Joi = require('joi')
const Boom = require('@hapi/boom')

const { joinRequestService, affiliateService } = require('../services')
const { mailUtil } = require('../utils')
const { mailTemplate } = require('../utils/templates')

module.exports = {
method: 'POST',
Expand All @@ -14,9 +16,19 @@ module.exports = {
const joinRequest = await joinRequestService.findByAccount(input.account)
const hasKYC = await affiliateService.checkKyc(input.account)

if (isAnInvitee || joinRequest?.length || !hasKYC)
if (isAnInvitee || joinRequest?.length)
throw Boom.badRequest('Account does not meet requirements')

if (!hasKYC) {
mailUtil.send({
account: input.account,
to: input.email,
subject:
'Further action is required to activate your Proton Affiliate account',
template: mailTemplate.generateRejectionByKYC
})
}

const transaction = await joinRequestService.addJoinRequest(input)

return { id: transaction.id }
Expand Down
10 changes: 7 additions & 3 deletions hapi/src/routes/send-confirmation.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ const Joi = require('joi')
const Boom = require('@hapi/boom')

const {
mailUtil: { sendConfirmation }
mailUtil: { send }
} = require('../utils')
const {
mailTemplate: { generateConfirmation }
} = require('../utils/templates')
const {
joinRequestService: { findByAccount }
} = require('../services')
Expand All @@ -15,10 +18,11 @@ module.exports = {
try {
for (const account of input.accounts) {
const { email } = await findByAccount(account)
await sendConfirmation({
await send({
account: account,
to: email,
subject: 'You are ready to share your Proton referral link!'
subject: 'Welcome to the Proton Affiliate Program!',
template: generateConfirmation
})
}

Expand Down
9 changes: 3 additions & 6 deletions hapi/src/utils/mail.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ const nodemailer = require('nodemailer')
const {
mailConfig: { host, port, user, pass }
} = require('../config')
const {
mailTemplate: { generateConfirmationMail }
} = require('./templates')

const sendConfirmation = async ({ account, to, subject }) => {
const send = async ({ account, to, subject, template }) => {
try {
const transporter = nodemailer.createTransport({
host,
Expand All @@ -20,13 +17,13 @@ const sendConfirmation = async ({ account, to, subject }) => {
from: `Proton Affiliate <${user}>`,
to,
subject,
html: generateConfirmationMail({ account })
html: template({ account })
})
} catch (error) {
console.log(error)
}
}

module.exports = {
sendConfirmation
send
}
77 changes: 75 additions & 2 deletions hapi/src/utils/templates/mail.template.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const generateConfirmationMail = ({ account }) => {
const generateConfirmation = ({ account }) => {
return `
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -74,6 +74,79 @@ const generateConfirmationMail = ({ account }) => {
`
}

const generateRejectionByKYC = ({ account }) => {
return `
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<table style="margin-left: auto; margin-right: auto;">
<tr>
<div style="max-width: 640px; margin-left: auto; margin-right: auto;">
<a href="https://earnproton.com" style="text-decoration: none; margin: 40px 0px 0px 16px; width: 178px; height: 53px;">
<img style="object-fit: scale-down;" src="https://earnproton.com/icons/proton.png"/>
</a>
<p align="left" style="margin: 24px 16px 24px; font-family: Arial; font-size: 21px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: normal; letter-spacing: 0.15px; text-align: left; color: #000;">
${account} - Regarding Your Proton On-Chain Referral Program Request
</p>
<p align="left" style="margin: 0px 16px 8px; font-family: Arial; font-size: 16px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: 1.5; letter-spacing: 0.44px; text-align: left; color: #000;">
Your Proton referral link is not ready yet. To begin using the Proton Referral Program and start earning rewards, you must first complete the KYC (Know Your Client) authentication process in the Proton wallet.
</p>
<br>
<p align="left" style="margin: 0px 16px 24px; font-family: Arial; font-size: 16px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: 1.5; letter-spacing: 0.44px; text-align: left; color: #000; overflow-wrap: break-word;">
Please, go to the Proton wallet app and submit your KYC application. Once completed, you can start using your referral link. To find out what countries can complete a KYC, go to the Proton wallet app or ask in the Proton Telegram chat: https://t.me/protonxpr. If you're still having problems after confirming this information, please get in touch with us through Telegram: https://t.me/eoscr.
</p>
<p align="left" style="margin: 0px 16px 0px; font-family: Arial; font-size: 16px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: 1.5; letter-spacing: 0.44px; text-align: left; color: #000;">
Best Regards,
</p>
<br>
<p align="left" style="margin: 0px 16px 35px; font-family: Arial; font-size: 16px; font-weight: bold; font-stretch: normal; font-style: normal; line-height: 1.5; letter-spacing: 0.44px; text-align: left; color: #000;">
The Proton Affiliate Team
<br>
(Edenia, SoftAtom)
</p>
</div>
</tr>
<tr>
<div style="background-color: #000; margin-left: auto; margin-right: auto; padding-top: 20px;">
<p align="left" style="width: 348px; margin: 0px auto 8px auto; font-family: Arial; font-size: 12px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: 1.33; letter-spacing: 1.5px; text-align: center; color: #fff;">
THIS PROJECT WAS FUNDED THROUGH THE PROTON GOVERNANCE COMMITTEE WORKER PROPOSAL SYSTEM
</p>
<p align="left" style="flex-grow: 0; margin: 0px 16px 14px; font-family: Arial; font-size: 14px; font-weight: normal; font-stretch: normal; font-style: normal; line-height: 1.14; letter-spacing: 0.44px; text-align: center; color: #fff;">
<a href="https://forms.gle/GWHig5ciAvg5fdEH7" style="color: #fff;">
Apply Here for Funding
</a>
</p>
<div style="padding-bottom: 8px; text-align: center;">
<a href="https://www.facebook.com/protonxpr" style="text-decoration: none;">
<img style="width: 32px; height: 32px; margin-right: 16px;" src="https://earnproton.com/icons/facebook.png">
</a>
<a href="https://www.instagram.com/protonxpr" style="text-decoration: none;">
<img style="width: 32px; height: 32px; margin-right: 16px;" src="https://earnproton.com/icons/instagram.png">
</a>
<a href="https://twitter.com/protonxpr" style="text-decoration: none;">
<img style="width: 32px; height: 32px; margin-right: 16px;" src="https://earnproton.com/icons/twitter.png">
</a>
<a href="https://www.reddit.com/r/ProtonChain" style="text-decoration: none;">
<img style="width: 32px; height: 32px; margin-right: 16px;" src="https://earnproton.com/icons/reddit.png">
</a>
<a href="https://github.com/eoscostarica/proton-affiliate" style="text-decoration: none;">
<img style="width: 32px; height: 32px; margin-right: 16px;" src="https://earnproton.com/icons/github.png">
</a>
<a href="https://t.me/protonxpr" style="text-decoration: none;">
<img style="width: 32px; height: 32px;" src="https://earnproton.com/icons/telegram.png">
</a>
</div>
</div>
</tr>
</table>
</body>
`
}

module.exports = {
generateConfirmationMail
generateConfirmation,
generateRejectionByKYC
}
4 changes: 4 additions & 0 deletions hasura/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ type AddJoinRequestOutput {
id: String!
}

type SendJoinRequestRejectionOutput {
success: Boolean!
}

1 change: 1 addition & 0 deletions hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ custom_types:
- name: AddReferralOutput
- name: SendConfirmationOutput
- name: AddJoinRequestOutput
- name: SendJoinRequestRejectionOutput
scalars: []
1 change: 1 addition & 0 deletions hasura/metadata/databases/default/functions/functions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
2 changes: 2 additions & 0 deletions webapp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.DS_Store
2 changes: 1 addition & 1 deletion webapp/src/components/Loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Loader = () => {

return (
<div className={classes.root}>
<CircularProgress m={2} color="secondary" />
<CircularProgress m={2} color="primary" />
</div>
)
}
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/components/Loader/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default () => ({
justifyContent: 'center',
alignItems: 'center',
display: 'flex',
minHeight: '100%'
minHeight: '100%',
minWidth: '100%'
}
})
6 changes: 3 additions & 3 deletions webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"PENDING_PAYMENT": "Pending payment",
"PAYMENT_REJECTED": "Rejected",
"EXPIRED": "Expired",
"PAID": "Paid"
"PAID": "Paid",
"allStatus": "All status"
},
"routes": {
"/>title": "Affiliate Account Referrals Program on Proton Blockchain",
Expand Down Expand Up @@ -167,8 +168,7 @@
"menuAllRoles": "All roles",
"menuAdminRole": "Admin only",
"menuReferrerRole": "Referrers only",
"verified": "Verified",
"pending": "Pending"
"verified": "Verified"
},
"footer": {
"poweredBy": "Powered by",
Expand Down
9 changes: 8 additions & 1 deletion webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"login": "Ingresar",
"signOut": "Salir",
"lightMode": "Modo Claro",
"darkMode": "Modo Oscuro"
"darkMode": "Modo Oscuro",
"PENDING_USER_REGISTRATION": "Pendiente",
"PENDING_KYC_VERIFICATION": "KYC pendiente",
"PENDING_PAYMENT": "Pago pendiente",
"PAYMENT_REJECTED": "Rechazado",
"EXPIRED": "Expirado",
"PAID": "Pagado",
"allStatus": "Todos los estados"
},
"routes": {
"/>title": "Programa de afiliados de Proton",
Expand Down
Loading

0 comments on commit d832283

Please sign in to comment.