SPI  1.1.28
Secured Payment Interface
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
CPP_Examples.cpp
Go to the documentation of this file.
1 
15  #include "SPI.h"
16 
22  {
24  if (AshraitServiceHandle != NULL && AshraitServiceHandle->GetServiceStatus() == SPI_READY ) {
25  Modularity::SPI::AshraitEMVTransaction TranObj(12000,"your_string", Curr_Shekel);
26  TranObj.SetPinpadId(1);
27  AshraitServiceHandle.DoTransaction((Transaction*)&TranObj);
28  if (TranObj.GetTransactionResultCode() == 0) {
29  std::vector<ReceiptLine> MerchentReceipt = TranObj.GetMerchentRecipt();
30  }
31  }
33 
34  return 1;
35 
36  }
37 
43  {
45  Modularity::SPI::SPI PaymentInterface;
46  Modularity::SPI::Service *AshraitServiceHandle;
47  string Version;
48 
49  PaymentInterface.GetSPIVersion(Version);
50 
51  if ( (AshraitServiceHandle = PaymentInterface.GetServiceHandler("AshraitEMV")) == NULL)
52 
53  AshraitServiceHandle = PaymentInterface.AddService("AshraitEMV", Modularity::SPI::Config() )
54 
55  if (AshraitServiceHandle == NULL)
56 
57  return -1;
58 
59  AshraitServiceHandle->Init("Machine_Serial_Number");
62  if (AshraitServiceHandle->GetServiceStatus() == SPI_STATUS::SPI_NOT_ESTABLISHED)
63 
64  AshraitServiceHandle->DoEstablishment("0880700");
66  else if (AshraitServiceHandle->GetServiceStatus() == SPI_STATUS::SPI_NOT_READY)
67  {
69  std::string ReportResult;
71  AshraitServiceHandle->EndOfDay(&ReportObject);
72  if (ReportObject.GetPrintableString(ReportResult) == SPI_SUCESS)
73  std::cout << ReportResult;
75  }
76 
77  if (AshraitServiceHandle->GetServiceStatus() == SPI_STATUS::SPI_READY)
78 
79  std::cout << "Ready to use";
80 
81  return 0;
82  }
83 
84 
85