File Coverage

lib/Webservice/OVH/Order/Cart.pm
Criterion Covered Total %
statement 12 237 5.0
branch 0 158 0.0
condition 0 6 0.0
subroutine 4 27 14.8
pod 20 20 100.0
total 36 448 8.0


line stmt bran cond sub pod time code
1             package Webservice::OVH::Order::Cart;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             Webservice::OVH::Order::Cart
8              
9             =head1 SYNOPSIS
10              
11             use Webservice::OVH;
12            
13             my $ovh = Webservice::OVH->new_from_json("credentials.json");
14            
15             my $cart = $ovh->order->new_cart(ovh_subsidiary => 'DE');
16            
17             $cart->add_domain('www.domain.com');
18            
19             $cart->delete;
20              
21             =head1 DESCRIPTION
22              
23             Provides methods to manage shopping carts.
24              
25             =head1 METHODS
26              
27             =cut
28              
29 36     36   256 use strict;
  36         76  
  36         1073  
30 36     36   184 use warnings;
  36         76  
  36         1001  
31 36     36   257 use Carp qw{ carp croak };
  36         94  
  36         2594  
32              
33             our $VERSION = 0.46;
34              
35 36     36   18160 use Webservice::OVH::Order::Cart::Item;
  36         109  
  36         111958  
36              
37             =head2 _new_existing
38              
39             Internal Method to create the Cart object.
40             This method is not ment to be called directly.
41              
42             =over
43              
44             =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $cart_id - api id
45              
46             =item * Return: L<Webservice::OVH::Order::Cart>
47              
48             =item * Synopsis: Webservice::OVH::Order::Cart->_new($ovh_api_wrapper, $cart_id, $module);
49              
50             =back
51              
52             =cut
53              
54             sub _new_existing {
55              
56 0     0     my ( $class, %params ) = @_;
57              
58 0 0         die "Missing module" unless $params{module};
59 0 0         die "Missing wrapper" unless $params{wrapper};
60 0 0         die "Missing id" unless $params{id};
61              
62 0           my $module = $params{module};
63 0           my $api_wrapper = $params{wrapper};
64 0           my $cart_id = $params{id};
65              
66 0           my $response = $api_wrapper->rawCall( method => 'get', path => "/order/cart/$cart_id", noSignature => 0 );
67 0 0         carp $response->error if $response->error;
68              
69 0 0         if ( !$response->error ) {
70              
71 0           my $properties = $response->content;
72 0           my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _id => $cart_id, _properties => $properties, _items => {} }, $class;
73              
74 0           return $self;
75              
76             } else {
77              
78 0           return undef;
79             }
80             }
81              
82             =head2 _new_existing
83              
84             Internal Method to create the Cart object.
85             This method is not ment to be called directly.
86              
87             =over
88              
89             =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object - api id
90              
91             =item * Return: L<Webservice::OVH::Order::Cart>
92              
93             =item * Synopsis: Webservice::OVH::Order::Cart->_new($ovh_api_wrapper, $module, ovhSubsidiary => 'DE', decription => 'Shopping');
94              
95             =back
96              
97             =cut
98              
99             sub _new {
100              
101 0     0     my ( $class, %params ) = @_;
102              
103 0 0         die "Missing module" unless $params{module};
104 0 0         die "Missing wrapper" unless $params{wrapper};
105              
106 0           my $module = $params{module};
107 0           my $api_wrapper = $params{wrapper};
108              
109 0 0         croak "Missing ovh_subsidiary" unless exists $params{ovh_subsidiary};
110 0           my $body = {};
111 0 0         $body->{description} = $params{description} if exists $params{description};
112 0 0         $body->{expire} = $params{expire} if exists $params{expire};
113 0           $body->{ovhSubsidiary} = $params{ovh_subsidiary};
114 0           my $response = $api_wrapper->rawCall( method => 'post', path => "/order/cart", body => $body, noSignature => 0 );
115 0 0         croak $response->error if $response->error;
116              
117 0           my $cart_id = $response->content->{cartId};
118 0           my $properties = $response->content;
119              
120 0           my $response_assign = $api_wrapper->rawCall( method => 'post', path => "/order/cart/$cart_id/assign", body => {}, noSignature => 0 );
121 0 0         croak $response_assign->error if $response_assign->error;
122              
123 0           my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _id => $cart_id, _properties => $properties, _items => {} }, $class;
124              
125 0           return $self;
126             }
127              
128             =head2 properties
129              
130             Retrieves properties.
131             This method updates the intern property variable.
132              
133             =over
134              
135             =item * Return: HASH
136              
137             =item * Synopsis: my $properties = $cart->properties;
138              
139             =back
140              
141             =cut
142              
143             sub properties {
144              
145 0     0 1   my ($self) = @_;
146              
147 0           my $api = $self->{_api_wrapper};
148 0           my $cart_id = $self->id;
149 0           my $response = $api->rawCall( method => 'get', path => "/order/cart/$cart_id", noSignature => 0 );
150 0 0         croak $response->error if $response->error;
151              
152 0           $self->{_properties} = $response->content;
153 0           return $self->{_properties};
154             }
155              
156             =head2 description
157              
158             Exposed property value.
159              
160             =over
161              
162             =item * Return: VALUE
163              
164             =item * Synopsis: my $description = $cart->description;
165              
166             =back
167              
168             =cut
169              
170             sub description {
171              
172 0     0 1   my ($self) = @_;
173              
174 0           return $self->{_properties}->{description};
175             }
176              
177             =head2 expire
178              
179             Exposed property value.
180              
181             =over
182              
183             =item * Return: VALUE
184              
185             =item * Synopsis: my $expire = $cart->expire;
186              
187             =back
188              
189             =cut
190              
191             sub expire {
192              
193 0     0 1   my ($self) = @_;
194              
195 0           return $self->{_properties}->{expire};
196             }
197              
198             =head2 read_only
199              
200             Exposed property value.
201              
202             =over
203              
204             =item * Return: VALUE
205              
206             =item * Synopsis: my $read_only = $cart->read_only;
207              
208             =back
209              
210             =cut
211              
212             sub read_only {
213              
214 0     0 1   my ($self) = @_;
215              
216 0 0         return $self->{_properties}->{readOnly} ? 1 : 0;
217             }
218              
219             =head2 change
220              
221             Exposed property value.
222              
223             =over
224              
225             =item * Parameter: %params - key => value description expire
226              
227             =item * Synopsis: my $change = $cart->change(description => 'Shopping!');
228              
229             =back
230              
231             =cut
232              
233             sub change {
234              
235 0     0 1   my ( $self, %params ) = @_;
236              
237 0 0         return unless $self->_is_valid;
238              
239 0           my $api = $self->{_api_wrapper};
240 0           my $cart_id = $self->id;
241              
242 0 0         croak "Missing Parameter description" unless exists $params{description};
243 0 0         croak "Missing Parameter description" unless exists $params{expire};
244              
245 0           my $body = {};
246 0 0         $body->{description} = $params{description} if $params{description};
247 0 0         $body->{expire} = $params{expire} if $params{expire};
248              
249 0           my $response = $api->rawCall( method => 'put', path => "/order/cart/$cart_id", body => $body, noSignature => 0 );
250 0 0         croak $response->error if $response->error;
251              
252 0           $self->properties;
253             }
254              
255             =head2 is_valid
256              
257             When this cart is deleted on the api side, this method returns 0.
258              
259             =over
260              
261             =item * Return: VALUE
262              
263             =item * Synopsis: print "Valid" if $cart->is_valid;
264              
265             =back
266              
267             =cut
268              
269             sub is_valid {
270              
271 0     0 1   my ($self) = @_;
272              
273 0           return $self->{_valid};
274             }
275              
276             =head2 _is_valid
277              
278             Intern method to check validity.
279             Difference is that this method carps an error.
280              
281             =over
282              
283             =item * Return: VALUE
284              
285             =item * Synopsis: $cart->_is_valid;
286              
287             =back
288              
289             =cut
290              
291             sub _is_valid {
292              
293 0     0     my ($self) = @_;
294              
295 0           my $cart_id = $self->id;
296 0 0         carp "Cart $cart_id is not valid anymore" unless $self->is_valid;
297 0           return $self->is_valid;
298             }
299              
300             =head2 delete
301              
302             Deletes the cart api sided and sets this object invalid.
303              
304             =over
305              
306             =item * Synopsis: $cart->delete;
307              
308             =back
309              
310             =cut
311              
312             sub delete {
313              
314 0     0 1   my ($self) = @_;
315              
316 0 0         return unless $self->_is_valid;
317              
318 0           my $api = $self->{_api_wrapper};
319 0           my $cart_id = $self->id;
320              
321 0           my $response = $api->rawCall( method => 'delete', path => "/order/cart/$cart_id", noSignature => 0 );
322 0 0         croak $response->error if $response->error;
323              
324 0           $self->{_valid} = 0;
325             }
326              
327             =head2 id
328              
329             Returns the api id.
330              
331             =over
332              
333             =item * Return: VALUE
334              
335             =item * Synopsis: my $id = $cart->id;
336              
337             =back
338              
339             =cut
340              
341             sub id {
342              
343 0     0 1   my ($self) = @_;
344              
345 0           return $self->{_id},;
346             }
347              
348             =head2 offers_domain
349              
350             Returns an Array of hashs with offers.
351              
352             =over
353              
354             =item * Parameter: $domain - domain name
355              
356             =item * Return: L<ARRAY>
357              
358             =item * Synopsis: my $offers = $cart->offers_domain('mydomain.de');
359              
360             =back
361              
362             =cut
363              
364             sub offers_domain {
365              
366 0     0 1   my ( $self, $domain ) = @_;
367              
368 0 0         return unless $self->_is_valid;
369              
370 0           my $api = $self->{_api_wrapper};
371 0           my $cart_id = $self->id;
372              
373 0           my $response = $api->rawCall( method => 'get', path => sprintf( "/order/cart/%s/domain?domain=%s", $cart_id, $domain ), noSignature => 0 );
374 0 0         croak $response->error if $response->error;
375              
376 0           return $response->content;
377             }
378              
379             =head2 add_domain
380              
381             Adds a domain request to a cart.
382              
383             =over
384              
385             =item * Parameter: $domain - domain name, %params - key => value duration offer_id quantity
386              
387             =item * Return: L<Webservice::OVH::Order::Cart::Item>
388              
389             =item * Synopsis: my $item = $cart->add_domain('mydomain.de');
390              
391             =back
392              
393             =cut
394              
395             sub add_domain {
396              
397 0     0 1   my ( $self, $domain, %params ) = @_;
398              
399 0 0         return unless $self->_is_valid;
400              
401 0           my $api = $self->{_api_wrapper};
402 0           my $cart_id = $self->id;
403              
404 0 0         croak "Missing domain parameter" unless $domain;
405              
406 0           my $body = {};
407 0 0         $body->{duration} = $params{duration} if exists $params{duration};
408 0 0         $body->{offerId} = $params{offer_id} if exists $params{offer_id};
409 0 0         $body->{quantity} = $params{quantity} if exists $params{quantity};
410 0           $body->{domain} = $domain;
411              
412 0           my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/domain", body => $body, noSignature => 0 );
413 0 0         croak $response->error if $response->error;
414              
415 0           my $item_id = $response->content->{itemId};
416 0           my $item = Webservice::OVH::Order::Cart::Item->_new( wrapper => $api, cart => $self, id => $item_id, module => $self->{_module} );
417              
418 0           my $owner = $params{owner_contact};
419 0           my $admin = $params{admin_account};
420 0           my $tech = $params{tech_account};
421              
422 0 0         if ($owner) {
423 0           my $config_preset_owner = { label => "OWNER_CONTACT", value => $owner };
424 0           my $response_product_set_config_owner = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_owner, noSignature => 0 );
425 0 0         my $config2 = $response_product_set_config_owner->content unless $response_product_set_config_owner->error;
426 0 0         croak $response_product_set_config_owner->error if $response_product_set_config_owner->error;
427             }
428              
429 0 0         if ($admin) {
430              
431 0           my $config_preset_admin = { label => "ADMIN_ACCOUNT", value => $admin };
432 0           my $response_product_set_config_admin = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_admin, noSignature => 0 );
433 0 0         my $config3 = $response_product_set_config_admin->content unless $response_product_set_config_admin->error;
434 0 0         croak $response_product_set_config_admin->error if $response_product_set_config_admin->error;
435             }
436              
437 0 0         if ($tech) {
438              
439 0           my $config_preset_tech = { label => "TECH_ACCOUNT", value => $tech };
440 0           my $response_product_set_config_tech = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_tech, noSignature => 0 );
441 0 0         my $config4 = $response_product_set_config_tech->content unless $response_product_set_config_tech->error;
442 0 0         croak $response_product_set_config_tech->error if $response_product_set_config_tech->error;
443             }
444              
445 0           return $item;
446             }
447              
448             =head2 offer_dns
449              
450             Returns an Hash with information for dns Zone pricing
451             A Domain must be added before requestion info
452              
453             =over
454              
455             =item * Parameter: $dns - domain name
456              
457             =item * Return: L<HASHREF>
458              
459             =item * Synopsis: my $offer = $cart->offers_dns;
460              
461             =back
462              
463             =cut
464              
465             sub offer_dns {
466              
467 0     0 1   my ( $self, $domain ) = @_;
468              
469 0 0         return unless $self->_is_valid;
470              
471 0           my $api = $self->{_api_wrapper};
472 0           my $cart_id = $self->id;
473              
474 0           my $response = $api->rawCall( method => 'get', path => sprintf( "/order/cart/%s/dns?domain=%s", $cart_id, $domain ), noSignature => 0 );
475 0 0         croak $response->error if $response->error;
476              
477 0           return $response->content;
478             }
479              
480             =head2 add_dns
481              
482             Adds a dns Zone to a cart.
483              
484             =over
485              
486             =item * Return: L<Webservice::OVH::Order::Cart::Item>
487              
488             =item * Synopsis: my $item = $cart->add_dns;
489              
490             =back
491              
492             =cut
493              
494             sub add_dns {
495              
496 0     0 1   my ( $self, $domain, %params ) = @_;
497              
498 0 0         return unless $self->_is_valid;
499              
500 0           my $api = $self->{_api_wrapper};
501 0           my $cart_id = $self->id;
502              
503 0           my $body = {};
504 0 0         $body->{duration} = $params{duration} if exists $params{duration};
505 0 0         $body->{planCode} = $params{plan_code} if exists $params{plan_code};
506 0 0         $body->{pricingMode} = $params{pricing_mode} if exists $params{pricing_mode};
507 0 0         $body->{quantity} = $params{quantity} if exists $params{quantity};
508 0           $body->{domain} = $domain;
509              
510 0           my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/dns", body => $body, noSignature => 0 );
511 0 0         croak $response->error if $response->error;
512              
513 0           my $item_id = $response->content->{itemId};
514 0           my $item = Webservice::OVH::Order::Cart::Item->_new( wrapper => $api, cart => $self, id => $item_id, module => $self->{_module} );
515              
516 0           return $item;
517             }
518              
519              
520             =head2 offers_domain_transfer
521              
522             Returns an Array of hashes with offers.
523              
524             =over
525              
526             =item * Parameter: $domain - domain name
527              
528             =item * Return: L<ARRAY>
529              
530             =item * Synopsis: my $offers = $cart->offers_domain_transfer('mydomain.de');
531              
532             =back
533              
534             =cut
535              
536             sub offers_domain_transfer {
537              
538 0     0 1   my ( $self, $domain ) = @_;
539              
540 0 0         return unless $self->_is_valid;
541              
542 0           my $api = $self->{_api_wrapper};
543 0           my $cart_id = $self->id;
544              
545 0           my $response = $api->rawCall( method => 'get', path => sprintf( "/order/cart/%s/domainTransfer?domain=%s", $cart_id, $domain ), noSignature => 0 );
546 0 0         croak $response->error if $response->error;
547              
548 0           return $response->content;
549             }
550              
551             =head2 offers_domain
552              
553             Adds a domain transfer request to a cart.
554              
555             =over
556              
557             =item * Parameter: $domain - domain name, %params - key => value duration offer_id quantity
558              
559             =item * Return: L<Webservice::OVH::Order::Cart::Item>
560              
561             =item * Synopsis: my $item = $cart->add_transfer('mydomain.de');
562              
563             =back
564              
565             =cut
566              
567             sub add_transfer {
568              
569 0     0 1   my ( $self, $domain, %params ) = @_;
570              
571 0 0         return unless $self->_is_valid;
572              
573 0           my $api = $self->{_api_wrapper};
574 0           my $cart_id = $self->id;
575              
576 0 0         croak "Missing domain parameter" unless $domain;
577 0 0         croak "Missing auth_info" unless exists $params{auth_info};
578              
579 0           my $body = {};
580 0 0         $body->{duration} = $params{duration} if exists $params{duration};
581 0 0         $body->{offerId} = $params{offer_id} if exists $params{offer_id};
582 0 0         $body->{quantity} = $params{quantity} if exists $params{quantity};
583 0           $body->{domain} = $domain;
584              
585 0           my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/domainTransfer", body => $body, noSignature => 0 );
586 0 0         croak $response->error if $response->error;
587              
588 0           my $item_id = $response->content->{itemId};
589 0           my $item = Webservice::OVH::Order::Cart::Item->_new( wrapper => $api, cart => $self, id => $item_id, module => $self->{_module} );
590              
591 0 0         return unless $item;
592              
593 0           my $auth_info = $params{auth_info};
594 0           my $owner = $params{owner_contact};
595 0           my $admin = $params{admin_account};
596 0           my $tech = $params{tech_account};
597              
598 0           my $config_preset = { label => "AUTH_INFO", value => $auth_info };
599 0           my $response_product_set_config = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset, noSignature => 0 );
600 0 0         my $config1 = $response_product_set_config->content unless $response_product_set_config->error;
601 0 0         croak $response_product_set_config->error if $response_product_set_config->error;
602              
603 0 0         if ($owner) {
604 0           my $config_preset_owner = { label => "OWNER_CONTACT", value => $owner };
605 0           my $response_product_set_config_owner = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_owner, noSignature => 0 );
606 0 0         my $config2 = $response_product_set_config_owner->content unless $response_product_set_config_owner->error;
607 0 0         croak $response_product_set_config_owner->error if $response_product_set_config_owner->error;
608             }
609              
610 0 0         if ($admin) {
611 0           my $config_preset_admin = { label => "ADMIN_ACCOUNT", value => $admin };
612 0           my $response_product_set_config_admin = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_admin, noSignature => 0 );
613 0 0         my $config3 = $response_product_set_config_admin->content unless $response_product_set_config_admin->error;
614 0 0         croak $response_product_set_config_admin->error if $response_product_set_config_admin->error;
615             }
616              
617 0 0         if ($tech) {
618 0           my $config_preset_tech = { label => "TECH_ACCOUNT", value => $tech };
619 0           my $response_product_set_config_tech = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $config_preset_tech, noSignature => 0 );
620 0 0         my $config4 = $response_product_set_config_tech->content unless $response_product_set_config_tech->error;
621 0 0         croak $response_product_set_config_tech->error if $response_product_set_config_tech->error;
622             }
623              
624 0           return $item;
625             }
626              
627             =head2 info_checkout
628              
629             Returns checkout without generating an order.
630              
631             =over
632              
633             =item * Return: HASH
634              
635             =item * Synopsis: my $checkout = $cart->info_checkout;
636              
637             =back
638              
639             =cut
640              
641             sub info_checkout {
642              
643 0     0 1   my ($self) = @_;
644              
645 0 0         return unless $self->_is_valid;
646              
647 0           my $api = $self->{_api_wrapper};
648 0           my $cart_id = $self->id;
649              
650 0           my $response = $api->rawCall( method => 'get', path => "/order/cart/$cart_id/checkout", noSignature => 0 );
651 0 0         croak $response->error if $response->error;
652              
653 0           return $response->content;
654             }
655              
656             =head2 checkout
657              
658             Generates an order. Makes the cart invalid. Returns the order.
659              
660             =over
661              
662             =item * Return: L<Webservice::OVH::Me::Order>
663              
664             =item * Synopsis: my $order = $cart->checkout;
665              
666             =back
667              
668             =cut
669              
670             sub checkout {
671              
672 0     0 1   my ($self) = @_;
673              
674 0 0         return unless $self->_is_valid;
675              
676 0           my $api = $self->{_api_wrapper};
677 0           my $cart_id = $self->id;
678              
679 0           my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/checkout", body => {}, noSignature => 0 );
680 0 0         croak $response->error if $response->error;
681              
682 0           my $order_id = $response->content->{orderId};
683 0           my $order = Webservice::OVH::Me::Order->_new( wrapper => $api, id => $order_id, module => $self->{_module} );
684              
685 0           return $order;
686             }
687              
688             =head2 items
689              
690             Produces an Array of Item Objects.
691              
692             =over
693              
694             =item * Return: L<ARRAY>
695              
696             =item * Synopsis: my $items = $cart->items;
697              
698             =back
699              
700             =cut
701              
702             sub items {
703              
704 0     0 1   my ($self) = @_;
705              
706 0 0         return unless $self->_is_valid;
707              
708 0           my $api = $self->{_api_wrapper};
709 0           my $cart_id = $self->id;
710 0           my $response = $api->rawCall( method => 'get', path => "/order/cart/$cart_id/item", noSignature => 0 );
711 0 0         croak $response->error if $response->error;
712              
713 0           my $item_ids = $response->content;
714 0           my $items = [];
715              
716 0           foreach my $item_id (@$item_ids) {
717              
718 0   0       my $item = $self->{_items}{$item_id} = $self->{_items}{$item_id} || Webservice::OVH::Order::Cart::Item->_new( wrapper => $api, cart => $self, id => $item_id, module => $self->{_module} );
719 0           push @$items, $item;
720             }
721              
722 0           return $items;
723             }
724              
725             =head2 item
726              
727             Returns a single item by id
728              
729             =over
730              
731             =item * Parameter: $item_id - api id
732              
733             =item * Return: L<Webservice::OVH::Order::Cart::Item>
734              
735             =item * Synopsis: my $item = $ovh->order->cart->item(123456);
736              
737             =back
738              
739             =cut
740              
741             sub item {
742              
743 0     0 1   my ( $self, $item_id ) = @_;
744              
745 0 0         return unless $self->_is_valid;
746              
747 0           my $api = $self->{_api_wrapper};
748 0   0       my $item = $self->{_items}{$item_id} = $self->{_items}{$item_id} || Webservice::OVH::Order::Cart::Item->_new( wrapper => $api, cart => $self, id => $item_id, module => $self->{_module} );
749 0           return $item;
750             }
751              
752             =head2 item
753              
754             Deletes all items from the cart.
755              
756             =over
757              
758             =item * Synopsis: $cart->clear;
759              
760             =back
761              
762             =cut
763              
764             sub clear {
765              
766 0     0 1   my ($self) = @_;
767              
768 0 0         return unless $self->_is_valid;
769              
770 0           my $items = $self->items;
771              
772 0           foreach my $item (@$items) {
773              
774 0           $item->delete;
775             }
776             }
777              
778             =head2 assign
779              
780             Assign a shopping cart to an loggedin client
781              
782             =over
783              
784             =item * Synopsis: $cart->assign;
785              
786             =back
787              
788             =cut
789              
790             sub assign {
791              
792 0     0 1   my ($self) = @_;
793              
794 0 0         return unless $self->_is_valid;
795              
796 0           my $api = $self->{_api_wrapper};
797 0           my $cart_id = $self->id;
798 0           my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/assign", noSignature => 0 );
799 0 0         croak $response->error if $response->error;
800             }
801              
802              
803              
804              
805              
806              
807             1;
808