Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8f80614b

Von G. Richardson vor mehr als 7 Jahren hinzugefügt

  • ID 8f80614bf1e632e7d70e591b3025540b1bc4b2b9
  • Vorgänger 8131b96c
  • Nachfolger dbb4b288

ShopModul - alten XTCommerce Testcode entfernt

Unterschiede anzeigen:

SL/ShopConnector/ALL.pm
1 1
package SL::ShopConnector::ALL;
2 2

  
3 3
use strict;
4
#use SL::ShopConnector::XTCommerce;
5 4
use SL::ShopConnector::Shopware;
6
# use SL::ShopConnector::ideal;
7 5

  
8 6
my %shop_connector_by_name = (
9
#  xtcommerce  => 'SL::ShopConnector::XTCommerce',
10 7
  shopware    => 'SL::ShopConnector::Shopware',
11
#  ideal       => 'SL::ShopConnector::IDeal',
12 8
);
13 9

  
14 10
my %shop_connector_by_connector = (
15
#  xtcommerce => 'SL::ShopConnector::XTCommerce',
16 11
  shopware   => 'SL::ShopConnector::Shopware',
17
#  ideal      => 'SL::ShopConnector::IDeal',
18 12
);
19 13

  
20 14
my @shop_connector_order = qw(
21
  xtcommerce
22 15
  shopware
23
  ideal
24 16
);
25 17

  
26 18
my @shop_connectors =
27 19
  (
28
#    { id => "xtcommerce", description => "XT Commerce"},
29 20
    { id => "shopware",   description => "Shopware" },
30
#    { id => "ideal",      description => "IDeal" }
31 21
  );
32 22

  
33 23
sub all_enabled_shop_connectors {
SL/ShopConnector/XTCommerce.pm
1
package SL::ShopConnector::XTCommerce;
2

  
3
use strict;
4

  
5
use parent qw(SL::ShopConnector::Base);
6

  
7
use LWP::UserAgent;     
8
use LWP::Authen::Digest;
9
use Data::Dumper;
10

  
11
use Rose::Object::MakeMethods::Generic (
12
  'scalar --get_set_init' => [ qw(connector url) ],
13
);
14

  
15
sub get_order {
16
  my ($self, $id) = @_;
17
   
18
  my $url = $self->url;
19
  my $data = $self->connector->get("$url/order/$id");
20
  my $data_json = $data->content;
21
  my $import = SL::JSON::decode_json($data_json);
22

  
23
# need to check return here, only return well defined data
24

  
25
  return $import;
26

  
27
  # printf("loading %s:%s\n", $self->config->url, $self->config->port);
28
};
29

  
30
sub get_new_orders {
31
  my ($self) = @_;
32
   
33
  my $url = $self->url;
34
  my $data = $self->connector->get("$url/orders");
35
  my $data_json = $data->content;
36
  my $orders = SL::JSON::decode_json($data_json);
37

  
38
# need to check return here, only return well defined data
39

  
40
  return $orders;
41

  
42
  # printf("loading %s:%s\n", $self->config->url, $self->config->port);
43
};
44

  
45
sub update_part {
46
  my ($self, $part) = @_;
47

  
48
  my $url = $self->url;
49
  my $partnumber = $part->partnumber;
50
  my $data = $self->connector->get("$url/part/$partnumber");
51

  
52
};
53

  
54
sub init_url {
55
  my ($self) = @_;
56
  # TODO: validate url and port
57
  $self->url($self->config->url . ":" . $self->config->port);
58
};
59
  
60
sub init_connector {
61
  my ($self) = @_;
62
  my $ua = LWP::UserAgent->new;          
63
  $ua->credentials(                      
64
      $self->url,
65
      "XT Commerce SOAP 2.0",                
66
      "user" => "sdfsdfsdfsdfasdfsdf"     
67
      );                                     
68
  return $ua;                            
69
};
70

  
71
1;
72

  
73
__END__
74

  
75
=encoding utf-8
76

  
77
=head1 NAME
78

  
79
SL::ShopConnecter::XTCommerce - connector for XTCommerce with SOAP2.0 plugin
80

  
81
=head1 SYNOPSIS
82

  
83
=head1 DESCRIPTION
84

  
85
=head1 BUGS
86

  
87
None yet. :)
88

  
89
=head1 AUTHOR
90

  
91
=cut

Auch abrufbar als: Unified diff