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

Commit 5ab098e

Browse files
Final deployment changes
1 parent 285e4f5 commit 5ab098e

File tree

9 files changed

+33
-17
lines changed

9 files changed

+33
-17
lines changed

apps/backend-serverless/serverless.purple.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ package:
6363
- 'node_modules/.prisma/client/libquery_engine-linux-arm64-*'
6464
- '!node_modules/prisma/libquery_engine-*'
6565
- '!node_modules/@prisma/engines/**'
66+
- 'node_modules/@project-serum/**'
6667
functions:
6768
install:
6869
handler: src/handlers/shopify-handlers/install.install
@@ -306,6 +307,7 @@ functions:
306307
Resource: ${self:resources.Outputs.ShopifyQueueArn.Value}
307308
process-message:
308309
handler: src/handlers/webhooks/sqs/process-transaction-message.processTransactionMessage
310+
timeout: 30
309311
events:
310312
- sqs:
311313
arn: ${self:resources.Outputs.ProcessQueueArn.Value}

apps/backend-serverless/src/handlers/clients/payment-ui/customer-data.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export const customerData = Sentry.AWSLambda.wrapHandler(
2020
Sentry.captureEvent({
2121
message: 'in customerData',
2222
level: 'info',
23+
extra: {
24+
event,
25+
},
2326
});
2427

2528
const paymentRecordService = new PaymentRecordService(prisma);

apps/backend-serverless/src/utilities/clients/create-customer-response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ export const createCustomerResponse = async (
125125
let customerOwns =
126126
currentTier && currentTier.mint ? await customerOwnsTier(customerWallet, currentTier.mint) : false;
127127

128-
console.log('tier status', currentTier, nextPossibleTier, isFirstTier, customerOwns);
128+
// console.log('tier status', currentTier, nextPossibleTier, isFirstTier, customerOwns);
129129
let customerNfts = (await createProductsNftResponse(merchant)).customerView[customerWallet];
130130

131-
console.log('customer nfts', customerNfts);
131+
// console.log('customer nfts', customerNfts);
132132
return {
133133
amountSpent: customer.amountSpent,
134134
tier: currentTier,

apps/merchant-ui/src/components/ProductsCard/TreeSetup.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ export default function TreeSetup(props: Props) {
110110
<Button pending={loading} onClick={handleSave}>
111111
Setup
112112
</Button>
113-
<Button variant="outline" onClick={disconnect}>
114-
Disconnect Wallet
115-
</Button>
116113
</CardFooter>
117114
</Card>
118115
);

apps/merchant-ui/src/components/TiersCard.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export function TiersCard(props: Props) {
129129
tiers: {
130130
...newTier,
131131
...(data.mintAddress && { mint: data.mintAddress }),
132+
active: true,
132133
},
133134
});
134135

@@ -244,7 +245,7 @@ export function TiersCard(props: Props) {
244245
<TableHead>$ Threshold</TableHead>
245246
<TableHead>% Back</TableHead>
246247
<TableHead>Active</TableHead>
247-
{/* <TableHead>Frozen</TableHead> */}
248+
<TableHead>Frozen</TableHead>
248249
<TableHead></TableHead>
249250
</TableRow>
250251
</TableHeader>
@@ -309,9 +310,9 @@ export function TiersCard(props: Props) {
309310
<TableCell>
310311
<Switch checked={tier.active} onCheckedChange={() => handleToggle(tier.id)} />
311312
</TableCell>
312-
{/* <TableCell>
313-
<Switch checked={false} />
314-
</TableCell> */}
313+
<TableCell>
314+
<Switch checked={true} />
315+
</TableCell>
315316
<TableCell className="flex flex-row space-x-1">
316317
{editing === tier.id ? (
317318
<Button variant="outline" onClick={() => handleSave(tier.id)}>
@@ -371,7 +372,7 @@ export function TiersCard(props: Props) {
371372
/>
372373
</TableCell>
373374
<TableCell></TableCell>
374-
{/* <TableCell></TableCell> */}
375+
<TableCell></TableCell>
375376
<TableCell className="flex flex-row space-x-1">
376377
<Button
377378
variant="outline"

apps/mock-shopify-serverless/src/handlers/payment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export const payment = async (event: APIGatewayProxyEventV2): Promise<APIGateway
2323
id: id,
2424
gid: gid,
2525
group: group,
26-
amount: 5,
26+
amount: 11,
2727
currency: 'USD',
28-
test: false,
28+
test: true,
2929
merchant_locale: 'en',
3030
payment_method: {
3131
type: 'type',

apps/payment-ui/src/components/CheckoutSection/PaymentView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const PaymentView: React.FC = () => {
3737
<div className="w-full h-full flex flex-col items-center">
3838
<div className="flex flex-col items-center">
3939
<QRCode />
40-
<div className="text-gray-600 text-xs pt-4">Scan this code to pay with your Solana wallet</div>
40+
<p className="text-gray-600 text-xs pt-4">Scan this code to pay with your Solana wallet</p>
4141
</div>
4242
</div>
4343
)}

apps/payment-ui/src/components/PayToLabel/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ export const PayToLabel = () => {
3030
const calculateDiscount = (cart: number, discountRate: number) => (discountRate * cart) / 100;
3131

3232
useEffect(() => {
33-
if (customerTier !== null && paymentDetails !== null) {
34-
let cart = Number(paymentDetails.totalAmountFiatDisplay.substring(1));
33+
if (paymentDetails !== null) {
34+
let cart = Number(paymentDetails.usdcSize);
3535
setCart(cart);
36-
setDiscount(calculateDiscount(cart, customerTier.discount));
3736
setIsLoading(false);
3837
}
39-
}, [customerTier, paymentDetails]);
38+
}, [paymentDetails]);
39+
40+
useEffect(() => {
41+
if (customerTier !== null && cart > 0) {
42+
setDiscount(calculateDiscount(cart, customerTier.discount));
43+
}
44+
}, [customerTier, cart]);
4045

4146
function calculateFinalAmount(): number {
4247
if (!loyaltyDetails || !customer || !paymentDetails || !customerTier) {

apps/transaction-request-serverless/src/services/builders/payment-transaction-ix.builder.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
createAssociatedTokenAccountInstruction,
33
createBurnInstruction,
44
createCloseAccountInstruction,
5+
createFreezeAccountInstruction,
56
createMintToInstruction,
67
getAccount,
78
getAssociatedTokenAddress,
@@ -226,6 +227,9 @@ export class PaymentTransactionBuilder {
226227
transaction = transaction.add(
227228
createMintToInstruction(this.nextTier, newCustomerTokenAddress, this.feePayer, 1)
228229
);
230+
transaction = transaction.add(
231+
createFreezeAccountInstruction(newCustomerTokenAddress, this.nextTier, this.feePayer)
232+
);
229233
} else if (this.currentTier && !this.nextTier && !this.customerOwnsTier) {
230234
let newCustomerTokenAddress = await getAssociatedTokenAddress(this.currentTier, this.sender);
231235

@@ -241,6 +245,10 @@ export class PaymentTransactionBuilder {
241245
transaction = transaction.add(
242246
createMintToInstruction(this.currentTier, newCustomerTokenAddress, this.feePayer, 1)
243247
);
248+
249+
transaction = transaction.add(
250+
createFreezeAccountInstruction(newCustomerTokenAddress, this.currentTier, this.feePayer)
251+
);
244252
} else {
245253
console.log('hit else case');
246254
}

0 commit comments

Comments
 (0)