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