File Coverage

blib/lib/Business/GoCardless/RedirectFlow.pm
Criterion Covered Total %
statement 21 21 100.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 31 34 91.1


line stmt bran cond sub pod time code
1             package Business::GoCardless::RedirectFlow;
2              
3             =head1 NAME
4              
5             Business::GoCardless::RedirectFlow
6              
7             =head1 DESCRIPTION
8              
9             A class for a gocardless redirect flow, extends L
10              
11             =cut
12              
13 19     19   125 use strict;
  19         41  
  19         884  
14 19     19   127 use warnings;
  19         46  
  19         1204  
15              
16 19     19   104 use Moo;
  19         45  
  19         115  
17             extends 'Business::GoCardless::PreAuthorization';
18              
19 19     19   10692 use Business::GoCardless::Exception;
  19         56  
  19         648  
20 19     19   9397 use Business::GoCardless::Mandate;
  19         70  
  19         4829  
21              
22             =head1 ATTRIBUTES
23              
24             confirmation_url
25             redirect_url
26             scheme
27             session_token
28             success_redirect_url
29             links
30             metadata
31              
32             =cut
33              
34             has [ qw/
35             confirmation_url
36             redirect_url
37             scheme
38             session_token
39             success_redirect_url
40             links
41             metadata
42             / ] => (
43             is => 'rw',
44             );
45              
46              
47             =head1 AUTHOR
48              
49             Lee Johnson - C
50              
51             This library is free software; you can redistribute it and/or modify it under
52             the same terms as Perl itself. If you would like to contribute documentation,
53             features, bug fixes, or anything else then please raise an issue / pull request:
54              
55             https://github.com/Humanstate/business-gocardless
56              
57             =cut
58              
59             sub cancel {
60 1     1 0 64 Business::GoCardless::Exception->throw({
61             message => "->cancel on a RedirectFlow is not meaningful in the Pro API",
62             });
63             }
64              
65             sub mandate {
66 2     2 0 2995 my ( $self ) = @_;
67              
68 2 100       15 if ( ! $self->links ) {
69 1         16 $self->find_with_client( 'redirect_flows' );
70             }
71              
72             my $Mandate = Business::GoCardless::Mandate->new(
73             client => $self->client,
74             id => $self->links ? $self->links->{mandate} : undef,
75 2 50       42 );
76              
77 2         34 return $Mandate->find_with_client( 'mandates' );
78             }
79              
80             1;
81              
82             # vim: ts=4:sw=4:et