def update(self, params=None): if params is None: params = dict() params['option_id'] = self.option_id Api.call('products/update_option', params) option = Option(Api.call('products/detail_option', params)) return option.option[0]
def stop(cls, params=None): if params is None: params = dict() if 'lineitem_id' in params: url = 'sales/stop_lineitem_recurring' return Api.call(url, params) elif 'sale_id' in params: url = 'sales/detail_sale' sale = Api.call(url, params) sale = json.loads(sale) if 'response_code' in sale: active_lineitems = Util.active(sale['sale']['invoices']) if dict(active_lineitems): url = 'sales/stop_lineitem_recurring' result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call(url, params) i += 1 return json.dumps(result, sort_keys=True, indent=4) else: return '{"response":{"code":"SUCCESS","message":"No active recurring lineitems"}}' else: return sale else: return '{"errors":{"code":"INVALID PARAMETER","message":"You must pass a sale_id or lineitem_id."}}'
def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response)
def update(self, params=None): if params is None: params = dict() params['coupon_code'] = self.coupon_code Api.call('products/update_coupon', params) coupon = Coupon(Api.call('products/detail_coupon', params)) return coupon.coupon
def update(self, params=None): if params is None: params = dict() params['product_id'] = self.product_id Api.call('products/update_product', params) product = Product(Api.call('products/detail_product', params)) return product.product
def retrieve(cls, params=None): if params is None: params = dict() if 'sale_id' in params or 'invoice_id' in params: url = 'sales/detail_sale' else: url = 'sales/list_sales' return Api.call(url, params)
def refund(cls, params=None): if params is None: params = dict() if 'lineitem_id' in params: url = 'sales/refund_lineitem' else: url = 'sales/refund_invoice' return Api.call(url, params)
def retrieve(cls, params=None): if params is None: params = dict() if 'product_id' in params: url = 'products/detail_product' else: url = 'products/list_products' return Api.call(url, params)
def retrieve(cls, params=None): if params is None: params = dict() if 'coupon_code' in params: url = 'products/detail_coupon' else: url = 'products/list_coupons' return Api.call(url, params)
def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params))
def active(cls, params=None): if params is None: params = dict() if 'sale_id' in params: url = 'sales/detail_sale' sale = Api.call(url, params) sale = json.loads(sale) if 'response_code' in sale: active_lineitems = Util.active(sale['sale']['invoices']) else: return sale else: return '{"errors":{"code":"INVALID PARAMETER","message":"You must pass a sale_id."}}' if dict(active_lineitems): response = active_lineitems else: response = '{"response":{"code":"SUCCESS","message":"No active reurring lineitems"}}' return response
def authorize(cls, params=None): response = Charge(Api.call('authService', params)) return response.response
def create(cls, params=None): if params is None: params = dict() return cls(Api.call('products/create_option', params))
def delete(self, params=None): if params is None: params = dict() params['option_id'] = self.option_id return Option(Api.call('products/delete_option', params))
def ship(cls, params=None): if params is None: params = dict() url = 'sales/mark_shipped' return Api.call(url, params)
def list(cls, params=None): if params is None: params = dict() list = cls(Api.call('products/list_options', params)) return list.options
def delete(self, params=None): if params is None: params = dict() params['coupon_code'] = self.coupon_code return Coupon(Api.call('products/delete_coupon', params))
def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary
def update(cls, params=None): if params is None: params = dict() url = 'products/update_option' return Api.call(url, params)
def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params))
def reauth(cls, params=None): if params is None: params = dict() url = 'sales/reauth' return Api.call(url, params)
def retrieve(cls, params=None): if params is None: params = dict() url = 'acct/detail_contact_info' response = cls(Api.call(url, params)) return response.vendor_contact_info
def list(cls, params=None): if params is None: params = dict() return cls(Api.call('products/list_coupons', params))
def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale
def find(cls, params=None): if params is None: params = dict() option = cls(Api.call('products/detail_option', params)) return option.option[0]
def retrieve(cls, params=None): if params is None: params = dict() url = 'acct/detail_contact_info' return Api.call(url, params)
def delete(cls, params=None): if params is None: params = dict() url = 'products/delete_product' return Api.call(url, params)
def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params))
def find(cls, params=None): if params is None: params = dict() result = cls(Api.call('products/detail_coupon', params)) return result.coupon
def reauth(self): params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/reauth', params))
def comment(cls, params=None): if params is None: params = dict() url = 'sales/create_comment' return Api.call(url, params)
def create(cls, params=None): if params is None: params = dict() url = 'products/create_coupon' return Api.call(url, params)