File: draft_order.py

package info (click to toggle)
python-shopifyapi 12.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: python: 1,752; sh: 10; makefile: 9
file content (15 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from ..base import ShopifyResource
from shopify import mixins
from .draft_order_invoice import DraftOrderInvoice


class DraftOrder(ShopifyResource, mixins.Metafields):
    def send_invoice(self, draft_order_invoice=DraftOrderInvoice()):
        resource = self.post("send_invoice", draft_order_invoice.encode())
        return DraftOrderInvoice(DraftOrder.format.decode(resource.body))

    def complete(self, params={}):
        if params.get("payment_pending", False):
            self._load_attributes_from_response(self.put("complete", payment_pending="true"))
        else:
            self._load_attributes_from_response(self.put("complete"))