Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 2.24 KB | None | 0 0
  1. package com.megafon.bank.logic.api.model.response.payment
  2.  
  3. import com.google.api.client.util.Key
  4. import ru.touchin.templates.googlejson.GoogleJsonModel
  5. import java.math.BigDecimal
  6.  
  7. class MobilePaymentPreparationResponse : GoogleJsonModel() {
  8.  
  9.     @field:Key("payment")
  10.     lateinit var payment: Payment
  11.         private set
  12.  
  13.     class Payment : GoogleJsonModel() {
  14.  
  15.         @field:Key("id")
  16.         lateinit var id: String
  17.             private set
  18.  
  19.         @field:Key("to")
  20.         lateinit var to: To
  21.             private set
  22.  
  23.         @field:Key("from")
  24.         lateinit var from: From
  25.             private set
  26.  
  27.         override fun validate() {
  28.             super.validate()
  29.             validateNotNull(id)
  30.             validateNotNull(to)
  31.             validateNotNull(from)
  32.         }
  33.  
  34.     }
  35.  
  36.     class From : GoogleJsonModel() {
  37.  
  38.         @field:Key("amount_min")
  39.         lateinit var amountMin: BigDecimal
  40.             private set
  41.  
  42.         @field: Key("amount_max")
  43.         var amountMax: BigDecimal? = null
  44.             private set
  45.  
  46.         override fun validate() {
  47.             super.validate()
  48.             validateNotNull(amountMin)
  49.         }
  50.     }
  51.  
  52.     class To : GoogleJsonModel() {
  53.  
  54.         @field:Key("account")
  55.         lateinit var account: Account
  56.             private set
  57.  
  58.         @field:Key("service")
  59.         lateinit var service: Service
  60.             private set
  61.  
  62.         override fun validate() {
  63.             super.validate()
  64.             validateNotNull(account)
  65.             validateNotNull(service)
  66.         }
  67.  
  68.     }
  69.  
  70.     class Account : GoogleJsonModel() {
  71.  
  72.         @field:Key("msisdn")
  73.         lateinit var msisdn: String
  74.             private set
  75.  
  76.         override fun validate() {
  77.             super.validate()
  78.             validateNotNull(msisdn)
  79.         }
  80.  
  81.     }
  82.  
  83.     class Service : GoogleJsonModel() {
  84.  
  85.         @field:Key("id")
  86.         lateinit var id: String
  87.             private set
  88.  
  89.         @field:Key("name")
  90.         var name: String? = null
  91.             private set
  92.  
  93.         override fun validate() {
  94.             super.validate()
  95.             validateNotNull(id)
  96.         }
  97.  
  98.     }
  99.  
  100.     override fun validate() {
  101.         super.validate()
  102.         validateNotNull(payment)
  103.     }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement