storj/web/satellite/tests/unit/mock/api/payments.ts

68 lines
1.6 KiB
TypeScript
Raw Normal View History

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