@@ -334,10 +334,11 @@ def get_price_id_list(self, package_keyname, item_keynames):
334334 keynames in the given package
335335
336336 """
337- mask = 'id, keyName, prices'
337+ mask = 'id, itemCategory, keyName, prices[categories] '
338338 items = self .list_items (package_keyname , mask = mask )
339339
340340 prices = []
341+ gpu_number = - 1
341342 for item_keyname in item_keynames :
342343 try :
343344 # Need to find the item in the package that has a matching
@@ -353,8 +354,17 @@ def get_price_id_list(self, package_keyname, item_keynames):
353354 # because that is the most generic price. verifyOrder/placeOrder
354355 # can take that ID and create the proper price for us in the location
355356 # in which the order is made
356- price_id = [p ['id' ] for p in matching_item ['prices' ]
357- if not p ['locationGroupId' ]][0 ]
357+ if matching_item ['itemCategory' ]['categoryCode' ] != "gpu0" :
358+ price_id = [p ['id' ] for p in matching_item ['prices' ]
359+ if not p ['locationGroupId' ]][0 ]
360+ else :
361+ # GPU items has two generic prices and they are added to the list
362+ # according to the number of gpu items added in the order.
363+ gpu_number += 1
364+ price_id = [p ['id' ] for p in matching_item ['prices' ]
365+ if not p ['locationGroupId' ]
366+ and p ['categories' ][0 ]['categoryCode' ] == "gpu" + str (gpu_number )][0 ]
367+
358368 prices .append (price_id )
359369
360370 return prices
0 commit comments