storj/web/satellite/tests/unit/mock/api/payments.ts
Wilfred Asomani 05e57edb20 web/satellite: see token payments history
This change lists token payment histories from storjscan/coinpayments on the "Payment Methods > Storj Tokens" page

see: https://github.com/storj/storj/issues/4941

Change-Id: I178ba7940c4cb132f05673607030725a4c4b3e1c
2022-09-30 16:44:47 +00:00

82 lines
2.0 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import {
AccountBalance,
Coupon,
CreditCard,
PaymentsApi,
PaymentsHistoryItem,
ProjectUsageAndCharges,
TokenDeposit,
NativePaymentHistoryItem,
Wallet,
} 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<string> {
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([]);
}
nativePaymentsHistory(): Promise<NativePaymentHistoryItem[]> {
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);
}
getWallet(): Promise<Wallet> {
return Promise.resolve(new Wallet());
}
claimWallet(): Promise<Wallet> {
return Promise.resolve(new Wallet());
}
}