| 1 | package Business::TrueLayer::Mandate; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Business::TrueLayer::Mandate - class representing a mandate | ||||||||||
| 6 | as used in the TrueLayer v3 API. | ||||||||||
| 7 | |||||||||||
| 8 | Business::TrueLayer::Mandate uses the Status role. | ||||||||||
| 9 | |||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||
| 11 | |||||||||||
| 12 | my $Mandate = Business::TrueLayer::Mandate->new( | ||||||||||
| 13 | type => ... | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | =cut | ||||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 2 | ▶ | use feature qw/ signatures postderef /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 2 | extends 'Business::TrueLayer::Request'; | |||||||||
| 24 | 2 | with 'Business::TrueLayer::Role::Status'; | |||||||||
| 25 | 2 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 2 | ▶ | no warnings qw/ experimental::signatures experimental::postderef /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 2 | with 'Business::TrueLayer::Types::Beneficiary'; | |||||||||
| 29 | 2 | with 'Business::TrueLayer::Types::Remitter'; | |||||||||
| 30 | 2 | with 'Business::TrueLayer::Types::User'; | |||||||||
| 31 | |||||||||||
| 32 | 2 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | |||||||||||
| 34 | =head1 ATTRIBUTES | ||||||||||
| 35 | |||||||||||
| 36 | =over | ||||||||||
| 37 | |||||||||||
| 38 | =item id (Str) | ||||||||||
| 39 | |||||||||||
| 40 | =item type (Str) | ||||||||||
| 41 | |||||||||||
| 42 | =item beneficiary | ||||||||||
| 43 | |||||||||||
| 44 | A L<Business::TrueLayer::Beneficiary> object. Hash refs will be coerced. | ||||||||||
| 45 | |||||||||||
| 46 | =item user | ||||||||||
| 47 | |||||||||||
| 48 | A L<Business::TrueLayer::User> object. Hash refs will be coerced. | ||||||||||
| 49 | |||||||||||
| 50 | =back | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||
| 53 | |||||||||||
| 54 | # the mandate JSON, as per the TrueLayer docs, contains a key | ||||||||||
| 55 | # "mandate" that has all the stuff in it, rather than the stuff | ||||||||||
| 56 | # being at the top level - this is annoying, so pull it out and | ||||||||||
| 57 | # handle it at the top level | ||||||||||
| 58 | 4 | ▶ | sub BUILDARGS { | ||||||||
|
Subroutine
BUILDARGS: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 59 | 4 | my ( $self,$args ) = @_; | |||||||||
| 60 | |||||||||||
| 61 | my %mandate = $args->{mandate} | ||||||||||
| 62 | ? ( $args->{mandate}->%* ) | ||||||||||
| 63 | 4 | ▶ | : ( $args->%* ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | ; | ||||||||||
| 65 | |||||||||||
| 66 | 4 | return { %mandate,%{ $args } }; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 2 | enum MandateType => [ qw( sweeping commercial direct_debit ) ]; | |||||||||
| 70 | |||||||||||
| 71 | 2 | has [ qw/ type / ] => ( | |||||||||
| 72 | is => 'ro', | ||||||||||
| 73 | isa => 'MandateType', | ||||||||||
| 74 | required => 1, | ||||||||||
| 75 | ); | ||||||||||
| 76 | |||||||||||
| 77 | 2 | has [ qw/ status id / ] => ( | |||||||||
| 78 | is => 'ro', | ||||||||||
| 79 | isa => 'Str', | ||||||||||
| 80 | required => 0, | ||||||||||
| 81 | ); | ||||||||||
| 82 | |||||||||||
| 83 | 2 | has [ qw/ currency / ] => ( | |||||||||
| 84 | is => 'ro', | ||||||||||
| 85 | isa => 'Str', | ||||||||||
| 86 | required => 1, | ||||||||||
| 87 | ); | ||||||||||
| 88 | |||||||||||
| 89 | 2 | has remitter => ( | |||||||||
| 90 | is => 'ro', | ||||||||||
| 91 | isa => 'Business::TrueLayer::Remitter', | ||||||||||
| 92 | coerce => 1, | ||||||||||
| 93 | required => 1, | ||||||||||
| 94 | ); | ||||||||||
| 95 | |||||||||||
| 96 | =head1 SEE ALSO | ||||||||||
| 97 | |||||||||||
| 98 | L<Business::TrueLayer::User> | ||||||||||
| 99 | |||||||||||
| 100 | L<Business::TrueLayer::Role::Status> | ||||||||||
| 101 | |||||||||||
| 102 | =cut | ||||||||||
| 103 | |||||||||||
| 104 | 2 | 1; | |||||||||