- accessToken and refreshToken methods from interface
- accessToken param from transactionsPastDay
- Unused env variables from config.ts

Added
- Initial Refresh token to env
- Dayjs library for working with dates

Implemented
- getAccessToken
- getRefreshToken
- fetchNewRefreshToken
- transactionsPastDay

Signed-off-by: Martin Berg Alstad <git@martials.no>
This commit is contained in:
Martin Berg Alstad
2024-12-25 21:06:42 +01:00
committed by Martin Berg Alstad
parent 480c0356f9
commit 6650e2cd2b
7 changed files with 127 additions and 49 deletions

View File

@ -1,26 +1,8 @@
import type { Bank, OAuthTokenResponse, Transaction } from "@/bank/sparebank1.ts"
const tokenResponse: OAuthTokenResponse = {
access_token: "my_access_token",
token_type: "Bearer",
expires_in: 3600,
refresh_token: "my_refresh_token",
refresh_token_expires_in: 3600,
refresh_token_absolute_expires_in: 3600,
}
import type { Bank, Transaction } from "@/bank/sparebank1.ts"
export class BankStub implements Bank {
async accessToken(): Promise<OAuthTokenResponse> {
return tokenResponse
}
async refreshToken(_unused: string): Promise<OAuthTokenResponse> {
return tokenResponse
}
async transactionsPastDay(
_accountIds: ReadonlyArray<string> | string,
_accessToken: string,
): Promise<ReadonlyArray<Transaction>> {
const someFields = {
date: "2019-08-20",