Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update qiwi models in more java-friendly way
- Loading branch information
1 parent
80f03a3
commit 9049d08
Showing
11 changed files
with
90 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
qiwi/src/main/scala/com/github/unknownnpc/psw/qiwi/model/AccountBalance.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.github.unknownnpc.psw.qiwi.model | ||
|
||
trait AccountBalance | ||
|
||
case class AccountBalanceRequest(apiToken: String, wallet: String) | ||
|
||
case class AccountBalanceResponse(accounts: List[AccountBalanceResponseAccount]) | ||
case class AccountBalanceResponseAccount(alias: String, fsAlias: String, bankAlias: String, | ||
title: String, `type`: AccountBalanceResponseAccountType, hasBalance: Boolean, balance: AccountBalanceResponseAccountBalance, | ||
currency: Int, defaultAccount: Boolean) | ||
case class AccountBalanceResponseAccountType(id: String, title: String) | ||
case class AccountBalanceResponseAccountBalance(amount: BigDecimal, currency: Int) |
60 changes: 0 additions & 60 deletions
60
qiwi/src/main/scala/com/github/unknownnpc/psw/qiwi/model/QiwiModel.scala
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
qiwi/src/main/scala/com/github/unknownnpc/psw/qiwi/model/WalletHistory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.github.unknownnpc.psw.qiwi.model | ||
|
||
import java.util.Date | ||
|
||
object ReqTransferType extends Enumeration { | ||
type ReqTransferType = Value | ||
val ALL, IN, OUT, QIWI_CARD = Value | ||
} | ||
|
||
/** | ||
* Should be as passed as serial number from 0, eg: MK eqs 4. | ||
*/ | ||
object ReqSources extends Enumeration { | ||
type ReqSources = Value | ||
val QW_RUB, QW_USD, QW_EUR, CARD, MK = Value | ||
} | ||
|
||
object ResStatus extends Enumeration { | ||
type ResStatus = Value | ||
val WAITING, SUCCESS, ERROR = Value | ||
} | ||
|
||
trait WalletHistory { | ||
type StartEndDates = (Date, Date) | ||
type NextPage = (Date, Long) | ||
} | ||
|
||
case class WalletHistoryRequest(apiToken: String, personId: String, rows: Int = 10, | ||
operation: Option[ReqTransferType.Value] = Some(ReqTransferType.ALL), | ||
sources: List[ReqSources.Value] = List.empty, startEndDates: Option[WalletHistory#StartEndDates] = None, | ||
nextPage: Option[WalletHistory#NextPage] = None) | ||
|
||
case class WalletHistoryResponse(data: List[WalletHistoryResponseData], nextTxnId: Option[Long], nextTxnDate: Option[Date]) | ||
|
||
case class WalletHistoryResponseData(txnId: Long, personId: Long, date: Date, errorCode: Long, error: String, status: ResStatus.Value, | ||
statusText: String, trmTxnId: String, account: String, sum: WalletHistoryResponseAmountCurrency, total: WalletHistoryResponseAmountCurrency, | ||
provider: WalletHistoryResponseProvider, comment: String, currencyRate: BigDecimal, chequeReady: Option[Boolean], | ||
bankDocumentAvailable: Option[Boolean], bankDocumentReady: Option[Boolean], repeatPaymentEnabled: Option[Boolean], | ||
favoritePaymentEnabled: Option[Boolean], regularPaymentEnabled: Option[Boolean]) | ||
|
||
case class WalletHistoryResponseAmountCurrency(amount: BigDecimal, currency: String) | ||
|
||
case class WalletHistoryResponseProvider(id: Long, shortName: String, longName: String, logoUrl: String, description: String, | ||
keys: String, siteUrl: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
qiwi/src/main/scala/com/github/unknownnpc/psw/qiwi/serializer/QiwiSerializer.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.github.unknownnpc.psw.qiwi.serializer | ||
|
||
import com.github.unknownnpc.psw.api.Serializer | ||
import com.github.unknownnpc.psw.qiwi.model.QiwiModel.{AccountBalance, WalletHistory} | ||
import com.github.unknownnpc.psw.qiwi.model.{AccountBalanceRequest, AccountBalanceResponse, WalletHistoryRequest, WalletHistoryResponse} | ||
import org.apache.http.client.methods.HttpGet | ||
|
||
private[qiwi] object QiwiSerializer { | ||
|
||
implicit val walletHistoryReqResSerializer: Serializer[WalletHistory.Request, WalletHistory.Response, HttpGet, String] = new WalletHistoryReqResSerializer | ||
implicit val accountBalanceReqResSerializer: Serializer[AccountBalance.Request, AccountBalance.Response, HttpGet, String] = new AccountBalanceReqResSerializer | ||
implicit val walletHistoryReqResSerializer: Serializer[WalletHistoryRequest, WalletHistoryResponse, HttpGet, String] = new WalletHistoryReqResSerializer | ||
implicit val accountBalanceReqResSerializer: Serializer[AccountBalanceRequest, AccountBalanceResponse, HttpGet, String] = new AccountBalanceReqResSerializer | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters