def getSalesAdvice(self, client): with openYaml() as stream: data = yaml.load(stream)['salesadvice'] salesAdviceReq = client.factory.create(data["factory"]) with openYaml() as stream: data = yaml.load(stream)['login'] salesAdviceReq.institutionID = data["institutionID"] salesAdviceReq.instrumentType = data["instrumentType"] salesAdviceReq.institutionPassword = data["institutionPassword"]
def getCampaigns(self, client): with openYaml() as stream: data = yaml.load(stream)['campaignList'] campaignList = client.factory.create(data["factory"]) campaignList.sourceChannel = data["sourceChannel"] with openYaml() as stream: data = yaml.load(stream)['login'] campaignList.institutionID = data["institutionID"] campaignList.institutionPassword = data["institutionPassword"] campaignList.userProfile = data["userProfile"] with openYaml() as stream: data = yaml.load(stream)['common'] campaignList.userProfile = data["responseLanguage"] campaignListResponse = client.service.getCampaignList(campaignList) print(campaignListResponse) for c in campaignListResponse.campaignSet.campaignSet: print(c) print(c.campaignId)
def createVoucher(self, client): with openYaml() as stream: data = yaml.load(stream)['voucher'] voucherReq = client.factory.create(data["factory"]) voucherReq.sourceChannel = data["sourceChannel"] voucherReq.customerInternalNo = data["customerInternalNo"] voucherReq.validityMode = data["validityMode"] voucherReq.validityDuration = data["validityDuration"] voucherReq.itemBarcode = data["itemBarcode"] voucherReq.rewardType = data["rewardType"] with openYaml() as stream: data = yaml.load(stream)['login'] voucherReq.institutionID = data["institutionID"] voucherReq.instrumentType = data["instrumentType"] voucherReq.institutionPassword = data["institutionPassword"] voucherReq.userProfile = data["userProfile"] with openYaml() as stream: data = yaml.load(stream)['common'] voucherReq.userProfile = data["responseLanguage"] createVoucherResp = client.service.getvoucher(voucherReq) voucher = Voucher.Voucher(createVoucherResp) return client.service.getvoucher(voucher)
def login(self, client): with openYaml() as stream: data = yaml.load(stream)['login'] customerLogin = client.factory.create(data["factory"]) customerLogin.institutionID = data["institutionID"] customerLogin.instrumentType = data["instrumentType"] customerLogin.institutionPassword = data["institutionPassword"] customerLogin.userProfile = data["userProfile"] customerLogin.instrumentNo = data["instrumentNo"] customerLogin.password = data['password'] customerLoginResponse = client.service.customerLogin(customerLogin) print(data["institutionPassword"]) print(customerLoginResponse) customer = Customer.Customer(customerLoginResponse.customerLoginOutputs.firstName, customerLoginResponse.customerLoginOutputs.lastName, customerLoginResponse.customerLoginOutputs.email, customerLoginResponse.customerLoginOutputs.internalCustomerNo) return customer
__author__ = 'Keech' from flask import Flask,send_from_directory,request from Models.Session import Session import os import json from suds.client import Client from settings import APP_ROOT, openYaml import yaml from urllib import error app = Flask(__name__) Session = Session() currentItemCount = 0 with openYaml() as stream: data = yaml.load(stream)['wsdlUrl'] aUrl = data["aUrl"] _coffeesOnHold = 7; while True: try: aClient = Client(aUrl) break except (TimeoutError, error.URLError) as e: pass print("Client has started successfully") tUrl = data["tUrl"] while True: try: tClient= Client(tUrl)