Shipment/Purolator/WSDLV2/Interfaces/ShippingService/ShippingServiceEndpoint.pm untested

filter: Statementstmt 0.0% 0 / 89 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 129 CC 9 SCAR 23.2
CC
9
Cov
0%
START
30.0
CreateShipment
6.0
VoidShipment
6.0
CRAP 10.2
1 package Shipment::Purolator::WSDLV2::Interfaces::ShippingService::ShippingServiceEndpoint;
2 $Shipment::Purolator::WSDLV2::Interfaces::ShippingService::ShippingServiceEndpoint::VERSION = '3.11';
3 use strict;
4 use warnings;
5 use Class::Std::Fast::Storable;
6 use Scalar::Util qw(blessed);
7 use base qw(SOAP::WSDL::Client::Base);
8  
9  
10 # only load if it hasn't been loaded before
11 require Shipment::Purolator::WSDLV2::Typemaps::ShippingService
12 if
13 not Shipment::Purolator::WSDLV2::Typemaps::ShippingService->can('get_class');
14  
15  
16 sub START {
17  
18 my $proxy_domain = $_[2]->{proxy_domain} || 'devwebservices.purolator.com';
19  
20 $_[0]->set_proxy(
21 'https://' . $proxy_domain . '/EWS/V2/Shipping/ShippingService.asmx')
22 if not $_[2]->{proxy};
23  
24 $_[0]->set_class_resolver(
25 'Shipment::Purolator::WSDLV2::Typemaps::ShippingService')
26 if not $_[2]->{class_resolver};
27  
28 $_[0]->set_prefix($_[2]->{use_prefix}) if exists $_[2]->{use_prefix};
29  
30 my $options = $_[2];
31 ## provide credentials
32 eval { use SOAP::Lite; };
33 if ($@) {
34 warn "SOAP::Lite not installed, using builtin SOAP::WSDL Transport";
35 *SOAP::WSDL::Transport::HTTP::get_basic_credentials =
36 sub { return ($options->{key}, $options->{password}); };
37 }
38 else {
39 *SOAP::Transport::HTTP::Client::get_basic_credentials =
40 sub { return ($options->{key}, $options->{password}); };
41 }
42 }
43  
44 sub CreateShipment {
45 my ($self, $body, $header) = @_;
46 die "CreateShipment must be called as object method (\$self is <$self>)"
47 if not blessed($self);
48 return $self->SUPER::call(
49 { operation => 'CreateShipment',
50 soap_action =>
51 'http://purolator.com/pws/service/v2/CreateShipment',
52 style => 'document',
53 body => {
54  
55  
56 'use' => 'literal',
57 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
58 encodingStyle => '',
59 parts => [
60 qw( Shipment::Purolator::WSDLV2::Elements::CreateShipmentRequest )
61 ],
62 },
63 header => {
64  
65 'use' => 'literal',
66 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
67 encodingStyle => '',
68 parts => [
69 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
70 ],
71  
72 },
73 headerfault => {
74  
75 },
76 response => {
77 header => {
78  
79  
80 'use' => 'literal',
81 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
82 encodingStyle => '',
83 parts => [
84 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
85 ],
86 },
87 body => {
88  
89  
90 'use' => 'literal',
91 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
92 encodingStyle => '',
93 parts => [
94 qw( Shipment::Purolator::WSDLV2::Elements::CreateShipmentResponse )
95 ],
96 },
97 }
98 },
99 $body,
100 $header
101 );
102 }
103  
104  
105 sub VoidShipment {
106 my ($self, $body, $header) = @_;
107 die "VoidShipment must be called as object method (\$self is <$self>)"
108 if not blessed($self);
109 return $self->SUPER::call(
110 { operation => 'VoidShipment',
111 soap_action => 'http://purolator.com/pws/service/v2/VoidShipment',
112 style => 'document',
113 body => {
114  
115  
116 'use' => 'literal',
117 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
118 encodingStyle => '',
119 parts => [
120 qw( Shipment::Purolator::WSDLV2::Elements::VoidShipmentRequest )
121 ],
122 },
123 header => {
124  
125 'use' => 'literal',
126 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
127 encodingStyle => '',
128 parts => [
129 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
130 ],
131  
132 },
133 headerfault => {
134  
135 },
136 response => {
137 header => {
138  
139  
140 'use' => 'literal',
141 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
142 encodingStyle => '',
143 parts => [
144 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
145 ],
146 },
147 body => {
148  
149  
150 'use' => 'literal',
151 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
152 encodingStyle => '',
153 parts => [
154 qw( Shipment::Purolator::WSDLV2::Elements::VoidShipmentResponse )
155 ],
156 },
157 }
158 },
159 $body,
160 $header
161 );
162 }
163  
164  
165 sub ValidateShipment {
166 my ($self, $body, $header) = @_;
167 die "ValidateShipment must be called as object method (\$self is <$self>)"
168 if not blessed($self);
169 return $self->SUPER::call(
170 { operation => 'ValidateShipment',
171 soap_action =>
172 'http://purolator.com/pws/service/v2/ValidateShipment',
173 style => 'document',
174 body => {
175  
176  
177 'use' => 'literal',
178 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
179 encodingStyle => '',
180 parts => [
181 qw( Shipment::Purolator::WSDLV2::Elements::ValidateShipmentRequest )
182 ],
183 },
184 header => {
185  
186 'use' => 'literal',
187 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
188 encodingStyle => '',
189 parts => [
190 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
191 ],
192  
193 },
194 headerfault => {
195  
196 },
197 response => {
198 header => {
199  
200  
201 'use' => 'literal',
202 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
203 encodingStyle => '',
204 parts => [
205 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
206 ],
207 },
208 body => {
209  
210  
211 'use' => 'literal',
212 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
213 encodingStyle => '',
214 parts => [
215 qw( Shipment::Purolator::WSDLV2::Elements::ValidateShipmentResponse )
216 ],
217 },
218 }
219 },
220 $body,
221 $header
222 );
223 }
224  
225  
226 sub Consolidate {
227 my ($self, $body, $header) = @_;
228 die "Consolidate must be called as object method (\$self is <$self>)"
229 if not blessed($self);
230 return $self->SUPER::call(
231 { operation => 'Consolidate',
232 soap_action => 'http://purolator.com/pws/service/v2/Consolidate',
233 style => 'document',
234 body => {
235  
236  
237 'use' => 'literal',
238 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
239 encodingStyle => '',
240 parts => [
241 qw( Shipment::Purolator::WSDLV2::Elements::ConsolidateRequest )
242 ],
243 },
244 header => {
245  
246 'use' => 'literal',
247 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
248 encodingStyle => '',
249 parts => [
250 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
251 ],
252  
253 },
254 headerfault => {
255  
256 },
257 response => {
258 header => {
259  
260  
261 'use' => 'literal',
262 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
263 encodingStyle => '',
264 parts => [
265 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
266 ],
267 },
268 body => {
269  
270  
271 'use' => 'literal',
272 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
273 encodingStyle => '',
274 parts => [
275 qw( Shipment::Purolator::WSDLV2::Elements::ConsolidateResponse )
276 ],
277 },
278 }
279 },
280 $body,
281 $header
282 );
283 }
284  
285  
286 sub _get_name_resolver {
287  
288 my $prefix_1 = {
289 'attribute' => 'Shipment::Purolator::WSDLV2::Attributes',
290 'typemap' => 'Shipment::Purolator::WSDLV2::Typemaps',
291 'interface' => 'Shipment::Purolator::WSDLV2::Interfaces',
292 'type' => 'Shipment::Purolator::WSDLV2::Types',
293 'server' => 'Shipment::Purolator::WSDLV2::Server',
294 'element' => 'Shipment::Purolator::WSDLV2::Elements'
295 };
296  
297  
298 return SOAP::WSDL::Generator::Template::Plugin::XSD->new(
299 { prefix_resolver => SOAP::WSDL::Generator::PrefixResolver->new(
300 { namespace_prefix_map => {
301 'http://www.w3.org/2001/XMLSchema' =>
302 'SOAP::WSDL::XSD::Typelib::Builtin',
303 },
304 namespace_map => {},
305 prefix => $prefix_1,
306 }
307 )
308 }
309 );
310 }
311  
312 1;
313  
314 __END__