Remove obsolete function buy_item()
This commit is contained in:
parent
485bcd32a6
commit
e26563b946
|
@ -53,7 +53,7 @@ class BuyCommand(object):
|
||||||
raise ValueError("BuyCommand in illegal state")
|
raise ValueError("BuyCommand in illegal state")
|
||||||
|
|
||||||
def run(self, user_name):
|
def run(self, user_name):
|
||||||
net.buy_item(self._item.id, what_about_it=self._what_to_buy(), user_name=user_name)
|
raise NotImplementedError('BuyCommand.run(user_name)')
|
||||||
|
|
||||||
def item_name(self):
|
def item_name(self):
|
||||||
return self._item.name
|
return self._item.name
|
||||||
|
|
|
@ -71,16 +71,6 @@ def get_user_name_from_auth_blob(authblob):
|
||||||
return d['username']
|
return d['username']
|
||||||
|
|
||||||
|
|
||||||
def buy_item(item_id, what_about_it, user_name):
|
|
||||||
require_type(int, item_id)
|
|
||||||
assert(what_about_it in (ITEM_ONLY, DEPOSIT_ONLY, ITEM_AND_DEPOSIT))
|
|
||||||
|
|
||||||
content = _request('buyable/item/' + urllib.quote(str(item_id)),
|
|
||||||
{'user':user_name, 'deposit':what_about_it, 'amount':1}, method='POST')
|
|
||||||
if content != 'Created':
|
|
||||||
raise ValueError('Server says "%s"' % content)
|
|
||||||
|
|
||||||
|
|
||||||
def bulk_buy(buycommands, user_name):
|
def bulk_buy(buycommands, user_name):
|
||||||
item_ids = tuple(e.item_id() for e in buycommands if e.includes_commodity())
|
item_ids = tuple(e.item_id() for e in buycommands if e.includes_commodity())
|
||||||
deposit_ids = tuple(e.item_id() for e in buycommands if e.includes_deposit())
|
deposit_ids = tuple(e.item_id() for e in buycommands if e.includes_deposit())
|
||||||
|
@ -131,8 +121,6 @@ if __name__ == '__main__':
|
||||||
user_name = get_user_name_from_auth_blob(os.environ['BARCODE_PLUGIN_TEST_AUTH_BLOB'])
|
user_name = get_user_name_from_auth_blob(os.environ['BARCODE_PLUGIN_TEST_AUTH_BLOB'])
|
||||||
print('User name: ' + user_name)
|
print('User name: ' + user_name)
|
||||||
|
|
||||||
buy_item(1, True, user_name)
|
|
||||||
|
|
||||||
balance = get_balance(user_name)
|
balance = get_balance(user_name)
|
||||||
print('Balance is %f, type is "%s"' % (balance, type(balance).__name__))
|
print('Balance is %f, type is "%s"' % (balance, type(balance).__name__))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue