File Coverage

blib/lib/Business/GoCardless/RedirectFlow.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 30 32 93.7


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   140 use strict;
  19         53  
  19         580  
14 19     19   103 use warnings;
  19         50  
  19         512  
15              
16 19     19   114 use Moo;
  19         55  
  19         128  
17             extends 'Business::GoCardless::PreAuthorization';
18              
19 19     19   8076 use Business::GoCardless::Exception;
  19         71  
  19         675  
20 19     19   8075 use Business::GoCardless::Mandate;
  19         81  
  19         3692  
21              
22             =head1 ATTRIBUTES
23              
24             confirmation_url
25             redirect_url
26             scheme
27             session_token
28             success_redirect_url
29             links
30              
31             =cut
32              
33             has [ qw/
34             confirmation_url
35             redirect_url
36             scheme
37             session_token
38             success_redirect_url
39             links
40             / ] => (
41             is => 'rw',
42             );
43              
44              
45             =head1 AUTHOR
46              
47             Lee Johnson - C
48              
49             This library is free software; you can redistribute it and/or modify it under
50             the same terms as Perl itself. If you would like to contribute documentation,
51             features, bug fixes, or anything else then please raise an issue / pull request:
52              
53             https://github.com/Humanstate/business-gocardless
54              
55             =cut
56              
57             sub cancel {
58 1     1 0 56 Business::GoCardless::Exception->throw({
59             message => "->cancel on a RedirectFlow is not meaningful in the Pro API",
60             });
61             }
62              
63             sub mandate {
64 2     2 0 4058 my ( $self ) = @_;
65              
66 2 100       17 if ( ! $self->links ) {
67 1         9 $self->find_with_client( 'redirect_flows' );
68             }
69              
70             my $Mandate = Business::GoCardless::Mandate->new(
71             client => $self->client,
72             id => $self->links->{mandate}
73 2         29 );
74              
75 2         29 return $Mandate->find_with_client( 'mandates' );
76             }
77              
78             1;
79              
80             # vim: ts=4:sw=4:et