5 use Support::TestSetup;
9 use SL::Dev::Part qw(new_part);
10 use SL::Dev::Shop qw(new_shop new_shop_part);
11 use SL::Dev::CustomerVendor qw(new_customer);
13 use SL::DB::ShopOrder;
14 use SL::DB::ShopOrderItem;
15 use SL::Controller::ShopOrder;
19 use SL::ShopConnector::Shopware;
20 my ($shop, $shopware, $shop_order, $shop_part, $part, $customer, $employee, $json_import);
27 $shop = new_shop( connector => 'shopware',
28 last_order_number => 20000,
29 pricetype => 'brutto',
30 price_source => 'master_data',
33 $shopware = SL::Shop->new( config => $shop );
34 $part = new_part( partnumber => 'SW10002',
35 description => 'TITANIUM CARBON GS 12m cm',
37 $shop_part = new_shop_part(part => $part, shop => $shop);
39 $employee = SL::DB::Manager::Employee->current || croak "No employee";
41 $customer = new_customer( name => 'Evil Inc',
42 street => 'Evil Street',
44 email => 'evil@evilinc.com'
50 my $file = "t/shop/json_ok.json";
52 open(my $json_fh, "<:encoding(UTF-8)", $file)
53 or die("Can't open \"$file\": $!\n");
63 my $json_import = get_json();
64 note('testing shoporder mapping json good');
65 my $import = SL::JSON::decode_json($json_import);
66 $shop_order = $shopware->connector->import_data_to_shop_order($import);
67 is($shop_order->shop_id , $shop->id , "shop_id ok");
70 Support::TestSetup::login();
83 "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(OrderItem Order);
84 "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(ShopPart Part ShopOrderItem ShopOrder Shop Customer);