SOAP/OrderWS.pm

filter: Statementstmt 53.0% 43 / 81 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 39.4% 45 / 114 CC 16 SCAR 45.0
CC
16
Cov
41%
soapify
132.0
orderLines
42.0
BEGIN
1.0
CRAP 89.8
↑ Summary SOAP/ItemDTOEx.pm »
1 package jBilling::Client::SOAP::OrderWS;
2 1 ▶ use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 our $VERSION = 0.05;
4 1 ▶ use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 1 extends 'jBilling::Client::SOAP::Object';
7
8 1 has 'activeSince', is => 'rw', isa => 'Str';
9 1 has 'activeUntil', is => 'rw', isa => 'Str';
10 1 has 'anticipatePeriods', is => 'rw', isa => 'Str';
11 1 has 'billingTypeId', is => 'rw', isa => 'Int';
12 1 has 'billingTypeStr', is => 'rw', isa => 'Str';
13 1 has 'createDate', is => 'rw', isa => 'Str';
14 1 has 'createdBy', is => 'rw', isa => 'Int';
15 1 has 'currencyId', is => 'rw', isa => 'Int';
16 1 has 'deleted', is => 'rw', isa => 'Bool';
17 1 has 'dtFM', is => 'rw', isa => 'Int';
18 1 has 'dueDateUnitId', is => 'rw', isa => 'Int';
19 1 has 'dueDateValue', is => 'rw', isa => 'Str';
20 1 has 'generatedInvoices', is => 'rw', isa => 'Str';
21 1 has 'id', is => 'rw', isa => 'Int';
22 1 has 'lastNotified', is => 'rw', isa => 'Str';
23 1 has 'nextBillableDay', is => 'rw', isa => 'Str';
24 1 has 'notes', is => 'rw', isa => 'Str';
25 1 has 'notesInInvoice', is => 'rw', isa => 'Str';
26 1 has 'notificationStep', is => 'rw', isa => 'Str';
27 1 has 'notify', is => 'rw', isa => 'Str';
28 1 has 'orderLines', is => 'bare', isa => 'arrayRef';
29 1 has 'ownInvoice', is => 'rw', isa => 'Int';
30 1 has 'period', is => 'rw', isa => 'Int';
31 1 has 'periodStr', is => 'rw', isa => 'Str';
32 1 has 'pricingFields', is => 'rw', isa => 'Str';
33 1 has 'statusId', is => 'rw', isa => 'Int';
34 1 has 'statusStr', is => 'rw', isa => 'Str';
35 1 has 'timeUnitStr', is => 'rw', isa => 'Str';
36 1 has 'total', is => 'rw', isa => 'Str';
37 1 has 'userId', is => 'rw', isa => 'Int';
38 1 has 'metaFields', is => 'bare', isa => 'arrayRef';
39 1 has 'versionNum', is => 'rw', isa => 'Int';
40 1 has 'isCurrent', is => 'rw', isa => 'Str';
41 1 has 'cycleStarts', is => 'rw', isa => 'Str';
42 1 has 'jbilling', is => 'rw', isa => 'jBilling::Client::SOAP';
43
44 0 ▶ sub orderLines {
Subroutine orderLines: not called CC=6 SCAR=37.4
Pod undocumented
45 0 my $self = shift;
46 0 my @lines;
47 0 my $item = shift;
48 0 ▶ if ( ref($item) eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $item eq 'HASH') { } 0 0 0
elsif (ref $item eq 'ARRAY') { } 0 0 0
49
50 #code
51 0 my %hash = %{$item};
52 0 my $line = jBilling::Client::SOAP::OrderLineWS->new();
53 0 $line->load($item);
54 0 push @lines, $line;
55 0 $self->{orderLines} = \@lines;
56 }
57 elsif ( ref($item) eq 'ARRAY' ) {
58 0 foreach my $v ( @{$item} ) {
59 0 ▶ if (ref($v) eq 'jBilling::Client::SOAP::OrderLineWS'){
Branch: 2 branches
BranchTrueFalseTotal
if (ref $v eq 'jBilling::Client::SOAP::OrderLineWS') { } 0 0 0
elsif (ref $v eq 'HASH') { } 0 0 0
60 # This is an object created by our Client
61 0 push @lines, $v;
62 } elsif (ref($v) eq 'HASH') {
63 #This is coming back from getOrder
64 0 my %hash = %{$v};
65 0 my $line = jBilling::Client::SOAP::OrderLineWS->new();
66 0 $line->load(\%hash);
67 0 push @lines, $line;
68 }
69
70 }
71 0 $self->{orderLines} = \@lines;
72 }
73 else {
74 0 return $self->{orderLines};
75 }
76
77 }
78
79 0 ▶ sub soapify {
Subroutine soapify: not called CC=11 SCAR=48.8
Pod undocumented
80 0 my $self = shift;
81 0 my @soap; # This Array will store our SOAP::Data Object
82 my @ols; # Stores array of OrderLines
83 0 my @mfs; # Stores array of Metafields
84
85 # Collect our class metadata
86 0 foreach my $method ($self->getClassMethods){
87 0 ▶ push @soap, SOAP::Data->new(name => $method, value => $self->$method)
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->$method and $method ne "orderLines" and $method ne "metaFields" 0 0 0
Condition0%0/6
defined $self->$method and $method ne "orderLines" and $method ne "metaFields"
!ll&&!rl&&r
000
defined $self->$method and $method ne "orderLines"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->$method and $method ne "orderLines" and $method ne "metaFields"
defined $self->$method $method ne "orderLines" $method ne "metaFields"
Truth table0%0/4
A and B and C
A= defined $self->$methodB= $method ne "orderLines"C= $method ne "metaFields"
ABCresult
0XX0
10X0
1100
1111
88 if (defined $self->$method
89 and $method ne 'orderLines'
90 and $method ne 'metaFields'
91 );
92 }
93
94 # Populate any OrderLines contained in the object.
95 0 ▶ if (defined $self->orderLines ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->orderLines) 0 0 0
96 0 foreach my $ol (@{$self->orderLines}){
97 0 push @ols, SOAP::Data->name("orderLines" => $ol->soapify)->type("orderLines");
98 }
99 }
100
101
102 # Populate any MetaFields contained in the object.
103 0 ▶ if (defined $self->metaFields) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->metaFields) 0 0 0
104 0 foreach my $mf (@{$self->metaFields}){
105 0 push @mfs, $mf->soapify;
106 }
107 }
108
109 0 ▶ push @soap, @ols if @ols;
Branch: 1 branch
BranchTrueFalseTotal
if @ols 0 0 0
110
111 0 ▶ push @soap, @mfs if @mfs; # Push MetaFields if they are present
Branch: 1 branch
BranchTrueFalseTotal
if @mfs 0 0 0
112 0 my $soapreq = SOAP::Data->name("arg0" => \@soap); # This combines our SOAP::Data array into the arg0 Parameter expected by jbilling's API
113 0 return $soapreq
114
115 }
116
117 1 1;
↑ Summary SOAP/ItemDTOEx.pm »