Revision 98d0f52e
Von Jan Büren vor fast 3 Jahren hinzugefügt
SL/ShopConnector/Base.pm | ||
---|---|---|
7 | 7 |
scalar => [ qw(config) ], |
8 | 8 |
); |
9 | 9 |
|
10 |
sub get_one_order { die 'get_one_order needs to be implemented' } |
|
10 |
sub get_one_order { |
|
11 |
die 'get_one_order needs to be implemented'; |
|
12 |
|
|
13 |
my ($self, $ordnumber) = @_; |
|
14 |
my %fetched_order; |
|
15 |
|
|
16 |
# 1. fetch the order and import it as a kivi order |
|
17 |
# 2. update the order state for report |
|
18 |
# 3. return a hash with either success or error state |
|
19 |
my $one_order; # REST call |
|
20 |
|
|
21 |
my $error = $self->import_data_to_shop_order($one_order); |
|
22 |
|
|
23 |
$self->set_orderstatus($one_order->{id}, "fetched") unless $error; |
|
24 |
|
|
25 |
return \( |
|
26 |
shop_id => $self->config->id, |
|
27 |
shop_description => $self->config->description, |
|
28 |
number_of_orders => $error ? 0 : 1, |
|
29 |
message => $error ? "Error: $error->{msg}" : '', |
|
30 |
error => $error ? 1 : 0, |
|
31 |
); |
|
32 |
} |
|
33 |
|
|
11 | 34 |
|
12 | 35 |
sub get_new_orders { die 'get_order needs to be implemented' } |
13 | 36 |
|
... | ... | |
49 | 72 |
|
50 | 73 |
=over 4 |
51 | 74 |
|
52 |
=item C<get_one_order> |
|
75 |
=item C<get_one_order $ordnumber> |
|
76 |
|
|
77 |
Needs a order number and fetch (one or more) orders |
|
78 |
which are returned by the Shop system. The function |
|
79 |
has to take care of getting the order including customer |
|
80 |
and item information to kivi. |
|
81 |
It has to return a hash with either the number of succesful |
|
82 |
imported order or within the same hash structure a error message. |
|
83 |
|
|
84 |
|
|
53 | 85 |
|
54 | 86 |
=item C<get_new_orders> |
55 | 87 |
|
... | ... | |
73 | 105 |
|
74 | 106 |
=item C<set_orderstatus> |
75 | 107 |
|
108 |
Sets the state of the order in the Shop. |
|
109 |
Valid values are dependant on the Shop API, common states |
|
110 |
are delivered, fetched, paid, in progress ... |
|
111 |
|
|
112 |
|
|
76 | 113 |
=back |
77 | 114 |
|
78 | 115 |
=head1 SEE ALSO |
Auch abrufbar als: Unified diff
Shop: Base Class get_one_order etwas ausführlicher dokumentiert