| 1 | package Business::GoCardless::Exception; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | Business::GoCardless::Exception | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | Exception handling for the Business::GoCardless modules, uses the Throwable | ||||||||||||||||||||||||||||||||||||||||||
| 10 | module. | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 56 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 56 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 56 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 56 | ▶ | use JSON (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 56 | ▶ | use Carp qw/ cluck /; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 56 | with 'Throwable'; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | =head2 message | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | The error message, if JSON is passed this will be coerced to a string. | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | =head2 code | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | The error code, generally the HTTP status code. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =head2 response | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | The error response, generally the HTTP response. | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | The following attributes are populated from the error response of the Pro (v2) | ||||||||||||||||||||||||||||||||||||||||||
| 38 | API, see L<https://developer.gocardless.com/api-reference/#api-usage-errors> | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =head2 type | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | The type of error, one of C<gocardless>, C<invalid_api_usage>, C<invalid_state>, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | or C<validation_failed>. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =head2 request_id | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | The ID of the request, include this if you need to contact GoCardless support. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | =head2 documentation_url | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | A link to the GoCardless documentation for the error. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | =head2 errors | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | An arrayref of the individual errors, for C<validation_failed> errors these have | ||||||||||||||||||||||||||||||||||||||||||
| 56 | C<field> and C<message> keys, for other errors they have C<reason> and C<message> | ||||||||||||||||||||||||||||||||||||||||||
| 57 | keys (and possibly C<links>). | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 34 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 34 | my ( $orig,$class,@args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 34 | my $args = $class->$orig( @args ); | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | # v2 API errors are JSON, so pull out the details to allow inspection | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # of the error rather than just having it as a message string | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 34 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $args->{"message"} and not ref $args->{"message"} and $args->{"message"} =~ /^\{/
defined $args->{"message"} and not ref $args->{"message"}
MC/DC66%2/3
defined $args->{"message"} and not ref $args->{"message"} and $args->{"message"} =~ /^\{/
defined $args->{"message"}
not ref $args->{"message"}
$args->{"message"} =~ /^\{/
Truth table75%3/4
A and not(B) and C
A= defined $args->{"message"}B= not ref $args->{"message"}C= $args->{"message"} =~ /^\{/
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | defined( $args->{message} ) | ||||||||||||||||||||||||||||||||||||||||||
| 70 | && ! ref( $args->{message} ) | ||||||||||||||||||||||||||||||||||||||||||
| 71 | && $args->{message} =~ /^\{/ | ||||||||||||||||||||||||||||||||||||||||||
| 72 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 14 | my $data = eval { _decode_json( $args->{message} ) }; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 14 | ▶ | if ( ref( $data ) eq 'HASH' && ref( $data->{error} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $data eq "HASH" and ref $data->{"error"} eq "HASH"
MC/DC100%2/2
ref $data eq "HASH" and ref $data->{"error"} eq "HASH"
ref $data eq "HASH"
ref $data->{"error"} eq "HASH"
Truth table100%3/3
A and B
A= ref $data eq "HASH"B= ref $data->{"error"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 11 | my $error = $data->{error}; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 11 | ▶ | $args->{$_} //= $error->{$_} for qw/ type request_id documentation_url /; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{$_} //= $error->{$_}
MC/DC50%1/2
$args->{$_} //= $error->{$_}
$args->{$_}
$error->{$_}
Truth table66%2/3
A //= B
A= $args->{$_}B= $error->{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 11 | ▶ | $args->{errors} //= $error->{errors}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{"errors"} //= $error->{"errors"}
MC/DC50%1/2
$args->{"errors"} //= $error->{"errors"}
$args->{"errors"}
$error->{"errors"}
Truth table66%2/3
A //= B
A= $args->{"errors"}B= $error->{"errors"}
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 34 | return $args; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 56 | }; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # plain string or JSON | ||||||||||||||||||||||||||||||||||||||||||
| 86 | has message => ( | ||||||||||||||||||||||||||||||||||||||||||
| 87 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 88 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 33 | ▶ | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 33 | my ( $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 33 | ▶ | cluck $message if $ENV{GOCARDLESS_DEV_TESTING}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 33 | ▶ | if ( $message =~ /^[{\[]/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | # defensive decoding | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 15 | eval { $message = _decode_json( $message ) }; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 15 | ▶ | $@ && do { return "Failed to parse JSON response ($message): $@"; }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 14 | ▶ | if ( ref( $message ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 13 | ▶ | my $error = delete( $message->{error} ) // "Unknown error"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $message->{"error"} // "Unknown error"
MC/DC0%0/1
delete $message->{"error"} // "Unknown error"
delete $message->{"error"}
Truth table50%1/2
A
A= delete $message->{"error"}
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 13 | ▶ | if ( ref( $error ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 11 | my $mess = $error->{message}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 11 | ▶ | foreach my $sub_error ( @{ $error->{errors} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$error->{"errors"} // []
MC/DC100%1/1
$error->{"errors"} // []
$error->{"errors"}
Truth table100%2/2
A
A= $error->{"errors"}
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 7 | $mess .= ' / ' . $sub_error->{message}; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 11 | return $mess . " << $mess >> "; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | } elsif ( ref( $error ) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | return join( ', ',@{ $error } ); | |||||||||||||||||||||||||||||||||||||||||
| 114 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | return join( ', ',@{ $message } ); | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 18 | return $message; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 56 | ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | # generally the HTTP status code | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 56 | has code => ( | |||||||||||||||||||||||||||||||||||||||||
| 129 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 130 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # generally the HTTP status code + message | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 56 | has response => ( | |||||||||||||||||||||||||||||||||||||||||
| 135 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 136 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 56 | has [ qw/ | |||||||||||||||||||||||||||||||||||||||||
| 140 | type | ||||||||||||||||||||||||||||||||||||||||||
| 141 | request_id | ||||||||||||||||||||||||||||||||||||||||||
| 142 | documentation_url | ||||||||||||||||||||||||||||||||||||||||||
| 143 | / ] => ( | ||||||||||||||||||||||||||||||||||||||||||
| 144 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 145 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | has errors => ( | ||||||||||||||||||||||||||||||||||||||||||
| 149 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 150 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 33 | ▶ | coerce => sub { ref( $_[0] ) eq 'ARRAY' ? $_[0] : [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 22 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 56 | ); | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | # error responses are UTF-8 encoded bytes, but we may have been passed a | ||||||||||||||||||||||||||||||||||||||||||
| 156 | # message that has already been decoded. work out which it is before decoding | ||||||||||||||||||||||||||||||||||||||||||
| 157 | # so any failure to decode is reported as is, rather than retrying in the | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # other mode and masking the real error. note a string of characters that is | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # also valid UTF-8 (e.g. "ΓΈ") is ambiguous, and treated as UTF-8 bytes | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 29 | ▶ | sub _decode_json { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_json: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 29 | my ( $json ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 29 | ▶ | my $is_utf8_bytes = $json !~ /[^\x00-\xFF]/ | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
!($json =~ /[^\x00-\xFF]/) && utf8::decode(my $copy = $json)
MC/DC100%2/2
!($json =~ /[^\x00-\xFF]/) && utf8::decode(my $copy = $json)
!($json =~ /[^\x00-\xFF]/)
utf8::decode(my $copy = $json)
Truth table100%3/3
not(A) && B
A= !($json =~ /[^\x00-\xFF]/)B= utf8::decode(my $copy = $json)
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | && utf8::decode( my $copy = $json ); | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 29 | ▶ | return JSON->new->utf8( $is_utf8_bytes ? 1 : 0 )->decode( $json ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | =head2 description | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | An alias to the message attribute. | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | =head2 reasons | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | Returns a list of the C<reason> values from the L</errors>: | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | my @reasons = $Exception->reasons; | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =head2 has_reason | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | Returns true if any of the L</errors> have the given reason: | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | if ( $Exception->has_reason( 'mandate_is_inactive' ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | =head2 conflicting_resource_id | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | Returns the ID of the resource already created with the idempotency key used | ||||||||||||||||||||||||||||||||||||||||||
| 192 | in the request, if the error is an C<idempotent_creation_conflict>. | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | # compatibility with ruby lib | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | ▶ | sub description { shift->message } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 7 | ▶ | sub reasons { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reasons: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 7 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | ▶ | return map { $_->{reason} // () } @{ $self->errors }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_->{"reason"} // ()
MC/DC0%0/2
$_->{"reason"} // ()
$_->{"reason"}
()
Truth table33%1/3
A // B
A= $_->{"reason"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | ▶ | sub has_reason { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_reason: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | my ( $self,$reason ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 4 | return scalar( grep { $_ eq $reason } $self->reasons ); | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | ▶ | sub conflicting_resource_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conflicting_resource_id: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 4 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 4 | foreach my $error ( @{ $self->errors } ) { | |||||||||||||||||||||||||||||||||||||||||
| 213 | 5 | ▶ | next if ( $error->{reason} // '' ) ne 'idempotent_creation_conflict'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$error->{"reason"} // ""
MC/DC0%0/1
$error->{"reason"} // ""
$error->{"reason"}
Truth table50%1/2
A
A= $error->{"reason"}
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 3 | return $error->{links}{conflicting_resource_id}; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | Lee Johnson - C<lee@payprop.com> | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 225 | the same terms as Perl itself. If you would like to contribute documentation, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | features, bug fixes, or anything else then please raise an issue / pull request: | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | https://github.com/payprop/business-gocardless | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 56 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | # vim: ts=4:sw=4:et | ||||||||||||||||||||||||||||||||||||||||||