Skip to content

Commit

Permalink
Реализуй поддержку тегов 1227 и 1228
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderfefelov committed Jul 8, 2019
1 parent 04ef289 commit d49d8b7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ case class BarCodeCheckString (
BarCode: BarCodeCheckStringData
) extends CheckString

case class PaymentData (
Cash: Double = 0.0,
ElectronicPayment: Double = 0.0,
AdvancePayment: Double = 0.0,
Credit: Double = 0.0,
CashProvision: Double = 0.0
)

case class RegisterCheckRequest (
// Meta
//
Expand All @@ -97,17 +105,15 @@ case class RegisterCheckRequest (
NotPrint: Boolean = false,
CashierName: String,
CashierVATIN: String,
ClientInfo: Option[String] = None,
ClientINN: Option[String] = None,
SenderEmail: Option[String] = None,
ClientAddress: Option[String] = None,
TaxVariant: Option[String] = None,
AdditionalProps: List[AdditionalProp] = List(),
KPP: Option[String] = None,
CheckStrings: List[CheckString],
Cash: Double = 0.0,
ElectronicPayment: Double = 0.0,
AdvancePayment: Double = 0.0,
Credit: Double = 0.0,
CashProvision: Double = 0.0
Payment: PaymentData
)

object RegisterCheckRequest {
Expand Down Expand Up @@ -162,6 +168,14 @@ object RegisterCheckRequest {
}
}

implicit val paymentDataWrites: Writes[PaymentData] = (
(__ \ "Cash").write[Double] and
(__ \ "ElectronicPayment").write[Double] and
(__ \ "AdvancePayment").write[Double] and
(__ \ "Credit").write[Double] and
(__ \ "CashProvision").write[Double]
)(unlift(PaymentData.unapply))

implicit val registerCheckRequestWrites: Writes[RegisterCheckRequest] = (
(__ \ "Command").write[String] and
(__ \ "IdCommand").write[String] and
Expand All @@ -174,17 +188,15 @@ object RegisterCheckRequest {
(__ \ "NotPrint").write[Boolean] and
(__ \ "CashierName").write[String] and
(__ \ "CashierVATIN").write[String] and
(__ \ "ClientInfo").writeNullable[String] and
(__ \ "ClientINN").writeNullable[String] and
(__ \ "SenderEmail").writeNullable[String] and
(__ \ "ClientAddress").writeNullable[String] and
(__ \ "TaxVariant").writeNullable[String] and
(__ \ "AdditionalProps").write[List[AdditionalProp]] and
(__ \ "KPP").writeNullable[String] and
(__ \ "CheckStrings").write[List[CheckString]] and
(__ \ "Cash").write[Double] and
(__ \ "ElectronicPayment").write[Double] and
(__ \ "AdvancePayment").write[Double] and
(__ \ "Credit").write[Double] and
(__ \ "CashProvision").write[Double]
__.write[PaymentData]
)(unlift(RegisterCheckRequest.unapply))

}
5 changes: 3 additions & 2 deletions src/test/scala/integration/KkmServerApiIntegration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ class KkmServerApiIntegration extends AsyncFlatSpec with PatienceConfiguration
CancelOpenedCheck = true,
CashierName = CASHIER_NAME,
CashierVATIN = CASHIER_VATIN,
ClientInfo = Option("ООО \"Рога и копыта\""),
ClientINN = Option("1234567890"),
SenderEmail = Option("none@inter.net"),
AdditionalProps = List(
AdditionalProp(Print = true, PrintInHeader = true, NameProp = "Название1", Prop = "Значение1"),
Expand All @@ -324,8 +326,7 @@ class KkmServerApiIntegration extends AsyncFlatSpec with PatienceConfiguration
RegisterCheckString(RegisterCheckStringData(GOOD, EAN13 = Option(EAN), Quantity = 5.00, Price = 4000.00, Amount = 19500.00, Tax = tax, Department = department)),
BarCodeCheckString(BarCodeCheckStringData("EAN13", EAN))
),
Cash = 19000.00,
ElectronicPayment = 500.00
Payment = PaymentData(Cash = 19000.00, ElectronicPayment = 500.00)
)
}

Expand Down

0 comments on commit d49d8b7

Please sign in to comment.