SPI  1.2404.0
Secured Payment Interface
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 
virtual SPILIBRARY_API SPI_RET_VAL Init(string DeviceSerialNo)=0
Initialize the payment service.
This file conatins all requiered methods to perform on SPI.
virtual SPILIBRARY_API SPI_RET_VAL DoTransaction(Transaction *TransactionPtr)=0
That blocking method is called in order to perform the the whole process of transaction with a well i...
This class contains all the methods to Config a Service or a device when attached to a Service...
Definition: Config.h:33
SPILIBRARY_API SPI_RET_VAL GetPrintableString(std::string &OutputResult) const
Get printable string of the report created. This string come in ASCII from the service processor duri...
int DoAshraitTransactionExample(Modularity::SPI::Service *AshraitServiceHandle)
Do transaction example.
This class contains all the requiered operations for Reports.
Definition: Report.h:30
This class contains all the input data and output data of AshraitEMV transactions, including the methods inherited from class Transaction. All data in this class is reachable through various methods which define the behaivor of the operation.
virtual SPILIBRARY_API SPI_RET_VAL DoEstablishment(string Retailer)=0
Establishes the service and makes it ready for use, considering database, etc. Must be called once or...
int InitAshraitExample()
Make AshraitEMV service ready to do transactions.
virtual SPILIBRARY_API SPI_RET_VAL EndOfDay(Report *ReportResult)=0
End of day function is batching all transactions to Service processor. This method is blocking and re...
virtual SPILIBRARY_API SPI_STATUS GetServiceStatus()=0
Get service status.
This class contains all the operations that Avilible for a Service. Since this class is abstract...
Definition: Service.h:36
SPILIBRARY_API Service * AddService(string ServiceName, ServiceID Id, Config &ServiceConfig)
Defines an active payment service and initilaizes it. Should be called before any operation is made w...
SPILIBRARY_API void GetSPIVersion(string &Version)
Retrieve SPI version into string.
SPILIBRARY_API Service * GetServiceHandler(string ServiceName)
Retrieves handle of active payment service instance according its name.
This class contains all the operations of the Payment Interface, Creation and Services management...
Definition: SPI.h:47