CCAvenue/NonSeamless/Response.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 38 CC 3 SCAR 13.3
CC
3
Cov
0%
_build_is_valid_request
6.0
_build_is_success
6.0
_build_decoded_response
2.0
CRAP 3.8
1 package Net::Payment::CCAvenue::NonSeamless::Response;
2  
3 use Moose;
4 extends 'Net::Payment::CCAvenue';
5  
6  
7 =head1 NAME
8  
9 Net::Payment::CCAvenue::NonSeamless::Response - Reads the returned encoded response!
10  
11 =head1 VERSION
12  
13 Version 0.01
14  
15 =cut
16  
17 our $VERSION = '0.02';
18  
19 =head1 SYNOPSIS
20  
21 CCAvenue billing page (Non-Seamless) - On receiving the authorization status from the bank, CCAvenue sends the response back to your website with the transaction status.
22  
23 Query parameters are <orderNo> and <encResp>
24  
25 use Net::Payment::CCAvenue::NonSeamless::Response;
26  
27 my $foo = Net::Payment::CCAvenue::NonSeamless::Response->new(
28 encryption_key => 'xxxx',
29 access_code => 'xxxx',
30 merchant_id => 'xxxxx',
31 order_no => 'Returned orderNo query param value',
32 enc_response => 'Returned encResp query param value',
33 );
34  
35 # Returns true if payment was success
36 $foo->is_success();
37  
38 =cut
39  
40 =head1 See More
41  
42 =over 2
43  
44 =item L<Net::Payment::CCAvenue>
45 =item L<Net::Payment::CCAvenue::NonSeamless>
46  
47 =head1 Attributes
48  
49 =head2 order_no
50  
51 Order number (C<orderNo>) as query parameter returned from CCAvenue sends to callback url.
52  
53 =head2 enc_response
54  
55 Encrypted response (C<encResp>) as query parameter returned from CCAvenue sends to callback url.
56  
57 =cut
58  
59 has [qw(order_no enc_response)] => (
60 is => 'ro',
61 isa => 'Str',
62 required => 1
63 );
64  
65 =head2 decoded_response
66  
67 Decoded response from CCAvenue.
68  
69 =cut
70  
71 has decoded_response => (
72 is => 'ro',
73 isa => 'Maybe[HashRef]',
74 lazy_build => 1
75 );
76  
77 sub _build_decoded_response {
78 my ($self) = @_;
79 return $self->decrypt_data($self->enc_response);
80 }
81  
82 =head2 is_valid_request
83  
84 Returns C<true> if callback url get the encoded response.
85  
86 =head2 is_success
87  
88 Returns C<true> if payment has been processed successfully and it has bank reciept number.
89  
90 =cut
91  
92 has [ qw(is_valid_request is_success)] => (
93 is => 'ro',
94 isa => 'Bool',
95 lazy_build => 1,
96 );
97  
98 sub _build_is_valid_request {
99 return 0 unless $self->decoded_response;
100 return 1;
101 }
102  
103 sub _build_is_success {
104 return 0 unless $self->bank_receipt_no;
105 return 1;
106 }
107  
108 =head2 response_message
109  
110 Returns response message, could be error message or any other message
111  
112 =head2 bank_receipt_no
113  
114 Returns bank reciept number
115  
116 =head2 tracking_id
117  
118 Returns bank tracking identifier
119  
120 =cut
121  
122 has [ qw(response_message bank_receipt_no tracking_id) ] => (
123 is => 'ro',
124 isa => 'Maybe[Str]',
125 lazy_build => 1,
126 );
127  
128 sub _build_response_message {
129 return $self->decoded_response->{'status_message'};
130 }
131  
132 sub _build_bank_receipt_no {
133 return $self->decoded_response->{'bank_receipt_no'};
134 }
135  
136 sub _build_tracking_id {
137 return $self->decoded_response->{'tracking_id'};
138 }
139  
140 =head1 AUTHOR
141  
142 Rakesh Kumar Shardiwal, C<< <rakesh.shardiwal at gmail.com> >>
143  
144 =head1 BUGS
145  
146 Please report any bugs or feature requests to C<bug-net-payment-ccavenue-nonseamless at rt.cpan.org>, or through
147 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Payment-CCAvenue-NonSeamless>. I will be notified, and then you'll
148 automatically be notified of progress on your bug as I make changes.
149  
150 =head1 SUPPORT
151  
152 You can find documentation for this module with the perldoc command.
153  
154 perldoc Net::Payment::CCAvenue::NonSeamless
155  
156  
157 You can also look for information at:
158  
159 =over 4
160  
161 =item * RT: CPAN's request tracker (report bugs here)
162  
163 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Payment-CCAvenue-NonSeamless>
164  
165 =item * AnnoCPAN: Annotated CPAN documentation
166  
167 L<http://annocpan.org/dist/Net-Payment-CCAvenue-NonSeamless>
168  
169 =item * CPAN Ratings
170  
171 L<http://cpanratings.perl.org/d/Net-Payment-CCAvenue-NonSeamless>
172  
173 =item * Search CPAN
174  
175 L<http://search.cpan.org/dist/Net-Payment-CCAvenue-NonSeamless/>
176  
177 =back
178  
179  
180 =head1 ACKNOWLEDGEMENTS
181  
182  
183 =head1 LICENSE AND COPYRIGHT
184  
185 Copyright 2021 Rakesh Kumar Shardiwal.
186  
187 This program is free software; you can redistribute it and/or modify it
188 under the terms of the the Artistic License (2.0). You may obtain a
189 copy of the full license at:
190  
191 L<http://www.perlfoundation.org/artistic_license_2_0>
192  
193 Any use, modification, and distribution of the Standard or Modified
194 Versions is governed by this Artistic License. By using, modifying or
195 distributing the Package, you accept this license. Do not use, modify,
196 or distribute the Package, if you do not accept this license.
197  
198 If your Modified Version has been derived from a Modified Version made
199 by someone other than you, you are nevertheless required to ensure that
200 your Modified Version complies with the requirements of this license.
201  
202 This license does not grant you the right to use any trademark, service
203 mark, tradename, or logo of the Copyright Holder.
204  
205 This license includes the non-exclusive, worldwide, free-of-charge
206 patent license to make, have made, use, offer to sell, sell, import and
207 otherwise transfer the Package with respect to any patent claims
208 licensable by the Copyright Holder that are necessarily infringed by the
209 Package. If you institute patent litigation (including a cross-claim or
210 counterclaim) against any party alleging that the Package constitutes
211 direct or contributory patent infringement, then this Artistic License
212 to you shall terminate on the date that such litigation is filed.
213  
214 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
215 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
216 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
217 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
218 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
219 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
220 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
221 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
222  
223  
224 =cut
225  
226 1; # End of Net::Payment::CCAvenue::NonSeamless