Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Interfaces/AAA/Accounting_Defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@

namespace Targoman::API::AAA {

TARGOMAN_DEFINE_ENUM(enuPreVoucherType,
Withdrawal,
Invoice,
Income,
IncreaseWallet,
CODCreadit,
CODDebit,
Prize,
TransferFrom,
TransferTo,
Freeze,
UnFreeze
)
//TARGOMAN_DEFINE_ENUM(enuPreVoucherType,
// Withdrawal,
// Invoice,
// Income,
// IncreaseWallet,
// CODCreadit,
// CODDebit,
// Prize,
// TransferFrom,
// TransferTo,
// Freeze,
// UnFreeze
// )

TARGOMAN_DEFINE_ENUM(enuVoucherType,
Withdrawal = 'W',
Expand Down Expand Up @@ -88,7 +88,7 @@ TARGOMAN_DEFINE_ENUM(enuVoucherItemProcessStatus,

} //namespace Targoman::API::AAA

TAPI_DECLARE_METATYPE_ENUM(Targoman::API::AAA, enuPreVoucherType); // -> TAPI_REGISTER_TARGOMAN_ENUM() in Accounting_Interfaces.cpp
//TAPI_DECLARE_METATYPE_ENUM(Targoman::API::AAA, enuPreVoucherType); // -> TAPI_REGISTER_TARGOMAN_ENUM() in Accounting_Interfaces.cpp
TAPI_DECLARE_METATYPE_ENUM(Targoman::API::AAA, enuVoucherType); // -> TAPI_REGISTER_TARGOMAN_ENUM() in Accounting_Interfaces.cpp
TAPI_DECLARE_METATYPE_ENUM(Targoman::API::AAA, enuVoucherStatus) // -> TAPI_REGISTER_TARGOMAN_ENUM() in Accounting_Interfaces.cpp
TAPI_DECLARE_METATYPE_ENUM(Targoman::API::AAA, enuDiscountType) // -> TAPI_REGISTER_TARGOMAN_ENUM() in Accounting_Interfaces.cpp
Expand Down Expand Up @@ -866,7 +866,7 @@ TAPI_DEFINE_STRUCT(stuVoucherItem,
//typedef QList<stuVoucherItem> InvItems_t;

TAPI_DEFINE_STRUCT(stuPreVoucher,
SF_NULLABLE_Enum (Type, enuPreVoucherType),
// SF_NULLABLE_Enum (Type, enuPreVoucherType),
SF_quint64 (UserID),
SF_QListOfVarStruct (Items, stuVoucherItem),
// SF _ Struct (Prize, stuPrize, v.Desc.size()),
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/AAA/Accounting_Interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace Targoman::API;

using namespace Targoman::API::AAA;

TAPI_REGISTER_TARGOMAN_ENUM(Targoman::API::AAA, enuPreVoucherType);
//TAPI_REGISTER_TARGOMAN_ENUM(Targoman::API::AAA, enuPreVoucherType);
TAPI_REGISTER_TARGOMAN_ENUM(Targoman::API::AAA, enuVoucherType);
TAPI_REGISTER_TARGOMAN_ENUM(Targoman::API::AAA, enuVoucherStatus);
TAPI_REGISTER_TARGOMAN_ENUM(Targoman::API::AAA, enuDiscountType);
Expand Down
4 changes: 2 additions & 2 deletions Interfaces/AAA/intfAccountingBasedModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ Targoman::API::AAA::stuPreVoucher IMPL_REST_POST(intfAccountingBasedModule, addT

_lastPreVoucher.Round = static_cast<quint16>(FinalPrice % 1000);
_lastPreVoucher.ToPay = static_cast<quint32>(FinalPrice) - _lastPreVoucher.Round;
_lastPreVoucher.Type = enuPreVoucherType::Invoice;
// _lastPreVoucher.Type = enuPreVoucherType::Invoice;
_lastPreVoucher.Sign.clear();
_lastPreVoucher.Sign = QString(voucherSign(QJsonDocument(_lastPreVoucher.toJson()).toJson()).toBase64());

Expand Down Expand Up @@ -838,7 +838,7 @@ Targoman::API::AAA::stuPreVoucher intfAccountingBasedModule::internalUpdateBaske

_lastPreVoucher.Round = static_cast<quint16>(FinalPrice % 1000);
_lastPreVoucher.ToPay = static_cast<quint32>(FinalPrice) - _lastPreVoucher.Round;
_lastPreVoucher.Type = enuPreVoucherType::Invoice;
// _lastPreVoucher.Type = enuPreVoucherType::Invoice;
_lastPreVoucher.Sign.clear();
_lastPreVoucher.Sign = QString(voucherSign(QJsonDocument(_lastPreVoucher.toJson()).toJson()).toBase64());

Expand Down
14 changes: 10 additions & 4 deletions Modules/Account/moduleSrc/Account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,12 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, finalizeBasket, (
tblVoucher::DTO VoucherDTO;
VoucherDTO.fromJson(QJsonObject::fromVariantMap(VoucherInfo));

if (VoucherDTO.vchStatus != enuVoucherStatus::New)
throw exHTTPBadRequest("Only New vouchers allowed");

if (VoucherDTO.vchType != enuVoucherType::Invoice)
throw exHTTPBadRequest("Only Expense vouchers allowed");

Targoman::API::AAA::stuPreVoucher PreVoucher;
PreVoucher.fromJson(VoucherDTO.vchDesc.object());

Expand Down Expand Up @@ -950,7 +956,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, finalizeBasket, (
PreVoucher_COD_Credit.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_COD_CREDIT));
PreVoucher_COD_Credit.Summary = "COD Credit";
PreVoucher_COD_Credit.ToPay = RemainingAfterWallet;
PreVoucher_COD_Credit.Type = enuPreVoucherType::CODCreadit;
// PreVoucher_COD_Credit.Type = enuPreVoucherType::CODCreadit;
PreVoucher_COD_Credit.Sign = QString(voucherSign(QJsonDocument(PreVoucher_COD_Credit.toJson()).toJson()).toBase64());

// quint64 COD_CreditVoucherID = Voucher::instance().Create(
Expand Down Expand Up @@ -989,7 +995,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, finalizeBasket, (
PreVoucher_COD_Debit.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_COD_DEBIT));
PreVoucher_COD_Debit.Summary = "COD Debit";
PreVoucher_COD_Debit.ToPay = RemainingAfterWallet;
PreVoucher_COD_Debit.Type = enuPreVoucherType::CODDebit;
// PreVoucher_COD_Debit.Type = enuPreVoucherType::CODDebit;
PreVoucher_COD_Debit.Sign = QString(voucherSign(QJsonDocument(PreVoucher_COD_Debit.toJson()).toJson()).toBase64());

quint64 COD_DebitVoucherID = Voucher::instance().Create(
Expand Down Expand Up @@ -1025,7 +1031,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, finalizeBasket, (
MustPay = NULLABLE_VALUE(PaymentGatewayTypesDTO.pgtMaxRequestAmount);

Voucher.Info.UserID = CurrentUserID;
Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
// Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
Voucher.Info.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_INC_WALLET, 0 /*_walID*/));
Voucher.Info.Summary = "Increase wallet";
Voucher.Info.ToPay = MustPay;
Expand Down Expand Up @@ -1544,7 +1550,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, approveOfflinePayment, (
Targoman::API::AAA::stuVoucher Voucher;

Voucher.Info.UserID = _APICALLBOOM.getUserID();
Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
// Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
Voucher.Info.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_INC_WALLET, _walID));
Voucher.Info.Summary = "Increase wallet";
Voucher.Info.ToPay = OfflinePaymentClaimDTO.ofpcAmount;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Account/moduleSrc/ORM/UserWallets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_CREATE(UserWallets, requestIncrease, (
stuVoucher Voucher;

Voucher.Info.UserID = _APICALLBOOM.getUserID();
Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
// Voucher.Info.Type = enuPreVoucherType::IncreaseWallet;
Voucher.Info.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_INC_WALLET, _walID));
Voucher.Info.Summary = "Increase wallet";
Voucher.Info.ToPay = _amount;
Expand Down