Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Hotfix: Order cancel button #482

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9c0d520
Eslint Configs (#423)
harshasomisetty Jul 16, 2023
38214a9
Formatting changes (#424)
harshasomisetty Jul 16, 2023
3e37c12
Cleaning files (#425)
harshasomisetty Jul 16, 2023
dc9d93f
Update payment.ts
harshasomisetty Jul 16, 2023
26e42e9
small local dev changes
harshasomisetty Jul 16, 2023
7fde5f6
Buttons Unify (#429)
harshasomisetty Jul 16, 2023
1fdc926
Css refactor (#432)
harshasomisetty Jul 16, 2023
6a90c4f
Paths rearchitect landing (#433)
harshasomisetty Jul 17, 2023
2c757d3
Checkout Prices Rearchitect (#434)
harshasomisetty Jul 17, 2023
230c5f9
Reorged checkout views (#436)
harshasomisetty Jul 17, 2023
3830cb1
Removed Config Folder(#435)
harshasomisetty Jul 17, 2023
c89bf4c
more small checkout changes
harshasomisetty Jul 17, 2023
e7698aa
Transaction Builder File (#440)
harshasomisetty Jul 17, 2023
147044b
Error types
harshasomisetty Jul 17, 2023
49442c8
prune lambdas
harshasomisetty Jul 17, 2023
ccdc348
Redoing Dev Env
harshasomisetty Jul 17, 2023
466f906
More dev setup
harshasomisetty Jul 18, 2023
b811f9c
Payment and Refund Simplify (#443)
harshasomisetty Jul 18, 2023
c483195
Pubkey check unify (#445)
harshasomisetty Jul 18, 2023
16f08b0
docs workspace
harshasomisetty Jul 18, 2023
a584601
local dev changes
harshasomisetty Jul 19, 2023
77e2bdf
Points rewards (#447)
harshasomisetty Jul 19, 2023
049fba5
Payment UI refactor (#448)
harshasomisetty Jul 21, 2023
69ecc37
Better customer profile dialog
harshasomisetty Jul 20, 2023
5dac65f
Points balance in paymentui
harshasomisetty Jul 21, 2023
d9b2bea
Points Payments bug fixes (#449)
harshasomisetty Jul 22, 2023
296a99c
Added paid with points in database (#451)
harshasomisetty Jul 22, 2023
e9869e0
Migrate Back to Yarn (#455)
harshasomisetty Jul 24, 2023
887f697
Scripts Setup (#456)
harshasomisetty Jul 24, 2023
114b8c9
Auth mock default
harshasomisetty Jul 24, 2023
669fe5f
small backend-update bugs
harshasomisetty Jul 25, 2023
23643ed
Singular Optional Shipping schema
harshasomisetty Jul 25, 2023
a538384
MerchantStore now gives status code
harshasomisetty Jul 25, 2023
d238513
README and documentation
harshasomisetty Jul 25, 2023
b780a19
revert generate single use seeds
harshasomisetty Jul 25, 2023
f3bc0d9
points back 100%
harshasomisetty Jul 25, 2023
2ad9b97
small payment size improvements for test
harshasomisetty Jul 25, 2023
f15e68e
Loyalty Tiers and Items UI Design (#463)
harshasomisetty Jul 25, 2023
c38381e
Tiers and Products backend (#465)
harshasomisetty Jul 26, 2023
fcae9dd
UI loyalty data updating (#479)
harshasomisetty Jul 27, 2023
9e4b020
Conditional UI rendering (#480)
harshasomisetty Jul 27, 2023
13d4e80
hotfix cancel order button
harshasomisetty Jul 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 7 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
extends: ['turbo', '@solana/eslint-config-solana', '@solana/eslint-config-solana/jest'],
root: true,
};
extends: ['custom'],
settings: {
next: {
rootDir: ['apps/*/'],
},
},
};
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
**/node_modules
.pnp
.pnp.js
**/package-lock.json
**/yarn.lock

# testing
**/coverage
Expand All @@ -17,7 +15,6 @@
**/.build

# misc
*.pem
.DS_Store

# debug
Expand All @@ -34,6 +31,9 @@
**/dist
**/.serverless


apps/**/pnpm-lock.yaml

#packages-dist

# General ignore rules for monorepos
Expand All @@ -45,3 +45,16 @@

# Working notes
working-notes.md

.pnp.*
.yarn/*
.yarnrc
!.yarn/cache/*
!.yarn/patches/*
!.yarn/plugins/*
!.yarn/releases/*
!.yarn/sdks/*
!.yarn/versions/*


**.pid
47 changes: 47 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
**/node_modules
.pnp
.pnp.js
**/package-lock.json
**/yarn.lock

# testing
**/coverage

# next.js
**/.next
**/out
**/build
**/.build

# misc
*.pem
.DS_Store

# debug
*debug.log*
*error.log*

# local env files
**/.env*

# turbo
.turbo

# apps and packages
**/dist
**/.serverless

#packages-dist

# General ignore rules for monorepos
**/.cache
**/.pnp
**/.pnp.js
**/coverage
**/.DS_Store

# Working notes
working-notes.md
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"eslint.workingDirectories": [
"apps/merchant-ui",
"apps/backend-serverless",
"apps/mock-shopify-serverless",
"apps/payment-ui"
]
}
101 changes: 33 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,64 @@
# Solana Payments App

## Learn More
This project allows Shopify merchants to accept crypto through their shopify store, and customers to purchase products using crypto.

Right now the overall documentation is federated to respective directories. Overall overview documentation coming soon.
[Visit Documentation](https://commercedocs.solanapay.com)

[Payment App Backend](apps/backend-serverless/README.md) - Server that handles communication and orchestration of payments, merchant experience, and customer experience.<br>
[Transaction Request Server](apps/transaction-request-serverless/README.md) - Server for building transaction for payments.<br>
[Merchant UI](apps/merchant-ui/README.md) - The merchant frontend that where merchants manage their payments.<br>
[Payment UI](apps/payment-ui/README.md) - The payment frontend where customers can complete payments.<br>
[System Design](system-design/README.md) - Where we communicate overall system design decisions for the current state.<br>
[Test Payment flow](solanatest8.myshopify.com)

## How to Deploy Locally
[Test Merchant Flow](merchant-staging.solanapay.com)

### Get Your Helius API Key
# Local Development

Go to [Helius](https://www.helius.dev/) and create a new account. You can use an existing account if you like, but we will modify your webhooks so it is advised you create a new account. Once you have your API key from Helius, come back here.
## Dependencies

### Set up the Application
These steps will get you up and running with a local dev environment, and you can later setup these environments for production

1. clone the repo
- Dependencies

```
git clone [email protected]:solana-labs/solana-payments-app.git
```

2. install the dependencies

```
(from root)
yarn
```

3. run ngrok to expose your local service to helius for transaction webhooks

```
ngrok http 4000
```
- Docker Desktop
- Mysql

4. create your .env.development files
- Keys

In each app
- Gas Keypair
- .env.dev in backend serverless
- [Helius API key](https://www.helius.dev)
- .env.dev in backend serverless

- backend-serverless
- payment-ui
- merchant-ui
- transaction-request-serverless
- Dev Certs

You will need to copy the .sample.env.development file and replace the values that need to be changed, these are marked in the sample files.
- [Follow this guide](https://blog.simontimms.com/2021/10/12/serverless-offline-https/)
- included sample dev certs in backend-serverless & mock-shopify-serverless, must proceed to safety on google chrome

**Note** Make sure you use the ngrok url from the previous step for the HELIUS_WEBHOOK_URL var.
## Commands

5. generate your database database model
Installation:

```
(from /apps/backend-serverless/)
npx prisma generate
git clone https://github.com/solana-labs/solana-payments-app
yarn install
yarn setup:env
```

6. migrate your database

Note: To migrate your database, it must be running. If you're using the local database we help stand up through docker-compose, do that now.

```
(from root)
docker-compose up // If you're using our assisted local database

(from /apps/backend-serverless)
npx prisma migrate dev

```

If you are using a local database, run

(from /apps/backend-serverless)
y prisma:seed:dev

7. stand everything up

If you've done everything correctly to this point, standing up the app should be a single command
Once the dependencies are all setup, env variables are set:

```
(from root)
yarn dev
yarn seed
```

### Make a Payment
## Testing

Everything is running! Now let's make a payment. In production, Shopify sends a post request to the backend-serverless apps. Specifically, to our backender-serverless-green service. Go [here](/system-design/shopify/README.md#mutual-tls-mtls) to read more about why the backend-serverless app is split up into two deployed services. Locally, you have to invoke your own payment. You can do this by visiting https:localhost:4004/payment. This will mock a shopify request, create your payment, and redirect you to your locally hosted payment-ui. It should look like this
Use these links to test out the local development flow

PAYMENT UI IMAGE GOES HERE
[Local Merchant UI](https://localhost:4004/install)

Now you can pay by connecting your wallet OR you can scan with any mobile Solana wallet that support Solana Pay.
[Local Payment Simulation](https://localhost:4004/payment)

**Note** To pay with a mobile Solana wallet, you must have set the BACKEND_URL env var inside of payment-ui in step 4 of the Set up the Application steps.
At the moment, here are some local development hacks we use to get it to work, these will be fixed shortly, including

## How to Contribute
- local queue events not being sent
- accessing mock payment records as created in the seed script

We need to flesh out more compartmentalized issues for developers to easily step in and contribute code. For now, please create an issue about further documentation you would like to see. Please make sure you set up our prettier and es-list packages and these don't conflict with your local setup. We use the [es-lint](https://github.com/solana-labs/eslint-config-solana) and [prettier](https://github.com/solana-labs/prettier-config-solana) packages from Solana Labs. Both should be installed with the rest of the dependencies.
You are welcome to play around with the code as you wish.
19 changes: 0 additions & 19 deletions apps/backend-serverless/.eslintrc

This file was deleted.

9 changes: 5 additions & 4 deletions apps/backend-serverless/.sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ PERSONA_API_KEY=sample_key

# Testing
JWT_SECRET_KEY='secret'
HISTORICAL_FEE_PAYERS=payer1,payer2
HISTORICAL_FEE_PAYERS='payer1,payer2'
NODE_EXTRA_CA_CERTS='dev-certs/cert.pem'
NODE_ENV=development
USE_AUTH_MOCK='9atpJhdCxw5w8SLSUhz1mUsv2GdSunZeYmpGXyomSz48'
USE_AUTH_MOCK='hard_coded_merchant_id'

# Other
HELIUS_WEBHOOK_URL='https://838c-47-18-98-120.ngrok.io/helius'


GAS_KEYPAIR_SECRET="yourGasKeypair"
46 changes: 0 additions & 46 deletions apps/backend-serverless/README.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAccountInfo, getPubkeyType } from '../../src/services/helius.service.js';
import { getPubkeyType } from '../../src/services/helius.service.js';

describe('Wallet', () => {
it('should create a wallet', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ describe('Install Query Params Model', () => {
runMissingFieldTests(
parseAndValidateAppInstallQueryParms,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
runInvalidFieldTypeTests(parseAndValidateAppInstallQueryParms, validParams, fields, wrongTypes);
runEmptyFieldTests(
parseAndValidateAppInstallQueryParms,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('unit testing redirect query parameters model', () => {
runMissingFieldTests(
parseAndValidateAppRedirectQueryParams,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
runInvalidFieldTypeTests(parseAndValidateAppRedirectQueryParams, validParams, fields, wrongTypes);
runEmptyFieldTests(parseAndValidateAppRedirectQueryParams, validParams, fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe('unit testing the transation request response model', () => {
runMissingFieldTests(
parseAndValidateTransactionRequestResponse,
validParams,
fields.filter(field => field !== 'message')
fields.filter(field => field !== 'message'),
);
runInvalidFieldTypeTests(parseAndValidateTransactionRequestResponse, validParams, fields, wrongTypes);
runEmptyFieldTests(
parseAndValidateTransactionRequestResponse,
validParams,
fields.filter(field => field !== 'message')
fields.filter(field => field !== 'message'),
);
});
Loading