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']
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']
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']
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']
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)