NobGit
public imalexnord read

Slot

Calendar-first scheduling powered by Cloudflare Workers and Google Calendar.

Languages

Repository composition by tracked source files.

TypeScript
TypeScript 79% CSS 19% SQL 2% HTML 0%
Create file Wiki Documentation
Clone
https://nobgit.com/user/imalexnord/slot.git
ssh://[email protected]:2222/user/imalexnord/slot.git

Trace

worker/stripe.ts

Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.

stripe.ts on main
Author Date Commit Line Code
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
1
import type { Env } from './types';
Open commit View diff
1 import type { Env } from './types';
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
2
Open commit View diff
2
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
3
export class StripeError extends Error {
Open commit View diff
3 export class StripeError extends Error {
Alex Nord 1 day ago f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
4
  constructor(
Open commit View diff
4 constructor(
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
5
    message: string,
Open commit View diff
5 message: string,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
6
    public readonly status = 502,
Open commit View diff
6 public readonly status = 502,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
7
    public readonly code?: string,
Open commit View diff
7 public readonly code?: string,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
8
  ) {
Open commit View diff
8 ) {
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
9
    super(message);
Open commit View diff
9 super(message);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
10
  }
Open commit View diff
10 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
11
}
Open commit View diff
11 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
12
Open commit View diff
12
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
13
export type StripeCheckoutSession = {
Open commit View diff
13 export type StripeCheckoutSession = {
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
14
  id: string;
Open commit View diff
14 id: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
15
  object: 'checkout.session';
Open commit View diff
15 object: 'checkout.session';
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
16
  url?: string | null;
Open commit View diff
16 url?: string | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
17
  status?: 'open' | 'complete' | 'expired' | null;
Open commit View diff
17 status?: 'open' | 'complete' | 'expired' | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
18
  payment_status?: 'paid' | 'unpaid' | 'no_payment_required';
Open commit View diff
18 payment_status?: 'paid' | 'unpaid' | 'no_payment_required';
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
19
  amount_total?: number | null;
Open commit View diff
19 amount_total?: number | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
20
  currency?: string | null;
Open commit View diff
20 currency?: string | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
21
  client_reference_id?: string | null;
Open commit View diff
21 client_reference_id?: string | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
22
  payment_intent?: string | { id?: string } | null;
Open commit View diff
22 payment_intent?: string | { id?: string } | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
23
  metadata?: Record<string, string> | null;
Open commit View diff
23 metadata?: Record<string, string> | null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
24
};
Open commit View diff
24 };
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
25
Open commit View diff
25
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
26
Open commit View diff
26
Alex Nord 1 day ago 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
27
Open commit View diff
27
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
28
export type StripeRefund = {
Open commit View diff
28 export type StripeRefund = {
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
29
  id: string;
Open commit View diff
29 id: string;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
30
  object: 'refund';
Open commit View diff
30 object: 'refund';
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
31
  amount: number;
Open commit View diff
31 amount: number;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
32
  currency?: string | null;
Open commit View diff
32 currency?: string | null;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
33
  payment_intent?: string | null;
Open commit View diff
33 payment_intent?: string | null;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
34
  status?: 'pending' | 'requires_action' | 'succeeded' | 'failed' | 'canceled' | null;
Open commit View diff
34 status?: 'pending' | 'requires_action' | 'succeeded' | 'failed' | 'canceled' | null;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
35
  metadata?: Record<string, string> | null;
Open commit View diff
35 metadata?: Record<string, string> | null;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
36
  failure_reason?: string | null;
Open commit View diff
36 failure_reason?: string | null;
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
37
};
Open commit View diff
37 };
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
38
Open commit View diff
38
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
39
type StripePaymentIntent = {
Open commit View diff
39 type StripePaymentIntent = {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
40
  id: string;
Open commit View diff
40 id: string;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
41
  object: 'payment_intent';
Open commit View diff
41 object: 'payment_intent';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
42
  latest_charge?: string | { id?: string; receipt_url?: string | null } | null;
Open commit View diff
42 latest_charge?: string | { id?: string; receipt_url?: string | null } | null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
43
};
Open commit View diff
43 };
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
44
Open commit View diff
44
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
45
type StripeCharge = {
Open commit View diff
45 type StripeCharge = {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
46
  id: string;
Open commit View diff
46 id: string;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
47
  object: 'charge';
Open commit View diff
47 object: 'charge';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
48
  receipt_url?: string | null;
Open commit View diff
48 receipt_url?: string | null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
49
};
Open commit View diff
49 };
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
50
Open commit View diff
50
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
51
type StripeEvent = {
Open commit View diff
51 type StripeEvent = {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
52
  id: string;
Open commit View diff
52 id: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
53
  type: string;
Open commit View diff
53 type: string;
Alex Nord 1 day ago 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
54
  data?: { object?: StripeCheckoutSession | StripeRefund };
Open commit View diff
54 data?: { object?: StripeCheckoutSession | StripeRefund };
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
55
};
Open commit View diff
55 };
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
56
Open commit View diff
56
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
57
function stripeSecret(env: Env): string {
Open commit View diff
57 function stripeSecret(env: Env): string {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
58
  const key = env.STRIPE_SECRET_KEY?.trim();
Open commit View diff
58 const key = env.STRIPE_SECRET_KEY?.trim();
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
59
  if (!key) throw new StripeError('Stripe is not configured for this deployment.', 503);
Open commit View diff
59 if (!key) throw new StripeError('Stripe is not configured for this deployment.', 503);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
60
  return key;
Open commit View diff
60 return key;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
61
}
Open commit View diff
61 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
62
Open commit View diff
62
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
63
async function stripeRequest<T>(env: Env, path: string, init: RequestInit = {}): Promise<T> {
Open commit View diff
63 async function stripeRequest<T>(env: Env, path: string, init: RequestInit = {}): Promise<T> {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
64
  let response: Response;
Open commit View diff
64 let response: Response;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
65
  try {
Open commit View diff
65 try {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
66
    response = await fetch(`https://api.stripe.com${path}`, {
Open commit View diff
66 response = await fetch(`https://api.stripe.com${path}`, {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
67
      ...init,
Open commit View diff
67 ...init,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
68
      headers: {
Open commit View diff
68 headers: {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
69
        Authorization: `Bearer ${stripeSecret(env)}`,
Open commit View diff
69 Authorization: `Bearer ${stripeSecret(env)}`,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
70
        ...(init.body ? { 'Content-Type': 'application/x-www-form-urlencoded' } : {}),
Open commit View diff
70 ...(init.body ? { 'Content-Type': 'application/x-www-form-urlencoded' } : {}),
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
71
        ...(init.headers ?? {}),
Open commit View diff
71 ...(init.headers ?? {}),
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
72
      },
Open commit View diff
72 },
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
73
    });
Open commit View diff
73 });
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
74
  } catch {
Open commit View diff
74 } catch {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
75
    throw new StripeError('Could not reach Stripe. Try again in a moment.', 502);
Open commit View diff
75 throw new StripeError('Could not reach Stripe. Try again in a moment.', 502);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
76
  }
Open commit View diff
76 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
77
Open commit View diff
77
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
78
  const data = (await response.json().catch(() => ({}))) as T & {
Open commit View diff
78 const data = (await response.json().catch(() => ({}))) as T & {
Alex Nord 1 day ago f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
79
    error?: { message?: string; code?: string };
Open commit View diff
79 error?: { message?: string; code?: string };
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
80
  };
Open commit View diff
80 };
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
81
  if (!response.ok) {
Open commit View diff
81 if (!response.ok) {
Alex Nord 1 day ago f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
82
    throw new StripeError(
Open commit View diff
82 throw new StripeError(
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
83
      data.error?.message || `Stripe request failed (${response.status}).`,
Open commit View diff
83 data.error?.message || `Stripe request failed (${response.status}).`,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
84
      response.status >= 500 ? 502 : response.status,
Open commit View diff
84 response.status >= 500 ? 502 : response.status,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
85
      data.error?.code,
Open commit View diff
85 data.error?.code,
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
86
    );
Open commit View diff
86 );
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
87
  }
Open commit View diff
87 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
88
  return data;
Open commit View diff
88 return data;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
89
}
Open commit View diff
89 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
90
Open commit View diff
90
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
91
export function stripeConfigured(env: Env): boolean {
Open commit View diff
91 export function stripeConfigured(env: Env): boolean {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
92
  return Boolean(env.STRIPE_SECRET_KEY?.trim() && env.STRIPE_WEBHOOK_SECRET?.trim());
Open commit View diff
92 return Boolean(env.STRIPE_SECRET_KEY?.trim() && env.STRIPE_WEBHOOK_SECRET?.trim());
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
93
}
Open commit View diff
93 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
94
Open commit View diff
94
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
95
export type StripeMode = 'test' | 'live' | 'unknown';
Open commit View diff
95 export type StripeMode = 'test' | 'live' | 'unknown';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
96
Open commit View diff
96
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
97
export function stripeMode(env: Env): StripeMode {
Open commit View diff
97 export function stripeMode(env: Env): StripeMode {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
98
  const key = env.STRIPE_SECRET_KEY?.trim() ?? '';
Open commit View diff
98 const key = env.STRIPE_SECRET_KEY?.trim() ?? '';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
99
  if (key.startsWith('sk_test_')) return 'test';
Open commit View diff
99 if (key.startsWith('sk_test_')) return 'test';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
100
  if (key.startsWith('sk_live_')) return 'live';
Open commit View diff
100 if (key.startsWith('sk_live_')) return 'live';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
101
  return 'unknown';
Open commit View diff
101 return 'unknown';
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
102
}
Open commit View diff
102 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
103
Open commit View diff
103
Alex Nord 1 day ago f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
104
export function stripeCheckoutSessionMode(sessionId: string | null | undefined): StripeMode {
Open commit View diff
104 export function stripeCheckoutSessionMode(sessionId: string | null | undefined): StripeMode {
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
105
  const id = sessionId?.trim() ?? '';
Open commit View diff
105 const id = sessionId?.trim() ?? '';
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
106
  if (id.startsWith('cs_test_')) return 'test';
Open commit View diff
106 if (id.startsWith('cs_test_')) return 'test';
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
107
  if (id.startsWith('cs_live_')) return 'live';
Open commit View diff
107 if (id.startsWith('cs_live_')) return 'live';
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
108
  return 'unknown';
Open commit View diff
108 return 'unknown';
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
109
}
Open commit View diff
109 }
same change f1dbf89

fix: clarify availability limits and document Stripe as optional

Full commit hash
f1dbf89ac73246b1bdab27a2d40d1f2ab4374bf8
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
110
Open commit View diff
110
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
111
export async function createStripeCheckoutSession(
Open commit View diff
111 export async function createStripeCheckoutSession(
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
112
  env: Env,
Open commit View diff
112 env: Env,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
113
  booking: {
Open commit View diff
113 booking: {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
114
    id: string;
Open commit View diff
114 id: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
115
    email: string;
Open commit View diff
115 email: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
116
    durationMinutes: number;
Open commit View diff
116 durationMinutes: number;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
117
    amountMinor: number;
Open commit View diff
117 amountMinor: number;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
118
    currency: string;
Open commit View diff
118 currency: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
119
    label: string;
Open commit View diff
119 label: string;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
120
  },
Open commit View diff
120 },
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
121
): Promise<StripeCheckoutSession> {
Open commit View diff
121 ): Promise<StripeCheckoutSession> {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
122
  const params = new URLSearchParams();
Open commit View diff
122 const params = new URLSearchParams();
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
123
  params.set('mode', 'payment');
Open commit View diff
123 params.set('mode', 'payment');
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
124
  const appUrl = env.APP_URL.replace(/\/+$/, '');
Open commit View diff
124 const appUrl = env.APP_URL.replace(/\/+$/, '');
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
125
  params.set('success_url', `${appUrl}/?payment=success&session_id={CHECKOUT_SESSION_ID}`);
Open commit View diff
125 params.set('success_url', `${appUrl}/?payment=success&session_id={CHECKOUT_SESSION_ID}`);
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
126
  params.set('cancel_url', `${appUrl}/api/payments/cancel-return?booking_id=${encodeURIComponent(booking.id)}`);
Open commit View diff
126 params.set('cancel_url', `${appUrl}/api/payments/cancel-return?booking_id=${encodeURIComponent(booking.id)}`);
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
127
  params.set('client_reference_id', booking.id);
Open commit View diff
127 params.set('client_reference_id', booking.id);
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
128
  // A time-slot reservation cannot safely wait days for a delayed bank payment.
Open commit View diff
128 // A time-slot reservation cannot safely wait days for a delayed bank payment.
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
129
  // Card Checkout still supports 3DS and wallets backed by cards, while giving us
Open commit View diff
129 // Card Checkout still supports 3DS and wallets backed by cards, while giving us
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
130
  // a definitive paid/unpaid result before the calendar invitation is sent.
Open commit View diff
130 // a definitive paid/unpaid result before the calendar invitation is sent.
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
131
  params.set('payment_method_types[0]', 'card');
Open commit View diff
131 params.set('payment_method_types[0]', 'card');
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
132
  params.set('expires_at', String(Math.floor(Date.now() / 1000) + 30 * 60));
Open commit View diff
132 params.set('expires_at', String(Math.floor(Date.now() / 1000) + 30 * 60));
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
133
  params.set('customer_email', booking.email);
Open commit View diff
133 params.set('customer_email', booking.email);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
134
  params.set('metadata[booking_id]', booking.id);
Open commit View diff
134 params.set('metadata[booking_id]', booking.id);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
135
  params.set('payment_intent_data[metadata][booking_id]', booking.id);
Open commit View diff
135 params.set('payment_intent_data[metadata][booking_id]', booking.id);
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
136
  // Explicitly attach the booking email to the PaymentIntent receipt. This makes
Open commit View diff
136 // Explicitly attach the booking email to the PaymentIntent receipt. This makes
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
137
  // live-mode receipts independent of the account's automatic-email toggle.
Open commit View diff
137 // live-mode receipts independent of the account's automatic-email toggle.
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
138
  params.set('payment_intent_data[receipt_email]', booking.email);
Open commit View diff
138 params.set('payment_intent_data[receipt_email]', booking.email);
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
139
  params.set('line_items[0][price_data][currency]', booking.currency.toLowerCase());
Open commit View diff
139 params.set('line_items[0][price_data][currency]', booking.currency.toLowerCase());
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
140
  params.set('line_items[0][price_data][unit_amount]', String(booking.amountMinor));
Open commit View diff
140 params.set('line_items[0][price_data][unit_amount]', String(booking.amountMinor));
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
141
  params.set('line_items[0][price_data][product_data][name]', booking.label);
Open commit View diff
141 params.set('line_items[0][price_data][product_data][name]', booking.label);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
142
  params.set(
Open commit View diff
142 params.set(
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
143
    'line_items[0][price_data][product_data][description]',
Open commit View diff
143 'line_items[0][price_data][product_data][description]',
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
144
    `${booking.durationMinutes}-minute booking`,
Open commit View diff
144 `${booking.durationMinutes}-minute booking`,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
145
  );
Open commit View diff
145 );
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
146
  params.set('line_items[0][quantity]', '1');
Open commit View diff
146 params.set('line_items[0][quantity]', '1');
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
147
Open commit View diff
147
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
148
  return stripeRequest<StripeCheckoutSession>(env, '/v1/checkout/sessions', {
Open commit View diff
148 return stripeRequest<StripeCheckoutSession>(env, '/v1/checkout/sessions', {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
149
    method: 'POST',
Open commit View diff
149 method: 'POST',
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
150
    body: params.toString(),
Open commit View diff
150 body: params.toString(),
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
151
  });
Open commit View diff
151 });
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
152
}
Open commit View diff
152 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
153
Open commit View diff
153
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
154
export async function retrieveStripeCheckoutSession(env: Env, sessionId: string): Promise<StripeCheckoutSession> {
Open commit View diff
154 export async function retrieveStripeCheckoutSession(env: Env, sessionId: string): Promise<StripeCheckoutSession> {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
155
  if (!/^cs_(test_|live_)?[A-Za-z0-9_]+$/.test(sessionId)) {
Open commit View diff
155 if (!/^cs_(test_|live_)?[A-Za-z0-9_]+$/.test(sessionId)) {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
156
    throw new StripeError('Invalid Stripe Checkout session id.', 400);
Open commit View diff
156 throw new StripeError('Invalid Stripe Checkout session id.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
157
  }
Open commit View diff
157 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
158
  return stripeRequest<StripeCheckoutSession>(env, `/v1/checkout/sessions/${encodeURIComponent(sessionId)}`);
Open commit View diff
158 return stripeRequest<StripeCheckoutSession>(env, `/v1/checkout/sessions/${encodeURIComponent(sessionId)}`);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
159
}
Open commit View diff
159 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
160
Open commit View diff
160
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
161
export async function expireStripeCheckoutSession(env: Env, sessionId: string): Promise<StripeCheckoutSession> {
Open commit View diff
161 export async function expireStripeCheckoutSession(env: Env, sessionId: string): Promise<StripeCheckoutSession> {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
162
  if (!/^cs_(test_|live_)?[A-Za-z0-9_]+$/.test(sessionId)) {
Open commit View diff
162 if (!/^cs_(test_|live_)?[A-Za-z0-9_]+$/.test(sessionId)) {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
163
    throw new StripeError('Invalid Stripe Checkout session id.', 400);
Open commit View diff
163 throw new StripeError('Invalid Stripe Checkout session id.', 400);
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
164
  }
Open commit View diff
164 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
165
  return stripeRequest<StripeCheckoutSession>(
Open commit View diff
165 return stripeRequest<StripeCheckoutSession>(
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
166
    env,
Open commit View diff
166 env,
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
167
    `/v1/checkout/sessions/${encodeURIComponent(sessionId)}/expire`,
Open commit View diff
167 `/v1/checkout/sessions/${encodeURIComponent(sessionId)}/expire`,
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
168
    { method: 'POST' },
Open commit View diff
168 { method: 'POST' },
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
169
  );
Open commit View diff
169 );
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
170
}
Open commit View diff
170 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
171
Open commit View diff
171
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
172
function constantTimeEqual(left: string, right: string): boolean {
Open commit View diff
172 function constantTimeEqual(left: string, right: string): boolean {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
173
  if (left.length !== right.length) return false;
Open commit View diff
173 if (left.length !== right.length) return false;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
174
  let result = 0;
Open commit View diff
174 let result = 0;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
175
  for (let index = 0; index < left.length; index += 1) {
Open commit View diff
175 for (let index = 0; index < left.length; index += 1) {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
176
    result |= left.charCodeAt(index) ^ right.charCodeAt(index);
Open commit View diff
176 result |= left.charCodeAt(index) ^ right.charCodeAt(index);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
177
  }
Open commit View diff
177 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
178
  return result === 0;
Open commit View diff
178 return result === 0;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
179
}
Open commit View diff
179 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
180
Open commit View diff
180
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
181
function bytesToHex(bytes: Uint8Array): string {
Open commit View diff
181 function bytesToHex(bytes: Uint8Array): string {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
182
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
Open commit View diff
182 return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
183
}
Open commit View diff
183 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
184
Open commit View diff
184
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
185
async function hmacSha256Hex(secret: string, message: string): Promise<string> {
Open commit View diff
185 async function hmacSha256Hex(secret: string, message: string): Promise<string> {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
186
  const encoder = new TextEncoder();
Open commit View diff
186 const encoder = new TextEncoder();
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
187
  const key = await crypto.subtle.importKey(
Open commit View diff
187 const key = await crypto.subtle.importKey(
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
188
    'raw',
Open commit View diff
188 'raw',
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
189
    encoder.encode(secret),
Open commit View diff
189 encoder.encode(secret),
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
190
    { name: 'HMAC', hash: 'SHA-256' },
Open commit View diff
190 { name: 'HMAC', hash: 'SHA-256' },
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
191
    false,
Open commit View diff
191 false,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
192
    ['sign'],
Open commit View diff
192 ['sign'],
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
193
  );
Open commit View diff
193 );
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
194
  const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(message));
Open commit View diff
194 const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(message));
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
195
  return bytesToHex(new Uint8Array(signature));
Open commit View diff
195 return bytesToHex(new Uint8Array(signature));
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
196
}
Open commit View diff
196 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
197
Open commit View diff
197
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
198
export async function verifyStripeWebhook(
Open commit View diff
198 export async function verifyStripeWebhook(
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
199
  env: Env,
Open commit View diff
199 env: Env,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
200
  rawBody: string,
Open commit View diff
200 rawBody: string,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
201
  signatureHeader: string | null,
Open commit View diff
201 signatureHeader: string | null,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
202
  toleranceSeconds = 300,
Open commit View diff
202 toleranceSeconds = 300,
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
203
): Promise<StripeEvent> {
Open commit View diff
203 ): Promise<StripeEvent> {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
204
  const secret = env.STRIPE_WEBHOOK_SECRET?.trim();
Open commit View diff
204 const secret = env.STRIPE_WEBHOOK_SECRET?.trim();
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
205
  if (!secret) throw new StripeError('Stripe webhook secret is not configured.', 503);
Open commit View diff
205 if (!secret) throw new StripeError('Stripe webhook secret is not configured.', 503);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
206
  if (!signatureHeader) throw new StripeError('Missing Stripe-Signature header.', 400);
Open commit View diff
206 if (!signatureHeader) throw new StripeError('Missing Stripe-Signature header.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
207
Open commit View diff
207
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
208
  const parts = signatureHeader.split(',').map((part) => part.trim());
Open commit View diff
208 const parts = signatureHeader.split(',').map((part) => part.trim());
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
209
  const timestamp = parts.find((part) => part.startsWith('t='))?.slice(2);
Open commit View diff
209 const timestamp = parts.find((part) => part.startsWith('t='))?.slice(2);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
210
  const signatures = parts.filter((part) => part.startsWith('v1=')).map((part) => part.slice(3));
Open commit View diff
210 const signatures = parts.filter((part) => part.startsWith('v1=')).map((part) => part.slice(3));
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
211
  const timestampNumber = Number(timestamp);
Open commit View diff
211 const timestampNumber = Number(timestamp);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
212
  if (!timestamp || !Number.isFinite(timestampNumber) || signatures.length === 0) {
Open commit View diff
212 if (!timestamp || !Number.isFinite(timestampNumber) || signatures.length === 0) {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
213
    throw new StripeError('Invalid Stripe webhook signature.', 400);
Open commit View diff
213 throw new StripeError('Invalid Stripe webhook signature.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
214
  }
Open commit View diff
214 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
215
Open commit View diff
215
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
216
  const ageSeconds = Math.abs(Date.now() / 1000 - timestampNumber);
Open commit View diff
216 const ageSeconds = Math.abs(Date.now() / 1000 - timestampNumber);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
217
  if (ageSeconds > toleranceSeconds) throw new StripeError('Expired Stripe webhook signature.', 400);
Open commit View diff
217 if (ageSeconds > toleranceSeconds) throw new StripeError('Expired Stripe webhook signature.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
218
Open commit View diff
218
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
219
  const expected = await hmacSha256Hex(secret, `${timestamp}.${rawBody}`);
Open commit View diff
219 const expected = await hmacSha256Hex(secret, `${timestamp}.${rawBody}`);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
220
  if (!signatures.some((signature) => constantTimeEqual(signature, expected))) {
Open commit View diff
220 if (!signatures.some((signature) => constantTimeEqual(signature, expected))) {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
221
    throw new StripeError('Invalid Stripe webhook signature.', 400);
Open commit View diff
221 throw new StripeError('Invalid Stripe webhook signature.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
222
  }
Open commit View diff
222 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
223
Open commit View diff
223
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
224
  try {
Open commit View diff
224 try {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
225
    return JSON.parse(rawBody) as StripeEvent;
Open commit View diff
225 return JSON.parse(rawBody) as StripeEvent;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
226
  } catch {
Open commit View diff
226 } catch {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
227
    throw new StripeError('Invalid Stripe webhook payload.', 400);
Open commit View diff
227 throw new StripeError('Invalid Stripe webhook payload.', 400);
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
228
  }
Open commit View diff
228 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
229
}
Open commit View diff
229 }
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
230
Open commit View diff
230
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
231
Open commit View diff
231
Alex Nord 1 day ago 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
232
Open commit View diff
232
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
233
export async function createStripeRefund(
Open commit View diff
233 export async function createStripeRefund(
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
234
  env: Env,
Open commit View diff
234 env: Env,
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
235
  paymentIntentId: string,
Open commit View diff
235 paymentIntentId: string,
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
236
  bookingId: string,
Open commit View diff
236 bookingId: string,
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
237
): Promise<StripeRefund> {
Open commit View diff
237 ): Promise<StripeRefund> {
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
238
  if (!/^pi_[A-Za-z0-9_]+$/.test(paymentIntentId)) {
Open commit View diff
238 if (!/^pi_[A-Za-z0-9_]+$/.test(paymentIntentId)) {
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
239
    throw new StripeError('Invalid Stripe PaymentIntent id.', 400);
Open commit View diff
239 throw new StripeError('Invalid Stripe PaymentIntent id.', 400);
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
240
  }
Open commit View diff
240 }
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
241
  const params = new URLSearchParams();
Open commit View diff
241 const params = new URLSearchParams();
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
242
  params.set('payment_intent', paymentIntentId);
Open commit View diff
242 params.set('payment_intent', paymentIntentId);
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
243
  params.set('metadata[booking_id]', bookingId);
Open commit View diff
243 params.set('metadata[booking_id]', bookingId);
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
244
  params.set('metadata[source]', 'slot_booking_cancellation');
Open commit View diff
244 params.set('metadata[source]', 'slot_booking_cancellation');
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
245
  return stripeRequest<StripeRefund>(env, '/v1/refunds', {
Open commit View diff
245 return stripeRequest<StripeRefund>(env, '/v1/refunds', {
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
246
    method: 'POST',
Open commit View diff
246 method: 'POST',
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
247
    body: params.toString(),
Open commit View diff
247 body: params.toString(),
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
248
    headers: { 'Idempotency-Key': `slot-refund-${bookingId}` },
Open commit View diff
248 headers: { 'Idempotency-Key': `slot-refund-${bookingId}` },
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
249
  });
Open commit View diff
249 });
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
250
}
Open commit View diff
250 }
same change 9aa588b

feat: add rescheduling, time proposals and Stripe cancellation refunds

Full commit hash
9aa588b368f7c46ba3d287199a3d95506867c927
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
251
Open commit View diff
251
Alex Nord 1 day ago 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
252
export async function stripeReceiptUrl(env: Env, session: StripeCheckoutSession): Promise<string | null> {
Open commit View diff
252 export async function stripeReceiptUrl(env: Env, session: StripeCheckoutSession): Promise<string | null> {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
253
  const paymentIntentId = stripePaymentIntentId(session);
Open commit View diff
253 const paymentIntentId = stripePaymentIntentId(session);
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
254
  if (!paymentIntentId || !/^pi_[A-Za-z0-9_]+$/.test(paymentIntentId)) return null;
Open commit View diff
254 if (!paymentIntentId || !/^pi_[A-Za-z0-9_]+$/.test(paymentIntentId)) return null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
255
Open commit View diff
255
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
256
  const intent = await stripeRequest<StripePaymentIntent>(
Open commit View diff
256 const intent = await stripeRequest<StripePaymentIntent>(
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
257
    env,
Open commit View diff
257 env,
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
258
    `/v1/payment_intents/${encodeURIComponent(paymentIntentId)}?expand%5B%5D=latest_charge`,
Open commit View diff
258 `/v1/payment_intents/${encodeURIComponent(paymentIntentId)}?expand%5B%5D=latest_charge`,
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
259
  );
Open commit View diff
259 );
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
260
  if (intent.latest_charge && typeof intent.latest_charge !== 'string') {
Open commit View diff
260 if (intent.latest_charge && typeof intent.latest_charge !== 'string') {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
261
    return intent.latest_charge.receipt_url ?? null;
Open commit View diff
261 return intent.latest_charge.receipt_url ?? null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
262
  }
Open commit View diff
262 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
263
  if (typeof intent.latest_charge === 'string' && /^ch_[A-Za-z0-9_]+$/.test(intent.latest_charge)) {
Open commit View diff
263 if (typeof intent.latest_charge === 'string' && /^ch_[A-Za-z0-9_]+$/.test(intent.latest_charge)) {
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
264
    const charge = await stripeRequest<StripeCharge>(env, `/v1/charges/${encodeURIComponent(intent.latest_charge)}`);
Open commit View diff
264 const charge = await stripeRequest<StripeCharge>(env, `/v1/charges/${encodeURIComponent(intent.latest_charge)}`);
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
265
    return charge.receipt_url ?? null;
Open commit View diff
265 return charge.receipt_url ?? null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
266
  }
Open commit View diff
266 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
267
  return null;
Open commit View diff
267 return null;
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
268
}
Open commit View diff
268 }
same change 110f91e

Adding indication for test/live key

Full commit hash
110f91e747192b16de709ea11c5eea17eaeadd48
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
269
Open commit View diff
269
Alex Nord 1 day ago 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
270
export function stripePaymentIntentId(session: StripeCheckoutSession): string | null {
Open commit View diff
270 export function stripePaymentIntentId(session: StripeCheckoutSession): string | null {
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
271
  if (typeof session.payment_intent === 'string') return session.payment_intent;
Open commit View diff
271 if (typeof session.payment_intent === 'string') return session.payment_intent;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
272
  return session.payment_intent?.id ?? null;
Open commit View diff
272 return session.payment_intent?.id ?? null;
same change 9abcc27

Added Stripe payments

Full commit hash
9abcc271f095921a2c76e260009e53cda98d817a
Author
Alex Nord <[email protected]>
Date
1 day ago
Selected line
273
}
Open commit View diff
273 }