127 Call_IntBoolArg
args;
128 if (!args.Decode(&call.
tuple)) {
129 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
140 call.
Dump(SERVICE__CALL_DUMP);
141 Call_InsureShip
args;
142 if (!args.Decode(&call.
tuple)) {
143 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
148 if (shipRef.
get() ==
nullptr)
168 double paymentFraction = (args.amount / (shipRef->
type().
basePrice()));
169 if (paymentFraction < 0.05f) {
171 call.
client->
SendErrorMsg(
"Your payment of %.2f is below the minimum payment of %.2f required for coverage.", \
176 float fraction(0.1f);
177 if (paymentFraction == 0.05f) {
179 }
else if (paymentFraction == 0.1f) {
181 }
else if (paymentFraction == 0.15f) {
183 }
else if (paymentFraction == 0.2f) {
185 }
else if (paymentFraction == 0.25f) {
187 }
else if (paymentFraction == 0.3f) {
191 if (fraction < 0.05f) {
192 call.
client->
SendErrorMsg(
"There was a problem with your insurance premium calculation. Ref: ServerError 75520.");
194 }
else if (fraction == 0.1f) {
195 call.
client->
SendErrorMsg(
"Your insurance is at minimum coverage due to incorrect base prices. Ref: ServerError 75521.");
200 if (call.
byname.find(
"voidOld")->second->AsBool()->value())
203 throw UserError (
"InsureShipFailedSingleContract");
212 std::string reason =
"Insurance Premium on ";
214 reason +=
". Reference ID : xxxxx";
223 const std::string subject =
"New Ship Insurance";
224 std::string body =
"Dear valued customer,<br>";
225 body +=
"Congratulations on the insurance on your ship. A very wise choice indeed.<br>";
226 body +=
"This letter is to confirm that we have issued an insurance contract for your ship, ";
228 body +=
", at level of ";
229 body += std::to_string(fraction * 100);
230 body +=
"%.<br>This contract will expire after 12 weeks, on xxxxx";
233 body +=
"Best Wishes,<br>";
234 body +=
"The Secure Commerce Commission,<br><br>";
235 body +=
"Reference ID: xxxxx <br>";
Dispatcher *const m_dispatch
PyCallable_Make_Dispatcher(InsuranceBound) InsuranceBound(PyServiceMgr *mgr
void SendErrorMsg(const char *fmt,...)
PyCallable_Make_InnerDispatcher(InsuranceService) InsuranceService
PyRep * GetInsuranceByOwnerID(uint32 ownerID)
PyRep * GetItem(size_t index) const
Returns Python object.
Dispatcher *const m_dispatch
std::map< std::string, PyRep * > byname
PyCallable_DECL_CALL(InsureShip)
void SendMail(uint32 sender, uint32 recipient, const std::string &subject, const std::string &content)
void SendInfoModalMsg(const char *fmt,...)
Python floating point number.
int32 GetCharacterID() const
int32 GetCorporationID() const
std::string m_strBoundObjectName
virtual ~InsuranceBound()
void _SetCallDispatcher(CallDispatcher *d)
const ItemType & type() const
#define codelog(type, fmt,...)
bool IsShipInsured(uint32 shipID)
static void DeleteInsuranceByShipID(uint32 shipID)
static void TranserFunds(uint32 fromID, uint32 toID, double amount, std::string reason="", uint8 entryTypeID=Journal::EntryType::Undefined, uint32 referenceID=0, uint16 fromKey=Account::KeyType::Cash, uint16 toKey=Account::KeyType::Cash, Client *pClient=nullptr)
PyServiceMgr *const m_manager
ShipItemRef GetShip() const
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
PyServiceMgr *const m_manager
const std::string & itemName() const
PyRep * GetInsuranceByShipID(uint32 shipID)
bool InsertInsuranceByShipID(uint32 shipID, std::string name, uint32 ownerID, float level, double payOut, bool isCorpItem=false, uint8 numWeeks=12)
void Dump(LogType type) const
static int64 IntegerValue(PyRep *pRep)
Dispatcher *const m_dispatch
virtual ~InsuranceService()
const char * GetName() const