This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed trait Status { | |
| def `type`: String | |
| } | |
| case class Refund(`type` = "refund", refundId: String, refundReason:String, timestamp:Instant, amount:Double) extends Status | |
| case class Paid(`type` = "paid", timestamp: Instant, failureReasonCode:Option[String], failureDescription:Option[String], amount: Double) extends Status | |
| case class Overdue(`type` = "overdue", timestamp:Instant, paymentDate:Instant, amount:Double) extends Status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Metadata(isTest:Boolean, region: Region, sourceOfRequest:Option[String]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Invoice(invoiceId: String, orderCode:String, metadata:Metadata) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| invoiceSchema.read(DynamoValue(attributeValue)) // Either[WriteError, Invoice] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| invoiceSchema.write(Invoice(orderCode = "1230", invoiceId = "1")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lazy val invoiceSchema: Schema[Invoice] = Schema.record[Invoice]{field => | |
| ( | |
| field("orderCode", _.orderCode), | |
| field("invoiceId", _.invoiceId) | |
| ).mapN(Invoice.apply) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Invoice(orderCode: String, invoiceId:String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Map( | |
| "Foo" -> AttributeValue.builder.m( | |
| Map( | |
| "a" -> AttributeValue.builder.n("123").build, | |
| ..... | |
| ).asJava | |
| ).build | |
| ).asJava |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Foo(a:Int, b:Int, c:String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def choose(checkStatement: Boolean)(ifTrue: => Unit, ifFalse: => Unit): Unit = | |
| chooseN(if(checkStatement) 0 else 1)(List(ifTrue, ifFalse)) |