| 1 | # Mobile::Messaging::ParlayX.pm version 0.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (c) 2006 Thanos Chatziathanassioy <tchatzi@arx.net>. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | package Mobile::Messaging::ParlayX; | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | local $^W; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | require 'Exporter.pm'; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use vars qw(@ISA @EXPORT @EXPORT_OK); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | @ISA = (Exporter); | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | @EXPORT = qw(); #&new); | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | @EXPORT_OK = qw(@error_str); | |||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | $Mobile::Messaging::ParlayX::VERSION='0.0.3'; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | $Mobile::Messaging::ParlayX::ver=$Mobile::Messaging::ParlayX::VERSION; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict 'vars'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use LWP::UserAgent(); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use HTTP::Request(); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use XML::LibXML(); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | @Mobile::Messaging::ParlayX::Errors = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | Mobile::Messaging::ParlayX - Interface to ParlayX OSA. | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | Version 0.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | use Mobile::Messaging::ParlayX; | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | C<Mobile::Messaging::ParlayX> is an interface to ParlayX web service by Sony Ericsson for SMS and MMS messaging, | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | among other things. | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | This being a Web Service L<SOAP::Lite> would probably be better suited to the task, but I decided to stick | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | with C<LWP::UserAgent>, C<HTTP::Request> and C<XML::LibXML> until things in C<SOAP::Lite> stabilize (it is currently | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | under rewrite as far as I know) and I have more time (not that this will happen anytime soon). | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | Besides, I cannot fully grasp ParlayX just yet, thanks to inadequate documentation and JAVA only code | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | samples for it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | Anyway, you need L<LWP::UserAgent> , L<HTTP::Request> and L<XML::LibXML> for this module to work. | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | Most are in the standard distribution already, but any of them are available at your local CPAN mirror. | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | I tried not to stray too far off the ``native'' JAVA names of method and properties, but chances are some | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | differences exist. | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | =head1 new Mobile::Messaging::ParlayX | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | new Mobile::Messaging::ParlayX | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head2 Parameters/Properties | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =item username | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | C<>=> Your mobile operator should provide you with this, along with | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =item password | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | C<>=> for your authentication against his gateway. | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | =item nonce | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | C<>=> This is also supposed to be part of the authentication process, though I`m not quite sure what it does... | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Note that both password and nonce seem to be some kind of Base64 encoded digests, though I`m not quite sure what they are. | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | If you figure it out, I`ll be happy to include them here. | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | =item host | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | C<>=> Your operators` mobile gateway; the one your SOAP request will end up in. | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | =item senderName | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | C<>=> Technically, the originator of the SMS. Specs say it can be alphanumeric up to 11 chars in length, | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | though your operator may or may not allow you to set it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | =item receiptRequest | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | C<>=> You can ask for a delivery report for each SMS message, though the details of this are unclear to me, | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | since my operator does not (for the time being) support this. ``receiptRequest'' should be a hash reference | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | with ``endpoint'', ``correlator'' and ``interfaceName'' as the keys. | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | In theory, endpoint should be a URI of your own, where the operator will POST a SOAP of the results of the | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | SMS. Correlator is supposed to be a unique ID for this message, and your guess is as good as mine what | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ``interfaceName'' stands for. | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | How this works and how bad, I do not know, since if I put receiptRequest in my SOAP request, my operator | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | will drop the message altogether. | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | You can still try and send me a patch/recommendation though. | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =item ChargingInformation | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | C<>=> This is supposed to carry MT (Mobile Terminated) charging info in it and seems to work better than | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | receiptRequest above, but I cannot confirm this yet. | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | It is also a hash reference with ``description'' (probably will appear on the users` bill as such), | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ``currency'' and ``amount'' (which are fairly self-explanatory, although amount should be decimal ie not a | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | float) and ``code'' (which I haven`t the faintest idea what it does). | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | if you provide at least the first 3, the module will put the relavant item in the SOAP request, though | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | again I cannot guarantee that it`ll work as expected. | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | UPDATE: Either amount and currency or just plain code will work. Code is supposed to contain what TIM | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | refers to as VASID and VASPID, which in itself is enough for an MT message. | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $this = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table0%0/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return $self->initialize(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub initialize { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initialize: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if (@_ != 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $hash=$_[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | foreach (keys %$hash) { | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->{lc $_}=$hash->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | $self->{'die_on_error'} ||= 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"die_on_error"} ||= 0
MC/DC0%0/1
$self->{"die_on_error"} ||= 0
$self->{"die_on_error"}
Truth table0%0/2
A
A= $self->{"die_on_error"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $self->{'DEBUG'} ||= 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"DEBUG"} ||= 0
MC/DC0%0/1
$self->{"DEBUG"} ||= 0
$self->{"DEBUG"}
Truth table0%0/2
A
A= $self->{"DEBUG"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->{'ua'} = new LWP::UserAgent; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{'ua'}->agent("Mobile::Messaging::ParlayX/0.0.3"); | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $self->{'parser'} = XML::LibXML->new(); | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | =head2 Methods | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | =item sendSMS | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | C<>=> Pretty much finished. It would be highly unusable without named arguments, so call it like so: | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | $self->sendSMS( { | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | username => 'Your ParlayX Username', | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | host => 'ParlayX SMS Gateway', | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | nonce => 'No Idea What This Does', | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | senderName => 'Where The SMS will Seem to Come From', | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | message => 'The actual sms message', | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | addresses => 'Recipient(s)', | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | receiptRequest => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | endpoint => 'URI where the reciept will be sent', | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | interfaceName => 'Never used that one and dont quite know what it is', | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | correlator => 'Unique ID of the receiver' | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ChargingInformation => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | description => 'Arbitrary string describing the reason for the MT charge', | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | currency => 'Should be self-explanatory, but my operator does not use it', | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | amount => 'Ditto, because these are inside argument code', | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | code => 'Instead of amount and currency, you have these pre-packaged in code' | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | Obviously username, host, message and addresses are mandatory for anything to work at all, the rest | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | can be filled in according to your requirements. Your operator should give you a pretty good idea | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | what`s neccessary and what is not. | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Returns two scalars, the first indicating success (1) or not (0) while the second will give you the | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | unique id of the message (for future delivery report queries) in case of success. In case of failure | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | it will hopefully contain the error string returned by ParlayX Gateway. | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | The module will happily croak() if LWP::UserAgent cannot establish communication with ParlayX Gateway. | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | Ah, message and addresses can be array references, to send different messages to different recipients | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | or the same message to multiple recipients, or even different messages to the same recipient. Mix | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | those as you see fit. | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub sendSMS { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendSMS: not called CC=28 SCAR=67.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $self->{'DEBUG'} and warn "Entering sendSMS\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my ($username, $password, $nonce, $host, $senderName, $message, $receiptRequest, $ChargingInformation, $addresses); | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $username = $_[0]->{'username'} || $self->{'username'} || Carp::croak("Cant sendSMS without username\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant sendSMS without username\n")
$_[0]{"username"} or $self->{"username"}
MC/DC0%0/2
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant sendSMS without username\n")
$_[0]{"username"}
$self->{"username"}
Truth table0%0/3
A or B
A= $_[0]{"username"}B= $self->{"username"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $host = $_[0]->{'host'} || $self->{'host'} || Carp::croak("Cant sendSMS without ParlayX host definition\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant sendSMS without ParlayX host definition\n")
$_[0]{"host"} or $self->{"host"}
MC/DC0%0/2
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant sendSMS without ParlayX host definition\n")
$_[0]{"host"}
$self->{"host"}
Truth table0%0/3
A or B
A= $_[0]{"host"}B= $self->{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $password = $_[0]->{'password'} || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"} or $self->{"password"}
MC/DC0%0/2
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"}
$self->{"password"}
Truth table0%0/3
A or B
A= $_[0]{"password"}B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $nonce = $_[0]->{'nonce'} || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"} or $self->{"nonce"}
MC/DC0%0/2
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"}
$self->{"nonce"}
Truth table0%0/3
A or B
A= $_[0]{"nonce"}B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $senderName = $_[0]->{'senderName'} || $self->{'senderName'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'senderName'} || $self->{'senderName'} || ''
$_[0]{"senderName"} or $self->{"senderName"}
MC/DC0%0/2
$_[0]{'senderName'} || $self->{'senderName'} || ''
$_[0]{"senderName"}
$self->{"senderName"}
Truth table0%0/3
A or B
A= $_[0]{"senderName"}B= $self->{"senderName"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $message = $_[0]->{'message'} || $self->{'message'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'message'} || $self->{'message'} || ''
$_[0]{"message"} or $self->{"message"}
MC/DC0%0/2
$_[0]{'message'} || $self->{'message'} || ''
$_[0]{"message"}
$self->{"message"}
Truth table0%0/3
A or B
A= $_[0]{"message"}B= $self->{"message"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $addresses = $_[0]->{'addresses'} || $self->{'addresses'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'addresses'} || $self->{'addresses'} || ''
$_[0]{"addresses"} or $self->{"addresses"}
MC/DC0%0/2
$_[0]{'addresses'} || $self->{'addresses'} || ''
$_[0]{"addresses"}
$self->{"addresses"}
Truth table0%0/3
A or B
A= $_[0]{"addresses"}B= $self->{"addresses"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | #special handling of $receiptRequest & $ChargingInformation | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $receiptRequest = $_[0]->{'receiptRequest'} || $self->{'receiptRequest'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'receiptRequest'} || $self->{'receiptRequest'} || ''
$_[0]{"receiptRequest"} or $self->{"receiptRequest"}
MC/DC0%0/2
$_[0]{'receiptRequest'} || $self->{'receiptRequest'} || ''
$_[0]{"receiptRequest"}
$self->{"receiptRequest"}
Truth table0%0/3
A or B
A= $_[0]{"receiptRequest"}B= $self->{"receiptRequest"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | $ChargingInformation = $_[0]->{'ChargingInformation'} || $self->{'ChargingInformation'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'ChargingInformation'} || $self->{'ChargingInformation'} || ''
$_[0]{"ChargingInformation"} or $self->{"ChargingInformation"}
MC/DC0%0/2
$_[0]{'ChargingInformation'} || $self->{'ChargingInformation'} || ''
$_[0]{"ChargingInformation"}
$self->{"ChargingInformation"}
Truth table0%0/3
A or B
A= $_[0]{"ChargingInformation"}B= $self->{"ChargingInformation"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if ($receiptRequest && ref($receiptRequest) ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$receiptRequest and ref $receiptRequest ne "HASH"
MC/DC0%0/2
$receiptRequest and ref $receiptRequest ne "HASH"
$receiptRequest
ref $receiptRequest ne "HASH"
Truth table0%0/3
A and B
A= $receiptRequestB= ref $receiptRequest ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | Carp::croak("\$receiptRequest is not a hash reference\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ($ChargingInformation && ref($ChargingInformation) ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ChargingInformation and ref $ChargingInformation ne "HASH"
MC/DC0%0/2
$ChargingInformation and ref $ChargingInformation ne "HASH"
$ChargingInformation
ref $ChargingInformation ne "HASH"
Truth table0%0/3
A and B
A= $ChargingInformationB= ref $ChargingInformation ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | Carp::croak("\$ChargingInformation is not a hash reference\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if (!$addresses) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | Carp::croak("No recipients for SMS!\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $self->{'DEBUG'} and warn "Constructing SOAP request..\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | #construct the SOAP request..header first. | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $soap = $self->soap_send_body($username,$password,$nonce,$addresses,$senderName,$message,$receiptRequest,$ChargingInformation); | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $self->parse_xml(\$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP request passed XML validation, sending HTTP Request\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ($soapaction,$lookfor) = ('http://www.csapi.org/wsdl/parlayx/sms/send/v2_1/local','result'); | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return $self->doHTTP($host,\$soap,$soapaction,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | =item getSmsDeliveryStatus | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | C<>=> Pretty much finished too. It would be highly unusable without named arguments, so call it like so: | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||
| 242 | $self->getSmsDeliveryStatus( { | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | username => 'Your ParlayX Username', | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | host => 'ParlayX SMS Gateway', | ||||||||||||||||||||||||||||||||||||||||||||||
| 245 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | nonce => 'No Idea What This Does', | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | messageid => 'A message unique ID, obtained from sendSMS() above', | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | Needs username, host and messageid for anything to work at all, the rest | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | can be filled in according to your requirements. Your operator should give you a pretty good idea | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | what`s neccessary and what is not. | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | Returns a scalar indicating success (1) or not (0) and a hash reference (if you only asked | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | for a single message ID) containing deliveryStatus and recipients` address (addresses). | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | if you used an array reference to ask for multiple message IDs, the 2nd returning value will be | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | an array reference with hashes like the one above inside it (should work, but could not be tested | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | in time). | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||
| 261 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub getSmsDeliveryStatus { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSmsDeliveryStatus: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $self->{'DEBUG'} and warn "Entering getSmsDeliveryStatus()\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my ($username, $password, $nonce, $host, $messageid, $addresses); | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $username = $_[0]->{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"} or $self->{"username"}
MC/DC0%0/2
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"}
$self->{"username"}
Truth table0%0/3
A or B
A= $_[0]{"username"}B= $self->{"username"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | $host = $_[0]->{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"} or $self->{"host"}
MC/DC0%0/2
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"}
$self->{"host"}
Truth table0%0/3
A or B
A= $_[0]{"host"}B= $self->{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | $password = $_[0]->{'password'} || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"} or $self->{"password"}
MC/DC0%0/2
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"}
$self->{"password"}
Truth table0%0/3
A or B
A= $_[0]{"password"}B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | $nonce = $_[0]->{'nonce'} || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"} or $self->{"nonce"}
MC/DC0%0/2
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"}
$self->{"nonce"}
Truth table0%0/3
A or B
A= $_[0]{"nonce"}B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $messageid = $_[0]->{'messageid'} || $self->{'messageid'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'messageid'} || $self->{'messageid'} || ''
$_[0]{"messageid"} or $self->{"messageid"}
MC/DC0%0/2
$_[0]{'messageid'} || $self->{'messageid'} || ''
$_[0]{"messageid"}
$self->{"messageid"}
Truth table0%0/3
A or B
A= $_[0]{"messageid"}B= $self->{"messageid"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | $addresses = $_[0]->{'addresses'} || $self->{'addresses'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'addresses'} || $self->{'addresses'} || ''
$_[0]{"addresses"} or $self->{"addresses"}
MC/DC0%0/2
$_[0]{'addresses'} || $self->{'addresses'} || ''
$_[0]{"addresses"}
$self->{"addresses"}
Truth table0%0/3
A or B
A= $_[0]{"addresses"}B= $self->{"addresses"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if (!$messageid) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | Carp::croak("Need messageid for delivery status!\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | $self->{'DEBUG'} and warn "Constructing SOAP request..\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $soap = $self->soap_deliv_body($username,$password,$nonce,$messageid); | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $self->parse_xml(\$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP request passed XML validation, sending HTTP Request\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my ($soapaction,$lookfor) = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | '',{ deliveryStatus => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | address => '' } | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my ($success,$result) = $self->doHTTP($host,\$soap,$soapaction,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | return ($success,$result); | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||
| 303 | =item ReceiveSms | ||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | C<>=> Works quite well for me YMMV. | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | $self->ReceiveSms( { | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | username => 'Your ParlayX Username', | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | host => 'ParlayX SMS Gateway', | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | nonce => 'No Idea What This Does', | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | registrationIdentifier => 'Never seen this used, so dont know what it does - username should be enough to identify you', | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||
| 315 | This is the polling interface for receiving SMS from ParlayX. Using it will result in ParlayX | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ``de-spooling'' awaiting SMSs for you. | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | Obviously needs a username to work and may need registrationIdentifier, the rest | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | can be filled in according to your requirements. Your operator should give you a pretty good idea | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | what`s neccessary and what is not. | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | Returns a scalar indicating success (1) or not (0) and a hash reference (if only a single SMS was waiting | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | in line) containing message, senderAddress and the number the SMS was sent to (smsServiceActivationNumber). | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | if multiple messages are waiting, the 2nd returning value will be | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | an array reference with hashes like the one above inside it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||
| 325 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||
| 327 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub ReceiveSms { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReceiveSms: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | $self->{'DEBUG'} and warn "Entering ReceiveSms()\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ($username, $password, $nonce, $host, $registrationIdentifier); | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | $username = $_[0]->{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"} or $self->{"username"}
MC/DC0%0/2
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"}
$self->{"username"}
Truth table0%0/3
A or B
A= $_[0]{"username"}B= $self->{"username"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | $host = $_[0]->{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"} or $self->{"host"}
MC/DC0%0/2
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"}
$self->{"host"}
Truth table0%0/3
A or B
A= $_[0]{"host"}B= $self->{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | $password = $_[0]->{'password'} || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"} or $self->{"password"}
MC/DC0%0/2
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"}
$self->{"password"}
Truth table0%0/3
A or B
A= $_[0]{"password"}B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $nonce = $_[0]->{'nonce'} || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"} or $self->{"nonce"}
MC/DC0%0/2
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"}
$self->{"nonce"}
Truth table0%0/3
A or B
A= $_[0]{"nonce"}B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | $registrationIdentifier = $_[0]->{'registrationIdentifier'} || $self->{'registrationIdentifier'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'registrationIdentifier'} || $self->{'registrationIdentifier'} || ''
$_[0]{"registrationIdentifier"} or $self->{"registrationIdentifier"}
MC/DC0%0/2
$_[0]{'registrationIdentifier'} || $self->{'registrationIdentifier'} || ''
$_[0]{"registrationIdentifier"}
$self->{"registrationIdentifier"}
Truth table0%0/3
A or B
A= $_[0]{"registrationIdentifier"}B= $self->{"registrationIdentifier"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | $self->{'DEBUG'} and warn "Constructing SOAP request..\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $soap = $self->soap_receivesms_body($username,$password,$nonce,$registrationIdentifier); | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $self->parse_xml(\$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP request passed XML validation, sending HTTP Request\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my ($soapaction,$lookfor) = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | '', { | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | message => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | senderAddress => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 356 | smsServiceActivationNumber => '' | ||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 358 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my ($success,$result) = $self->doHTTP($host,\$soap,$soapaction,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | return ($success,$result); | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | =item ReceiveAutoSms | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | C<>=> | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | $self->ReceiveAutoSms($incoming_soap_post); | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||
| 373 | This is the other (lets call on-demand) interface for receiving SMS from ParlayX. | ||||||||||||||||||||||||||||||||||||||||||||||
| 374 | You need to register yourself with the gateway (see C<startSmsNotification()> and C<stopSmsNotification()> below) | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | and then, whenever you have an incoming SMS, the gateway will POST any SMS to the URI you specified there. | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | Returns a hash reference containing message, senderAddress and the number the SMS was sent to (smsServiceActivationNumber). | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | An example, written in mod_perl/Apache::ASP, script accepting SMS follows. | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||
| 379 | <% | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | use Mobile::Messaging::ParlayX; | ||||||||||||||||||||||||||||||||||||||||||||||
| 382 | my $incoming = $Request->BinaryRead(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 383 | $incoming =~ s|<message>|<result>|s; | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | $incoming =~ s|(smsServiceActivationNumber>.*?)</message>|$1</result>|s; | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | my $ret = $sms->ReceiveAutoSms(\$incoming); | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | %>> | ||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | In the example above, now $ret->{'message'} contains the SMS, $ret->{'smsServiceActivationNumber'} contains the number | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | the SMS was sent to (but prefixed with ``tel:'' so you might want to remove this before replying) and $ret->{'senderAddress'} | ||||||||||||||||||||||||||||||||||||||||||||||
| 390 | contains the number of the person who sent the SMS (which can be used as is in the reply). | ||||||||||||||||||||||||||||||||||||||||||||||
| 391 | Due to (our operator`s only ?) ParlayX being slightly liberal (for lack of a better word) it uses <message>, while it | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | meant <result>. The regex is there to make the message compatible with ReceiveSms() parsing above. | ||||||||||||||||||||||||||||||||||||||||||||||
| 393 | Also note the use of ``\$incoming'': In general, I try to avoid copying large strings back and forth and most of the module | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | will happily accept a scalar or a reference when either would apply. So you could use | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ``my $ret = $sms->ReceiveAutoSms($incoming);'' instead if you feel more comfortable with it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Personally, I designed it so I could use ``my $ret = $sms->ReceiveAutoSms(\$Request->BinaryRead());'' and I would too, | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | if it were not for the funky <message> instead of <result> stuff. | ||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||
| 399 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | sub ReceiveAutoSms { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReceiveAutoSms: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my $soap = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | if (ref($soap)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | return $self->parse_xml($soap, { | |||||||||||||||||||||||||||||||||||||||||||||
| 410 | message => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | senderAddress => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | smsServiceActivationNumber => '' | ||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | return $self->parse_xml(\$soap, { | |||||||||||||||||||||||||||||||||||||||||||||
| 418 | message => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | senderAddress => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 420 | smsServiceActivationNumber => '' | ||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||
| 426 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||
| 428 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | =item stopSmsNotification | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||
| 432 | C<>=> | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $self->stopSmsNotification( { | ||||||||||||||||||||||||||||||||||||||||||||||
| 435 | username => 'Your ParlayX Username', | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | host => 'ParlayX SMS Gateway', | ||||||||||||||||||||||||||||||||||||||||||||||
| 437 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 438 | nonce => 'No Idea What This Does', | ||||||||||||||||||||||||||||||||||||||||||||||
| 439 | correlator => 'Unique Identifier for you (assigned when you did startSmsNotification()' | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||
| 442 | if you previously registered yourself with ParlayX with C<startSmsNotification()> and you do not want to automatically | ||||||||||||||||||||||||||||||||||||||||||||||
| 443 | recieve SMS from now on, use this. It tells ParlayX to stop sending you SMS to the URI you specified. | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | You`ll probably never have to use this, but it is included for the sake of completeness. | ||||||||||||||||||||||||||||||||||||||||||||||
| 445 | I have no idea if it works without a correlator (mine doesn`t), but if you implementation is different, feel free to | ||||||||||||||||||||||||||||||||||||||||||||||
| 446 | fix this. | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||
| 448 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||
| 450 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | sub stopSmsNotification { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stopSmsNotification: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | $self->{'DEBUG'} and warn "Entering stopSmsNotification()\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my ($username, $password, $nonce, $host, $correlator); | |||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | $username = $_[0]->{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"} or $self->{"username"}
MC/DC0%0/2
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"}
$self->{"username"}
Truth table0%0/3
A or B
A= $_[0]{"username"}B= $self->{"username"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | $host = $_[0]->{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"} or $self->{"host"}
MC/DC0%0/2
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"}
$self->{"host"}
Truth table0%0/3
A or B
A= $_[0]{"host"}B= $self->{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | $password = $_[0]->{'password'} || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"} or $self->{"password"}
MC/DC0%0/2
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"}
$self->{"password"}
Truth table0%0/3
A or B
A= $_[0]{"password"}B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | $nonce = $_[0]->{'nonce'} || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"} or $self->{"nonce"}
MC/DC0%0/2
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"}
$self->{"nonce"}
Truth table0%0/3
A or B
A= $_[0]{"nonce"}B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | $correlator = $_[0]->{'correlator'} || $self->{'correlator'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'correlator'} || $self->{'correlator'} || ''
$_[0]{"correlator"} or $self->{"correlator"}
MC/DC0%0/2
$_[0]{'correlator'} || $self->{'correlator'} || ''
$_[0]{"correlator"}
$self->{"correlator"}
Truth table0%0/3
A or B
A= $_[0]{"correlator"}B= $self->{"correlator"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if (!$correlator) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | Carp::croak("Need correlator for stopSmsNotification!\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | $self->{'DEBUG'} and warn "Constructing SOAP request..\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my $soap = $self->soap_stopsms_body($username,$password,$nonce,$correlator); | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $self->parse_xml(\$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP request passed XML validation, sending HTTP Request\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my ($soapaction,$lookfor) = ('', 'Body'); | |||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my ($success,$result) = $self->doHTTP($host,\$soap,$soapaction,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | return ($success,$result); | |||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||
| 485 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||
| 489 | =item startSmsNotification | ||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||
| 491 | C<>=> | ||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||
| 493 | $self->startSmsNotification( { | ||||||||||||||||||||||||||||||||||||||||||||||
| 494 | username => 'Your ParlayX Username', | ||||||||||||||||||||||||||||||||||||||||||||||
| 495 | host => 'ParlayX SMS Gateway', | ||||||||||||||||||||||||||||||||||||||||||||||
| 496 | password => 'Password', | ||||||||||||||||||||||||||||||||||||||||||||||
| 497 | nonce => 'No Idea What This Does', | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | endpoint => 'YOUR URI that ParlayX will send SMS to', | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | correlator => 'A unique ID for you (more on this later)', | ||||||||||||||||||||||||||||||||||||||||||||||
| 500 | interfaceName => 'No idea..always empty as far as I know' | ||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | To register yourself with ParlayX you need to use this. After you do, all SMS to your number will be sent to the | ||||||||||||||||||||||||||||||||||||||||||||||
| 504 | URI you specify in ``endpoint''. | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | if you do not specify a correlator, L<time()|perlfunc/time> will be used. | ||||||||||||||||||||||||||||||||||||||||||||||
| 506 | Returns 3 scalars, the first indicating success (1) or failure (0), the second your designated correlator (keep this | ||||||||||||||||||||||||||||||||||||||||||||||
| 507 | somewhere safe) and the third will normall be empty, except for error cases, where it will contain extended error | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | information. | ||||||||||||||||||||||||||||||||||||||||||||||
| 509 | Probably one-off use for it... | ||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||
| 511 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||
| 513 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub startSmsNotification { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
startSmsNotification: not called CC=26 SCAR=65.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | $self->{'DEBUG'} and warn "Entering startSmsNotification()\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my ($username, $password, $nonce, $host, $endpoint, $correlator, $interfaceName, $smsServiceActivationNumber, $criteria); | |||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | $username = $_[0]->{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"} or $self->{"username"}
MC/DC0%0/2
$_[0]{'username'} || $self->{'username'} || Carp::croak("Cant getSmsDeliveryStatus without username\n")
$_[0]{"username"}
$self->{"username"}
Truth table0%0/3
A or B
A= $_[0]{"username"}B= $self->{"username"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | $host = $_[0]->{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"} or $self->{"host"}
MC/DC0%0/2
$_[0]{'host'} || $self->{'host'} || Carp::croak("Cant getSmsDeliveryStatus without ParlayX host definition\n")
$_[0]{"host"}
$self->{"host"}
Truth table0%0/3
A or B
A= $_[0]{"host"}B= $self->{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | $password = $_[0]->{'password'} || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"} or $self->{"password"}
MC/DC0%0/2
$_[0]{'password'} || $self->{'password'} || ''
$_[0]{"password"}
$self->{"password"}
Truth table0%0/3
A or B
A= $_[0]{"password"}B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | $nonce = $_[0]->{'nonce'} || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"} or $self->{"nonce"}
MC/DC0%0/2
$_[0]{'nonce'} || $self->{'nonce'} || ''
$_[0]{"nonce"}
$self->{"nonce"}
Truth table0%0/3
A or B
A= $_[0]{"nonce"}B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | $endpoint = $_[0]->{'endpoint'} || $self->{'endpoint'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'endpoint'} || $self->{'endpoint'} || ''
$_[0]{"endpoint"} or $self->{"endpoint"}
MC/DC0%0/2
$_[0]{'endpoint'} || $self->{'endpoint'} || ''
$_[0]{"endpoint"}
$self->{"endpoint"}
Truth table0%0/3
A or B
A= $_[0]{"endpoint"}B= $self->{"endpoint"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | $correlator = $_[0]->{'correlator'} || $self->{'correlator'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'correlator'} || $self->{'correlator'} || ''
$_[0]{"correlator"} or $self->{"correlator"}
MC/DC0%0/2
$_[0]{'correlator'} || $self->{'correlator'} || ''
$_[0]{"correlator"}
$self->{"correlator"}
Truth table0%0/3
A or B
A= $_[0]{"correlator"}B= $self->{"correlator"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | $interfaceName = $_[0]->{'interfaceName'} || $self->{'interfaceName'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'interfaceName'} || $self->{'interfaceName'} || ''
$_[0]{"interfaceName"} or $self->{"interfaceName"}
MC/DC0%0/2
$_[0]{'interfaceName'} || $self->{'interfaceName'} || ''
$_[0]{"interfaceName"}
$self->{"interfaceName"}
Truth table0%0/3
A or B
A= $_[0]{"interfaceName"}B= $self->{"interfaceName"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | $smsServiceActivationNumber = $_[0]->{'smsServiceActivationNumber'} || $self->{'smsServiceActivationNumber'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'smsServiceActivationNumber'} || $self->{'smsServiceActivationNumber'} || ''
$_[0]{"smsServiceActivationNumber"} or $self->{"smsServiceActivationNumber"}
MC/DC0%0/2
$_[0]{'smsServiceActivationNumber'} || $self->{'smsServiceActivationNumber'} || ''
$_[0]{"smsServiceActivationNumber"}
$self->{"smsServiceActivationNumber"}
Truth table0%0/3
A or B
A= $_[0]{"smsServiceActivationNumber"}B= $self->{"smsServiceActivationNumber"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | $criteria = $_[0]->{'criteria'} || $self->{'criteria'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$_[0]{'criteria'} || $self->{'criteria'} || ''
$_[0]{"criteria"} or $self->{"criteria"}
MC/DC0%0/2
$_[0]{'criteria'} || $self->{'criteria'} || ''
$_[0]{"criteria"}
$self->{"criteria"}
Truth table0%0/3
A or B
A= $_[0]{"criteria"}B= $self->{"criteria"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if (!$endpoint) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | Carp::croak("Need endpoint for startSmsNotification!\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 537 | elsif (!$smsServiceActivationNumber) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | Carp::croak("Need smsServiceActivationNumber for startSmsNotification!\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | if (!$correlator) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | $correlator = time(); | |||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | $self->{'DEBUG'} and warn "Constructing SOAP request..\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my $soap = $self->soap_startsms_body($username,$password,$nonce,$endpoint,$correlator,$interfaceName,$smsServiceActivationNumber,$criteria); | |||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $self->parse_xml(\$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP request passed XML validation, sending HTTP Request\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my ($soapaction,$lookfor) = ('', 'Body'); | |||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | my ($success,$result) = $self->doHTTP($host,\$soap,$soapaction,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | return ($success,$correlator,$result); | |||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||
| 560 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||
| 562 | =head2 Esoterics | ||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||
| 564 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||
| 566 | =item Before we do this, know that all this is subject (rather mandatory I think) to change. | ||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||
| 568 | =item soap_header | ||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||
| 570 | =item soap_footer | ||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||
| 572 | =item parse_xml | ||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||
| 574 | =item doHTTP | ||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||
| 576 | =item soap_startsms_body | ||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||
| 578 | =item soap_stopsms_body | ||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||
| 580 | =item soap_deliv_body | ||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||
| 582 | =item soap_send_body | ||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||
| 584 | =item soap_receivesms_body | ||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||
| 586 | =item receipt_request | ||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||
| 588 | =item charging_info | ||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||
| 590 | C<>=> In very particular order, the top 4 things are not very likely to change anytime soon, | ||||||||||||||||||||||||||||||||||||||||||||||
| 591 | unless L<SOAP::Lite> transforms into something usable by a poor smuck like me soon. | ||||||||||||||||||||||||||||||||||||||||||||||
| 592 | About the rest, I do not know, especially charging_info and receipt_request are only written | ||||||||||||||||||||||||||||||||||||||||||||||
| 593 | based on (shoddy) documentation and have never been used in real life. | ||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||
| 595 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||
| 597 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | sub soap_startsms_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_startsms_body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my ($username,$password,$nonce,$endpoint,$correlator,$interfaceName,$smsServiceActivationNumber,$criteria) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my $soap = $self->soap_header($username,$password,$nonce); | |||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | $soap .= qq[<ns2:startSmsNotification xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification_manager/v2_2/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 607 | <ns2:reference> | ||||||||||||||||||||||||||||||||||||||||||||||
| 608 | <endpoint>$endpoint</endpoint> | ||||||||||||||||||||||||||||||||||||||||||||||
| 609 | <interfaceName>$interfaceName</interfaceName> | ||||||||||||||||||||||||||||||||||||||||||||||
| 610 | <correlator>$correlator</correlator> | ||||||||||||||||||||||||||||||||||||||||||||||
| 611 | </ns2:reference> | ||||||||||||||||||||||||||||||||||||||||||||||
| 612 | <ns2:smsServiceActivationNumber>$smsServiceActivationNumber</ns2:smsServiceActivationNumber> | ||||||||||||||||||||||||||||||||||||||||||||||
| 613 | <ns2:criteria>$criteria</ns2:criteria> | ||||||||||||||||||||||||||||||||||||||||||||||
| 614 | </ns2:startSmsNotification>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $soap .= $self->soap_footer(); | |||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | return $soap; | |||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | sub soap_stopsms_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_stopsms_body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | my ($username,$password,$nonce,$correlator) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my $soap = $self->soap_header($username,$password,$nonce); | |||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $soap .= qq[<ns2:stopSmsNotification xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification_manager/v2_2/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 629 | <ns2:correlator>$correlator</ns2:correlator> | ||||||||||||||||||||||||||||||||||||||||||||||
| 630 | </ns2:stopSmsNotification>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $soap .= $self->soap_footer(); | |||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | return $soap; | |||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | sub soap_deliv_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_deliv_body: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | my ($username,$password,$nonce,$messageid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my $soap = $self->soap_header($username,$password,$nonce); | |||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | if (ref($messageid) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | foreach (@{$messageid}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | $soap .= qq[<ns2:getSmsDeliveryStatus xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/send/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 647 | <ns2:requestIdentifier>$_</ns2:requestIdentifier> | ||||||||||||||||||||||||||||||||||||||||||||||
| 648 | </ns2:getSmsDeliveryStatus>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 651 | elsif ($messageid) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $soap .= qq[<ns2:getSmsDeliveryStatus xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/send/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 653 | <ns2:requestIdentifier>$messageid</ns2:requestIdentifier> | ||||||||||||||||||||||||||||||||||||||||||||||
| 654 | </ns2:getSmsDeliveryStatus>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | $soap .= $self->soap_footer(); | |||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | return $soap; | |||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | sub soap_send_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_send_body: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | my ($username,$password,$nonce,$addresses,$senderName,$message,$receiptRequest,$ChargingInformation) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | my $soap = $self->soap_header($username,$password,$nonce); | |||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | ▶ | if (ref($message) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 669 | #different messages for (possibly) different recipients | ||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | for (my $i=0; $i < scalar(@{$message}); $i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | $soap .= qq[<ns2:sendSms xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/send/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1">]; | |||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | if (ref($addresses) eq 'ARRAY' && $addresses->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $addresses eq "ARRAY" and $addresses->[$i]
MC/DC0%0/2
ref $addresses eq "ARRAY" and $addresses->[$i]
ref $addresses eq "ARRAY"
$addresses->[$i]
Truth table0%0/3
A and B
A= ref $addresses eq "ARRAY"B= $addresses->[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $soap .= qq[<ns2:addresses>$addresses->[$i]</ns2:addresses>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 677 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $soap .= qq[<ns2:addresses>$addresses</ns2:addresses>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | if (ref($senderName) eq 'ARRAY' && $senderName->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $senderName eq "ARRAY" and $senderName->[$i]
MC/DC0%0/2
ref $senderName eq "ARRAY" and $senderName->[$i]
ref $senderName eq "ARRAY"
$senderName->[$i]
Truth table0%0/3
A and B
A= ref $senderName eq "ARRAY"B= $senderName->[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $soap .= qq[<ns2:senderName>$senderName->[$i]</ns2:senderName>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 684 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $soap .= qq[<ns2:senderName>$senderName</ns2:senderName>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | $soap .= qq[<ns2:message>$message->[$i]</ns2:message>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | if (ref($receiptRequest) eq 'ARRAY' && ref($receiptRequest->[$i]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
ref $receiptRequest eq "ARRAY" and ref $receiptRequest->[$i] eq "HASH"
MC/DC0%0/2
ref $receiptRequest eq "ARRAY" and ref $receiptRequest->[$i] eq "HASH"
ref $receiptRequest eq "ARRAY"
ref $receiptRequest->[$i] eq "HASH"
Truth table0%0/3
A and B
A= ref $receiptRequest eq "ARRAY"B= ref $receiptRequest->[$i] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | $soap .= $self->receipt_request($receiptRequest->[$i]); | |||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 693 | elsif ($receiptRequest) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | $soap .= $self->receipt_request($receiptRequest); | |||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | if (ref($ChargingInformation) eq 'ARRAY' && ref($ChargingInformation->[$i]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
ref $ChargingInformation eq "ARRAY" and ref $ChargingInformation->[$i] eq "HASH"
MC/DC0%0/2
ref $ChargingInformation eq "ARRAY" and ref $ChargingInformation->[$i] eq "HASH"
ref $ChargingInformation eq "ARRAY"
ref $ChargingInformation->[$i] eq "HASH"
Truth table0%0/3
A and B
A= ref $ChargingInformation eq "ARRAY"B= ref $ChargingInformation->[$i] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | $soap .= $self->charging_info($ChargingInformation->[$i]); | |||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 700 | elsif ($ChargingInformation) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $soap .= $self->charging_info($ChargingInformation); | |||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $soap .= qq[</ns2:sendSms>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 707 | elsif (ref($addresses) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 708 | #same message to different recipients | ||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | foreach (@{$addresses}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $soap .= qq[<ns2:sendSms xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/send/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 711 | <ns2:addresses>$_</ns2:addresses> | ||||||||||||||||||||||||||||||||||||||||||||||
| 712 | <ns2:message>$message</ns2:message>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ($senderName) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $soap .= qq[<ns2:senderName>$senderName</ns2:senderName>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | if ($receiptRequest) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $soap .= $self->receipt_request($receiptRequest); | |||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | if ($ChargingInformation) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $soap .= $self->charging_info($ChargingInformation); | |||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | $soap .= qq[</ns2:sendSms>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 729 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 730 | #one message, one recipient | ||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $soap .= qq[<ns2:sendSms xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/send/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1"> | |||||||||||||||||||||||||||||||||||||||||||||
| 732 | <ns2:addresses>$addresses</ns2:addresses> | ||||||||||||||||||||||||||||||||||||||||||||||
| 733 | <ns2:message>$message</ns2:message>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | if ($senderName) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | $soap .= qq[<ns2:senderName>$senderName</ns2:senderName>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | if ($receiptRequest) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $soap .= $self->receipt_request($receiptRequest); | |||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | if ($ChargingInformation) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $soap .= $self->charging_info($ChargingInformation); | |||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $soap .= qq[</ns2:sendSms>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $soap .= $self->soap_footer(); | |||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | return $soap; | |||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | sub soap_header { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_header: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | my $username = shift || $self->{'username'}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $self->{'username'}
MC/DC0%0/2
shift() || $self->{'username'}
shift()
$self->{'username'}
Truth table0%0/3
A || B
A= shift()B= $self->{'username'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | my $password = shift || $self->{'password'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
shift() || $self->{'password'} || ''
shift() or $self->{"password"}
MC/DC0%0/2
shift() || $self->{'password'} || ''
shift()
$self->{"password"}
Truth table0%0/3
A or B
A= shift()B= $self->{"password"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | ▶ | my $nonce = shift || $self->{'nonce'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
shift() || $self->{'nonce'} || ''
shift() or $self->{"nonce"}
MC/DC0%0/2
shift() || $self->{'nonce'} || ''
shift()
$self->{"nonce"}
Truth table0%0/3
A or B
A= shift()B= $self->{"nonce"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if ($password) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $password = q[<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">].$password.q[</wsse:Password>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||
| 764 | #only if password, can nonce make sense or not ? | ||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | if ($nonce) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | $nonce = q[<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">].$nonce.q[</wsse:Nonce>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | return qq[<?xml version="1.0" ?> | |||||||||||||||||||||||||||||||||||||||||||||
| 771 | <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> | ||||||||||||||||||||||||||||||||||||||||||||||
| 772 | <SOAP-ENV:Header> | ||||||||||||||||||||||||||||||||||||||||||||||
| 773 | <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> | ||||||||||||||||||||||||||||||||||||||||||||||
| 774 | <wsse:UsernameToken wsu:Id="XWSSGID-11435375577461001212174" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> | ||||||||||||||||||||||||||||||||||||||||||||||
| 775 | <wsse:Username>] | ||||||||||||||||||||||||||||||||||||||||||||||
| 776 | .$username | ||||||||||||||||||||||||||||||||||||||||||||||
| 777 | .qq[</wsse:Username>] | ||||||||||||||||||||||||||||||||||||||||||||||
| 778 | .$password | ||||||||||||||||||||||||||||||||||||||||||||||
| 779 | .$nonce | ||||||||||||||||||||||||||||||||||||||||||||||
| 780 | .qq[ | ||||||||||||||||||||||||||||||||||||||||||||||
| 781 | </wsse:UsernameToken> | ||||||||||||||||||||||||||||||||||||||||||||||
| 782 | </wsse:Security> | ||||||||||||||||||||||||||||||||||||||||||||||
| 783 | </SOAP-ENV:Header> | ||||||||||||||||||||||||||||||||||||||||||||||
| 784 | <SOAP-ENV:Body>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | sub soap_footer { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_footer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | return qq[</SOAP-ENV:Body> | |||||||||||||||||||||||||||||||||||||||||||||
| 791 | </SOAP-ENV:Envelope>]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | ▶ | sub receipt_request { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
receipt_request: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | my $rr = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | if (ref($rr) ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | Carp::croak("Cant do receipt request without endpoint, interfaceName or correlator (receiptRequest is not a HASH reference\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | if ($rr->{'endpoint'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | $rr->{'endpoint'} = qq[<endpoint>$rr->{'endpoint'}</endpoint>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | if ($rr->{'correlator'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | $rr->{'correlator'} = qq[<correlator>$rr->{'correlator'}</correlator>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | if ($rr->{'interfaceName'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | $rr->{'interfaceName'} = qq[<interfaceName>$rr->{'interfaceName'}</interfaceName>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | if ($rr->{'interfaceName'} || $rr->{'correlator'} || $rr->{'endpoint'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rr->{"interfaceName"} or $rr->{"correlator"} or $rr->{"endpoint"}
$rr->{"interfaceName"} or $rr->{"correlator"}
MC/DC0%0/3
$rr->{"interfaceName"} or $rr->{"correlator"} or $rr->{"endpoint"}
$rr->{"interfaceName"}
$rr->{"correlator"}
$rr->{"endpoint"}
Truth table0%0/4
A or B or C
A= $rr->{"interfaceName"}B= $rr->{"correlator"}C= $rr->{"endpoint"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | return qq[<ns2:receiptRequest> $rr->{'endpoint'} $rr->{'interfaceName'} $rr->{'correlator'} </ns2:receiptRequest>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 816 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | sub soap_receivesms_body { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soap_receivesms_body: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | my ($username,$password,$nonce,$registrationIdentifier) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | my $soap = $self->soap_header($username,$password,$nonce); | |||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $soap .= qq[<ns2:getReceivedSms xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/receive/v2_1/local" xmlns:ns3="http://www.csapi.org/schema/parlayx/common/v2_1">]; | |||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | if ($registrationIdentifier) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $soap .= qq[<ns2:registrationIdentifier>$registrationIdentifier</ns2:registrationIdentifier>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $soap .= qq[</ns2:getReceivedSms>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | $soap .= $self->soap_footer(); | |||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | sub charging_info { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charging_info: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | my $ci = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | if (ref($ci) ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | Carp::croak("Cant do charging information without description, currency, amount or code (ChargingInformation is not a HASH reference\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | if ($ci->{'description'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | $ci->{'description'} = qq[<description>$ci->{'description'}</description>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | if ($ci->{'currency'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | $ci->{'currency'} = qq[<currency>$ci->{'currency'}</currency>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | ▶ | if ($ci->{'amount'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | $ci->{'amount'} = qq[<amount>$ci->{'amount'}</amount>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | if ($ci->{'code'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | $ci->{'code'} = qq[<code>$ci->{'code'}</code>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | if ( ($ci->{'currency'} && $ci->{'amount'}) || $ci->{'code'} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ci->{"currency"} and $ci->{"amount"} or $ci->{"code"}
$ci->{"currency"} and $ci->{"amount"}
MC/DC0%0/3
$ci->{"currency"} and $ci->{"amount"} or $ci->{"code"}
$ci->{"currency"}
$ci->{"amount"}
$ci->{"code"}
Truth table0%0/5
A and B or C
A= $ci->{"currency"}B= $ci->{"amount"}C= $ci->{"code"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | return qq[<ns2:charging> $ci->{'currency'} $ci->{'amount'} $ci->{'description'} $ci->{'code'} </ns2:charging>]; | |||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 863 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | sub parse_xml { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_xml: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | my $soap = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | my $returns = shift || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | my $doc; | |||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | if (ref($soap)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP document:\n". ("-" x 80) . "\n" . $$soap . "\n" .("-" x 80) ."\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 880 | #might be a reference | ||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | $doc = $self->{'parser'}->parse_string($$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 883 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | ▶ | $self->{'DEBUG'} and warn "SOAP document:\n". ("-" x 80) . "\n$soap" . "\n" . ("-" x 80) ."\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | $doc = $self->{'parser'}->parse_string($soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 887 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | if (ref($soap)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | Carp::croak("SOAP document:\n\n$$soap\n\n is not valid XML\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 893 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | Carp::croak("SOAP document:\n\n$soap\n\n is not valid XML\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | if (!$returns) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 901 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $ret = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | if (ref($returns) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my $count = 0; #one or more ``results'' ? | |||||||||||||||||||||||||||||||||||||||||||||
| 906 | #$ret will be an array of hashes if more than one | ||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $ret = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | foreach my $res ($doc->getElementsByTagName('result')) { | |||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | if ($count) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | push @{$ret},$returns; | |||||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | foreach (keys(%{$returns})) { | |||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | $returns->{$_} = $res->findvalue($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | if ($count > 1) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 919 | #had more than 1 <results> sections | ||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | push @{$ret},$returns; | |||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 922 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | $ret = $returns; | |||||||||||||||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 926 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | foreach my $res ($doc->getElementsByTagName($returns)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $ret = $res->to_literal; | |||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | if (!$ret) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | $ret = $doc->findvalue('/'); | |||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | ▶ | sub doHTTP { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
doHTTP: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | my ($host,$soap,$soapaction,$lookfor) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | my $req = HTTP::Request->new(POST => $host); | |||||||||||||||||||||||||||||||||||||||||||||
| 945 | #ref $soap to save string copying back and forth... | ||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | if (ref($soap)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | $req->content($$soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 949 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | $req->content($soap); | |||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | $req->header('SOAPAction' => $soapaction); | |||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | my $res = $self->{'ua'}->request($req); | |||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | if ($res->is_success()) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | $self->{'DEBUG'} and warn "Request successfull (200 OK) parsing response...\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | my $result = $self->parse_xml(\$res->content,$lookfor); | |||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | return (1,$result); | |||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 964 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | if ($res->content) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | ▶ | $self->{'DEBUG'} and warn "Request unsuccessfull parsing response...\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | my $fault = $self->parse_xml(\$res->content,'Fault'); | |||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | return (0,$fault); | |||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 971 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | Carp::croak("request failed with ".$res->as_string."\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||||||
| 977 | =head1 Revision History | ||||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 980 | Initial Release | ||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0.0.2 | ||||||||||||||||||||||||||||||||||||||||||||||
| 982 | Requisite XML::LibXML 1.62 specified in Makefile.PL | ||||||||||||||||||||||||||||||||||||||||||||||
| 983 | Fixed some POD formatting issues | ||||||||||||||||||||||||||||||||||||||||||||||
| 984 | Fixed some POD typos | ||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||
| 986 | Corrected tag ``ChargingInformation'' to ``charging'' in sub charging_info, as per documentation | ||||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||||
| 988 | =head1 Caveats | ||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||
| 990 | I really mean to split this to Mobile::Messaging::ParlayX::SMS, | ||||||||||||||||||||||||||||||||||||||||||||||
| 991 | Mobile::Messaging::ParlayX::MMS and Mobile::Messaging::ParlayX::TS | ||||||||||||||||||||||||||||||||||||||||||||||
| 992 | (Terminal Status), but I really ran out of time. Perhaps in the future (along with | ||||||||||||||||||||||||||||||||||||||||||||||
| 993 | better SOAP handling). | ||||||||||||||||||||||||||||||||||||||||||||||
| 994 | while on the subject of SOAP handling, I use XML::LibXML to validate all objects | ||||||||||||||||||||||||||||||||||||||||||||||
| 995 | before sending, receiving or processing them, but this is obviously one area that | ||||||||||||||||||||||||||||||||||||||||||||||
| 996 | needs quite a lot of work. | ||||||||||||||||||||||||||||||||||||||||||||||
| 997 | I`ve also done very little in terms of charsets, partly because my operator was in | ||||||||||||||||||||||||||||||||||||||||||||||
| 998 | no position to tell me and partly because I was lazy. I have no clue what happens | ||||||||||||||||||||||||||||||||||||||||||||||
| 999 | with GSM 03.38, UTF-8 and numeric encoded UTF-8 thrown in the mix. I`ve reached a | ||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | point where it works semi-reliably for me and - after I take a break - I`ll look | ||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | further into this. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | Initial release...what did you expect ;) - well, not any more, but 0.0.2 fixes | ||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | were purely cosmetic in nature. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | Seriously now, most of the stuff is confirmed to work but probably not all angles | ||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | are covered (in fact, I suspect very few are). | ||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | Obvious thanks to LWP::UserAgent, HTTP::Request and XML::LibXML authors, for none | ||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | of this would be possible without them (although some may argue that this would be | ||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | a good thing). | ||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | Big thanks should also go to Joshua Chamas for Apache::ASP and the mod_perl gurus. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | Thanos Chatziathanassiou <tchatzi@arx.net> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | http://www.arx.net | ||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | Copyright (c) 2007 arx.net - Thanos Chatziathanassiou . All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||