storj/web/satellite/tests/unit/mock/api/payments.ts
Jeremy Wharton ea772a8480 web/satellite: Allow users to see coupon in billing area
This change allows users to see the Stripe coupon applied to their
account in the billing area.

Change-Id: Ie1e810bfb2847f9b0c0bb827d5ca03c16cf5e818
2021-08-14 16:09:54 -05:00

68 lines
1.6 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import {
AccountBalance,
Coupon,
CreditCard,
PaymentsApi,
PaymentsHistoryItem,
ProjectUsageAndCharges,
TokenDeposit,
} from '@/types/payments';
/**
* Mock for PaymentsApi
*/
export class PaymentsMock implements PaymentsApi {
private mockCoupon: Coupon | null = null;
public setMockCoupon(coupon: Coupon | null): void {
this.mockCoupon = coupon;
}
setupAccount(): Promise<void> {
throw new Error('Method not implemented');
}
getBalance(): Promise<AccountBalance> {
return Promise.resolve(new AccountBalance());
}
projectsUsageAndCharges(): Promise<ProjectUsageAndCharges[]> {
return Promise.resolve([]);
}
addCreditCard(_token: string): Promise<void> {
throw new Error('Method not implemented');
}
removeCreditCard(_cardId: string): Promise<void> {
throw new Error('Method not implemented');
}
listCreditCards(): Promise<CreditCard[]> {
return Promise.resolve([]);
}
makeCreditCardDefault(_cardId: string): Promise<void> {
throw new Error('Method not implemented');
}
paymentsHistory(): Promise<PaymentsHistoryItem[]> {
return Promise.resolve([]);
}
makeTokenDeposit(amount: number): Promise<TokenDeposit> {
return Promise.resolve(new TokenDeposit(amount, 'testAddress', 'testLink'));
}
applyCouponCode(_: string): Promise<Coupon> {
throw new Error('Method not implemented');
}
getCoupon(): Promise<Coupon | null> {
return Promise.resolve(this.mockCoupon);
}
}