line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Stripe::TypeConstraints; |
2
|
|
|
|
|
|
|
$Net::Stripe::TypeConstraints::VERSION = '0.42'; |
3
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
93
|
|
4
|
2
|
|
|
2
|
|
14
|
use Moose::Util::TypeConstraints qw/subtype as where message enum/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
28
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Custom Moose TypeConstraints for Net::Stripe object attributes and parameters |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
subtype 'StripeTokenId', |
9
|
|
|
|
|
|
|
as 'Str', |
10
|
|
|
|
|
|
|
where { |
11
|
|
|
|
|
|
|
/^tok_.+/ |
12
|
|
|
|
|
|
|
}, |
13
|
|
|
|
|
|
|
message { |
14
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a token id string of the form tok_.+", $_ ); |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
subtype 'StripeCardId', |
18
|
|
|
|
|
|
|
as 'Str', |
19
|
|
|
|
|
|
|
where { |
20
|
|
|
|
|
|
|
/^card_.+/ |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
message { |
23
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a card id string of the form card_.+", $_ ); |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
subtype 'StripeCustomerId', |
27
|
|
|
|
|
|
|
as 'Str', |
28
|
|
|
|
|
|
|
where { |
29
|
|
|
|
|
|
|
/^cus_.+/ |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
message { |
32
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a customer id string of the form cus_.+", $_ ); |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
subtype 'StripeResourceObject', |
36
|
|
|
|
|
|
|
as 'Object', |
37
|
|
|
|
|
|
|
where { |
38
|
|
|
|
|
|
|
( $_->isa( 'Net::Stripe::Resource' ) || $_->isa( 'Net::Stripe::Card' ) ) && $_->can( 'form_fields' ) |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
message { |
41
|
|
|
|
|
|
|
sprintf( "Value '%s' must be an object that inherits from Net::Stripe::Resource with a 'form_fields' method", $_ ); |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
subtype 'StripeSourceId', |
45
|
|
|
|
|
|
|
as 'Str', |
46
|
|
|
|
|
|
|
where { |
47
|
|
|
|
|
|
|
/^src_.+/ |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
message { |
50
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a source id string of the form src_.+", $_ ); |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# ach_credit_transfer, ach_debit, alipay, bancontact, card, card_present, eps, |
54
|
|
|
|
|
|
|
# giropay, ideal, multibanco, klarna, p24, sepa_debit, sofort, three_d_secure, |
55
|
|
|
|
|
|
|
# or wechat |
56
|
|
|
|
|
|
|
enum 'StripeSourceType' => [qw/ ach_credit_transfer card /]; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
enum 'StripeSourceUsage' => [qw/ reusable single_use /]; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
enum 'StripeSourceFlow' => [qw/ redirect receiver code_verification none /]; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
subtype 'EmptyStr', |
63
|
|
|
|
|
|
|
as 'Str', |
64
|
|
|
|
|
|
|
where { |
65
|
|
|
|
|
|
|
$_ eq '' |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
message { |
68
|
|
|
|
|
|
|
sprintf( "Value '%s' must be an empty string", $_ ); |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
subtype 'StripeProductId', |
72
|
|
|
|
|
|
|
as 'Str', |
73
|
|
|
|
|
|
|
where { |
74
|
|
|
|
|
|
|
/^prod_.+/ |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
message { |
77
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a product id string of the form prod_.+", $_ ); |
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
enum 'StripeProductType' => [qw/ good service /]; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
subtype 'StripeAPIVersion', |
83
|
|
|
|
|
|
|
as 'Str', |
84
|
|
|
|
|
|
|
where { |
85
|
|
|
|
|
|
|
/^\d{4}-\d{2}-\d{2}$/ |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
message { |
88
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a Stripe API version string of the form yyyy-mm-dd", |
89
|
|
|
|
|
|
|
$_, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
subtype 'StripePaymentMethodId', |
94
|
|
|
|
|
|
|
as 'Str', |
95
|
|
|
|
|
|
|
where { |
96
|
|
|
|
|
|
|
/^pm_.+/ |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
message { |
99
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a payment method id string of the form pm_.+", $_ ); |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
subtype 'StripePaymentIntentId', |
103
|
|
|
|
|
|
|
as 'Str', |
104
|
|
|
|
|
|
|
where { |
105
|
|
|
|
|
|
|
/^pi_.+/ |
106
|
|
|
|
|
|
|
}, |
107
|
|
|
|
|
|
|
message { |
108
|
|
|
|
|
|
|
sprintf( "Value '%s' must be a payment intent id string of the form pi_.+", $_ ); |
109
|
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
enum StripePaymentMethodType => [qw/ card sepia_debit ideal /]; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
enum StripeCaptureMethod => [qw/ automatic manual /]; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
enum StripeConfirmationMethod => [qw/ automatic manual /]; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
enum StripeCancellationReason => [qw/ duplicate fraudulent requested_by_customer abandoned /]; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
enum StripeSetupFutureUsage => [qw/ on_session off_session /]; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=pod |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 NAME |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Net::Stripe::TypeConstraints - Custom Moose TypeConstraints for Net::Stripe object attributes and parameters |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 VERSION |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
version 0.42 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHORS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Luke Closs |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Rusty Conover |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=back |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Prime Radiant, Inc., (c) copyright 2014 Lucky Dinosaur LLC. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
154
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |