/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.2-dev * User agent: apibuilder app.apibuilder.io/mard/mard2p-api/0.0.2-dev/play_2_2_client */ package payp.mard2p.api.v0.models { /** * Account is defined by the app specifically to manage users transactions. * * @param accountid Internal unique identifier for this account. * @param ownerid The username registered in the application * @param totalAmount The amount specific to the debit and sold account. This field allows the process * transactions. * @param currency The currency specific to location. * @param sold The amount specific to the balance account. This field allows the process * transactions. * @param debit The amount specific to the money merchant have to collect and pay. This field * allows the process transactions. */ final case class Account( accountid: Long, ownerid: String, totalAmount: Double, currency: String, sold: Double, debit: Double ) /** * @param accountid Internal unique identifier for this account. * @param ownerid The username registered in the application. * @param totalAmount The amount specific to the debit and sold account. This field allows the process * transactions. * @param sold The amount specific to the balance account. This field allows the process * transactions. * @param debit The amount specific to the money merchant have to collect and pay. This field * allows the process transactions. * @param currency The currency specific to location. */ final case class AccountForm( accountid: Long, ownerid: String, totalAmount: _root_.scala.Option[Double] = None, sold: Double, debit: _root_.scala.Option[Double] = None, currency: String ) /** * Deposit describes a way a payment is handled. It depends of Payment Resource * * @param depid Internal unique identifier for this account. * @param paymentid The added paymentid used to proceed the deposit transaction. */ final case class Deposit( depid: Long, paymentid: Long ) /** * Payment is defined by the app specifically to emit users transactions. * * @param payid Internal unique identifier for this payment. * @param actorid The username registered in the application * @param amount The amount to send. This field allowed the processing transactions. * @param refAccountid The accountid to use to send money to the specific account. * @param paymentMethod The type of payment to use [Mobile Money or Credit Card]. * @param operatorid The operator specified the type of payment if Mobile Money. * @param phone The phone identifying specific account of consumer. * @param pin The code used to validate the transaction. * @param currency The phone identifying specific account of consumer. * @param paymentContext This field specify the type of transaction [Buying, Deposit, Withdraw]. */ final case class Payment( payid: Long, actorid: String, amount: Double, refAccountid: Long, paymentMethod: String, operatorid: String, phone: Long, pin: Int, currency: String, paymentContext: String ) /** * @param payid Internal unique identifier for this payment. * @param actorid The username registered in the application * @param amount The amount to send. This field allowed the processing transactions. * @param refAccountid The accountid to use to send money to the specific account. * @param paymentMethod The type of payment to use [Mobile Money or Credit Card]. * @param operatorid The operator specified the type of payment if Mobile Money. * @param phone The phone identifying specific account of consumer. * @param pin The code used to validate the transaction. * @param currency The phone identifying specific account of consumer. * @param paymentContext This field specify the type of transaction [Buying, Deposit, Withdraw]. */ final case class PaymentForm( payid: Long, actorid: String, amount: Double, refAccountid: Long, paymentMethod: String, operatorid: String, phone: Long, pin: Int, currency: String, paymentContext: String ) /** * Transfer is defined by the app specifically to manage users transactions * (sending and receiving). * * @param transferid Internal unique identifier for this account. * @param senderid The username registered in the application * @param amount The amount to be send. This field allows the process transactions. * @param refAccountidReceiver The accountid to use to send money and referencing the receiver. * @param refAccountidSender The accountid to use to send money and referencing the sender. * @param currency The currency specific to a country. */ final case class Transfer( transferid: Long, senderid: String, amount: Double, refAccountidReceiver: Long, refAccountidSender: Long, currency: String ) /** * @param transferid Internal unique identifier for this account. * @param senderid The username registered in the application. * @param amount The amount to be send. This field allows the process transactions. * @param refAccountidReceiver The accountid to use to send money and referencing the receiver. * @param refAccountidSender The accountid to use to send money and referencing the sender. * @param currency The currency specific to a country. */ final case class TransferForm( transferid: Long, senderid: String, amount: Double, refAccountidReceiver: Long, refAccountidSender: Long, currency: String ) /** * Used only to validate json files - used as a resource where http status code * defines success * * @param valid If true, the json schema is valid. If false, there is at least one validation * error. * @param errors Contains any validation errors that result from parsing the json document. If * empty, the document is valid. */ final case class Validation( valid: Boolean, errors: Seq[String] = Nil ) /** * Withdraw describes a way a payment is handled. It depends of Payment Resource * * @param wdwid Internal unique identifier for this account. * @param paymentid The added paymentid used to proceed the deposit transaction. */ final case class Withdraw( wdwid: Long, paymentid: Long ) sealed trait AppSortBy extends _root_.scala.Product with _root_.scala.Serializable object AppSortBy { case object Created extends AppSortBy { override def toString = "created" } case object Edited extends AppSortBy { override def toString = "edited" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends AppSortBy /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[AppSortBy] = scala.List(Created, Edited) private val byName: Map[String, AppSortBy] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): AppSortBy = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[AppSortBy] = byName.get(value.toLowerCase) } sealed trait OriginalType extends _root_.scala.Product with _root_.scala.Serializable object OriginalType { /** * The original is in the api.json format */ case object ApiJson extends OriginalType { override def toString = "api_json" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends OriginalType /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[OriginalType] = scala.List(ApiJson) private val byName: Map[String, OriginalType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): OriginalType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[OriginalType] = byName.get(value.toLowerCase) } /** * A publication represents something that a user can subscribe to. An example * would be subscribing to an email alert whenever a new version of an application * is created. */ sealed trait Publication extends _root_.scala.Product with _root_.scala.Serializable object Publication { /** * For organizations for which I am an administrator, email me whenever a user * applies to join the org. */ case object MembershipRequestsCreate extends Publication { override def toString = "membership_requests.create" } /** * For organizations for which I am a member, email me whenever a user joins the * org. */ case object MembershipsCreate extends Publication { override def toString = "memberships.create" } /** * For organizations for which I am a member, email me whenever an application is * created. */ case object ApplicationsCreate extends Publication { override def toString = "applications.create" } /** * For applications that I watch, email me whenever a version is created. */ case object VersionsCreate extends Publication { override def toString = "versions.create" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends Publication /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[Publication] = scala.List(MembershipRequestsCreate, MembershipsCreate, ApplicationsCreate, VersionsCreate) private val byName: Map[String, Publication] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): Publication = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[Publication] = byName.get(value.toLowerCase) } sealed trait SortOrder extends _root_.scala.Product with _root_.scala.Serializable object SortOrder { case object Asc extends SortOrder { override def toString = "asc" } case object Desc extends SortOrder { override def toString = "desc" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends SortOrder /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[SortOrder] = scala.List(Asc, Desc) private val byName: Map[String, SortOrder] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): SortOrder = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[SortOrder] = byName.get(value.toLowerCase) } /** * Controls who is able to view this version */ sealed trait Visibility extends _root_.scala.Product with _root_.scala.Serializable object Visibility { /** * Anybody, including non logged in users, can view this application */ case object Public extends Visibility { override def toString = "public" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends Visibility /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[Visibility] = scala.List(Public) private val byName: Map[String, Visibility] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): Visibility = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[Visibility] = byName.get(value.toLowerCase) } } package payp.mard2p.api.v0.models { package object json { import play.api.libs.json.__ import play.api.libs.json.JsString import play.api.libs.json.Writes import play.api.libs.functional.syntax._ import io.apibuilder.common.v0.models.json._ import io.apibuilder.generator.v0.models.json._ import io.apibuilder.spec.v0.models.json._ import payp.mard2p.api.v0.models.json._ private[v0] implicit val jsonReadsUUID: play.api.libs.json.Reads[_root_.java.util.UUID] = __.read[String].map { str => _root_.java.util.UUID.fromString(str) } private[v0] implicit val jsonWritesUUID: play.api.libs.json.Writes[_root_.java.util.UUID] = (x: _root_.java.util.UUID) => play.api.libs.json.JsString(x.toString) private[v0] implicit val jsonReadsJodaDateTime: play.api.libs.json.Reads[_root_.org.joda.time.DateTime] = __.read[String].map { str => _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseDateTime(str) } private[v0] implicit val jsonWritesJodaDateTime: play.api.libs.json.Writes[_root_.org.joda.time.DateTime] = (x: _root_.org.joda.time.DateTime) => { play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(x)) } private[v0] implicit val jsonReadsJodaLocalDate: play.api.libs.json.Reads[_root_.org.joda.time.LocalDate] = __.read[String].map { str => _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseLocalDate(str) } private[v0] implicit val jsonWritesJodaLocalDate: play.api.libs.json.Writes[_root_.org.joda.time.LocalDate] = (x: _root_.org.joda.time.LocalDate) => { play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.date.print(x)) } implicit val jsonReadsMard2pAPIAppSortBy: play.api.libs.json.Reads[payp.mard2p.api.v0.models.AppSortBy] = new play.api.libs.json.Reads[payp.mard2p.api.v0.models.AppSortBy] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[payp.mard2p.api.v0.models.AppSortBy] = { js match { case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.AppSortBy(v.value)) case _ => { (js \ "value").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.AppSortBy(v)) case _: play.api.libs.json.JsError => (js \ "app_sort_by").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.AppSortBy(v)) case err: play.api.libs.json.JsError => err } } } } } } def jsonWritesMard2pAPIAppSortBy(obj: payp.mard2p.api.v0.models.AppSortBy) = { play.api.libs.json.JsString(obj.toString) } def jsObjectAppSortBy(obj: payp.mard2p.api.v0.models.AppSortBy) = { play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) } implicit def jsonWritesMard2pAPIAppSortBy: play.api.libs.json.Writes[AppSortBy] = { (obj: payp.mard2p.api.v0.models.AppSortBy) => { payp.mard2p.api.v0.models.json.jsonWritesMard2pAPIAppSortBy(obj) } } implicit val jsonReadsMard2pAPIOriginalType: play.api.libs.json.Reads[payp.mard2p.api.v0.models.OriginalType] = new play.api.libs.json.Reads[payp.mard2p.api.v0.models.OriginalType] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[payp.mard2p.api.v0.models.OriginalType] = { js match { case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.OriginalType(v.value)) case _ => { (js \ "value").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.OriginalType(v)) case _: play.api.libs.json.JsError => (js \ "original_type").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.OriginalType(v)) case err: play.api.libs.json.JsError => err } } } } } } def jsonWritesMard2pAPIOriginalType(obj: payp.mard2p.api.v0.models.OriginalType) = { play.api.libs.json.JsString(obj.toString) } def jsObjectOriginalType(obj: payp.mard2p.api.v0.models.OriginalType) = { play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) } implicit def jsonWritesMard2pAPIOriginalType: play.api.libs.json.Writes[OriginalType] = { (obj: payp.mard2p.api.v0.models.OriginalType) => { payp.mard2p.api.v0.models.json.jsonWritesMard2pAPIOriginalType(obj) } } implicit val jsonReadsMard2pAPIPublication: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Publication] = new play.api.libs.json.Reads[payp.mard2p.api.v0.models.Publication] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[payp.mard2p.api.v0.models.Publication] = { js match { case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Publication(v.value)) case _ => { (js \ "value").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Publication(v)) case _: play.api.libs.json.JsError => (js \ "publication").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Publication(v)) case err: play.api.libs.json.JsError => err } } } } } } def jsonWritesMard2pAPIPublication(obj: payp.mard2p.api.v0.models.Publication) = { play.api.libs.json.JsString(obj.toString) } def jsObjectPublication(obj: payp.mard2p.api.v0.models.Publication) = { play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) } implicit def jsonWritesMard2pAPIPublication: play.api.libs.json.Writes[Publication] = { (obj: payp.mard2p.api.v0.models.Publication) => { payp.mard2p.api.v0.models.json.jsonWritesMard2pAPIPublication(obj) } } implicit val jsonReadsMard2pAPISortOrder: play.api.libs.json.Reads[payp.mard2p.api.v0.models.SortOrder] = new play.api.libs.json.Reads[payp.mard2p.api.v0.models.SortOrder] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[payp.mard2p.api.v0.models.SortOrder] = { js match { case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.SortOrder(v.value)) case _ => { (js \ "value").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.SortOrder(v)) case _: play.api.libs.json.JsError => (js \ "sort_order").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.SortOrder(v)) case err: play.api.libs.json.JsError => err } } } } } } def jsonWritesMard2pAPISortOrder(obj: payp.mard2p.api.v0.models.SortOrder) = { play.api.libs.json.JsString(obj.toString) } def jsObjectSortOrder(obj: payp.mard2p.api.v0.models.SortOrder) = { play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) } implicit def jsonWritesMard2pAPISortOrder: play.api.libs.json.Writes[SortOrder] = { (obj: payp.mard2p.api.v0.models.SortOrder) => { payp.mard2p.api.v0.models.json.jsonWritesMard2pAPISortOrder(obj) } } implicit val jsonReadsMard2pAPIVisibility: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Visibility] = new play.api.libs.json.Reads[payp.mard2p.api.v0.models.Visibility] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[payp.mard2p.api.v0.models.Visibility] = { js match { case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Visibility(v.value)) case _ => { (js \ "value").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Visibility(v)) case _: play.api.libs.json.JsError => (js \ "visibility").validate[String] match { case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(payp.mard2p.api.v0.models.Visibility(v)) case err: play.api.libs.json.JsError => err } } } } } } def jsonWritesMard2pAPIVisibility(obj: payp.mard2p.api.v0.models.Visibility) = { play.api.libs.json.JsString(obj.toString) } def jsObjectVisibility(obj: payp.mard2p.api.v0.models.Visibility) = { play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) } implicit def jsonWritesMard2pAPIVisibility: play.api.libs.json.Writes[Visibility] = { (obj: payp.mard2p.api.v0.models.Visibility) => { payp.mard2p.api.v0.models.json.jsonWritesMard2pAPIVisibility(obj) } } implicit def jsonReadsMard2pAPIAccount: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Account] = { for { accountid <- (__ \ "accountid").read[Long] ownerid <- (__ \ "ownerid").read[String] totalAmount <- (__ \ "total_amount").read[Double] currency <- (__ \ "currency").read[String] sold <- (__ \ "sold").read[Double] debit <- (__ \ "debit").read[Double] } yield Account(accountid, ownerid, totalAmount, currency, sold, debit) } def jsObjectAccount(obj: payp.mard2p.api.v0.models.Account): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "accountid" -> play.api.libs.json.JsNumber(obj.accountid), "ownerid" -> play.api.libs.json.JsString(obj.ownerid), "total_amount" -> play.api.libs.json.JsNumber(obj.totalAmount), "currency" -> play.api.libs.json.JsString(obj.currency), "sold" -> play.api.libs.json.JsNumber(obj.sold), "debit" -> play.api.libs.json.JsNumber(obj.debit) ) } implicit def jsonWritesMard2pAPIAccount: play.api.libs.json.Writes[Account] = { (obj: payp.mard2p.api.v0.models.Account) => { payp.mard2p.api.v0.models.json.jsObjectAccount(obj) } } implicit def jsonReadsMard2pAPIAccountForm: play.api.libs.json.Reads[payp.mard2p.api.v0.models.AccountForm] = { for { accountid <- (__ \ "accountid").read[Long] ownerid <- (__ \ "ownerid").read[String] totalAmount <- (__ \ "total_amount").readNullable[Double] sold <- (__ \ "sold").read[Double] debit <- (__ \ "debit").readNullable[Double] currency <- (__ \ "currency").read[String] } yield AccountForm(accountid, ownerid, totalAmount, sold, debit, currency) } def jsObjectAccountForm(obj: payp.mard2p.api.v0.models.AccountForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "accountid" -> play.api.libs.json.JsNumber(obj.accountid), "ownerid" -> play.api.libs.json.JsString(obj.ownerid), "sold" -> play.api.libs.json.JsNumber(obj.sold), "currency" -> play.api.libs.json.JsString(obj.currency) ) ++ (obj.totalAmount match { case None => play.api.libs.json.Json.obj() case Some(x) => play.api.libs.json.Json.obj("total_amount" -> play.api.libs.json.JsNumber(x)) }) ++ (obj.debit match { case None => play.api.libs.json.Json.obj() case Some(x) => play.api.libs.json.Json.obj("debit" -> play.api.libs.json.JsNumber(x)) }) } implicit def jsonWritesMard2pAPIAccountForm: play.api.libs.json.Writes[AccountForm] = { (obj: payp.mard2p.api.v0.models.AccountForm) => { payp.mard2p.api.v0.models.json.jsObjectAccountForm(obj) } } implicit def jsonReadsMard2pAPIDeposit: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Deposit] = { for { depid <- (__ \ "depid").read[Long] paymentid <- (__ \ "paymentid").read[Long] } yield Deposit(depid, paymentid) } def jsObjectDeposit(obj: payp.mard2p.api.v0.models.Deposit): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "depid" -> play.api.libs.json.JsNumber(obj.depid), "paymentid" -> play.api.libs.json.JsNumber(obj.paymentid) ) } implicit def jsonWritesMard2pAPIDeposit: play.api.libs.json.Writes[Deposit] = { (obj: payp.mard2p.api.v0.models.Deposit) => { payp.mard2p.api.v0.models.json.jsObjectDeposit(obj) } } implicit def jsonReadsMard2pAPIPayment: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Payment] = { for { payid <- (__ \ "payid").read[Long] actorid <- (__ \ "actorid").read[String] amount <- (__ \ "amount").read[Double] refAccountid <- (__ \ "ref_accountid").read[Long] paymentMethod <- (__ \ "payment_method").read[String] operatorid <- (__ \ "operatorid").read[String] phone <- (__ \ "phone").read[Long] pin <- (__ \ "pin").read[Int] currency <- (__ \ "currency").read[String] paymentContext <- (__ \ "payment_context").read[String] } yield Payment(payid, actorid, amount, refAccountid, paymentMethod, operatorid, phone, pin, currency, paymentContext) } def jsObjectPayment(obj: payp.mard2p.api.v0.models.Payment): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "payid" -> play.api.libs.json.JsNumber(obj.payid), "actorid" -> play.api.libs.json.JsString(obj.actorid), "amount" -> play.api.libs.json.JsNumber(obj.amount), "ref_accountid" -> play.api.libs.json.JsNumber(obj.refAccountid), "payment_method" -> play.api.libs.json.JsString(obj.paymentMethod), "operatorid" -> play.api.libs.json.JsString(obj.operatorid), "phone" -> play.api.libs.json.JsNumber(obj.phone), "pin" -> play.api.libs.json.JsNumber(obj.pin), "currency" -> play.api.libs.json.JsString(obj.currency), "payment_context" -> play.api.libs.json.JsString(obj.paymentContext) ) } implicit def jsonWritesMard2pAPIPayment: play.api.libs.json.Writes[Payment] = { (obj: payp.mard2p.api.v0.models.Payment) => { payp.mard2p.api.v0.models.json.jsObjectPayment(obj) } } implicit def jsonReadsMard2pAPIPaymentForm: play.api.libs.json.Reads[payp.mard2p.api.v0.models.PaymentForm] = { for { payid <- (__ \ "payid").read[Long] actorid <- (__ \ "actorid").read[String] amount <- (__ \ "amount").read[Double] refAccountid <- (__ \ "ref_accountid").read[Long] paymentMethod <- (__ \ "payment_method").read[String] operatorid <- (__ \ "operatorid").read[String] phone <- (__ \ "phone").read[Long] pin <- (__ \ "pin").read[Int] currency <- (__ \ "currency").read[String] paymentContext <- (__ \ "payment_context").read[String] } yield PaymentForm(payid, actorid, amount, refAccountid, paymentMethod, operatorid, phone, pin, currency, paymentContext) } def jsObjectPaymentForm(obj: payp.mard2p.api.v0.models.PaymentForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "payid" -> play.api.libs.json.JsNumber(obj.payid), "actorid" -> play.api.libs.json.JsString(obj.actorid), "amount" -> play.api.libs.json.JsNumber(obj.amount), "ref_accountid" -> play.api.libs.json.JsNumber(obj.refAccountid), "payment_method" -> play.api.libs.json.JsString(obj.paymentMethod), "operatorid" -> play.api.libs.json.JsString(obj.operatorid), "phone" -> play.api.libs.json.JsNumber(obj.phone), "pin" -> play.api.libs.json.JsNumber(obj.pin), "currency" -> play.api.libs.json.JsString(obj.currency), "payment_context" -> play.api.libs.json.JsString(obj.paymentContext) ) } implicit def jsonWritesMard2pAPIPaymentForm: play.api.libs.json.Writes[PaymentForm] = { (obj: payp.mard2p.api.v0.models.PaymentForm) => { payp.mard2p.api.v0.models.json.jsObjectPaymentForm(obj) } } implicit def jsonReadsMard2pAPITransfer: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Transfer] = { for { transferid <- (__ \ "transferid").read[Long] senderid <- (__ \ "senderid").read[String] amount <- (__ \ "amount").read[Double] refAccountidReceiver <- (__ \ "ref_accountid_receiver").read[Long] refAccountidSender <- (__ \ "ref_accountid_sender").read[Long] currency <- (__ \ "currency").read[String] } yield Transfer(transferid, senderid, amount, refAccountidReceiver, refAccountidSender, currency) } def jsObjectTransfer(obj: payp.mard2p.api.v0.models.Transfer): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "transferid" -> play.api.libs.json.JsNumber(obj.transferid), "senderid" -> play.api.libs.json.JsString(obj.senderid), "amount" -> play.api.libs.json.JsNumber(obj.amount), "ref_accountid_receiver" -> play.api.libs.json.JsNumber(obj.refAccountidReceiver), "ref_accountid_sender" -> play.api.libs.json.JsNumber(obj.refAccountidSender), "currency" -> play.api.libs.json.JsString(obj.currency) ) } implicit def jsonWritesMard2pAPITransfer: play.api.libs.json.Writes[Transfer] = { (obj: payp.mard2p.api.v0.models.Transfer) => { payp.mard2p.api.v0.models.json.jsObjectTransfer(obj) } } implicit def jsonReadsMard2pAPITransferForm: play.api.libs.json.Reads[payp.mard2p.api.v0.models.TransferForm] = { for { transferid <- (__ \ "transferid").read[Long] senderid <- (__ \ "senderid").read[String] amount <- (__ \ "amount").read[Double] refAccountidReceiver <- (__ \ "ref_accountid_receiver").read[Long] refAccountidSender <- (__ \ "ref_accountid_sender").read[Long] currency <- (__ \ "currency").read[String] } yield TransferForm(transferid, senderid, amount, refAccountidReceiver, refAccountidSender, currency) } def jsObjectTransferForm(obj: payp.mard2p.api.v0.models.TransferForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "transferid" -> play.api.libs.json.JsNumber(obj.transferid), "senderid" -> play.api.libs.json.JsString(obj.senderid), "amount" -> play.api.libs.json.JsNumber(obj.amount), "ref_accountid_receiver" -> play.api.libs.json.JsNumber(obj.refAccountidReceiver), "ref_accountid_sender" -> play.api.libs.json.JsNumber(obj.refAccountidSender), "currency" -> play.api.libs.json.JsString(obj.currency) ) } implicit def jsonWritesMard2pAPITransferForm: play.api.libs.json.Writes[TransferForm] = { (obj: payp.mard2p.api.v0.models.TransferForm) => { payp.mard2p.api.v0.models.json.jsObjectTransferForm(obj) } } implicit def jsonReadsMard2pAPIValidation: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Validation] = { for { valid <- (__ \ "valid").read[Boolean] errors <- (__ \ "errors").read[Seq[String]] } yield Validation(valid, errors) } def jsObjectValidation(obj: payp.mard2p.api.v0.models.Validation): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "valid" -> play.api.libs.json.JsBoolean(obj.valid), "errors" -> play.api.libs.json.Json.toJson(obj.errors) ) } implicit def jsonWritesMard2pAPIValidation: play.api.libs.json.Writes[Validation] = { (obj: payp.mard2p.api.v0.models.Validation) => { payp.mard2p.api.v0.models.json.jsObjectValidation(obj) } } implicit def jsonReadsMard2pAPIWithdraw: play.api.libs.json.Reads[payp.mard2p.api.v0.models.Withdraw] = { for { wdwid <- (__ \ "wdwid").read[Long] paymentid <- (__ \ "paymentid").read[Long] } yield Withdraw(wdwid, paymentid) } def jsObjectWithdraw(obj: payp.mard2p.api.v0.models.Withdraw): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "wdwid" -> play.api.libs.json.JsNumber(obj.wdwid), "paymentid" -> play.api.libs.json.JsNumber(obj.paymentid) ) } implicit def jsonWritesMard2pAPIWithdraw: play.api.libs.json.Writes[Withdraw] = { (obj: payp.mard2p.api.v0.models.Withdraw) => { payp.mard2p.api.v0.models.json.jsObjectWithdraw(obj) } } } } package payp.mard2p.api.v0 { object Bindables { import play.api.mvc.{PathBindable, QueryStringBindable} // import models directly for backwards compatibility with prior versions of the generator import Core._ import Models._ object Core { implicit def pathBindableDateTimeIso8601(implicit stringBinder: QueryStringBindable[String]): PathBindable[_root_.org.joda.time.DateTime] = ApibuilderPathBindable(ApibuilderTypes.dateTimeIso8601) implicit def queryStringBindableDateTimeIso8601(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[_root_.org.joda.time.DateTime] = ApibuilderQueryStringBindable(ApibuilderTypes.dateTimeIso8601) implicit def pathBindableDateIso8601(implicit stringBinder: QueryStringBindable[String]): PathBindable[_root_.org.joda.time.LocalDate] = ApibuilderPathBindable(ApibuilderTypes.dateIso8601) implicit def queryStringBindableDateIso8601(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[_root_.org.joda.time.LocalDate] = ApibuilderQueryStringBindable(ApibuilderTypes.dateIso8601) } object Models { import payp.mard2p.api.v0.models._ val appSortByConverter: ApibuilderTypeConverter[payp.mard2p.api.v0.models.AppSortBy] = new ApibuilderTypeConverter[payp.mard2p.api.v0.models.AppSortBy] { override def convert(value: String): payp.mard2p.api.v0.models.AppSortBy = payp.mard2p.api.v0.models.AppSortBy(value) override def convert(value: payp.mard2p.api.v0.models.AppSortBy): String = value.toString override def example: payp.mard2p.api.v0.models.AppSortBy = payp.mard2p.api.v0.models.AppSortBy.Created override def validValues: Seq[payp.mard2p.api.v0.models.AppSortBy] = payp.mard2p.api.v0.models.AppSortBy.all } implicit def pathBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): PathBindable[payp.mard2p.api.v0.models.AppSortBy] = ApibuilderPathBindable(appSortByConverter) implicit def queryStringBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[payp.mard2p.api.v0.models.AppSortBy] = ApibuilderQueryStringBindable(appSortByConverter) val originalTypeConverter: ApibuilderTypeConverter[payp.mard2p.api.v0.models.OriginalType] = new ApibuilderTypeConverter[payp.mard2p.api.v0.models.OriginalType] { override def convert(value: String): payp.mard2p.api.v0.models.OriginalType = payp.mard2p.api.v0.models.OriginalType(value) override def convert(value: payp.mard2p.api.v0.models.OriginalType): String = value.toString override def example: payp.mard2p.api.v0.models.OriginalType = payp.mard2p.api.v0.models.OriginalType.ApiJson override def validValues: Seq[payp.mard2p.api.v0.models.OriginalType] = payp.mard2p.api.v0.models.OriginalType.all } implicit def pathBindableOriginalType(implicit stringBinder: QueryStringBindable[String]): PathBindable[payp.mard2p.api.v0.models.OriginalType] = ApibuilderPathBindable(originalTypeConverter) implicit def queryStringBindableOriginalType(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[payp.mard2p.api.v0.models.OriginalType] = ApibuilderQueryStringBindable(originalTypeConverter) val publicationConverter: ApibuilderTypeConverter[payp.mard2p.api.v0.models.Publication] = new ApibuilderTypeConverter[payp.mard2p.api.v0.models.Publication] { override def convert(value: String): payp.mard2p.api.v0.models.Publication = payp.mard2p.api.v0.models.Publication(value) override def convert(value: payp.mard2p.api.v0.models.Publication): String = value.toString override def example: payp.mard2p.api.v0.models.Publication = payp.mard2p.api.v0.models.Publication.MembershipRequestsCreate override def validValues: Seq[payp.mard2p.api.v0.models.Publication] = payp.mard2p.api.v0.models.Publication.all } implicit def pathBindablePublication(implicit stringBinder: QueryStringBindable[String]): PathBindable[payp.mard2p.api.v0.models.Publication] = ApibuilderPathBindable(publicationConverter) implicit def queryStringBindablePublication(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[payp.mard2p.api.v0.models.Publication] = ApibuilderQueryStringBindable(publicationConverter) val sortOrderConverter: ApibuilderTypeConverter[payp.mard2p.api.v0.models.SortOrder] = new ApibuilderTypeConverter[payp.mard2p.api.v0.models.SortOrder] { override def convert(value: String): payp.mard2p.api.v0.models.SortOrder = payp.mard2p.api.v0.models.SortOrder(value) override def convert(value: payp.mard2p.api.v0.models.SortOrder): String = value.toString override def example: payp.mard2p.api.v0.models.SortOrder = payp.mard2p.api.v0.models.SortOrder.Asc override def validValues: Seq[payp.mard2p.api.v0.models.SortOrder] = payp.mard2p.api.v0.models.SortOrder.all } implicit def pathBindableSortOrder(implicit stringBinder: QueryStringBindable[String]): PathBindable[payp.mard2p.api.v0.models.SortOrder] = ApibuilderPathBindable(sortOrderConverter) implicit def queryStringBindableSortOrder(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[payp.mard2p.api.v0.models.SortOrder] = ApibuilderQueryStringBindable(sortOrderConverter) val visibilityConverter: ApibuilderTypeConverter[payp.mard2p.api.v0.models.Visibility] = new ApibuilderTypeConverter[payp.mard2p.api.v0.models.Visibility] { override def convert(value: String): payp.mard2p.api.v0.models.Visibility = payp.mard2p.api.v0.models.Visibility(value) override def convert(value: payp.mard2p.api.v0.models.Visibility): String = value.toString override def example: payp.mard2p.api.v0.models.Visibility = payp.mard2p.api.v0.models.Visibility.Public override def validValues: Seq[payp.mard2p.api.v0.models.Visibility] = payp.mard2p.api.v0.models.Visibility.all } implicit def pathBindableVisibility(implicit stringBinder: QueryStringBindable[String]): PathBindable[payp.mard2p.api.v0.models.Visibility] = ApibuilderPathBindable(visibilityConverter) implicit def queryStringBindableVisibility(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[payp.mard2p.api.v0.models.Visibility] = ApibuilderQueryStringBindable(visibilityConverter) } trait ApibuilderTypeConverter[T] { def convert(value: String): T def convert(value: T): String def example: T def validValues: Seq[T] = Nil def errorMessage(key: String, value: String, ex: java.lang.Exception): String = { val base = s"Invalid value '$value' for parameter '$key'. " validValues.toList match { case Nil => base + "Ex: " + convert(example) case values => base + ". Valid values are: " + values.mkString("'", "', '", "'") } } } object ApibuilderTypes { val dateTimeIso8601: ApibuilderTypeConverter[_root_.org.joda.time.DateTime] = new ApibuilderTypeConverter[_root_.org.joda.time.DateTime] { override def convert(value: String): _root_.org.joda.time.DateTime = _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseDateTime(value) override def convert(value: _root_.org.joda.time.DateTime): String = _root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(value) override def example: _root_.org.joda.time.DateTime = _root_.org.joda.time.DateTime.now } val dateIso8601: ApibuilderTypeConverter[_root_.org.joda.time.LocalDate] = new ApibuilderTypeConverter[_root_.org.joda.time.LocalDate] { override def convert(value: String): _root_.org.joda.time.LocalDate = _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseLocalDate(value) override def convert(value: _root_.org.joda.time.LocalDate): String = _root_.org.joda.time.format.ISODateTimeFormat.date.print(value) override def example: _root_.org.joda.time.LocalDate = _root_.org.joda.time.LocalDate.now } } final case class ApibuilderQueryStringBindable[T]( converters: ApibuilderTypeConverter[T] ) extends QueryStringBindable[T] { override def bind(key: String, params: Map[String, Seq[String]]): _root_.scala.Option[_root_.scala.Either[String, T]] = { params.getOrElse(key, Nil).headOption.map { v => try { Right( converters.convert(v) ) } catch { case ex: java.lang.Exception => Left( converters.errorMessage(key, v, ex) ) } } } override def unbind(key: String, value: T): String = { s"$key=${converters.convert(value)}" } } final case class ApibuilderPathBindable[T]( converters: ApibuilderTypeConverter[T] ) extends PathBindable[T] { override def bind(key: String, value: String): _root_.scala.Either[String, T] = { try { Right( converters.convert(value) ) } catch { case ex: java.lang.Exception => Left( converters.errorMessage(key, value, ex) ) } } override def unbind(key: String, value: T): String = { converters.convert(value) } } } } package payp.mard2p.api.v0 { object Constants { val BaseUrl = "https://api.apibuilder.io" val Namespace = "payp.mard2p.api.v0" val UserAgent = "apibuilder app.apibuilder.io/mard/mard2p-api/0.0.2-dev/play_2_2_client" val Version = "0.0.2-dev" val VersionMajor = 0 } class Client( val baseUrl: String = "https://api.apibuilder.io", auth: scala.Option[payp.mard2p.api.v0.Authorization] = None, defaultHeaders: Seq[(String, String)] = Nil ) extends interfaces.Client { import io.apibuilder.common.v0.models.json._ import io.apibuilder.generator.v0.models.json._ import io.apibuilder.spec.v0.models.json._ import payp.mard2p.api.v0.models.json._ private val logger = play.api.Logger("payp.mard2p.api.v0.Client") logger.info(s"Initializing payp.mard2p.api.v0.Client for url $baseUrl") def accounts: Accounts = Accounts def deposits: Deposits = Deposits def payments: Payments = Payments def transfers: Transfers = Transfers def validations: Validations = Validations def withdraws: Withdraws = Withdraws object Accounts extends Accounts { override def postCreate( accountid: Long, ownerid: String, totalAmount: Double, sold: Double, debit: Double, currency: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] = { val payload = play.api.libs.json.Json.obj( "accountid" -> play.api.libs.json.Json.toJson(accountid), "ownerid" -> play.api.libs.json.Json.toJson(ownerid), "total_amount" -> play.api.libs.json.Json.toJson(totalAmount), "sold" -> play.api.libs.json.Json.toJson(sold), "debit" -> play.api.libs.json.Json.toJson(debit), "currency" -> play.api.libs.json.Json.toJson(currency) ) _executeRequest("POST", s"/accounts/create", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Account", r, _.validate[payp.mard2p.api.v0.models.Account]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def putUpdateByAccountid( accountid: Long, ownerid: String, totalAmount: Double, currency: String, sold: Double, debit: Double, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] = { val payload = play.api.libs.json.Json.obj( "ownerid" -> play.api.libs.json.Json.toJson(ownerid), "total_amount" -> play.api.libs.json.Json.toJson(totalAmount), "currency" -> play.api.libs.json.Json.toJson(currency), "sold" -> play.api.libs.json.Json.toJson(sold), "debit" -> play.api.libs.json.Json.toJson(debit) ) _executeRequest("PUT", s"/accounts/update/${accountid}", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Account", r, _.validate[payp.mard2p.api.v0.models.Account]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def deleteDeleteByAccountid( accountid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = { _executeRequest("DELETE", s"/accounts/delete/${accountid}", requestHeaders = requestHeaders).map { case r if r.status == 204 => () case r if r.status == 401 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByAccountid( accountid: Long, ownerid: String, totalAmount: Double, sold: Double, debit: Double, currency: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] = { val queryParameters = Seq( Some("ownerid" -> ownerid), Some("total_amount" -> totalAmount.toString), Some("sold" -> sold.toString), Some("debit" -> debit.toString), Some("currency" -> currency) ).flatten _executeRequest("GET", s"/accounts/${accountid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Account", r, _.validate[payp.mard2p.api.v0.models.Account]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getList( accountid: Long, ownerid: String, totalAmount: Double, currency: String, sold: Double, debit: Double, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Account]] = { val queryParameters = Seq( Some("accountid" -> accountid.toString), Some("ownerid" -> ownerid), Some("total_amount" -> totalAmount.toString), Some("currency" -> currency), Some("sold" -> sold.toString), Some("debit" -> debit.toString) ).flatten _executeRequest("GET", s"/accounts/list", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("Seq[payp.mard2p.api.v0.models.Account]", r, _.validate[Seq[payp.mard2p.api.v0.models.Account]]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } } object Deposits extends Deposits { override def deleteDeleteByDepid( depid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = { _executeRequest("DELETE", s"/deposits/delete/${depid}", requestHeaders = requestHeaders).map { case r if r.status == 204 => () case r if r.status == 401 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByDepid( depid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val queryParameters = Seq( Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/deposits/${depid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] = { val queryParameters = Seq( Some("payid" -> payid.toString), Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/deposits/list", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("Seq[payp.mard2p.api.v0.models.Payment]", r, _.validate[Seq[payp.mard2p.api.v0.models.Payment]]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } } object Payments extends Payments { override def postCreate( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, currency: String, phone: Long, pin: Int, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val payload = play.api.libs.json.Json.obj( "payid" -> play.api.libs.json.Json.toJson(payid), "payment_method" -> play.api.libs.json.Json.toJson(paymentMethod), "actorid" -> play.api.libs.json.Json.toJson(actorid), "ref_accountid" -> play.api.libs.json.Json.toJson(refAccountid), "operatorid" -> play.api.libs.json.Json.toJson(operatorid), "amount" -> play.api.libs.json.Json.toJson(amount), "currency" -> play.api.libs.json.Json.toJson(currency), "phone" -> play.api.libs.json.Json.toJson(phone), "pin" -> play.api.libs.json.Json.toJson(pin), "payment_context" -> play.api.libs.json.Json.toJson(paymentContext) ) _executeRequest("POST", s"/payments/create", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def putUpdateByPayid( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Int, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val payload = play.api.libs.json.Json.obj( "payment_method" -> play.api.libs.json.Json.toJson(paymentMethod), "actorid" -> play.api.libs.json.Json.toJson(actorid), "ref_accountid" -> play.api.libs.json.Json.toJson(refAccountid), "operatorid" -> play.api.libs.json.Json.toJson(operatorid), "amount" -> play.api.libs.json.Json.toJson(amount), "phone" -> play.api.libs.json.Json.toJson(phone), "pin" -> play.api.libs.json.Json.toJson(pin), "currency" -> play.api.libs.json.Json.toJson(currency), "payment_context" -> play.api.libs.json.Json.toJson(paymentContext) ) _executeRequest("PUT", s"/payments/update/${payid}", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def deleteDeleteByPayid( payid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = { _executeRequest("DELETE", s"/payments/delete/${payid}", requestHeaders = requestHeaders).map { case r if r.status == 204 => () case r if r.status == 401 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByPayid( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val queryParameters = Seq( Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/payments/${payid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByRefAccountid( refAccountid: Long, payid: Long, paymentMethod: String, actorid: String, operatorid: String, amount: Double, phone: Long, pin: Int, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val queryParameters = Seq( Some("payid" -> payid.toString), Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/payments/${refAccountid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] = { val queryParameters = Seq( Some("payid" -> payid.toString), Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/payments/list", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("Seq[payp.mard2p.api.v0.models.Payment]", r, _.validate[Seq[payp.mard2p.api.v0.models.Payment]]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } } object Transfers extends Transfers { override def postCreate( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Transfer] = { val payload = play.api.libs.json.Json.obj( "transferid" -> play.api.libs.json.Json.toJson(transferid), "senderid" -> play.api.libs.json.Json.toJson(senderid), "amount" -> play.api.libs.json.Json.toJson(amount), "currency" -> play.api.libs.json.Json.toJson(currency), "ref_accountid_receiver" -> play.api.libs.json.Json.toJson(refAccountidReceiver), "ref_accountid_sender" -> play.api.libs.json.Json.toJson(refAccountidSender) ) _executeRequest("POST", s"/transfers/create", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Transfer", r, _.validate[payp.mard2p.api.v0.models.Transfer]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def putUpdateByTransferid( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Transfer] = { val payload = play.api.libs.json.Json.obj( "senderid" -> play.api.libs.json.Json.toJson(senderid), "amount" -> play.api.libs.json.Json.toJson(amount), "currency" -> play.api.libs.json.Json.toJson(currency), "ref_accountid_receiver" -> play.api.libs.json.Json.toJson(refAccountidReceiver), "ref_accountid_sender" -> play.api.libs.json.Json.toJson(refAccountidSender) ) _executeRequest("PUT", s"/transfers/update/${transferid}", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Transfer", r, _.validate[payp.mard2p.api.v0.models.Transfer]) case r if r.status == 409 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409", requestUri = Some(r.ahcResponse.getUri)) } } override def deleteDeleteByTransferid( transferid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = { _executeRequest("DELETE", s"/transfers/delete/${transferid}", requestHeaders = requestHeaders).map { case r if r.status == 204 => () case r if r.status == 401 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByTransferid( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] = { val queryParameters = Seq( Some("senderid" -> senderid), Some("amount" -> amount.toString), Some("currency" -> currency), Some("ref_accountid_receiver" -> refAccountidReceiver.toString), Some("ref_accountid_sender" -> refAccountidSender.toString) ).flatten _executeRequest("GET", s"/transfers/${transferid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Account", r, _.validate[payp.mard2p.api.v0.models.Account]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getList( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Account]] = { val queryParameters = Seq( Some("transferid" -> transferid.toString), Some("senderid" -> senderid), Some("amount" -> amount.toString), Some("currency" -> currency), Some("ref_accountid_receiver" -> refAccountidReceiver.toString), Some("ref_accountid_sender" -> refAccountidSender.toString) ).flatten _executeRequest("GET", s"/transfers/list", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("Seq[payp.mard2p.api.v0.models.Account]", r, _.validate[Seq[payp.mard2p.api.v0.models.Account]]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } } object Validations extends Validations { override def post( value: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Validation] = { val payload = play.api.libs.json.Json.toJson(value) _executeRequest("POST", s"/validations", body = Some(payload), requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Validation", r, _.validate[payp.mard2p.api.v0.models.Validation]) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200", requestUri = Some(r.ahcResponse.getUri)) } } } object Withdraws extends Withdraws { override def deleteDeleteByWdwid( wdwid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = { _executeRequest("DELETE", s"/withdraws/delete/${wdwid}", requestHeaders = requestHeaders).map { case r if r.status == 204 => () case r if r.status == 401 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getByWdwid( wdwid: Long, depid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] = { val queryParameters = Seq( Some("depid" -> depid.toString), Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/withdraws/${wdwid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("payp.mard2p.api.v0.models.Payment", r, _.validate[payp.mard2p.api.v0.models.Payment]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } override def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] = { val queryParameters = Seq( Some("payid" -> payid.toString), Some("payment_method" -> paymentMethod), Some("actorid" -> actorid), Some("ref_accountid" -> refAccountid.toString), Some("operatorid" -> operatorid), Some("amount" -> amount.toString), Some("phone" -> phone.toString), Some("pin" -> pin.toString), Some("currency" -> currency), Some("payment_context" -> paymentContext) ).flatten _executeRequest("GET", s"/withdraws/list", queryParameters = queryParameters, requestHeaders = requestHeaders).map { case r if r.status == 200 => _root_.payp.mard2p.api.v0.Client.parseJson("Seq[payp.mard2p.api.v0.models.Payment]", r, _.validate[Seq[payp.mard2p.api.v0.models.Payment]]) case r if r.status == 404 => throw payp.mard2p.api.v0.errors.UnitResponse(r.status) case r => throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404", requestUri = Some(r.ahcResponse.getUri)) } } } def _requestHolder(path: String): play.api.libs.ws.WS.WSRequestHolder = { import play.api.Play.current val holder = play.api.libs.ws.WS.url(baseUrl + path).withHeaders( "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString ).withHeaders(defaultHeaders: _*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), com.ning.http.client.Realm.AuthScheme.BASIC) } } } def _logRequest(method: String, req: play.api.libs.ws.WS.WSRequestHolder): play.api.libs.ws.WS.WSRequestHolder = { val queryComponents = for { (name, values) <- req.queryString value <- values } yield s"$name=$value" val url = s"${req.url}${queryComponents.mkString("?", "&", "")}" auth.fold(logger.info(s"curl -X $method '$url'")) { _ => logger.info(s"curl -X $method -u '[REDACTED]:' '$url'") } req } def _executeRequest( method: String, path: String, queryParameters: Seq[(String, String)] = Nil, requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.Response] = { method.toUpperCase match { case "GET" => { _logRequest("GET", _requestHolder(path).withHeaders(requestHeaders: _*).withQueryString(queryParameters: _*)).get() } case "POST" => { _logRequest("POST", _requestHolder(path).withHeaders(_withJsonContentType(requestHeaders): _*).withQueryString(queryParameters: _*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { _logRequest("PUT", _requestHolder(path).withHeaders(_withJsonContentType(requestHeaders): _*).withQueryString(queryParameters: _*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { sys.error("PATCH method is not supported in Play Framework Version 2.2.x") } case "DELETE" => { _logRequest("DELETE", _requestHolder(path).withHeaders(requestHeaders: _*).withQueryString(queryParameters: _*)).delete() } case "HEAD" => { _logRequest("HEAD", _requestHolder(path).withHeaders(requestHeaders: _*).withQueryString(queryParameters: _*)).head() } case "OPTIONS" => { _logRequest("OPTIONS", _requestHolder(path).withHeaders(requestHeaders: _*).withQueryString(queryParameters: _*)).options() } case _ => { _logRequest(method, _requestHolder(path).withHeaders(requestHeaders: _*).withQueryString(queryParameters: _*)) sys.error("Unsupported method[%s]".format(method)) } } } /** * Adds a Content-Type: application/json header unless the specified requestHeaders * already contain a Content-Type header */ def _withJsonContentType(headers: Seq[(String, String)]): Seq[(String, String)] = { headers.find { _._1.toUpperCase == "CONTENT-TYPE" } match { case None => headers ++ Seq("Content-Type" -> "application/json; charset=UTF-8") case Some(_) => headers } } } object Client { def parseJson[T]( className: String, r: play.api.libs.ws.Response, f: (play.api.libs.json.JsValue => play.api.libs.json.JsResult[T]) ): T = { f(play.api.libs.json.Json.parse(r.body)) match { case play.api.libs.json.JsSuccess(x, _) => x case play.api.libs.json.JsError(errors) => { throw payp.mard2p.api.v0.errors.FailedRequest(r.status, s"Invalid json for class[" + className + "]: " + errors.mkString(" "), requestUri = Some(r.ahcResponse.getUri)) } } } } sealed trait Authorization extends _root_.scala.Product with _root_.scala.Serializable object Authorization { final case class Basic(username: String, password: Option[String] = None) extends Authorization } package interfaces { trait Client { def baseUrl: String def accounts: payp.mard2p.api.v0.Accounts def deposits: payp.mard2p.api.v0.Deposits def payments: payp.mard2p.api.v0.Payments def transfers: payp.mard2p.api.v0.Transfers def validations: payp.mard2p.api.v0.Validations def withdraws: payp.mard2p.api.v0.Withdraws } } trait Accounts { /** * Used to create an account. */ def postCreate( accountid: Long, ownerid: String, totalAmount: Double, sold: Double, debit: Double, currency: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] /** * Used to update an account. */ def putUpdateByAccountid( accountid: Long, ownerid: String, totalAmount: Double, currency: String, sold: Double, debit: Double, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] /** * Delete some account. */ def deleteDeleteByAccountid( accountid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] /** * Find account by its id */ def getByAccountid( accountid: Long, ownerid: String, totalAmount: Double, sold: Double, debit: Double, currency: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] /** * Find all the accounts. */ def getList( accountid: Long, ownerid: String, totalAmount: Double, currency: String, sold: Double, debit: Double, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Account]] } trait Deposits { /** * Delete some deposit. */ def deleteDeleteByDepid( depid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] /** * Find deposit by its id. */ def getByDepid( depid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * List all the deposits */ def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] } trait Payments { /** * Used to create a payment. */ def postCreate( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, currency: String, phone: Long, pin: Int, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * Used to update a payment. */ def putUpdateByPayid( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Int, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * Delete some payment. */ def deleteDeleteByPayid( payid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] /** * Find payment by its id. */ def getByPayid( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * Find payment by id accountid */ def getByRefAccountid( refAccountid: Long, payid: Long, paymentMethod: String, actorid: String, operatorid: String, amount: Double, phone: Long, pin: Int, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * List all the payments */ def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] } trait Transfers { /** * Used to create a transfer resource. */ def postCreate( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Transfer] /** * Used to update a transfer resource. */ def putUpdateByTransferid( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Transfer] /** * Delete some transfer. */ def deleteDeleteByTransferid( transferid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] /** * Find transfer by its id */ def getByTransferid( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Account] /** * Find all the transfers. */ def getList( transferid: Long, senderid: String, amount: Double, currency: String, refAccountidReceiver: Long, refAccountidSender: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Account]] } trait Validations { def post( value: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Validation] } trait Withdraws { /** * Delete some withdraw. */ def deleteDeleteByWdwid( wdwid: Long, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] /** * Find withdraw by its id. */ def getByWdwid( wdwid: Long, depid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[payp.mard2p.api.v0.models.Payment] /** * List all the withdraws */ def getList( payid: Long, paymentMethod: String, actorid: String, refAccountid: Long, operatorid: String, amount: Double, phone: Long, pin: Long, currency: String, paymentContext: String, requestHeaders: Seq[(String, String)] = Nil )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[payp.mard2p.api.v0.models.Payment]] } package errors { import io.apibuilder.common.v0.models.json._ import io.apibuilder.generator.v0.models.json._ import io.apibuilder.spec.v0.models.json._ import payp.mard2p.api.v0.models.json._ final case class UnitResponse(status: Int) extends Exception(s"HTTP $status") final case class FailedRequest(responseCode: Int, message: String, requestUri: Option[_root_.java.net.URI] = None) extends _root_.java.lang.Exception(s"HTTP $responseCode: $message") } }