| 1 | package Business::TrueLayer::Role::Status; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | Business::TrueLayer::Role::Status | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | A role for attributes and behviour related to status | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | =cut | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 4 | ▶ | use feature qw/ signatures postderef /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 4 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 4 | ▶ | no warnings qw/ experimental::signatures experimental::postderef /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 4 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =head1 ATTRIBUTES | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | =over | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =item status (Str) | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | =back | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =cut | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 4 | has [ qw/ status / ] => ( | |||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||
| 32 | isa => 'Str', | ||||||||||||||||||||
| 33 | required => 1, | ||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | =head2 METHODS | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =head2 authorization_required | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =head2 authorizing | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =head2 authorized | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =head2 executed | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | =head2 settled | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head2 failed | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | Check if the resource is at a current state: | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | if ( $Resouce->authorizing ) { | ||||||||||||||||||||
| 53 | ... | ||||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 1 | ▶ | sub authorization_required { | ||||||||||||||||||
|
Subroutine
authorization_required: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 59 | 1 | shift->_is_status( 'authorization_required' ); | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 1 | ▶ | sub authorizing { shift->_is_status( 'authorizing' ); } | ||||||||||||||||||
|
Subroutine
authorizing: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 63 | 3 | ▶ | sub authorized { shift->_is_status( 'authorized' ); } | ||||||||||||||||||
|
Subroutine
authorized: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 64 | 1 | ▶ | sub executed { shift->_is_status( 'executed' ); } | ||||||||||||||||||
|
Subroutine
executed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 65 | 0 | ▶ | sub revoked { shift->_is_status( 'revoked' ); } | ||||||||||||||||||
|
Subroutine
revoked: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 66 | 1 | ▶ | sub settled { shift->_is_status( 'settled' ); } | ||||||||||||||||||
|
Subroutine
settled: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 67 | 1 | ▶ | sub failed { shift->_is_status( 'failed' ); } | ||||||||||||||||||
|
Subroutine
failed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | ▶ | sub remitter_changed { | ||||||||||||||||||
|
Subroutine
remitter_changed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 70 | 0 | shift->_is_status( 'remitter_changed' ); | |||||||||||||||||||
| 71 | } | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 8 | ▶ | sub _is_status ( $self,$status ) { | ||||||||||||||||||
|
Subroutine
_is_status: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 74 | 8 | ▶ | return ( $self->status // '' ) eq $status ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->status // ""
MC/DC100%1/1
$self->status // ""
$self->status
Truth table100%2/2
A
A= $self->status
| |||||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 4 | 1; | |||||||||||||||||||