Esempio n. 1
0
 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]
Esempio n. 2
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."}}'
Esempio n. 3
0
 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 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."}}'
Esempio n. 5
0
 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
Esempio n. 6
0
 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)
Esempio n. 8
0
 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)
Esempio n. 9
0
 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)
Esempio n. 10
0
 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)
Esempio n. 12
0
 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)
Esempio n. 13
0
 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))
Esempio n. 14
0
 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
Esempio n. 15
0
 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
Esempio n. 16
0
 def authorize(cls, params=None):
     response = Charge(Api.call('authService', params))
     return response.response
Esempio n. 17
0
 def create(cls, params=None):
     if params is None:
         params = dict()
     return cls(Api.call('products/create_option', params))
Esempio n. 18
0
 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))
Esempio n. 19
0
 def ship(cls, params=None):
     if params is None:
         params = dict()
     url = 'sales/mark_shipped'
     return Api.call(url, params)
Esempio n. 20
0
 def list(cls, params=None):
     if params is None:
         params = dict()
     list = cls(Api.call('products/list_options', params))
     return list.options
Esempio n. 21
0
 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))
Esempio n. 22
0
 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)
Esempio n. 24
0
 def authorize(cls, params=None):
     response = Charge(Api.call('authService', params))
     return response.response
Esempio n. 25
0
 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))
Esempio n. 26
0
 def reauth(cls, params=None):
     if params is None:
         params = dict()
     url = 'sales/reauth'
     return Api.call(url, params)
Esempio n. 27
0
 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
Esempio n. 28
0
 def list(cls, params=None):
     if params is None:
         params = dict()
     return cls(Api.call('products/list_coupons', params))
Esempio n. 29
0
 def find(cls, params=None):
     if params is None:
         params = dict()
     response = cls(Api.call('sales/detail_sale', params))
     return response.sale
Esempio n. 30
0
 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)
Esempio n. 32
0
 def delete(cls, params=None):
     if params is None:
         params = dict()
     url = 'products/delete_product'
     return Api.call(url, params)
Esempio n. 33
0
 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))
Esempio n. 34
0
 def find(cls, params=None):
     if params is None:
         params = dict()
     result = cls(Api.call('products/detail_coupon', params))
     return result.coupon
Esempio n. 35
0
 def reauth(self):
     params = dict()
     params['sale_id'] = self.sale_id
     return Sale(Api.call('sales/reauth', params))
Esempio n. 36
0
 def comment(cls, params=None):
     if params is None:
         params = dict()
     url = 'sales/create_comment'
     return Api.call(url, params)
 def retrieve(cls, params=None):
     if params is None:
         params = dict()
     url = 'acct/detail_contact_info'
     return Api.call(url, params)
Esempio n. 38
0
 def ship(cls, params=None):
     if params is None:
         params = dict()
     url = 'sales/mark_shipped'
     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)
Esempio n. 40
0
 def reauth(cls, params=None):
     if params is None:
         params = dict()
     url = 'sales/reauth'
     return Api.call(url, params)