mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 18:38:15 +01:00
Donation data workflows for PayPal
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
@@ -736,6 +736,8 @@ const CHAT_CALLS = {
|
||||
challenge: 'v1/challenge',
|
||||
configV2: 'v2/config',
|
||||
createBoost: 'v1/subscription/boost/create',
|
||||
createPaypalBoost: 'v1/subscription/boost/paypal/create',
|
||||
confirmPaypalBoost: 'v1/subscription/boost/paypal/confirm',
|
||||
deliveryCert: 'v1/certificate/delivery',
|
||||
devices: 'v1/devices',
|
||||
directoryAuthV2: 'v2/directory/auth',
|
||||
@@ -1172,7 +1174,7 @@ export type CreateBoostResultType = z.infer<typeof CreateBoostResultSchema>;
|
||||
export type CreateBoostReceiptCredentialsOptionsType = Readonly<{
|
||||
paymentIntentId: string;
|
||||
receiptCredentialRequest: string;
|
||||
processor: string;
|
||||
processor: 'STRIPE' | 'BRAINTREE';
|
||||
}>;
|
||||
const CreateBoostReceiptCredentialsResultSchema = z.object({
|
||||
receiptCredentialResponse: z.string(),
|
||||
@@ -1228,6 +1230,36 @@ type ConfirmIntentWithStripeResultType = z.infer<
|
||||
typeof ConfirmIntentWithStripeResultSchema
|
||||
>;
|
||||
|
||||
export type CreatePaypalBoostOptionsType = Readonly<{
|
||||
currency: string;
|
||||
amount: StripeDonationAmount;
|
||||
level: number;
|
||||
returnUrl: string;
|
||||
cancelUrl: string;
|
||||
}>;
|
||||
const CreatePaypalBoostResultSchema = z.object({
|
||||
approvalUrl: z.string(),
|
||||
paymentId: z.string(),
|
||||
});
|
||||
export type CreatePaypalBoostResultType = z.infer<
|
||||
typeof CreatePaypalBoostResultSchema
|
||||
>;
|
||||
|
||||
export type ConfirmPaypalBoostOptionsType = Readonly<{
|
||||
currency: string;
|
||||
amount: number;
|
||||
level: number;
|
||||
payerId: string;
|
||||
paymentId: string;
|
||||
paymentToken: string;
|
||||
}>;
|
||||
const ConfirmPaypalBoostResultSchema = z.object({
|
||||
paymentId: z.string(),
|
||||
});
|
||||
export type ConfirmPaypalBoostResultType = z.infer<
|
||||
typeof ConfirmPaypalBoostResultSchema
|
||||
>;
|
||||
|
||||
export type RedeemReceiptOptionsType = Readonly<{
|
||||
receiptCredentialPresentation: string;
|
||||
visible: boolean;
|
||||
@@ -4487,6 +4519,34 @@ export function createPaymentMethodWithStripe(
|
||||
});
|
||||
}
|
||||
|
||||
export function createPaypalBoostPayment(
|
||||
options: CreatePaypalBoostOptionsType
|
||||
): Promise<CreatePaypalBoostResultType> {
|
||||
return _ajax({
|
||||
unauthenticated: true,
|
||||
host: 'chatService',
|
||||
call: 'createPaypalBoost',
|
||||
httpType: 'POST',
|
||||
jsonData: options,
|
||||
responseType: 'json',
|
||||
zodSchema: CreatePaypalBoostResultSchema,
|
||||
});
|
||||
}
|
||||
|
||||
export function confirmPaypalBoostPayment(
|
||||
options: ConfirmPaypalBoostOptionsType
|
||||
): Promise<ConfirmPaypalBoostResultType> {
|
||||
return _ajax({
|
||||
unauthenticated: true,
|
||||
host: 'chatService',
|
||||
call: 'confirmPaypalBoost',
|
||||
httpType: 'POST',
|
||||
jsonData: options,
|
||||
responseType: 'json',
|
||||
zodSchema: ConfirmPaypalBoostResultSchema,
|
||||
});
|
||||
}
|
||||
|
||||
export async function createGroup(
|
||||
group: Proto.IGroup,
|
||||
options: GroupCredentialsType
|
||||
|
||||
Reference in New Issue
Block a user