mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 18:46:46 +00:00
Merge pull request #679 from constantine2nd/branches-atms-wip
Branches atms wip
This commit is contained in:
commit
a86b0baa67
@ -2,24 +2,18 @@ package code.api.v1_4_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.api.util.APIUtil.{BaseErrorResponseBody, ResourceDoc}
|
||||
import code.common._
|
||||
import code.api.util.APIUtil.ResourceDoc
|
||||
import code.api.v1_2_1.AmountOfMoneyJsonV121
|
||||
import code.atms.Atms.Atm
|
||||
import code.branches.Branches.{BranchT, Branch}
|
||||
import code.crm.CrmEvent.{CrmEvent, CrmEventId}
|
||||
import code.products.Products.Product
|
||||
import code.branches.Branches.BranchT
|
||||
import code.common._
|
||||
import code.crm.CrmEvent.CrmEvent
|
||||
import code.customer.{Customer, CustomerMessage}
|
||||
import code.model._
|
||||
import code.products.Products.ProductCode
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
import net.liftweb.json.JsonAST.{JObject, JValue}
|
||||
import org.pegdown.PegDownProcessor
|
||||
import code.api.v1_2_1.AmountOfMoneyJsonV121
|
||||
import code.api.v2_0_0.TransactionRequestChargeJsonV200
|
||||
import code.products.Products.Product
|
||||
import code.transactionrequests.TransactionRequestTypeCharge
|
||||
import net.liftweb.common.{Box, Full}
|
||||
|
||||
import code.common.Meta
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
import org.pegdown.PegDownProcessor
|
||||
|
||||
|
||||
object JSONFactory1_4_0 {
|
||||
@ -212,7 +206,7 @@ object JSONFactory1_4_0 {
|
||||
|
||||
|
||||
|
||||
def createBranchesJson(branchesList: List[Branch]) : BranchesJson = {
|
||||
def createBranchesJson(branchesList: List[BranchT]) : BranchesJson = {
|
||||
BranchesJson(branchesList.map(createBranchJson))
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package code.atms
|
||||
|
||||
import code.atms.Atms._
|
||||
import code.common.{AddressT, LicenseT, LocationT, MetaT}
|
||||
import code.common._
|
||||
import code.model.BankId
|
||||
import code.util.{TwentyFourHourClockString, MediumString, UUIDString}
|
||||
import code.util.{TwentyFourHourClockString, UUIDString}
|
||||
import net.liftweb.mapper._
|
||||
|
||||
object MappedAtmsProvider extends AtmsProvider {
|
||||
@ -81,28 +81,30 @@ class MappedAtm extends Atm with LongKeyedMapper[MappedAtm] with IdPK {
|
||||
override def bankId : BankId = BankId(mBankId.get)
|
||||
override def name: String = mName.get
|
||||
|
||||
override def address: AddressT = new AddressT {
|
||||
override def line1: String = mLine1.get
|
||||
override def line2: String = mLine2.get
|
||||
override def line3: String = mLine3.get
|
||||
override def city: String = mCity.get
|
||||
override def county: String = mCounty.get
|
||||
override def state: String = mState.get
|
||||
override def countryCode: String = mCountryCode.get
|
||||
override def postCode: String = mPostCode.get
|
||||
}
|
||||
override def address = Address(
|
||||
line1 = mLine1.get,
|
||||
line2 = mLine2.get,
|
||||
line3 = mLine3.get,
|
||||
city = mCity.get,
|
||||
county = Some(mCounty.get),
|
||||
state = mState.get,
|
||||
countryCode = mCountryCode.get,
|
||||
postCode = mPostCode.get
|
||||
)
|
||||
|
||||
override def meta: MetaT = new MetaT {
|
||||
override def license: LicenseT = new LicenseT {
|
||||
override def id: String = mLicenseId.get
|
||||
override def name: String = mLicenseName.get
|
||||
}
|
||||
}
|
||||
override def meta = Meta (
|
||||
license = License (
|
||||
id = mLicenseId.get,
|
||||
name = mLicenseName.get
|
||||
)
|
||||
)
|
||||
|
||||
override def location: LocationT = new LocationT {
|
||||
override def latitude: Double = mlocationLatitude
|
||||
override def longitude: Double = mlocationLongitude
|
||||
}
|
||||
override def location = Location(
|
||||
latitude = mlocationLatitude.get,
|
||||
longitude = mlocationLongitude.get,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
override def OpeningTimeOnMonday : String = mOpeningTimeOnMonday.get
|
||||
|
||||
@ -1036,7 +1036,7 @@ trait Connector extends MdcLoggable{
|
||||
|
||||
|
||||
|
||||
def getBranch(bankId : BankId, branchId: BranchId) : Box[MappedBranch]
|
||||
def getBranch(bankId : BankId, branchId: BranchId) : Box[BranchT]
|
||||
|
||||
def getAtm(bankId : BankId, atmId: AtmId) : Box[Atm]
|
||||
|
||||
|
||||
@ -2,13 +2,14 @@ package code.bankconnectors
|
||||
|
||||
import java.util.{Date, UUID}
|
||||
|
||||
import code.api.util.APIUtil.saveConnectorMetric
|
||||
import code.api.util.ErrorMessages
|
||||
import code.api.v2_1_0.{AtmJsonPost, BranchJsonPostV210, TransactionRequestCommonBodyJSON}
|
||||
import code.atms.Atms.{Atm, AtmId}
|
||||
import code.atms.MappedAtm
|
||||
import code.branches.Branches._
|
||||
import code.branches.MappedBranch
|
||||
import code.common._
|
||||
import code.common.{Address, _}
|
||||
import code.fx.{FXRate, MappedFXRate, fx}
|
||||
import code.management.ImporterAPI.ImporterTransaction
|
||||
import code.metadata.comments.Comments
|
||||
@ -25,8 +26,9 @@ import code.transaction.MappedTransaction
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
import code.transactionrequests._
|
||||
import code.util.Helper
|
||||
import code.util.Helper._
|
||||
import code.util.Helper.{MdcLoggable, _}
|
||||
import code.views.Views
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import com.tesobe.model.UpdateBankAccount
|
||||
import net.liftweb.common._
|
||||
import net.liftweb.mapper.{By, _}
|
||||
@ -35,21 +37,12 @@ import net.liftweb.util.{BCrypt, Props, StringHelpers}
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent._
|
||||
import scala.concurrent.duration._
|
||||
import scala.language.postfixOps
|
||||
import scala.math.BigInt
|
||||
import code.api.util.APIUtil.saveConnectorMetric
|
||||
import code.api.v2_2_0.ProductJsonV220
|
||||
|
||||
import scalacache.ScalaCache
|
||||
import scalacache.{ScalaCache, _}
|
||||
import scalacache.guava.GuavaCache
|
||||
import scalacache._
|
||||
import concurrent.duration._
|
||||
import language.postfixOps
|
||||
import memoization._
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import code.util.Helper.MdcLoggable
|
||||
|
||||
import code.common.Address
|
||||
import code.common.MetaT
|
||||
import scalacache.memoization._
|
||||
|
||||
|
||||
object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
|
||||
@ -263,7 +263,7 @@ object Branches extends SimpleInjector {
|
||||
|
||||
|
||||
// Helper to get the count out of an option
|
||||
def countOfBranches (listOpt: Option[List[Branch]]) : Int = {
|
||||
def countOfBranches (listOpt: Option[List[BranchT]]) : Int = {
|
||||
val count = listOpt match {
|
||||
case Some(list) => list.size
|
||||
case None => 0
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
package code.branches
|
||||
|
||||
import code.branches.Branches._
|
||||
import code.model.BankId
|
||||
|
||||
import code.common._
|
||||
|
||||
import code.model.BankId
|
||||
import code.util.{TwentyFourHourClockString, UUIDString}
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.mapper._
|
||||
import org.joda.time.Hours
|
||||
|
||||
import scala.util.Try
|
||||
|
||||
object MappedBranchesProvider extends BranchesProvider {
|
||||
|
||||
@ -36,9 +30,6 @@ class MappedBranch extends BranchT with LongKeyedMapper[MappedBranch] with IdPK
|
||||
override def getSingleton = MappedBranch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
object mBankId extends UUIDString(this)
|
||||
object mName extends MappedString(this, 255)
|
||||
|
||||
@ -131,37 +122,106 @@ class MappedBranch extends BranchT with LongKeyedMapper[MappedBranch] with IdPK
|
||||
|
||||
override def bankId: BankId = BankId(mBankId.get)
|
||||
|
||||
override def address: AddressT = new AddressT {
|
||||
override def line1: String = mLine1.get
|
||||
override def line2: String = mLine2.get
|
||||
override def line3: String = mLine3.get
|
||||
override def city: String = mCity.get
|
||||
override def county: String = mCounty.get
|
||||
override def state: String = mState.get
|
||||
override def countryCode: String = mCountryCode.get
|
||||
override def postCode: String = mPostCode.get
|
||||
}
|
||||
override def address = Address(
|
||||
line1 = mLine1.get,
|
||||
line2 = mLine2.get,
|
||||
line3 = mLine3.get,
|
||||
city = mCity.get,
|
||||
county = Some(mCounty.get),
|
||||
state = mState.get,
|
||||
countryCode = mCountryCode.get,
|
||||
postCode = mPostCode.get
|
||||
)
|
||||
|
||||
override def meta: MetaT = new MetaT {
|
||||
override def license: LicenseT = new LicenseT {
|
||||
override def id: String = mLicenseId.get
|
||||
override def name: String = mLicenseName.get
|
||||
}
|
||||
}
|
||||
override def meta = Meta (
|
||||
license = License (
|
||||
id = mLicenseId.get,
|
||||
name = mLicenseName.get
|
||||
)
|
||||
)
|
||||
|
||||
override def lobbyString: LobbyStringT = new LobbyStringT {
|
||||
override def hours: String = mLobbyHours
|
||||
}
|
||||
override def lobbyString = Some(new LobbyStringT {
|
||||
override def hours: String = mLobbyHours.get
|
||||
})
|
||||
override def location =
|
||||
Location(
|
||||
latitude = mlocationLatitude.get,
|
||||
longitude = mlocationLongitude.get,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
override def driveUpString: DriveUpStringT = new DriveUpStringT {
|
||||
override def hours: String = mDriveUpHours
|
||||
override def driveUpString = Some(new DriveUpStringT {
|
||||
override def hours: String = mDriveUpHours.get
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
override def location: LocationT = new LocationT {
|
||||
override def latitude: Double = mlocationLatitude
|
||||
override def longitude: Double = mlocationLongitude
|
||||
}
|
||||
override def lobby = Some(
|
||||
Lobby(
|
||||
monday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnMonday.get,
|
||||
closingTime = mLobbyClosingTimeOnMonday.get
|
||||
),
|
||||
tuesday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnTuesday.get,
|
||||
closingTime = mLobbyClosingTimeOnTuesday.get
|
||||
),
|
||||
wednesday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnWednesday.get,
|
||||
closingTime = mLobbyClosingTimeOnWednesday.get
|
||||
),
|
||||
thursday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnThursday.get,
|
||||
closingTime = mLobbyClosingTimeOnThursday.get
|
||||
),
|
||||
friday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnFriday.get,
|
||||
closingTime = mLobbyClosingTimeOnFriday.get
|
||||
),
|
||||
saturday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnSaturday.get,
|
||||
closingTime = mLobbyClosingTimeOnSaturday.get
|
||||
),
|
||||
sunday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnSunday.get,
|
||||
closingTime = mLobbyClosingTimeOnSunday.get
|
||||
)
|
||||
)
|
||||
)
|
||||
// Opening / Closing times are expected to have the format 24 hour format e.g. 13:45
|
||||
// but could also be 25:44 if we want to represent a time after midnight.
|
||||
override def driveUp = Some(
|
||||
DriveUp(
|
||||
monday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnMonday.get,
|
||||
closingTime = mDriveUpClosingTimeOnMonday.get
|
||||
),
|
||||
tuesday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnTuesday.get,
|
||||
closingTime = mDriveUpClosingTimeOnTuesday.get
|
||||
),
|
||||
wednesday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnWednesday.get,
|
||||
closingTime = mDriveUpClosingTimeOnWednesday.get
|
||||
),
|
||||
thursday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnThursday.get,
|
||||
closingTime = mDriveUpClosingTimeOnThursday.get
|
||||
),
|
||||
friday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnFriday.get,
|
||||
closingTime = mDriveUpClosingTimeOnFriday.get
|
||||
),
|
||||
saturday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnSaturday.get,
|
||||
closingTime = mDriveUpClosingTimeOnSaturday.get
|
||||
),
|
||||
sunday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnSunday.get,
|
||||
closingTime = mDriveUpClosingTimeOnSunday.get
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
/*
|
||||
@ -173,57 +233,80 @@ class MappedBranch extends BranchT with LongKeyedMapper[MappedBranch] with IdPK
|
||||
|
||||
|
||||
|
||||
override def lobby = Lobby(
|
||||
monday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnMonday.get,
|
||||
closingTime = mLobbyClosingTimeOnMonday.get
|
||||
),
|
||||
tuesday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnTuesday.get,
|
||||
closingTime = mLobbyClosingTimeOnTuesday.get
|
||||
),
|
||||
wednesday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnWednesday.get,
|
||||
closingTime = mLobbyClosingTimeOnWednesday.get
|
||||
),
|
||||
thursday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnThursday.get,
|
||||
closingTime = mLobbyClosingTimeOnThursday.get
|
||||
),
|
||||
friday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnFriday.get,
|
||||
closingTime = mLobbyClosingTimeOnFriday.get
|
||||
),
|
||||
saturday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnSaturday.get,
|
||||
closingTime = mLobbyClosingTimeOnSaturday.get
|
||||
),
|
||||
sunday = OpeningTimes(
|
||||
openingTime = mLobbyOpeningTimeOnSunday.get,
|
||||
closingTime = mLobbyClosingTimeOnSunday.get
|
||||
)
|
||||
)
|
||||
// Opening / Closing times are expected to have the format 24 hour format e.g. 13:45
|
||||
// but could also be 25:44 if we want to represent a time after midnight.
|
||||
override def lobbyOpeningTimeOnMonday : String = mLobbyOpeningTimeOnMonday.get
|
||||
override def lobbyClosingTimeOnMonday : String = mLobbyClosingTimeOnMonday.get
|
||||
|
||||
override def lobbyOpeningTimeOnTuesday : String = mLobbyOpeningTimeOnTuesday.get
|
||||
override def lobbyClosingTimeOnTuesday : String = mLobbyClosingTimeOnTuesday.get
|
||||
|
||||
override def lobbyOpeningTimeOnWednesday : String = mLobbyOpeningTimeOnWednesday.get
|
||||
override def lobbyClosingTimeOnWednesday : String = mLobbyClosingTimeOnWednesday.get
|
||||
|
||||
override def lobbyOpeningTimeOnThursday : String = mLobbyOpeningTimeOnThursday.get
|
||||
override def lobbyClosingTimeOnThursday: String = mLobbyClosingTimeOnThursday.get
|
||||
|
||||
override def lobbyOpeningTimeOnFriday : String = mLobbyOpeningTimeOnFriday.get
|
||||
override def lobbyClosingTimeOnFriday : String = mLobbyClosingTimeOnFriday.get
|
||||
|
||||
override def lobbyOpeningTimeOnSaturday : String = mLobbyOpeningTimeOnSaturday.get
|
||||
override def lobbyClosingTimeOnSaturday : String = mLobbyClosingTimeOnSaturday.get
|
||||
|
||||
override def lobbyOpeningTimeOnSunday: String = mLobbyOpeningTimeOnSunday.get
|
||||
override def lobbyClosingTimeOnSunday : String = mLobbyClosingTimeOnSunday.get
|
||||
|
||||
override def driveUpOpeningTimeOnMonday : String = mDriveUpOpeningTimeOnMonday.get
|
||||
override def driveUpClosingTimeOnMonday : String = mDriveUpClosingTimeOnMonday.get
|
||||
|
||||
override def driveUpOpeningTimeOnTuesday : String = mDriveUpOpeningTimeOnTuesday.get
|
||||
override def driveUpClosingTimeOnTuesday : String = mDriveUpClosingTimeOnTuesday.get
|
||||
|
||||
override def driveUpOpeningTimeOnWednesday : String = mDriveUpOpeningTimeOnWednesday.get
|
||||
override def driveUpClosingTimeOnWednesday : String = mDriveUpClosingTimeOnWednesday.get
|
||||
|
||||
override def driveUpOpeningTimeOnThursday : String = mDriveUpOpeningTimeOnThursday.get
|
||||
override def driveUpClosingTimeOnThursday: String = mDriveUpClosingTimeOnThursday.get
|
||||
|
||||
override def driveUpOpeningTimeOnFriday : String = mDriveUpOpeningTimeOnFriday.get
|
||||
override def driveUpClosingTimeOnFriday : String = mDriveUpClosingTimeOnFriday.get
|
||||
|
||||
override def driveUpOpeningTimeOnSaturday : String = mDriveUpOpeningTimeOnSaturday.get
|
||||
override def driveUpClosingTimeOnSaturday : String = mDriveUpClosingTimeOnSaturday.get
|
||||
|
||||
override def driveUpOpeningTimeOnSunday: String = mDriveUpOpeningTimeOnSunday.get
|
||||
override def driveUpClosingTimeOnSunday : String = mDriveUpClosingTimeOnSunday.get
|
||||
override def driveUp = DriveUp(
|
||||
monday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnMonday.get,
|
||||
closingTime = mDriveUpClosingTimeOnMonday.get
|
||||
),
|
||||
tuesday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnTuesday.get,
|
||||
closingTime = mDriveUpClosingTimeOnTuesday.get
|
||||
),
|
||||
wednesday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnWednesday.get,
|
||||
closingTime = mDriveUpClosingTimeOnWednesday.get
|
||||
),
|
||||
thursday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnThursday.get,
|
||||
closingTime = mDriveUpClosingTimeOnThursday.get
|
||||
),
|
||||
friday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnFriday.get,
|
||||
closingTime = mDriveUpClosingTimeOnFriday.get
|
||||
),
|
||||
saturday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnSaturday.get,
|
||||
closingTime = mDriveUpClosingTimeOnSaturday.get
|
||||
),
|
||||
sunday = OpeningTimes(
|
||||
openingTime = mDriveUpOpeningTimeOnSunday.get,
|
||||
closingTime = mDriveUpClosingTimeOnSunday.get
|
||||
)
|
||||
)
|
||||
|
||||
*/
|
||||
|
||||
// Easy access for people who use wheelchairs etc. "Y"=true "N"=false ""=Unknown
|
||||
override def isAccessible : String = mIsAccessible.get
|
||||
override def isAccessible = mIsAccessible.get match {
|
||||
case "Y" => Some(true)
|
||||
case "N" => Some(false)
|
||||
case _ => None
|
||||
}
|
||||
|
||||
override def branchType : String = mBranchType.get
|
||||
override def moreInfo : String = mMoreInfo.get
|
||||
override def branchType = Some(mBranchType.get)
|
||||
override def moreInfo = Some(mMoreInfo.get)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ case class Meta (
|
||||
def line2 : String
|
||||
def line3 : String
|
||||
def city : String
|
||||
def county : String
|
||||
def county : Option[String]
|
||||
def state : String
|
||||
def postCode : String
|
||||
//ISO_3166-1_alpha-2
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package code.products
|
||||
|
||||
import code.products.Products._
|
||||
import code.common.{LicenseT, MetaT}
|
||||
import code.common.{License, Meta}
|
||||
import code.model.BankId
|
||||
import code.products.Products.ProductCode
|
||||
import code.util.{UUIDString}
|
||||
import code.products.Products.{Product, ProductCode}
|
||||
import code.util.UUIDString
|
||||
import net.liftweb.mapper._
|
||||
|
||||
import code.products.Products.Product
|
||||
|
||||
|
||||
object MappedProductsProvider extends ProductsProvider {
|
||||
|
||||
@ -62,12 +59,12 @@ class MappedProduct extends Product with LongKeyedMapper[MappedProduct] with IdP
|
||||
override def details: String = mDetails.get
|
||||
override def description: String = mDescription.get
|
||||
|
||||
override def meta: MetaT = new MetaT {
|
||||
override def license: LicenseT = new LicenseT {
|
||||
override def id: String = mLicenseId.get
|
||||
override def name: String = mLicenseName.get
|
||||
}
|
||||
}
|
||||
override def meta = Meta (
|
||||
license = License (
|
||||
id = mLicenseId.get,
|
||||
name = mLicenseName.get
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import code.products.Products.{Product, ProductCode}
|
||||
import code.bankconnectors.{Connector, OBPLimit, OBPOffset}
|
||||
import code.model.dataAccess.ResourceUser
|
||||
import code.model._
|
||||
import code.branches.Branches.Branch
|
||||
import code.branches.Branches.{Branch, BranchT}
|
||||
import code.atms.Atms.Atm
|
||||
import code.users.Users
|
||||
import code.util.Helper
|
||||
@ -52,7 +52,7 @@ trait OBPDataImport extends MdcLoggable {
|
||||
type ViewType <: View
|
||||
type TransactionType <: TransactionUUID
|
||||
type AccountOwnerUsername = String
|
||||
type BranchType <: Branch
|
||||
type BranchType <: BranchT
|
||||
type AtmType <: Atm
|
||||
type ProductType <: Product
|
||||
type CrmEventType <: CrmEvent
|
||||
|
||||
@ -7,7 +7,7 @@ import code.api.v2_1_0.{BranchJsonPostV210, TransactionRequestCommonBodyJSON}
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors.{Connector, InboundAdapterInfo, InboundUser, OBPQueryParam}
|
||||
import code.branches.Branches.{Branch, BranchId}
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches.MappedBranch
|
||||
import code.fx.FXRate
|
||||
import code.management.ImporterAPI.ImporterTransaction
|
||||
@ -196,7 +196,7 @@ class PhysicalCardsTest extends ServerSetup with DefaultUsers with DefaultConne
|
||||
override def getProducts(bankId: BankId): Box[List[Product]] = Empty
|
||||
override def getProduct(bankId: BankId, productCode: ProductCode): Box[Product] = Empty
|
||||
|
||||
override def createOrUpdateBranch(branch: BranchJsonPostV210, branchRoutingScheme: String, branchRoutingAddress: String): Box[Branch] = Empty
|
||||
override def createOrUpdateBranch(branch: Branch): Box[BranchT] = Empty
|
||||
override def getBranch(bankId: BankId, branchId: BranchId): Box[MappedBranch]= Empty
|
||||
override def getAtm(bankId: BankId, atmId: AtmId): Box[MappedAtm] = Empty // TODO Return Not Implemented
|
||||
|
||||
|
||||
@ -50,11 +50,11 @@ class AtmsTest extends V140ServerSetup with DefaultUsers {
|
||||
moreInfo : String
|
||||
) extends Atm
|
||||
|
||||
case class AddressImpl(line1 : String, line2 : String, line3 : String, city : String, county : String,
|
||||
case class AddressImpl(line1 : String, line2 : String, line3 : String, city : String, county : Option[String],
|
||||
state : String, postCode : String, countryCode : String) extends AddressT
|
||||
|
||||
|
||||
val fakeAddress1 = AddressImpl("Duckerstrasse 86", "Prenzlauerberg", "lala", "Berlin", "a county", "Berlin", "10437", "DE")
|
||||
val fakeAddress1 = AddressImpl("Duckerstrasse 86", "Prenzlauerberg", "lala", "Berlin", Some("a county"), "Berlin", "10437", "DE")
|
||||
val fakeAddress2 = fakeAddress1.copy(line1 = "00000")
|
||||
|
||||
val fakeMeta = new MetaT {
|
||||
|
||||
@ -3,8 +3,8 @@ package code.api.v1_4_0
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.{BranchJson, BranchesJson}
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import dispatch._
|
||||
import code.common.{AddressT, LicenseT, LocationT, MetaT}
|
||||
import code.branches.Branches.{Branch, BranchId, DriveUpStringT, LobbyStringT}
|
||||
import code.common._
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT, DriveUp, DriveUpStringT, Lobby, LobbyStringT}
|
||||
import code.branches.{Branches, BranchesProvider}
|
||||
import code.model.BankId
|
||||
import code.setup.DefaultUsers
|
||||
@ -23,11 +23,11 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
branchId: BranchId,
|
||||
bankId: BankId,
|
||||
name: String,
|
||||
address: AddressT,
|
||||
location: LocationT,
|
||||
meta: MetaT,
|
||||
lobbyString: LobbyStringT,
|
||||
driveUpString: DriveUpStringT,
|
||||
address: Address,
|
||||
location: Location,
|
||||
meta: Meta,
|
||||
lobbyString: Option[LobbyStringT],
|
||||
driveUpString: Option[DriveUpStringT],
|
||||
branchRoutingScheme: String,
|
||||
branchRoutingAddress: String,
|
||||
|
||||
@ -75,63 +75,72 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
driveUpOpeningTimeOnSunday: String,
|
||||
driveUpClosingTimeOnSunday : String,
|
||||
|
||||
|
||||
|
||||
// Easy access for people who use wheelchairs etc. "Y"=true "N"=false ""=Unknown
|
||||
isAccessible : String,
|
||||
isAccessible : Option[Boolean],
|
||||
|
||||
branchType : String,
|
||||
moreInfo : String
|
||||
branchType : Option[String],
|
||||
moreInfo : Option[String],
|
||||
driveUp: Option[DriveUp],
|
||||
lobby: Option[Lobby],
|
||||
branchRouting: Option[RoutingT]
|
||||
|
||||
) extends Branch
|
||||
case class AddressImpl(line1 : String, line2 : String, line3 : String, city : String, county : String,
|
||||
state : String, postCode : String, countryCode : String) extends AddressT
|
||||
) extends BranchT
|
||||
|
||||
|
||||
val fakeAddress1 = AddressImpl("Dunckerstraße 73 ApS", "Udemarken", "Hjørring", "Berlin", "Denmark", "Denmark", "10437", "DE")
|
||||
|
||||
val fakeAddress1 = Address("Dunckerstraße 73 ApS", "Udemarken", "Hjørring", "Berlin", Some("Denmark"), "Denmark", "10437", "DE")
|
||||
val fakeAddress2 = fakeAddress1.copy(line1 = "00000")
|
||||
|
||||
val fakeMeta = new MetaT {
|
||||
val license = new LicenseT {
|
||||
override def id: String = "sample-license"
|
||||
override def name: String = "Sample License"
|
||||
}
|
||||
}
|
||||
val fakeMeta = Meta (
|
||||
License (
|
||||
id = "sample-license",
|
||||
name = "Sample License"
|
||||
)
|
||||
)
|
||||
|
||||
val fakeMetaNoLicense = new MetaT {
|
||||
val license = new LicenseT {
|
||||
override def id: String = ""
|
||||
override def name: String = ""
|
||||
}
|
||||
}
|
||||
val fakeMetaNoLicense = Meta (
|
||||
License (
|
||||
id = "",
|
||||
name = ""
|
||||
)
|
||||
)
|
||||
|
||||
val fakeLocation = new LocationT {
|
||||
override def latitude: Double = 1.11
|
||||
override def longitude: Double = 2.22
|
||||
}
|
||||
val fakeLocation = Location (
|
||||
latitude = 1.11,
|
||||
longitude = 2.22,
|
||||
date =None,
|
||||
user = None
|
||||
)
|
||||
|
||||
|
||||
val fakeLocation2 = new LocationT {
|
||||
override def latitude: Double = 1.1111
|
||||
override def longitude: Double = 2.2222
|
||||
}
|
||||
val fakeLocation2 = Location (
|
||||
latitude = 1.1111,
|
||||
longitude = 2.2222,
|
||||
date =None,
|
||||
user = None
|
||||
)
|
||||
|
||||
|
||||
val fakeLobby = new LobbyStringT {
|
||||
val fakeLobby = Some(new LobbyStringT {
|
||||
val hours = "M-Th 9-5, Fri 9-6, Sat 9-1"
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
val fakeLobby2 = new LobbyStringT {
|
||||
val fakeLobby2 = Some(new LobbyStringT {
|
||||
val hours = "9-5"
|
||||
}
|
||||
})
|
||||
|
||||
val fakeDriveUp = new DriveUpStringT {
|
||||
val fakeDriveUp = Some(new DriveUpStringT {
|
||||
override def hours: String = "M-Th 8:30 - 5:30, Fri 8:30 - 6, Sat: 9-12"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
val fakeDriveUp2 = new DriveUpStringT {
|
||||
val fakeDriveUp2 = Some(new DriveUpStringT {
|
||||
override def hours: String = "M-Th 8:30 - 5:30"
|
||||
}
|
||||
})
|
||||
|
||||
val fakeBranchRoutingScheme : String = "Bank X Scheme"
|
||||
val fakeBranchRoutingAddress : String = "78676"
|
||||
@ -140,9 +149,9 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
val fakeOpeningTime : String = "10:00"
|
||||
val fakeClosingTime : String = "18:00"
|
||||
|
||||
val fakeIsAccessible : String = "Y"
|
||||
val fakeBranchType : String = "Main"
|
||||
val fakeMoreInfo : String = "Very near to the lake"
|
||||
val fakeIsAccessible: Option[Boolean] = Some(true)
|
||||
val fakeBranchType : Option[String] = Some("Main")
|
||||
val fakeMoreInfo : Option[String] = Some("Very near to the lake")
|
||||
|
||||
|
||||
val fakeBranch1 = BranchImpl(BranchId("branch1"), BankId("uk"),"Branch 1 Müdürlük", fakeAddress1, fakeLocation, fakeMeta, fakeLobby, fakeDriveUp, fakeBranchRoutingScheme,fakeBranchRoutingAddress,
|
||||
@ -153,16 +162,16 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeIsAccessible,
|
||||
fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeIsAccessible,
|
||||
fakeBranchType,
|
||||
fakeMoreInfo,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime)
|
||||
fakeMoreInfo, None, None, None)
|
||||
val fakeBranch2 = BranchImpl(BranchId("branch2"), BankId("uk"), "Branch 2 Lala", fakeAddress2, fakeLocation2, fakeMeta, fakeLobby2, fakeDriveUp2,fakeBranchRoutingScheme,fakeBranchRoutingAddress,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
@ -171,16 +180,16 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeIsAccessible,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeIsAccessible,
|
||||
fakeBranchType,
|
||||
fakeMoreInfo,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime)
|
||||
fakeMoreInfo, None, None, None)
|
||||
val fakeBranch3 = BranchImpl(BranchId("branch3"), BankId("uk"), "Branch 3", fakeAddress2, fakeLocation, fakeMetaNoLicense, fakeLobby, fakeDriveUp2,fakeBranchRoutingScheme,fakeBranchRoutingAddress,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
@ -189,20 +198,20 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeIsAccessible,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeIsAccessible,
|
||||
fakeBranchType,
|
||||
fakeMoreInfo,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime,
|
||||
fakeOpeningTime, fakeClosingTime) // Should not be returned
|
||||
fakeMoreInfo, None, None, None) // Should not be returned
|
||||
|
||||
// This mock provider is returning same branches for the fake banks
|
||||
val mockConnector = new BranchesProvider {
|
||||
override protected def getBranchesFromProvider(bank: BankId): Option[List[Branch]] = {
|
||||
override protected def getBranchesFromProvider(bank: BankId): Option[List[BranchT]] = {
|
||||
bank match {
|
||||
// have it return branches even for the bank without a license so we can test the API does not return them
|
||||
case BankWithLicense | BankWithoutLicense=> Some(List(fakeBranch1, fakeBranch2, fakeBranch3))
|
||||
@ -211,7 +220,7 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
}
|
||||
|
||||
// Mock a badly behaving connector that returns data that doesn't have license.
|
||||
override protected def getBranchFromProvider(branchId: BranchId): Option[Branch] = {
|
||||
override protected def getBranchFromProvider(branchId: BranchId): Option[BranchT] = {
|
||||
branchId match {
|
||||
case BankWithLicense => Some(fakeBranch1)
|
||||
case BankWithoutLicense=> Some(fakeBranch3) // In case the connector returns, the API should guard
|
||||
@ -221,7 +230,7 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
}
|
||||
|
||||
def verifySameData(branch: Branch, branchJson : BranchJson) = {
|
||||
def verifySameData(branch: BranchT, branchJson : BranchJson) = {
|
||||
branch.name should equal (branchJson.name)
|
||||
branch.branchId should equal(BranchId(branchJson.id))
|
||||
branch.address.line1 should equal(branchJson.address.line_1)
|
||||
@ -233,8 +242,8 @@ class BranchesTest extends V140ServerSetup with DefaultUsers {
|
||||
branch.address.postCode should equal(branchJson.address.postcode)
|
||||
branch.location.latitude should equal(branchJson.location.latitude)
|
||||
branch.location.longitude should equal(branchJson.location.longitude)
|
||||
branch.lobbyString.hours should equal(branchJson.lobby.hours)
|
||||
branch.driveUpString.hours should equal(branchJson.drive_up.hours)
|
||||
branch.lobbyString.getOrElse("") should equal(branchJson.lobby.hours)
|
||||
branch.driveUpString.getOrElse("") should equal(branchJson.drive_up.hours)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -2,7 +2,7 @@ package code.api.v1_4_0
|
||||
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.{ProductJson, ProductsJson}
|
||||
import code.common.{LicenseT, MetaT}
|
||||
import code.common.{License, LicenseT, Meta, MetaT}
|
||||
import code.model.BankId
|
||||
import code.products.Products.ProductCode
|
||||
import code.products.Products.Product
|
||||
@ -25,21 +25,21 @@ class ProductsTest extends ServerSetup with DefaultUsers with V140ServerSetup {
|
||||
moreInfoUrl: String,
|
||||
details: String,
|
||||
description: String,
|
||||
meta: MetaT) extends Product
|
||||
meta: Meta) extends Product
|
||||
|
||||
val fakeMeta = new MetaT {
|
||||
val license = new LicenseT {
|
||||
override def id: String = "example-data-license"
|
||||
override def name: String = "Example Data License"
|
||||
}
|
||||
}
|
||||
val fakeMeta = Meta(
|
||||
License (
|
||||
id = "example-data-license",
|
||||
name = "Example Data License"
|
||||
)
|
||||
)
|
||||
|
||||
val fakeMetaNoLicense = new MetaT {
|
||||
val license = new LicenseT {
|
||||
override def id: String = ""
|
||||
override def name: String = ""
|
||||
}
|
||||
}
|
||||
val fakeMetaNoLicense = Meta(
|
||||
License (
|
||||
id = "",
|
||||
name = ""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
val fakeProduct1 = ProductImpl(BankWithLicense, ProductCode("prod1"), "name 1", "cat 1", "family 1", "super family 1", "http://www.example.com/moreinfo1.html", "", "", fakeMeta)
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package code.branches
|
||||
|
||||
import code.model.BankId
|
||||
import code.branches.Branches.BranchId
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import net.liftweb.mapper.By
|
||||
import code.branches.Branches.Branch
|
||||
import code.setup.ServerSetup
|
||||
|
||||
class MappedBranchesProviderTest extends ServerSetup {
|
||||
@ -94,7 +93,7 @@ class MappedBranchesProviderTest extends ServerSetup {
|
||||
MappedBranch.find(By(MappedBranch.mBankId, fixture.bankIdX)).isDefined should equal(true)
|
||||
|
||||
When("we try to get the branches for that bank")
|
||||
val branchesOpt: Option[List[Branch]] = MappedBranchesProvider.getBranches(BankId(fixture.bankIdX))
|
||||
val branchesOpt: Option[List[BranchT]] = MappedBranchesProvider.getBranches(BankId(fixture.bankIdX))
|
||||
|
||||
Then("We should get a branches list")
|
||||
branchesOpt.isDefined should equal (true)
|
||||
|
||||
@ -6,7 +6,7 @@ import code.api.v2_1_0.{BranchJsonPostV210, TransactionRequestCommonBodyJSON}
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors._
|
||||
import code.branches.Branches.{Branch, BranchId}
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches.MappedBranch
|
||||
import code.fx.FXRate
|
||||
import code.management.ImporterAPI.ImporterTransaction
|
||||
@ -160,7 +160,7 @@ object MockedCardConnector extends ServerSetup
|
||||
override def getProducts(bankId: BankId): Box[List[Product]] = Empty
|
||||
override def getProduct(bankId: BankId, productCode: ProductCode): Box[Product] = Empty
|
||||
|
||||
override def createOrUpdateBranch(branch: BranchJsonPostV210, branchRoutingScheme: String, branchRoutingAddress: String): Box[Branch] = Empty
|
||||
override def createOrUpdateBranch(branch: Branch): Box[BranchT] = Empty
|
||||
override def getBranch(bankId: BankId, branchId: BranchId): Box[MappedBranch]= Empty
|
||||
override def getAtm(bankId: BankId, atmId: AtmId): Box[MappedAtm] = Empty // TODO Return Not Implemented
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ import code.api.v1_2_1.APIMethods121
|
||||
import code.atms.Atms
|
||||
import code.atms.Atms.{Atm, AtmId, countOfAtms}
|
||||
import code.branches.Branches
|
||||
import code.branches.Branches.{Branch, BranchId, countOfBranches}
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT, countOfBranches}
|
||||
import code.crm.CrmEvent
|
||||
import code.crm.CrmEvent
|
||||
import code.crm.CrmEvent.{CrmEvent, CrmEventId}
|
||||
@ -168,7 +168,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Shoul
|
||||
val branchId = BranchId(branch.id)
|
||||
|
||||
// check we have found a branch
|
||||
val foundBranchOpt: Option[Branch] = Branches.branchesProvider.vend.getBranch(branchId)
|
||||
val foundBranchOpt: Option[BranchT] = Branches.branchesProvider.vend.getBranch(branchId)
|
||||
foundBranchOpt.isDefined should equal(true)
|
||||
|
||||
val foundBranch = foundBranchOpt.get
|
||||
@ -189,8 +189,8 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Shoul
|
||||
foundBranch.meta.license.id should equal(branch.meta.license.id)
|
||||
foundBranch.meta.license.name should equal(branch.meta.license.name)
|
||||
|
||||
foundBranch.lobbyString.hours should equal(branch.lobby.get.hours) // TODO Check None situation (lobby is None)
|
||||
foundBranch.driveUpString.hours should equal(branch.driveUp.get.hours) // TODO Check None situation (driveUp is None)
|
||||
foundBranch.lobbyString.getOrElse("") should equal(branch.lobby.get.hours) // TODO Check None situation (lobby is None)
|
||||
foundBranch.driveUpString.getOrElse("") should equal(branch.driveUp.get.hours) // TODO Check None situation (driveUp is None)
|
||||
}
|
||||
|
||||
def verifyAtmCreated(atm : SandboxAtmImport) = {
|
||||
@ -1713,7 +1713,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Shoul
|
||||
|
||||
// Check we are starting from a clean slate (no branches for this bank)
|
||||
// Might be better to expect Try[List[Branch]] but then would need to modify the API stack up to the top
|
||||
val existingBranches: Option[List[Branch]] = Branches.branchesProvider.vend.getBranches(bankId1)
|
||||
val existingBranches: Option[List[BranchT]] = Branches.branchesProvider.vend.getBranches(bankId1)
|
||||
|
||||
// We want the size of the list inside the Option
|
||||
val existingBranchesCount = countOfBranches(existingBranches)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user