| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Webservice::OVH::Me::Order; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =encoding utf-8 | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | Webservice::OVH::Me::Order | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | use Webservice::OVH; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | my $ovh = Webservice::OVH->new_from_json("credentials.json"); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | my $order = $ovh->me->order(1234); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | my $order->pay_with_registered_payment_mean('fiedelityAccount') | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | Module provides possibility to access specified orders and payment options. | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 METHODS | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =cut | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 36 |  |  | 36 |  | 273 | use strict; | 
|  | 36 |  |  |  |  | 76 |  | 
|  | 36 |  |  |  |  | 1054 |  | 
| 28 | 36 |  |  | 36 |  | 198 | use warnings; | 
|  | 36 |  |  |  |  | 98 |  | 
|  | 36 |  |  |  |  | 971 |  | 
| 29 | 36 |  |  | 36 |  | 223 | use Carp qw{ carp croak }; | 
|  | 36 |  |  |  |  | 891 |  | 
|  | 36 |  |  |  |  | 3117 |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | our $VERSION = 0.48; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 36 |  |  | 36 |  | 16455 | use Webservice::OVH::Me::Order::Detail; | 
|  | 36 |  |  |  |  | 111 |  | 
|  | 36 |  |  |  |  | 55231 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head2 _new | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | Internal Method to create the Order object. | 
| 38 |  |  |  |  |  |  | This method is not ment to be called directly. | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =over | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $order_id - api id | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Me::Order> | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =item * Synopsis: Webservice::OVH::Me::Order->_new($ovh_api_wrapper, $order_id, $module); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =back | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =cut | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub _new { | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 |  |  | 0 |  |  | my ( $class, %params ) = @_; | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 | 0 |  |  |  |  | die "Missing module"    unless $params{module}; | 
| 57 | 0 | 0 |  |  |  |  | die "Missing wrapper"   unless $params{wrapper}; | 
| 58 | 0 | 0 |  |  |  |  | die "Missing id"        unless $params{id}; | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 |  |  |  |  |  | my $module      = $params{module}; | 
| 61 | 0 |  |  |  |  |  | my $api_wrapper = $params{wrapper}; | 
| 62 | 0 |  |  |  |  |  | my $order_id     = $params{id}; | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 |  |  |  |  |  | my $response = $api_wrapper->rawCall( method => 'get', path => "/me/order/$order_id", noSignature => 0 ); | 
| 65 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 66 |  |  |  |  |  |  |  | 
| 67 | 0 |  |  |  |  |  | my $porperties = $response->content; | 
| 68 |  |  |  |  |  |  |  | 
| 69 | 0 |  |  |  |  |  | my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _id => $order_id, _properties => $porperties, _details => {} }, $class; | 
| 70 |  |  |  |  |  |  |  | 
| 71 | 0 |  |  |  |  |  | return $self; | 
| 72 |  |  |  |  |  |  | } | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =head2 id | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | Returns the api id. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =over | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =item * Return: VALUE | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =item * Synopsis: my $id = $order->id; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =back | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =cut | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | sub id { | 
| 89 |  |  |  |  |  |  |  | 
| 90 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 0 |  |  |  |  |  | return $self->{_id}; | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =head2 properties | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Retrieves properties. | 
| 98 |  |  |  |  |  |  | This method updates the intern property variable. | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =over | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | =item * Return: HASH | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =item * Synopsis: my $properties = $order->properties; | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =back | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =cut | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | sub properties { | 
| 111 |  |  |  |  |  |  |  | 
| 112 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 113 |  |  |  |  |  |  |  | 
| 114 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 115 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 116 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id", noSignature => 0 ); | 
| 117 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 118 |  |  |  |  |  |  |  | 
| 119 | 0 |  |  |  |  |  | $self->{_properties} = $response->content; | 
| 120 | 0 |  |  |  |  |  | return $self->{_properties}; | 
| 121 |  |  |  |  |  |  | } | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =head2 date | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | Exposed property value. | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =over | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =item * Return: DateTime | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =item * Synopsis: my $date = $order->is_blocked; | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =back | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =cut | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | sub date { | 
| 138 |  |  |  |  |  |  |  | 
| 139 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 140 |  |  |  |  |  |  |  | 
| 141 | 0 |  |  |  |  |  | my $str_datetime = $self->{_properties}->{date}; | 
| 142 | 0 |  |  |  |  |  | my $datetime     = Webservice::OVH::Helper->parse_datetime($str_datetime); | 
| 143 | 0 |  |  |  |  |  | return $datetime; | 
| 144 |  |  |  |  |  |  | } | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =head2 expiration_date | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | Exposed property value. | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =over | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =item * Return: DateTime | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =item * Synopsis: my $expiration_date = $order->expiration_date; | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | =back | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =cut | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | sub expiration_date { | 
| 161 |  |  |  |  |  |  |  | 
| 162 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 163 |  |  |  |  |  |  |  | 
| 164 | 0 |  |  |  |  |  | my $str_datetime = $self->{_properties}->{expirationDate}; | 
| 165 | 0 |  |  |  |  |  | my $datetime     = Webservice::OVH::Helper->parse_datetime($str_datetime); | 
| 166 | 0 |  |  |  |  |  | return $datetime; | 
| 167 |  |  |  |  |  |  | } | 
| 168 |  |  |  |  |  |  |  | 
| 169 |  |  |  |  |  |  | =head2 password | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | Exposed property value. | 
| 172 |  |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  | =over | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | =item * Return: VALUE | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | =item * Synopsis: my $password = $order->password; | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | =back | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | =cut | 
| 182 |  |  |  |  |  |  |  | 
| 183 |  |  |  |  |  |  | sub password { | 
| 184 |  |  |  |  |  |  |  | 
| 185 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 186 |  |  |  |  |  |  |  | 
| 187 | 0 |  |  |  |  |  | return $self->{_properties}->{password}; | 
| 188 |  |  |  |  |  |  | } | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | =head2 pdf_url | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | Exposed property value. | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | =over | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | =item * Return: VALUE | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | =item * Synopsis: my $pdf_url = $order->pdf_url; | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | =back | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =cut | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | sub pdf_url { | 
| 205 |  |  |  |  |  |  |  | 
| 206 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 207 |  |  |  |  |  |  |  | 
| 208 | 0 |  |  |  |  |  | return $self->{_properties}->{pdfUrl}; | 
| 209 |  |  |  |  |  |  | } | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | =head2 price_without_tax | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | Exposed property value. | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | =over | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | =item * Return: VALUE | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | =item * Synopsis: my $price_without_tax = $order->price_without_tax; | 
| 220 |  |  |  |  |  |  |  | 
| 221 |  |  |  |  |  |  | =back | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | =cut | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  | sub price_without_tax { | 
| 226 |  |  |  |  |  |  |  | 
| 227 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 228 |  |  |  |  |  |  |  | 
| 229 | 0 |  |  |  |  |  | return $self->{_properties}->{priceWithoutTax}; | 
| 230 |  |  |  |  |  |  | } | 
| 231 |  |  |  |  |  |  |  | 
| 232 |  |  |  |  |  |  | =head2 price_with_tax | 
| 233 |  |  |  |  |  |  |  | 
| 234 |  |  |  |  |  |  | Exposed property value. | 
| 235 |  |  |  |  |  |  |  | 
| 236 |  |  |  |  |  |  | =over | 
| 237 |  |  |  |  |  |  |  | 
| 238 |  |  |  |  |  |  | =item * Return: VALUE | 
| 239 |  |  |  |  |  |  |  | 
| 240 |  |  |  |  |  |  | =item * Synopsis: my $price_with_tax = $order->price_with_tax; | 
| 241 |  |  |  |  |  |  |  | 
| 242 |  |  |  |  |  |  | =back | 
| 243 |  |  |  |  |  |  |  | 
| 244 |  |  |  |  |  |  | =cut | 
| 245 |  |  |  |  |  |  |  | 
| 246 |  |  |  |  |  |  | sub price_with_tax { | 
| 247 |  |  |  |  |  |  |  | 
| 248 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 249 |  |  |  |  |  |  |  | 
| 250 | 0 |  |  |  |  |  | return $self->{_properties}->{priceWithTax}; | 
| 251 |  |  |  |  |  |  | } | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | =head2 tax | 
| 254 |  |  |  |  |  |  |  | 
| 255 |  |  |  |  |  |  | Exposed property value. | 
| 256 |  |  |  |  |  |  |  | 
| 257 |  |  |  |  |  |  | =over | 
| 258 |  |  |  |  |  |  |  | 
| 259 |  |  |  |  |  |  | =item * Return: VALUE | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | =item * Synopsis: my $tax = $order->tax; | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | =back | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  | =cut | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | sub tax { | 
| 268 |  |  |  |  |  |  |  | 
| 269 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 270 |  |  |  |  |  |  |  | 
| 271 | 0 |  |  |  |  |  | return $self->{_properties}->{tax}; | 
| 272 |  |  |  |  |  |  | } | 
| 273 |  |  |  |  |  |  |  | 
| 274 |  |  |  |  |  |  | =head2 url | 
| 275 |  |  |  |  |  |  |  | 
| 276 |  |  |  |  |  |  | Exposed property value. | 
| 277 |  |  |  |  |  |  |  | 
| 278 |  |  |  |  |  |  | =over | 
| 279 |  |  |  |  |  |  |  | 
| 280 |  |  |  |  |  |  | =item * Return: VALUE | 
| 281 |  |  |  |  |  |  |  | 
| 282 |  |  |  |  |  |  | =item * Synopsis: my $url = $order->url; | 
| 283 |  |  |  |  |  |  |  | 
| 284 |  |  |  |  |  |  | =back | 
| 285 |  |  |  |  |  |  |  | 
| 286 |  |  |  |  |  |  | =cut | 
| 287 |  |  |  |  |  |  |  | 
| 288 |  |  |  |  |  |  | sub url { | 
| 289 |  |  |  |  |  |  |  | 
| 290 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 291 |  |  |  |  |  |  |  | 
| 292 | 0 |  |  |  |  |  | return $self->{_properties}->{url}; | 
| 293 |  |  |  |  |  |  | } | 
| 294 |  |  |  |  |  |  |  | 
| 295 |  |  |  |  |  |  | =head2 associated_object | 
| 296 |  |  |  |  |  |  |  | 
| 297 |  |  |  |  |  |  | Exposed property value. | 
| 298 |  |  |  |  |  |  |  | 
| 299 |  |  |  |  |  |  | =over | 
| 300 |  |  |  |  |  |  |  | 
| 301 |  |  |  |  |  |  | =item * Return: HASH | 
| 302 |  |  |  |  |  |  |  | 
| 303 |  |  |  |  |  |  | =item * Synopsis: my $associated_object = $order->associated_object; | 
| 304 |  |  |  |  |  |  |  | 
| 305 |  |  |  |  |  |  | =back | 
| 306 |  |  |  |  |  |  |  | 
| 307 |  |  |  |  |  |  | =cut | 
| 308 |  |  |  |  |  |  |  | 
| 309 |  |  |  |  |  |  | sub associated_object { | 
| 310 |  |  |  |  |  |  |  | 
| 311 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 312 |  |  |  |  |  |  |  | 
| 313 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 314 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 315 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/associatedObject", noSignature => 0 ); | 
| 316 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 317 |  |  |  |  |  |  |  | 
| 318 | 0 |  |  |  |  |  | return $response->content; | 
| 319 |  |  |  |  |  |  | } | 
| 320 |  |  |  |  |  |  |  | 
| 321 |  |  |  |  |  |  | =head2 available_registered_payment_mean | 
| 322 |  |  |  |  |  |  |  | 
| 323 |  |  |  |  |  |  | Returns an Array of available payment means. | 
| 324 |  |  |  |  |  |  |  | 
| 325 |  |  |  |  |  |  | =over | 
| 326 |  |  |  |  |  |  |  | 
| 327 |  |  |  |  |  |  | =item * Return: L<ARRAY> | 
| 328 |  |  |  |  |  |  |  | 
| 329 |  |  |  |  |  |  | =item * Synopsis: my $available_registered_payment_mean = $order->available_registered_payment_mean; | 
| 330 |  |  |  |  |  |  |  | 
| 331 |  |  |  |  |  |  | =back | 
| 332 |  |  |  |  |  |  |  | 
| 333 |  |  |  |  |  |  | =cut | 
| 334 |  |  |  |  |  |  |  | 
| 335 |  |  |  |  |  |  | sub available_registered_payment_mean { | 
| 336 |  |  |  |  |  |  |  | 
| 337 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 338 |  |  |  |  |  |  |  | 
| 339 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 340 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 341 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/availableRegisteredPaymentMean", noSignature => 0 ); | 
| 342 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 343 |  |  |  |  |  |  |  | 
| 344 | 0 |  |  |  |  |  | return $response->content; | 
| 345 |  |  |  |  |  |  | } | 
| 346 |  |  |  |  |  |  |  | 
| 347 |  |  |  |  |  |  | =head2 bill | 
| 348 |  |  |  |  |  |  |  | 
| 349 |  |  |  |  |  |  | Returns associated bill. | 
| 350 |  |  |  |  |  |  |  | 
| 351 |  |  |  |  |  |  | =over | 
| 352 |  |  |  |  |  |  |  | 
| 353 |  |  |  |  |  |  | =item * Return: L<Webservice::Me::Bill> | 
| 354 |  |  |  |  |  |  |  | 
| 355 |  |  |  |  |  |  | =item * Synopsis: my $bill = $order->bill; | 
| 356 |  |  |  |  |  |  |  | 
| 357 |  |  |  |  |  |  | =back | 
| 358 |  |  |  |  |  |  |  | 
| 359 |  |  |  |  |  |  | =cut | 
| 360 |  |  |  |  |  |  |  | 
| 361 |  |  |  |  |  |  | sub bill { | 
| 362 |  |  |  |  |  |  |  | 
| 363 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 364 |  |  |  |  |  |  |  | 
| 365 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 366 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 367 | 0 |  |  |  |  |  | my $module   = $self->{_module}; | 
| 368 |  |  |  |  |  |  |  | 
| 369 |  |  |  |  |  |  | #my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/bill", noSignature => 0 ); | 
| 370 |  |  |  |  |  |  | #croak $response->error if $response->error; | 
| 371 |  |  |  |  |  |  |  | 
| 372 | 0 |  |  |  |  |  | my $object = $self->associated_object; | 
| 373 |  |  |  |  |  |  |  | 
| 374 | 0 | 0 |  |  |  |  | if ( $object->{type} eq 'Bill' ) { | 
| 375 |  |  |  |  |  |  |  | 
| 376 | 0 |  |  |  |  |  | my $bill = $module->me->bill( $object->{id} ); | 
| 377 |  |  |  |  |  |  |  | 
| 378 | 0 |  |  |  |  |  | return $bill; | 
| 379 |  |  |  |  |  |  | } else { | 
| 380 |  |  |  |  |  |  |  | 
| 381 | 0 |  |  |  |  |  | return undef; | 
| 382 |  |  |  |  |  |  | } | 
| 383 |  |  |  |  |  |  | } | 
| 384 |  |  |  |  |  |  |  | 
| 385 |  |  |  |  |  |  | =head2 details | 
| 386 |  |  |  |  |  |  |  | 
| 387 |  |  |  |  |  |  | Returns an Array of detail Objects. | 
| 388 |  |  |  |  |  |  |  | 
| 389 |  |  |  |  |  |  | =over | 
| 390 |  |  |  |  |  |  |  | 
| 391 |  |  |  |  |  |  | =item * Return: L<ARRAY> | 
| 392 |  |  |  |  |  |  |  | 
| 393 |  |  |  |  |  |  | =item * Synopsis: my $details = $order->details; | 
| 394 |  |  |  |  |  |  |  | 
| 395 |  |  |  |  |  |  | =back | 
| 396 |  |  |  |  |  |  |  | 
| 397 |  |  |  |  |  |  | =cut | 
| 398 |  |  |  |  |  |  |  | 
| 399 |  |  |  |  |  |  | sub details { | 
| 400 |  |  |  |  |  |  |  | 
| 401 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 402 |  |  |  |  |  |  |  | 
| 403 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 404 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 405 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/details", noSignature => 0 ); | 
| 406 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 407 |  |  |  |  |  |  |  | 
| 408 | 0 |  |  |  |  |  | my $detail_ids = $response->content; | 
| 409 | 0 |  |  |  |  |  | my $details    = []; | 
| 410 |  |  |  |  |  |  |  | 
| 411 | 0 |  |  |  |  |  | foreach my $detail_id (@$detail_ids) { | 
| 412 |  |  |  |  |  |  |  | 
| 413 | 0 |  | 0 |  |  |  | my $detail = $self->{_details}{$detail_id} = $self->{_details}{$detail_id} || Webservice::OVH::Me::Order::Detail->_new( wrapper => $api, order => $self, id => $detail_id, module => $self->{_module} ); | 
| 414 | 0 |  |  |  |  |  | push @$details, $detail; | 
| 415 |  |  |  |  |  |  | } | 
| 416 |  |  |  |  |  |  |  | 
| 417 | 0 |  |  |  |  |  | return $details; | 
| 418 |  |  |  |  |  |  | } | 
| 419 |  |  |  |  |  |  |  | 
| 420 |  |  |  |  |  |  | =head2 details | 
| 421 |  |  |  |  |  |  |  | 
| 422 |  |  |  |  |  |  | Gets a specified detail Object by id. | 
| 423 |  |  |  |  |  |  |  | 
| 424 |  |  |  |  |  |  | =over | 
| 425 |  |  |  |  |  |  |  | 
| 426 |  |  |  |  |  |  | =item * Return: L<Webservice::Me::Order::Detail> | 
| 427 |  |  |  |  |  |  |  | 
| 428 |  |  |  |  |  |  | =item * Synopsis: my $details = $order->details; | 
| 429 |  |  |  |  |  |  |  | 
| 430 |  |  |  |  |  |  | =back | 
| 431 |  |  |  |  |  |  |  | 
| 432 |  |  |  |  |  |  | =cut | 
| 433 |  |  |  |  |  |  |  | 
| 434 |  |  |  |  |  |  | sub detail { | 
| 435 |  |  |  |  |  |  |  | 
| 436 | 0 |  |  | 0 | 0 |  | my ( $self, $detail_id ) = @_; | 
| 437 |  |  |  |  |  |  |  | 
| 438 | 0 |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 439 | 0 |  | 0 |  |  |  | my $detail = $self->{_details}{$detail_id} = $self->{_details}{$detail_id} || Webservice::OVH::Me::Order::Detail->_new( wrapper => $api, order => $self, id => $detail_id, module => $self->{_module} ); | 
| 440 |  |  |  |  |  |  |  | 
| 441 | 0 |  |  |  |  |  | return $detail; | 
| 442 |  |  |  |  |  |  | } | 
| 443 |  |  |  |  |  |  |  | 
| 444 |  |  |  |  |  |  | =head2 payment | 
| 445 |  |  |  |  |  |  |  | 
| 446 |  |  |  |  |  |  | Gets details about payment. | 
| 447 |  |  |  |  |  |  |  | 
| 448 |  |  |  |  |  |  | =over | 
| 449 |  |  |  |  |  |  |  | 
| 450 |  |  |  |  |  |  | =item * Return: VALUE | 
| 451 |  |  |  |  |  |  |  | 
| 452 |  |  |  |  |  |  | =item * Synopsis: my $payment = $order->payment; | 
| 453 |  |  |  |  |  |  |  | 
| 454 |  |  |  |  |  |  | =back | 
| 455 |  |  |  |  |  |  |  | 
| 456 |  |  |  |  |  |  | =cut | 
| 457 |  |  |  |  |  |  |  | 
| 458 |  |  |  |  |  |  | sub payment { | 
| 459 |  |  |  |  |  |  |  | 
| 460 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 461 |  |  |  |  |  |  |  | 
| 462 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 463 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 464 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/payment", noSignature => 0 ); | 
| 465 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 466 |  |  |  |  |  |  |  | 
| 467 | 0 |  |  |  |  |  | return $response->content; | 
| 468 |  |  |  |  |  |  | } | 
| 469 |  |  |  |  |  |  |  | 
| 470 |  |  |  |  |  |  | =head2 payment_means | 
| 471 |  |  |  |  |  |  |  | 
| 472 |  |  |  |  |  |  | Gets details about payment_means. | 
| 473 |  |  |  |  |  |  |  | 
| 474 |  |  |  |  |  |  | =over | 
| 475 |  |  |  |  |  |  |  | 
| 476 |  |  |  |  |  |  | =item * Return: VALUE | 
| 477 |  |  |  |  |  |  |  | 
| 478 |  |  |  |  |  |  | =item * Synopsis: my $payment_means = $order->payment_means; | 
| 479 |  |  |  |  |  |  |  | 
| 480 |  |  |  |  |  |  | =back | 
| 481 |  |  |  |  |  |  |  | 
| 482 |  |  |  |  |  |  | =cut | 
| 483 |  |  |  |  |  |  |  | 
| 484 |  |  |  |  |  |  | sub payment_means { | 
| 485 |  |  |  |  |  |  |  | 
| 486 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 487 |  |  |  |  |  |  |  | 
| 488 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 489 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 490 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/paymentMeans", noSignature => 0 ); | 
| 491 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 492 |  |  |  |  |  |  |  | 
| 493 | 0 |  |  |  |  |  | return $response->content; | 
| 494 |  |  |  |  |  |  | } | 
| 495 |  |  |  |  |  |  |  | 
| 496 |  |  |  |  |  |  | =head2 pay_with_registered_payment_mean | 
| 497 |  |  |  |  |  |  |  | 
| 498 |  |  |  |  |  |  | Pays the order. | 
| 499 |  |  |  |  |  |  |  | 
| 500 |  |  |  |  |  |  | =over | 
| 501 |  |  |  |  |  |  |  | 
| 502 |  |  |  |  |  |  | =item * Parameter: $payment_mean - payment mean | 
| 503 |  |  |  |  |  |  |  | 
| 504 |  |  |  |  |  |  | =item * Synopsis: $order->pay_with_registered_payment_mean; | 
| 505 |  |  |  |  |  |  |  | 
| 506 |  |  |  |  |  |  | =back | 
| 507 |  |  |  |  |  |  |  | 
| 508 |  |  |  |  |  |  | =cut | 
| 509 |  |  |  |  |  |  |  | 
| 510 |  |  |  |  |  |  | sub pay_with_registered_payment_mean { | 
| 511 |  |  |  |  |  |  |  | 
| 512 | 0 |  |  | 0 | 1 |  | my ( $self, $payment_mean ) = @_; | 
| 513 |  |  |  |  |  |  |  | 
| 514 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 515 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 516 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'post', path => "/me/order/$order_id/payWithRegisteredPaymentMean", body => { paymentMean => $payment_mean }, noSignature => 0 ); | 
| 517 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 518 |  |  |  |  |  |  | } | 
| 519 |  |  |  |  |  |  |  | 
| 520 |  |  |  |  |  |  | =head2 status | 
| 521 |  |  |  |  |  |  |  | 
| 522 |  |  |  |  |  |  | Status of the order. | 
| 523 |  |  |  |  |  |  |  | 
| 524 |  |  |  |  |  |  | =over | 
| 525 |  |  |  |  |  |  |  | 
| 526 |  |  |  |  |  |  | =item * Return: VALUE | 
| 527 |  |  |  |  |  |  |  | 
| 528 |  |  |  |  |  |  | =item * Synopsis: my $status = $order->status; | 
| 529 |  |  |  |  |  |  |  | 
| 530 |  |  |  |  |  |  | =back | 
| 531 |  |  |  |  |  |  |  | 
| 532 |  |  |  |  |  |  | =cut | 
| 533 |  |  |  |  |  |  |  | 
| 534 |  |  |  |  |  |  | sub status { | 
| 535 |  |  |  |  |  |  |  | 
| 536 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 537 |  |  |  |  |  |  |  | 
| 538 | 0 |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 539 | 0 |  |  |  |  |  | my $order_id = $self->id; | 
| 540 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/order/$order_id/status", noSignature => 0 ); | 
| 541 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 542 |  |  |  |  |  |  |  | 
| 543 | 0 |  |  |  |  |  | return $response->content; | 
| 544 |  |  |  |  |  |  | } | 
| 545 |  |  |  |  |  |  |  | 
| 546 |  |  |  |  |  |  | 1; |