use
feature
qw/ signatures postderef /
;
no
warnings
qw/ experimental::signatures experimental::postderef /
;
has
[
qw/ id currency account_holder_name /
] => (
is
=>
'ro'
,
isa
=>
'Str'
,
required
=> 1,
);
has
[
qw/
available_balance_in_minor
current_balance_in_minor
/
] => (
is
=>
'ro'
,
isa
=>
'Num'
,
required
=> 1,
);
subtype
'AccountIdentifier'
=> as
'Object'
=> where {
$_
->isa(
'Business::TrueLayer::MerchantAccount::Identifier'
)
}
;
coerce
'AccountIdentifier'
=> from
'HashRef'
=> via {
Business::TrueLayer::MerchantAccount::Identifier->new( %{
$_
} );
}
;
subtype
'AccountIdentifiers'
=> as
'ArrayRef[AccountIdentifier]'
;
coerce
'AccountIdentifiers'
=> from
'ArrayRef'
=> via {
my
@AccountIdentifiers
;
foreach
my
$item
(
$_
->@* ) {
push
(
@AccountIdentifiers
,
Business::TrueLayer::MerchantAccount::Identifier->new( %{
$item
} )
);
}
return
\
@AccountIdentifiers
;
}
;
has
'account_identifiers'
=> (
is
=>
'ro'
,
isa
=>
'AccountIdentifiers'
,
coerce
=> 1,
required
=> 1,
);
1;