| 1 | |||
| 2 | #!/usr/bin/perl | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use WWW::Shopify; | ||
| 8 | |||
| 9 | package WWW::Shopify::Model::DraftOrder; | ||
| 10 | use parent "WWW::Shopify::Model::Item"; | ||
| 11 | |||
| 12 | my $fields; sub fields { return $fields; } | ||
| 13 | BEGIN { $fields = { | ||
| 14 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 15 | "note" => new WWW::Shopify::Field::String::Words(), | ||
| 16 | "email" => new WWW::Shopify::Field::String::Email(), | ||
| 17 | "taxes_included" => new WWW::Shopify::Field::Boolean(), | ||
| 18 | "currency" => new WWW::Shopify::Field::Currency(), | ||
| 19 | "subtotal_price" => new WWW::Shopify::Field::Money(), | ||
| 20 | "total_tax" => new WWW::Shopify::Field::Money(), | ||
| 21 | "total_price" => new WWW::Shopify::Field::Money(), | ||
| 22 | "invoice_sent_at" => new WWW::Shopify::Field::Date(), | ||
| 23 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 24 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 25 | "tax_exempt" => new WWW::Shopify::Field::Boolean(), | ||
| 26 | "completed_at" => new WWW::Shopify::Field::Date(), | ||
| 27 | "name" => new WWW::Shopify::Field::String(), | ||
| 28 | "status" => new WWW::Shopify::Field::String::Enum(["open", "invoice_sent", "completed"]), | ||
| 29 | "billing_address" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::DraftOrder::BillingAddress"), | ||
| 30 | "shipping_address" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::DraftOrder::ShippingAddress"), | ||
| 31 | "invoice_url" => new WWW::Shopify::Field::String::URL(), | ||
| 32 | "applied_discount" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::DraftOrder::AppliedDiscount"), | ||
| 33 | "order_id" => new WWW::Shopify::Field::Relation::ReferenceOne('WWW::Shopify::Model::Order'), | ||
| 34 | "line_items" => new WWW::Shopify::Field::Relation::Many('WWW::Shopify::Model::DraftOrder::LineItem'), | ||
| 35 | "shipping_line" => new WWW::Shopify::Field::Relation::OwnOne('WWW::Shopify::Model::DraftOrder::ShippingLine'), | ||
| 36 | "tax_lines" => new WWW::Shopify::Field::Relation::Many('WWW::Shopify::Model::DraftOrder::TaxLine'), | ||
| 37 | "note_attributes" => new WWW::Shopify::Field::Relation::Many('WWW::Shopify::Model::DraftOrder::NoteAttribute'), | ||
| 38 | "tags" => new WWW::Shopify::Field::String(), | ||
| 39 | "customer" => new WWW::Shopify::Field::Relation::OwnOne('WWW::Shopify::Model::Customer'), | ||
| 40 | } } | ||
| 41 | my $queries; sub queries { return $queries; } | ||
| 42 | BEGIN { $queries = { | ||
| 43 | since_id => new WWW::Shopify::Query::LowerBound('id'), | ||
| 44 | status => new WWW::Shopify::Query::Enum('status', ['open', 'invoice_sent', 'completed']), | ||
| 45 | ids => new WWW::Shopify::Query::MultiMatch('id') | ||
| 46 | }; } | ||
| 47 | |||
| 48 | sub creation_filled { return qw(invoice_url) } | ||
| 49 | sub update_fields { return qw(note note_attributes email buyer_accepts_marketing customer tags name shipping_address metafields line_items applied_discount); }; | ||
| 50 | sub actions { return qw(send_invoice); } | ||
| 51 | |||
| 52 | |||
| 53 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 54 | |||
| 55 | 1 |