Esempio n. 1
0
def RequestForQuote(ProductName, Quantity):
    # type-checks and makes sure Quantity >= 1
    global NUMREQUESTS
    NUMREQUESTS += 1
    if Quantity < 1: raise ValueError("must order at least 1")
    else:
        import whrandom
        mult = whrandom.random()
        times = 0
        while mult > 0.25:
            mult = mult - 0.25
            times += 1
        mult += 0.5
        mult = round(mult, 3)
        print(mult, times)
        return SOAP.doubleType(round(mult*int(Quantity),2))
def RequestForQuote(ProductName, Quantity):
    # type-checks and makes sure Quantity >= 1
    global NUMREQUESTS
    NUMREQUESTS += 1
    if Quantity < 1: raise ValueError, "must order at least 1"
    else:
        import whrandom
        mult = whrandom.random()
        times = 0
        while mult > 0.25:
            mult = mult - 0.25
            times += 1
        mult += 0.5
        mult = round(mult, 3)
        print mult, times
        return SOAP.doubleType(round(mult * int(Quantity), 2))


def Buy(**kw):

    global NUMBUYS
    NUMBUYS += 1
    try:
        PurchaseOrder = kw["PurchaseOrder"]
    except:
        PurchaseOrder = kw["PO"]
    try:
        POkeys = PurchaseOrder['_keyord']
        POkeys.sort()
        POkeys_expected = ["shipTo", "billTo", "items", "poID", "createDate"]
        POkeys_expected.sort()
Esempio n. 3
0
def RequestForQuote(ProductName, Quantity):
    # type-checks and makes sure Quantity >= 1
    global NUMREQUESTS
    NUMREQUESTS += 1
    if Quantity < 1: raise ValueError, "must order at least 1"
    else:
        import whrandom
        mult = whrandom.random()
        times = 0
        while mult > 0.25:
            mult = mult - 0.25
            times += 1
        mult += 0.5
        mult = round(mult, 3)
        print mult, times
        return SOAP.doubleType(round(mult*int(Quantity),2))

    
def Buy(**kw):
    
    global NUMBUYS
    NUMBUYS += 1
    try:
        PurchaseOrder = kw["PurchaseOrder"]
    except:
        PurchaseOrder = kw["PO"]
    try:
        POkeys = PurchaseOrder['_keyord']
        POkeys.sort()
        POkeys_expected = ["shipTo","billTo","items","poID","createDate"]
        POkeys_expected.sort()