- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
  - _new_existing
  - _new_existing
  - properties
  - description
  - expire
  - read_only
  - change
  - is_valid
  - _is_valid
  - delete
  - id
  - offers_domain
  - offers_domain
  - offers_domain_transfer
  - offers_domain
  - info_checkout
  - checkout
  - items
  - item
  - item

# NAME

Webservice::OVH::Order::Cart

# SYNOPSIS

use Webservice::OVH;

my $ovh = Webservice::OVH->new_from_json("credentials.json");

my $cart = $ovh->order->new_cart(ovh_subsidiary => 'DE');

$cart->add_domain('www.domain.com');

$cart->delete;

# DESCRIPTION

Provides methods to manage shopping carts.

# METHODS

## _new_existing

Internal Method to create the Cart object. This method is not ment to be called directly.

- Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $cart_id - api id

- Return: Webservice::OVH::Order::Cart

- Synopsis: Webservice::OVH::Order::Cart->_new($ovh_api_wrapper, $cart_id, $module);

## _new_existing

Internal Method to create the Cart object. This method is not ment to be called directly.

- Parameter: $api_wrapper - ovh api wrapper object, $module - root object - api id

- Return: Webservice::OVH::Order::Cart

- Synopsis: Webservice::OVH::Order::Cart->_new($ovh_api_wrapper, $module, ovhSubsidiary => 'DE', decription => 'Shopping');

## properties

Retrieves properties. This method updates the intern property variable.

- Return: HASH

- Synopsis: my $properties = $cart->properties;

## description

Exposed property value.

- Return: VALUE

- Synopsis: my $description = $cart->description;

## expire

Exposed property value.

- Return: VALUE

- Synopsis: my $expire = $cart->expire;

## read_only

Exposed property value.

- Return: VALUE

- Synopsis: my $read_only = $cart->read_only;

## change

Exposed property value.

- Parameter: %params - key => value description expire

- Synopsis: my $change = $cart->change(description => 'Shopping!');

## is_valid

When this cart is deleted on the api side, this method returns 0.

- Return: VALUE

- Synopsis: print "Valid" if $cart->is_valid;

## _is_valid

Intern method to check validity. Difference is that this method carps an error.

- Return: VALUE

- Synopsis: $cart->_is_valid;

## delete

Deletes the cart api sided and sets this object invalid.

- Synopsis: $cart->delete;

## id

Returns the api id.

- Return: VALUE

- Synopsis: my $id = $cart->id;

## offers_domain

Returns an Array of hashs with offers.

- Parameter: $domain - domain name

- Return: ARRAY

- Synopsis: my $offers = $cart->offers_domain('mydomain.de');

## offers_domain

Adds a domain request to a cart.

- Parameter: $domain - domain name, %params - key => value duration offer_id quantity

- Return: Webservice::OVH::Order::Cart::Item

- Synopsis: my $item = $cart->add_domain('mydomain.de');

## offers_domain_transfer

Returns an Array of hashes with offers.

- Parameter: $domain - domain name

- Return: ARRAY

- Synopsis: my $offers = $cart->offers_domain_transfer('mydomain.de');

## offers_domain

Adds a domain transfer request to a cart.

- Parameter: $domain - domain name, %params - key => value duration offer_id quantity

- Return: Webservice::OVH::Order::Cart::Item

- Synopsis: my $item = $cart->add_transfer('mydomain.de');

## info_checkout

Returns checkout without generating an order.

- Return: HASH

- Synopsis: my $checkout = $cart->info_checkout;

## checkout

Generates an order. Makes the cart invalid. Returns the order.

- Return: Webservice::OVH::Me::Order

- Synopsis: my $order = $cart->checkout;

## items

Produces an Array of Item Objects.

- Return: ARRAY

- Synopsis: my $items = $cart->items;

## item

Returns a single item by id

- Parameter: $item_id - api id

- Return: Webservice::OVH::Order::Cart::Item

- Synopsis: my $item = $ovh->order->cart->item(123456);

## item

Deletes all items from the cart.

- Synopsis: $cart->clear;