1 package com.srv4pos.server.api.registration;
2
3 import com.srv4pos.server.api.ServiceFactory;
4 import com.srv4pos.server.api.activation.ActivationServiceSample;
5 import com.srv4pos.server.api.infrastructure.credentials.Credentials;
6 import com.srv4pos.server.api.infrastructure.http.Transport;
7 import com.srv4pos.server.api.posplus.KdReplyInfo;
8 import com.srv4pos.server.api.posplus.PosPlusService;
9 import com.srv4pos.server.api.posplus.PrintType;
10 import com.srv4pos.server.api.posplus.SVKdInfo;
11 import org.junit.Test;
12
13 import java.net.URL;
14 import java.util.Date;
15 import java.util.HashMap;
16
17 public class RegistrationSoftwareVendorServiceSample {
18 private final RegistrationService registrationService;
19 public RegistrationSoftwareVendorServiceSample(URL url, Credentials credentials, Transport transport) {
20 ServiceFactory serviceFactory = new ServiceFactory(url, credentials, transport);
21 registrationService = serviceFactory.getRegistrationService();
22 }
23
24 @Test
25 public void test() {
26 SVKdInfo kdInfo = new SVKdInfo();
27 kdInfo.setRefund(false);
28
29 kdInfo.setBrutto(1000);
30 kdInfo.setDate(new Date());
31 kdInfo.setPrintType(PrintType.Normal);
32 kdInfo.setReceiptNumber(0);
33 HashMap<Integer, Long> vatRateToSum = new HashMap<Integer, Long>();
34 vatRateToSum.put(6, 1000L);
35
36 kdInfo.setVatRateToSum(vatRateToSum);
37 kdInfo.setControlUnitSerial("PTEST900000000001");
38 kdInfo.setApplicationPackage("test.app");
39 String sellerId = "se9876543217";
40 String cashRegisterName = "TESTCASH";
41 KdReplyInfo kd = registrationService.kd(kdInfo, sellerId, cashRegisterName);
42
43 org.junit.Assert.assertEquals("Make sure test control unit exists", ActivationServiceSample.CONTROL_UNIT_SERIAL_NUMBER, kd.getControlUnitSerial());
44 org.junit.Assert.assertNotNull("Make sure test control unit replies", kd.getResponse());
45 }
46 }