Skip to content

Commit

Permalink
Don't throw exception when cashback type is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Sominemo committed Aug 3, 2022
1 parent c24b9d1 commit f127cf2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
39 changes: 36 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
## 2.0.1

### Mono library

- Don't throw exception when backend returns `null` as cashback type
(happens with `fop` account type)

## 2.0.0

### Breaking Changes

- Minimum Dart version is 2.17.0

#### Money library

- `CurrencyInfo` now requires a date parameter for both its constructors

#### Mono library

- `Client.id` and `Account.sendId` changed their types from `String` to `SendId`
- `Cashback.type` and `Account.cashbackType` changed their types from `String` to `CashbackType`.
- `Cashback.type` and `Account.cashbackType` changed their types from `String` to `CashbackType`.
Arbitrary money cashback is not supported anymore.

### What's New

- Added support for card type `eAid`
- Added `toString()` implementations for `CardType`, `BankCard`, `Client`, `Account`
- Fields `Client.id` and `Account.sendId` can now be used to generate `send.monobank.ua` links
thanks to the new `SendId` type and its `SendId.url` getter
thanks to the new `SendId` type and its `SendId.url` getter
- Support for getting `webhookUrl` under `Client` and setting one using `Client.setWebhook`
- Permissions list of the current token with `Client.permissions`
- Jars list of the current user with `Client.jars`
Expand All @@ -23,69 +35,90 @@ thanks to the new `SendId` type and its `SendId.url` getter
- Added `CurrencyInfo.date` property

## 1.4.5

- Minor refactoring

## 1.4.4

- Added support for new API fields

## 1.4.3

- Dependency update

## 1.4.2

- Max date range extended to 31 days

## 1.4.1

- Bugs fixed

## 1.4.0

- Null safety
- Bugs fixed

## 1.4.0-nullsafety.1

- Null safety
- Bugs fixed

## 1.3.0

- Breaking change: /mcc/mcc.dart removed
- Docs fixes

## 1.2.2

- Fixed CurrencyInfo integer parsing error

## 1.2.0

- Support for iban
- Support for fop account type

## 1.1.2

- isCreditUsed works properly now

## 1.1.1

- Changed card mask type to String so leading zeros won't ruin the actual value

## 1.1.0

- Fixed currency getting
- Getting currency example

## 1.0.7

- Formatting

## 1.0.6

- Renamed files

## 1.0.5

- more dartfmt

## 1.0.4

- dartfmt fixes

## 1.0.3

- Combined examples to a single file

## 1.0.2

- Added examples

## 1.0.1

- Fix metadata

## 1.0.0
- Initial version

- Initial version
6 changes: 3 additions & 3 deletions lib/src/mono.dart
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ enum CashbackType {
/// Cashback is unknown
unknown;

static CashbackType fromString(String str) {
if (str == 'None' || str == '') {
static CashbackType fromString(String? str) {
if (str == 'None' || str == '' || str == null) {
return none;
} else if (str == 'UAH') {
return uah;
Expand Down Expand Up @@ -729,7 +729,7 @@ class Account {
Currency.number(data['currencyCode'] as int)),
creditLimit = Money(data['creditLimit'] as int,
Currency.number(data['currencyCode'] as int)),
cashbackType = CashbackType.fromString(data['cashbackType'] as String),
cashbackType = CashbackType.fromString(data['cashbackType'] as String?),
iban = data['iban'] as String,
sendId = data['sendId'] as String != ''
? SendId(data['sendId'] as String, SendIdType.client)
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: >
Supports getting currencies and grabbing statement
version: 2.0.0
homepage: https://github.com/Sominemo/monobank_api
version: 2.0.1
repository: https://github.com/Sominemo/monobank_api

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down

0 comments on commit f127cf2

Please sign in to comment.