| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Transaction; | ||
| 9 | use parent 'WWW::Shopify::Model::Item'; | ||
| 10 | |||
| 11 | sub parent { return "WWW::Shopify::Model::Order"; } | ||
| 12 | my $fields; sub fields { return $fields; } | ||
| 13 | BEGIN { $fields = { | ||
| 14 | "amount" => new WWW::Shopify::Field::Money(), | ||
| 15 | "kind" => new WWW::Shopify::Field::String::Enum(["capture", "authorization", "sale", "void", "refund"]), | ||
| 16 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 17 | "status" => new WWW::Shopify::Field::String::Enum(["success", "failure", "error"]), | ||
| 18 | "receipt" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::Transaction::Receipt"), | ||
| 19 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 20 | "authorization" => new WWW::Shopify::Field::String(), | ||
| 21 | "gateway" => new WWW::Shopify::Field::String::Enum(["bogus", "real"]), | ||
| 22 | "order_id" => new WWW::Shopify::Field::Relation::Parent('WWW::Shopify::Model::Order'), | ||
| 23 | "parent_id" => new WWW::Shopify::Field::Relation::ReferenceOne('WWW::Shopify::Model::Transaction'), | ||
| 24 | "test" => new WWW::Shopify::Field::Boolean(), | ||
| 25 | "error_code" => new WWW::Shopify::Field::String(), | ||
| 26 | "signature" => new WWW::Shopify::Field::String(), | ||
| 27 | "source_name" => new WWW::Shopify::Field::String(), | ||
| 28 | "currency" => new WWW::Shopify::Field::String(), | ||
| 29 | "message" => new WWW::Shopify::Field::Text(), | ||
| 30 | "payment_details" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::Transaction::PaymentDetails"), | ||
| 31 | "user_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::User"), | ||
| 32 | "device_id" => new WWW::Shopify::Field::String(), | ||
| 33 | "currency_exchange_adjustment" => new WWW::Shopify::Field::Relation::OwnOne("WWW::Shopify::Model::Transaction::CurrencyExchangeAdjustment"), | ||
| 34 | "processed_at" => new WWW::Shopify::Field::Date(), | ||
| 35 | "authorization_expires_at" => new WWW::Shopify::Field::Date() | ||
| 36 | }; | ||
| 37 | } | ||
| 38 | sub creation_minimal { return qw(kind); } | ||
| 39 | sub creation_filled { return qw(id created_at); } | ||
| 40 | sub update_fields { return qw(amount kind); } | ||
| 41 | |||
| 42 | sub read_scope { return "read_orders"; } | ||
| 43 | sub write_scope { return "write_orders"; } | ||
| 44 | |||
| 45 | sub included_in_parent { return 0; } | ||
| 46 | |||
| 47 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 48 | |||
| 49 | 1 |