| 1 | package Net::Payjp; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use LWP::Protocol::https; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use HTTP::Request::Common; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use List::Util qw/min/; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use POSIX qw/floor/; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 15 | ▶ | use Net::Payjp::Account; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 15 | ▶ | use Net::Payjp::Charge; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 15 | ▶ | use Net::Payjp::Customer; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 15 | ▶ | use Net::Payjp::Plan; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 15 | ▶ | use Net::Payjp::Subscription; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 15 | ▶ | use Net::Payjp::Token; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 15 | ▶ | use Net::Payjp::Transfer; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 15 | ▶ | use Net::Payjp::Event; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 15 | ▶ | use Net::Payjp::Tenant; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 15 | ▶ | use Net::Payjp::TenantTransfer; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 15 | ▶ | use Net::Payjp::Statement; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | ▶ | use Net::Payjp::Balance; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 15 | ▶ | use Net::Payjp::Term; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 15 | ▶ | use Net::Payjp::Object; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 15 | ▶ | use Net::Payjp::ThreeDSecureRequest; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # ABSTRACT: API client for pay.jp | ||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # Create charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | my $payjp = Net::Payjp->new(api_key => $API_KEY); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | my $res = $payjp->charge->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | card => 'token_id_by_Checkout_or_payjp.js', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | amount => 3500, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | currency => 'jpy', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | if(my $e = $res->error){ | ||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | print "Error; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | print $e->{message}."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # Id of charge. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | print $res->id; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # Retrieve a charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $payjp->id($res->id); # Set id of charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | $res = $payjp->charge->retrieve; # or $payjp->charge->retrieve($res->id); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | This module is a wrapper around the Pay.jp HTTP API.Methods are generally named after the object name and the acquisition method. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | This method returns json objects for responses from the API. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head1 new Method | ||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | This creates a new Payjp api object. The following parameters are accepted: | ||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | =item api_key | ||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | This is required. You get this from your Payjp Account settings. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 15 | our $VERSION = '0.4.0'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 15 | our $API_BASE = 'https://api.pay.jp'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 15 | our $INITIAL_DELAY_SEC = 2; | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 15 | our $MAX_DELAY_SEC = 32; | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 138 | ▶ | sub new{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 138 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 138 | bless{__PACKAGE__->_init(@_)},$self; | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 138 | ▶ | sub _init{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 138 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 138 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | return( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | api_key => $p{api_key}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | id => $p{id}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | api_base => $API_BASE, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | max_retry => $p{max_retry} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | initial_delay => $p{initial_delay} || $INITIAL_DELAY_SEC, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 138 | ▶ | max_delay => $p{max_delay} || $MAX_DELAY_SEC, | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%6/8
$p{'max_retry'} || 0
$p{'initial_delay'} || $Net::Payjp::INITIAL_DELAY_SEC
$p{'max_delay'} || $Net::Payjp::MAX_DELAY_SEC
MC/DC100%1/1
$p{'max_retry'} || 0
$p{'max_retry'}
MC/DC0%0/2
$p{'initial_delay'} || $Net::Payjp::INITIAL_DELAY_SEC
$p{'initial_delay'}
$Net::Payjp::INITIAL_DELAY_SEC
MC/DC0%0/2
$p{'max_delay'} || $Net::Payjp::MAX_DELAY_SEC
$p{'max_delay'}
$Net::Payjp::MAX_DELAY_SEC
Truth table100%2/2
A
A= $p{'max_retry'}
Truth table66%2/3
A || B
A= $p{'initial_delay'}B= $Net::Payjp::INITIAL_DELAY_SEC
Truth table66%2/3
A || B
A= $p{'max_delay'}B= $Net::Payjp::MAX_DELAY_SEC
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 82 | ▶ | sub api_key{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api_key: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 82 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 82 | ▶ | $self->{api_key} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 82 | return $self->{api_key}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 71 | ▶ | sub api_base{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api_base: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 71 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 71 | ▶ | $self->{api_base} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 71 | return $self->{api_base}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 131 | ▶ | sub id{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 131 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 131 | ▶ | $self->{id} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 131 | return $self->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =head1 Charge Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Create a new charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | L<https://pay.jp/docs/api/#支払いを作成> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $payjp->charge->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | card => 'tok_76e202b409f3da51a0706605ac81', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | amount => 3500, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | currency => 'jpy', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | description => 'yakiimo', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | Retrieve a charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | L<https://pay.jp/docs/api/#支払いを情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | $payjp->charge->retrieve('ch_fa990a4c10672a93053a774730b0a'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | =head2 save | ||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | Update a charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | L<https://pay.jp/docs/api/#支払いを情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | $payjp->id('ch_fa990a4c10672a93053a774730b0a'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | $payjp->charge->save(description => 'update description.'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | =head2 refund | ||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | Refund a charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | L<https://pay.jp/docs/api/#返金する> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | $payjp->id('ch_fa990a4c10672a93053a774730b0a'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $payjp->charge->refund(amount => 1000, refund_reason => 'test.'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | =head2 capture | ||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | Capture a charge | ||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | L<https://pay.jp/docs/api/#支払い処理を確定する> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $payjp->id('ch_fa990a4c10672a93053a774730b0a'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | $payjp->charge->capture(amount => 2000); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | Returns the charge list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | L<https://pay.jp/docs/api/#支払いリストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $payjp->charge->all("limit" => 2, "offset" => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | =head1 Customer Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | Create a cumtomer | ||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | L<https://pay.jp/docs/api/#顧客を作成> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $payjp->customer->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | "description" => "test", | ||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | Retrieve a customer | ||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | L<https://pay.jp/docs/api/#顧客情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $payjp->customer->retrieve('cus_121673955bd7aa144de5a8f6c262'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | =head2 save | ||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | Update a customer | ||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | L<https://pay.jp/docs/api/#顧客情報を更新> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $payjp->id('cus_121673955bd7aa144de5a8f6c262'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | $payjp->customer->save(email => 'test@test.jp'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | =head2 delete | ||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Delete a customer | ||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | L<https://pay.jp/docs/api/#顧客を削除> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | $payjp->id('cus_121673955bd7aa144de5a8f6c262'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | $payjp->customer->delete; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | Returns the customer list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | L<https://pay.jp/docs/api/#顧客リストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $res = $payjp->customer->all(limit => 2, offset => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 13 | ▶ | sub charge{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charge: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 13 | return Net::Payjp::Charge->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | =head1 Cutomer card Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | Returns a customer's card object | ||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | my $card = $payjp->customer->card('cus_4df4b5ed720933f4fb9e28857517'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | Create a customer's card | ||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | L<https://pay.jp/docs/api/#顧客のカードを作成> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $card->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | card => 'tok_76e202b409f3da51a0706605ac81' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | Retrieve a customer's card | ||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | L<https://pay.jp/docs/api/#顧客のカード情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | $card->retrieve('car_f7d9fa98594dc7c2e42bfcd641ff'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | =head2 save | ||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | Update a customer's card | ||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | L<https://pay.jp/docs/api/#顧客のカードを更新> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | $card->id('car_f7d9fa98594dc7c2e42bfcd641ff'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | $card->save(exp_year => "2026", exp_month => "05", name => 'test'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =head2 delete | ||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | Delete a customer's card | ||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | L<https://pay.jp/docs/api/#顧客のカードを削除> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $card->id('car_f7d9fa98594dc7c2e42bfcd641ff'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | $card->delete; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | Returns the customer's card list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | L<https://pay.jp/docs/api/#顧客のカードリストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | $card->all(limit => 2, offset => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | =head1 Customer subscription Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Returns a customer's subscription object | ||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | my $subscription = $payjp->customer->subscription('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | Retrieve a customer's subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | L<https://pay.jp/docs/api/#顧客の定期課金情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | $subscription->retrieve('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Returns the customer's subscription list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | L<https://pay.jp/docs/api/#顧客の定期課金リストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | $subscription->all(limit => 1, offset => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 12 | ▶ | sub customer{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
customer: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 12 | return Net::Payjp::Customer->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | =head1 Plan Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Create a plan | ||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | L<https://pay.jp/docs/api/#プランを作成> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | $payjp->plan->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | amount => 500, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | currency => "jpy", | ||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | interval => "month", | ||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | trial_days => 30, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | name => 'test_plan' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | Retrieve a plan | ||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | L<https://pay.jp/docs/api/#プラン情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | $payjp->plan->retrieve('pln_45dd3268a18b2837d52861716260'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | =head2 save | ||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | Update a plan | ||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | L<https://pay.jp/docs/api/#プランを更新> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | $payjp->id('pln_45dd3268a18b2837d52861716260'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | $payjp->plan->save(name => 'NewPlan'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | =head2 delete | ||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | Delete a plan | ||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | L<https://pay.jp/docs/api/#プランを削除> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | $payjp->id('pln_45dd3268a18b2837d52861716260'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | $payjp->plan->delete; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | Returns the plan list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | L<https://pay.jp/docs/api/#プランリストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | $payjp->plan->all("limit" => 5, "offset" => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 5 | ▶ | sub plan{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plan: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 5 | return Net::Payjp::Plan->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | =head1 Subscription Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | Create a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | L<https://pay.jp/docs/api/#定期課金を作成> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | $payjp->subscription->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | customer => 'cus_4df4b5ed720933f4fb9e28857517', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | plan => 'pln_9589006d14aad86aafeceac06b60' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | Retrieve a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | L<https://pay.jp/docs/api/#定期課金情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | $payjp->subscription->retrieve('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | =head2 save | ||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | Update a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | L<https://pay.jp/docs/api/#定期課金を更新> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | $payjp->id('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | $payjp->subscription->save(trial_end => 1473911903); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | =head2 pause | ||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | Pause a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | L<https://pay.jp/docs/api/#定期課金を停止> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | $payjp->id('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | $payjp->subscription->pause; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | =head2 resume | ||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | Resume a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | L<https://pay.jp/docs/api/#定期課金を再開> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | $payjp->id('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | $payjp->subscription->resume; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | =head2 cancel | ||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | Cancel a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | L<https://pay.jp/docs/api/#定期課金をキャンセル> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | $payjp->id('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | $payjp->subscription->cancel; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | =head2 delete | ||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | Delete a subscription | ||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | L<https://pay.jp/docs/api/#定期課金を削除> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | $payjp->id('sub_567a1e44562932ec1a7682d746e0'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | $payjp->subscription->delete; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | Returns the subscription list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | L<https://pay.jp/docs/api/#定期課金のリストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | $payjp->subscription->all(limit => 3, offset => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 9 | ▶ | sub subscription{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subscription: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 9 | return Net::Payjp::Subscription->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | =head1 Token Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | Retrieve a token | ||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | L<https://pay.jp/docs/api/#トークン情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | $payjp->token->retrieve('tok_eff34b780cbebd61e87f09ecc9c6'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | =head2 tds_finish | ||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | Finish 3D-Secure flow of token | ||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | L<https://pay.jp/docs/api/#%E3%83%88%E3%83%BC%E3%82%AF%E3%83%B3%E3%81%AB%E5%AF%BE%E3%81%99%E3%82%8B3d%E3%82%BB%E3%82%AD%E3%83%A5%E3%82%A2%E3%83%95%E3%83%AD%E3%83%BC%E3%82%92%E5%AE%8C%E4%BA%86%E3%81%99%E3%82%8B> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | $payjp->id('tok_xxxxxx'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | $payjp->token->tds_finish(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 10 | ▶ | sub token{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
token: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 10 | return Net::Payjp::Token->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | =head1 Transfer Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | Retrieve a transfer | ||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | L<https://pay.jp/docs/api/#入金情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | $payjp->transfer->retrieve('tr_8f0c0fe2c9f8a47f9d18f03959ba1'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | Returns the transfer list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | L<https://pay.jp/docs/api/#入金リストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | $payjp->transfer->all("limit" => 3, offset => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | =head2 charges | ||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | Returns the charge list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | L<https://pay.jp/docs/api/#入金の内訳を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | $payjp->transfer->charges( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | limit => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | offset => 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 16 | ▶ | sub transfer{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transfer: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 16 | return Net::Payjp::Transfer->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | =head1 ThreeDSecureRequest Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | =head2 create | ||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | Create a three_d_secure_request | ||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | L<https://pay.jp/docs/api/#3d%E3%82%BB%E3%82%AD%E3%83%A5%E3%82%A2%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%82%92%E4%BD%9C%E6%88%90> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | $payjp->three_d_secure_request->create( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | "resource_id" => "car_xxxx", | ||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | Retrieve a three_d_secure_request | ||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | L<https://pay.jp/docs/api/#3d%E3%82%BB%E3%82%AD%E3%83%A5%E3%82%A2%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E6%83%85%E5%A0%B1%E3%82%92%E5%8F%96%E5%BE%97> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | $payjp->three_d_secure_request->retrieve('tdsr_xxxx'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | Returns the three_d_secure_request list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | L<https://pay.jp/docs/api/#3d%E3%82%BB%E3%82%AD%E3%83%A5%E3%82%A2%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%83%AA%E3%82%B9%E3%83%88%E3%82%92%E5%8F%96%E5%BE%97> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | $res = $payjp->three_d_secure_request->all(limit => 2, offset => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 3 | ▶ | sub three_d_secure_request{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
three_d_secure_request: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 3 | return Net::Payjp::ThreeDSecureRequest->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | =head1 Event Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | Retrieve a event | ||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | L<https://pay.jp/docs/api/#イベント情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | $res = $payjp->event->retrieve('evnt_2f7436fe0017098bc8d22221d1e'); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | =head2 all | ||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | Returns the event list | ||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | L<https://pay.jp/docs/api/#イベントリストを取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | $payjp->event->all(limit => 10, offset => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 12 | ▶ | sub event{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
event: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 12 | return Net::Payjp::Event->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | =head1 Account Methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | =head2 retrieve | ||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | Retrieve a account | ||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | L<https://pay.jp/docs/api/#アカウント情報を取得> | ||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | $payjp->account->retrieve; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 9 | ▶ | sub account{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
account: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 9 | return Net::Payjp::Account->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 5 | ▶ | sub tenant{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tenant: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 5 | return Net::Payjp::Tenant->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 8 | ▶ | sub tenant_transfer{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tenant_transfer: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 8 | return Net::Payjp::TenantTransfer->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 4 | ▶ | sub statement{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
statement: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 4 | return Net::Payjp::Statement->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 7 | ▶ | sub balance{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
balance: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 7 | return Net::Payjp::Balance->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 7 | ▶ | sub term{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
term: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 7 | return Net::Payjp::Term->new(%$self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 78 | ▶ | sub _request{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_request: called CC=16 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 78 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 78 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 78 | my $url = $p{url}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 78 | ▶ | my $method = $p{method} || 'GET'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$p{'method'} || 'GET'
MC/DC100%1/1
$p{'method'} || 'GET'
$p{'method'}
Truth table100%2/2
A
A= $p{'method'}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 78 | ▶ | my $retry = $p{retry} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$p{'retry'} || 0
MC/DC100%1/1
$p{'retry'} || 0
$p{'retry'}
Truth table100%2/2
A
A= $p{'retry'}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 78 | my $req; | |||||||||||||||||||||||||||||||||||||||||||||||
| 613 | my $with_param; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 78 | ▶ | if(ref $p{param} eq 'HASH' and keys %{$p{param}} > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $p{"param"} eq "HASH" and keys %{$p{"param"};} > 0
MC/DC100%2/2
ref $p{"param"} eq "HASH" and keys %{$p{"param"};} > 0
ref $p{"param"} eq "HASH"
keys %{$p{"param"};} > 0
Truth table100%3/3
A and B
A= ref $p{"param"} eq "HASH"B= keys %{$p{"param"};} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 27 | $with_param = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 78 | ▶ | if($with_param and ($method eq 'GET' or $method eq 'DELETE')){ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$with_param and $method eq "GET" || $method eq "DELETE"
$method eq "GET" or $method eq "DELETE"
MC/DC100%3/3
$with_param and $method eq "GET" || $method eq "DELETE"
$with_param
$method eq "GET"
$method eq "DELETE"
Truth table100%4/4
A and B or C
A= $with_paramB= $method eq "GET"C= $method eq "DELETE"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 17 | my @param; | |||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 17 | foreach my $k(keys %{$p{param}}){ | |||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 17 | push(@param, "$k=".$p{param}->{$k}); | |||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 17 | $url .= '?'.join("&", @param); | |||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 78 | ▶ | if($method eq 'POST' and $with_param){ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$method eq "POST" and $with_param
MC/DC100%2/2
$method eq "POST" and $with_param
$method eq "POST"
$with_param
Truth table100%3/3
A and B
A= $method eq "POST"B= $with_param
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 10 | $req = POST($url, $self->_api_param(param => $p{param})); | |||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 68 | $req = new HTTP::Request $method => $url; | |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 78 | $req->authorization_basic($self->api_key, ''); | |||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 78 | my $ua = LWP::UserAgent->new(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 78 | $ua->timeout(30); | |||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 78 | my $client = { | |||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 'bindings_version' => $VERSION, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 'lang' => 'perl', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 'lang_version' => $], | ||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 'publisher' => 'payjp', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 'uname' => $^O | ||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 78 | $ua->default_header( | |||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 'User-Agent' => 'Payjp/v1 PerlBindings/'.$VERSION, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 'X-Payjp-Client-User-Agent' => JSON->new->encode($client), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 78 | my $res = $ua->request($req); | |||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 78 | my $code = $res->code; | |||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 78 | ▶ | if($code == 200){ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 71 | my $obj = $self->_to_object(JSON->new->decode($res->content)); | |||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 71 | ▶ | $self->id($obj->id) if $obj->id; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 71 | return $obj; | |||||||||||||||||||||||||||||||||||||||||||||||
| 651 | ▶ | } elsif($code == 429 and $retry < $self->{max_retry}){ | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$code == 429 and $retry < $self->{"max_retry"}
MC/DC100%2/2
$code == 429 and $retry < $self->{"max_retry"}
$code == 429
$retry < $self->{"max_retry"}
Truth table100%3/3
A and B
A= $code == 429B= $retry < $self->{"max_retry"}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | sleep($self->_get_delay_sec( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | retry => $retry, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | init_sec => $self->{initial_delay}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | max_sec => $self->{max_delay} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 3 | )); | |||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 3 | return $self->_request(method => $method, url =>$url, param => $p{param}, retry => $retry + 1); | |||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } elsif($code =~ /^4/){ | ||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 3 | return $self->_to_object(JSON->new->decode($res->content)); | |||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 1 | return $self->_to_object( | |||||||||||||||||||||||||||||||||||||||||||||||
| 662 | { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | error => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | message => $res->message, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | status_code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 6 | ▶ | sub _get_delay_sec { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_delay_sec: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 6 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 6 | my $retry = $p{retry}; # number | |||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 6 | my $init_sec = $p{init_sec}; # number | |||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 6 | my $max_sec = $p{max_sec}; # number | |||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 6 | return min($init_sec * 2 ** $retry, $max_sec) / 2 * (1 + rand(1)); | |||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 76 | ▶ | sub _to_object{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_to_object: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 76 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 76 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 76 | return Net::Payjp::Object->new(%$hash); | |||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 12 | ▶ | sub _api_param{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_api_param: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 12 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 12 | my $param = $p{param}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 12 | my $req_param; | |||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 12 | foreach my $k(keys(%{$param})){ | |||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 14 | ▶ | if(ref($param->{$k}) eq 'HASH'){ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 2 | foreach(keys(%{$param->{$k}})){ | |||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 2 | $req_param->{$k.'['.$_.']'} = $param->{$k}->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 12 | $req_param->{$k} = $param->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 12 | return $req_param; | |||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 40 | ▶ | sub _instance_url{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_instance_url: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 40 | ▶ | return $self->_class_url.'/'.($self->id or ''); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->id || ''
MC/DC100%1/1
$self->id || ''
$self->id
Truth table100%2/2
A
A= $self->id
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 56 | ▶ | sub _class_url{ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_url: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 56 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 56 | my ($class) = lc(ref($self)) =~ /([^:]*$)/; | |||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 56 | return $self->api_base.'/v1/'.$class.'s'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||