def __processResponse(self, callback, resultID, errorStr, ext):
        self.__request = None
        self.__lastResponseTime = BigWorld.timeExact()
        self.__receivedData = {}
        if not AccountCommands.isCodeValid(resultID):
            LOG_WARNING(
                'WGM Balance info is not received, resultID: {}, errorStr: {}'.
                format(resultID, errorStr))
            callback(self.__receivedData)
            return
        else:
            for item in ext:
                if self.__checkFields(item):
                    currencyCode = item[_TOKEN_CURRENCY_CODE]
                    if currencyCode == _TOKEN_GOLD or currencyCode == _TOKEN_CREDITS:
                        amount = item[_TOKEN_AMOUNT]
                        isPaid = item[_TOKEN_CLASS][_TOKEN_IS_PAID]
                        action = _ACTION_PURCHASED if isPaid else _ACTION_EARNED
                        key = currencyCode + action
                        self.__receivedData[key] = amount
                else:
                    LOG_WARNING('Error parsing wgm response, row is: ', item)

            callback(self.__receivedData)
            return
Exemple #2
0
 def __onUpdatePlayerDTCmdResponseReceived(self,
                                           resultID,
                                           requestID,
                                           errorStr,
                                           errorMsg=None):
     if not AccountCommands.isCodeValid(requestID):
         _logger.error((errorStr, errorMsg))
Exemple #3
0
 def proxy(requestID, resultID, errorStr, ext=None):
     _logger.debug('sellMultipleItems callback(requestID=%d, resultID=%d, errorStr=%s', requestID, resultID, errorStr)
     results[requestID] = resultID
     if all((res is not None for res in results.itervalues())):
         if all((AccountCommands.isCodeValid(res) for res in results.itervalues())):
             callback(AccountCommands.RES_SUCCESS)
         else:
             callback(AccountCommands.RES_FAILURE)
    def _onInvitationResponseReceived(self, newStatus, invID, callback, requestID, code, errStr):
        if AccountCommands.isCodeValid(code):
            try:
                self.__invitations[invID]['status'] = newStatus
                self.__playerEvents.onPrebattleInvitationsChanged(self.__invitations)
            except KeyError:
                LOG_ERROR('Unknown invitation', self.__invitations, invID, callback, code, errStr)

        if callback is not None:
            callback(code, errStr)
        return
    def _onInvitationResponseReceived(self, newStatus, invitationId, senderDBID, callback, _, code, errStr):
        if AccountCommands.isCodeValid(code):
            uniqueId = _UniqueId(invitationId, senderDBID)
            try:
                self.__invitations[uniqueId]['status'] = newStatus
                self.__playerEvents.onPrebattleInvitationsChanged(self.__invitations)
            except KeyError:
                LOG_ERROR('Unknown invitation', uniqueId, self.__invitations, callback, code, errStr)

        if callback is not None:
            callback(code, errStr)
        return
Exemple #6
0
 def callback(resultID, requestID, errorStr, errorMsg=None):
     if AccountCommands.isCodeValid(requestID):
         _logger.debug(
             '[RenewableSubscription] _onIdleCrewXPVehicleSelected SUCCESS'
         )
         return
     if requestID == AccountCommands.RES_NOT_AVAILABLE:
         SystemMessages.pushMessage(
             backport.text(R.strings.messenger.serviceChannelMessages.
                           wotPlus.passiveXP.isDisabled.title()),
             type=SystemMessages.SM_TYPE.Warning)
     _logger.warning((errorStr, errorMsg))
     errorCallback()
    def _onInvitationResponseReceived(self, newStatus, invitationId, senderDBID, callback, _, code, errStr):
        if AccountCommands.isCodeValid(code):
            uniqueId = UniqueId(invitationId, senderDBID)
            try:
                self.__invitations[uniqueId]['status'] = newStatus
                self.__playerEvents.onPrebattleInvitationsChanged(self.__invitations)
            except KeyError:
                LOG_ERROR('Unknown invitation', uniqueId, self.__invitations, callback, code, errStr)

        else:
            self.__playerEvents.onPrebattleInvitationsError(invitationId, code, errStr)
        if callback is not None:
            callback(code, errStr)
        return
 def isSuccess(self):
     return AccountCommands.isCodeValid(self.code)
Exemple #9
0
 def isSuccess(self):
     return AccountCommands.isCodeValid(self.code)