some actual auth with the server and stuff
This commit is contained in:
parent
56e5c4569c
commit
720697bf7e
|
@ -11,6 +11,7 @@
|
|||
#include <thrift/transport/TSocket.h>
|
||||
#include <thrift/transport/TTransportUtils.h>
|
||||
|
||||
#include "sha1.h"
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace ::apache::thrift;
|
||||
|
@ -29,6 +30,12 @@ class PosBookieHandler : virtual public PosBookieIf {
|
|||
shared_ptr<TProtocol> protocol;
|
||||
PosClient client;
|
||||
|
||||
std::string getAuthString() {
|
||||
std::string s;
|
||||
this->client.getSalt(s);
|
||||
return SHA1Hash(s+"PSK").toHex();
|
||||
}
|
||||
|
||||
public:
|
||||
PosBookieHandler(char* serverHost, int serverPort)
|
||||
: socket(new TSocket(serverHost, serverPort))
|
||||
|
@ -60,7 +67,7 @@ class PosBookieHandler : virtual public PosBookieIf {
|
|||
|
||||
int32_t accountBalance = this->client.getHashAccountBalance(dataToHash);
|
||||
if(accountBalance < total_price) {
|
||||
this->client.performTransactionOnHash("AUTH", dataToHash, total_price * -1);
|
||||
this->client.performTransactionOnHash(this->getAuthString(), dataToHash, total_price * -1);
|
||||
return E_PURCHASE_STATUS::type::EPS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue