-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated Kavorka signature to remove non-functional argument types * removed Net::Stripe::Customer and HashRef for customer, as neither form was being serialized correctly for passing to the API call * removed Net::Stripe::Card and Net::Stripe::Token for card, as neither form was being serialized correctly for passing to the API call * added in-method validation and unit tests for the different combinations of the allowed argument types * updated and reorganized failing unit tests * closes <#94> and <#137>
- Loading branch information
Showing
4 changed files
with
226 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package Net::Stripe::TypeConstraints; | ||
|
||
use strict; | ||
use Moose::Util::TypeConstraints qw/subtype as where message/; | ||
|
||
# ABSTRACT: Custom Moose TypeConstraints for Net::Stripe object attributes and parameters | ||
|
||
subtype 'StripeTokenId', | ||
as 'Str', | ||
where { | ||
/^tok_.+/ | ||
}, | ||
message { | ||
sprintf( "Value '%s' must be a token id string of the form tok_.+", $_ ); | ||
}; | ||
|
||
subtype 'StripeCardId', | ||
as 'Str', | ||
where { | ||
/^card_.+/ | ||
}, | ||
message { | ||
sprintf( "Value '%s' must be a card id string of the form card_.+", $_ ); | ||
}; | ||
|
||
subtype 'StripeCustomerId', | ||
as 'Str', | ||
where { | ||
/^cus_.+/ | ||
}, | ||
message { | ||
sprintf( "Value '%s' must be a customer id string of the form cus_.+", $_ ); | ||
}; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters