Beispiel #1
0
 def saveCouponConfigAndAssertions(self,
                                   couponConfigReq={},
                                   saveCouponConfig={}):
     couponConfigReq.update({"info": inspect.stack()[1][3]})
     couponConfigObj = LuciObject.couponConfiguration(couponConfigReq)
     if saveCouponConfig == {}:
         saveCouponConfigRequestObj = LuciObject.saveCouponConfigRequest(
             couponConfigObj)
     else:
         saveCouponConfigRequestObj = LuciObject.saveCouponConfigRequest(
             couponConfigObj, saveCouponConfig)
     output = self.connObj.saveCouponConfiguration(
         saveCouponConfigRequestObj)
     Assertion.constructAssertion(output is not None,
                                  'Coupon Series Created successfully')
     couponConfigObj = output.__dict__
     return couponConfigObj, couponConfigObj['id']
Beispiel #2
0
 def getCouponSeriesId(campaignId):
     constant.config['campaignId'] = campaignId
     constant.config['adminId'] = int(constant.config['userId'])
     constant.config['requestId'] = 'RequestID_IRISV2_{}'.format(
         int(time.time()))
     return LuciHelper.getConnObj(
         newConnection=True).saveCouponConfiguration(
             LuciObject.saveCouponConfigRequest(
                 LuciObject.couponConfiguration({}))).__dict__['id']
Beispiel #3
0
    def createCouponLuci(self, condition):
        port = constant.config['luciPort'].next()
        connObj = LuciThrift(port)

        couponConfigObject = LuciObject.couponConfiguration(condition)
        saveCouponConfigObject = LuciObject.saveCouponConfigRequest(
            couponConfigObject)
        response = connObj.saveCouponConfiguration(saveCouponConfigObject)
        couponConfigObj = response.__dict__
        return couponConfigObj['id']
Beispiel #4
0
 def getSecondCouponSeriesId(campaignId):
     constant.config['campaignId'] = campaignId
     constant.config['adminId'] = int(constant.config['userId'])
     constant.config['requestId'] = 'RequestID_IRISV2_{}'.format(
         int(time.time()))
     return LuciHelper.getConnObj(
         newConnection=True).saveCouponConfiguration(
             LuciObject.saveCouponConfigRequest(
                 LuciObject.couponConfiguration({
                     "description": "multiple offers testing",
                     "info": "multiple offers testing",
                     "discount_code": "ABC123"
                 }))).__dict__['id']
Beispiel #5
0
    def couponConfigChange(self, condition):
        Logger.log('Setting Voucher Resent Config to :{} for voucherId :{}'.format(condition, self.voucherId))
        constant.config['campaignId'] = self.campaignId
        port = constant.config['luciPort'].next()
        connObj = LuciThrift(port)
        constructObj = LuciObject()

        configRequest = LuciObject.getCouponConfigRequest({'couponSeriesId': self.voucherId})
        couponConfigList = connObj.getCouponConfiguration(configRequest)
        couponConfig = couponConfigList[0].__dict__
        couponConfig.update(condition)
        
        couponConfigObject = LuciObject.couponConfiguration(couponConfig)
        saveCouponConfigObject = LuciObject.saveCouponConfigRequest(couponConfigObject)
        connObj.saveCouponConfiguration(saveCouponConfigObject)