Changeset 3190331
- Timestamp:
- 11/16/2024 06:05:21 PM (17 months ago)
- Location:
- ht-pay-jp-for-kintone
- Files:
-
- 56 added
- 2 deleted
- 84 edited
- 1 copied
-
tags/1.5.0 (copied) (copied from ht-pay-jp-for-kintone/trunk)
-
tags/1.5.0/composer.lock (modified) (5 diffs)
-
tags/1.5.0/ht-payjp-for-kintone.php (modified) (1 diff)
-
tags/1.5.0/includes/class-ht-payjp-for-kintone-Payment.php (modified) (1 diff)
-
tags/1.5.0/readme.txt (modified) (2 diffs)
-
tags/1.5.0/vendor/autoload.php (modified) (1 diff)
-
tags/1.5.0/vendor/composer/ClassLoader.php (modified) (24 diffs)
-
tags/1.5.0/vendor/composer/InstalledVersions.php (added)
-
tags/1.5.0/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/1.5.0/vendor/composer/autoload_namespaces.php (modified) (1 diff)
-
tags/1.5.0/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
tags/1.5.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/1.5.0/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.5.0/vendor/composer/installed.json (modified) (1 diff)
-
tags/1.5.0/vendor/composer/installed.php (added)
-
tags/1.5.0/vendor/composer/platform_check.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/.github (added)
-
tags/1.5.0/vendor/payjp/payjp-php/.github/workflows (added)
-
tags/1.5.0/vendor/payjp/payjp-php/.github/workflows/test.yml (added)
-
tags/1.5.0/vendor/payjp/payjp-php/.gitignore (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/.travis.yml (deleted)
-
tags/1.5.0/vendor/payjp/payjp-php/README.md (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/VERSION (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/build.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/composer.json (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/init.php (modified) (3 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/ApiRequestor.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/ApiResource.php (modified) (6 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/ApplicationUrl.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Balance.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Charge.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Customer.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Error/Base.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Error/Card.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Error/InvalidRequest.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Logger (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Logger/DefaultLogger.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Logger/LoggerInterface.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Payjp.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/PayjpObject.php (modified) (4 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Statement.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/StatementUrl.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Tenant.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/TenantTransfer.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Term.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/ThreeDSecureRequest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Token.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Transfer.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Util/Set.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/lib/Util/Util.php (modified) (5 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/scenario (added)
-
tags/1.5.0/vendor/payjp/payjp-php/scenario/ChargeForPlatform.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/scenario/README.md (added)
-
tags/1.5.0/vendor/payjp/payjp-php/scenario/TenantForPlatform.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/scenario/TenantTransfer.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/AccountTest.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/ApiRequestorTest.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/BalanceTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/CardErrorTest.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/ChargeTest.php (modified) (14 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/CustomerTest.php (modified) (8 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/PayjpObjectTest.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/PayjpTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/PlanTest.php (modified) (4 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/RequestOptionsTest.php (modified) (1 diff)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/StatementTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/TenantTransferTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/TermTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/TestCase.php (modified) (4 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/ThreeDSecureRequestTest.php (added)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/TokenTest.php (modified) (2 diffs)
-
tags/1.5.0/vendor/payjp/payjp-php/tests/TransferTest.php (modified) (2 diffs)
-
trunk/composer.lock (modified) (5 diffs)
-
trunk/ht-payjp-for-kintone.php (modified) (1 diff)
-
trunk/includes/class-ht-payjp-for-kintone-Payment.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/ClassLoader.php (modified) (24 diffs)
-
trunk/vendor/composer/InstalledVersions.php (added)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_namespaces.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.json (modified) (1 diff)
-
trunk/vendor/composer/installed.php (added)
-
trunk/vendor/composer/platform_check.php (added)
-
trunk/vendor/payjp/payjp-php/.github (added)
-
trunk/vendor/payjp/payjp-php/.github/workflows (added)
-
trunk/vendor/payjp/payjp-php/.github/workflows/test.yml (added)
-
trunk/vendor/payjp/payjp-php/.gitignore (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/.travis.yml (deleted)
-
trunk/vendor/payjp/payjp-php/README.md (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/VERSION (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/build.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/composer.json (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/init.php (modified) (3 diffs)
-
trunk/vendor/payjp/payjp-php/lib/ApiRequestor.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/lib/ApiResource.php (modified) (6 diffs)
-
trunk/vendor/payjp/payjp-php/lib/ApplicationUrl.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Balance.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Charge.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Customer.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Error/Base.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Error/Card.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Error/InvalidRequest.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Logger (added)
-
trunk/vendor/payjp/payjp-php/lib/Logger/DefaultLogger.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Logger/LoggerInterface.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Payjp.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/lib/PayjpObject.php (modified) (4 diffs)
-
trunk/vendor/payjp/payjp-php/lib/Statement.php (added)
-
trunk/vendor/payjp/payjp-php/lib/StatementUrl.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Tenant.php (added)
-
trunk/vendor/payjp/payjp-php/lib/TenantTransfer.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Term.php (added)
-
trunk/vendor/payjp/payjp-php/lib/ThreeDSecureRequest.php (added)
-
trunk/vendor/payjp/payjp-php/lib/Token.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Transfer.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/lib/Util/Set.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/lib/Util/Util.php (modified) (5 diffs)
-
trunk/vendor/payjp/payjp-php/scenario (added)
-
trunk/vendor/payjp/payjp-php/scenario/ChargeForPlatform.php (added)
-
trunk/vendor/payjp/payjp-php/scenario/README.md (added)
-
trunk/vendor/payjp/payjp-php/scenario/TenantForPlatform.php (added)
-
trunk/vendor/payjp/payjp-php/scenario/TenantTransfer.php (added)
-
trunk/vendor/payjp/payjp-php/tests/AccountTest.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/tests/ApiRequestorTest.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/tests/BalanceTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/CardErrorTest.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/tests/ChargeTest.php (modified) (14 diffs)
-
trunk/vendor/payjp/payjp-php/tests/CustomerTest.php (modified) (8 diffs)
-
trunk/vendor/payjp/payjp-php/tests/PayjpObjectTest.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/tests/PayjpTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/PlanTest.php (modified) (4 diffs)
-
trunk/vendor/payjp/payjp-php/tests/RequestOptionsTest.php (modified) (1 diff)
-
trunk/vendor/payjp/payjp-php/tests/StatementTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/TenantTransferTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/TermTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/TestCase.php (modified) (4 diffs)
-
trunk/vendor/payjp/payjp-php/tests/ThreeDSecureRequestTest.php (added)
-
trunk/vendor/payjp/payjp-php/tests/TokenTest.php (modified) (2 diffs)
-
trunk/vendor/payjp/payjp-php/tests/TransferTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ht-pay-jp-for-kintone/tags/1.5.0/composer.lock
r2685245 r3190331 2 2 "_readme": [ 3 3 "This file locks the dependencies of your project to a known state", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md# composer-lock-the-lock-file",4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 5 "This file is @generated automatically" 6 6 ], … … 9 9 { 10 10 "name": "payjp/payjp-php", 11 "version": "1. 0.5",11 "version": "1.7.0", 12 12 "source": { 13 13 "type": "git", 14 14 "url": "https://github.com/payjp/payjp-php.git", 15 "reference": " 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd"15 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175" 16 16 }, 17 17 "dist": { 18 18 "type": "zip", 19 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/ 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd",20 "reference": " 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd",19 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/f8fe3185fc0a481214c35421f051d8cc50f3f175", 20 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175", 21 21 "shasum": "" 22 22 }, … … 28 28 }, 29 29 "require-dev": { 30 "phpunit/phpunit": "~4.0", 31 "satooshi/php-coveralls": "~0.6.1", 32 "squizlabs/php_codesniffer": "~2.0" 30 "phpunit/phpunit": "~5.7 || ~9.5", 31 "squizlabs/php_codesniffer": "~3.6" 33 32 }, 34 33 "type": "library", … … 60 59 "payment processing" 61 60 ], 62 "time": "2019-08-09T13:10:15+00:00" 61 "support": { 62 "issues": "https://github.com/payjp/payjp-php/issues", 63 "source": "https://github.com/payjp/payjp-php/tree/1.7.0" 64 }, 65 "time": "2024-11-13T05:21:09+00:00" 63 66 } 64 67 ], … … 70 73 "prefer-lowest": false, 71 74 "platform": [], 72 "platform-dev": [] 75 "platform-dev": [], 76 "plugin-api-version": "2.6.0" 73 77 } -
ht-pay-jp-for-kintone/tags/1.5.0/ht-payjp-for-kintone.php
r2989122 r3190331 8 8 * Text Domain: ht-pay-jp-for-kintone 9 9 * Domain Path: /languages 10 * Version: 1. 4.110 * Version: 1.5.0 11 11 * 12 12 * @package HT_Payjp_For_Kintone -
ht-pay-jp-for-kintone/tags/1.5.0/includes/class-ht-payjp-for-kintone-Payment.php
r2989122 r3190331 170 170 ); 171 171 172 } catch ( \Payjp\Error\Card $e ) { 173 // カード決済エラーの場合 174 $abort = true; 175 $submission->set_response( $contact_form->filter_message( __( 'Card payment failed. Please check your card information.', 'payjp-for-kintone' ) ) ); 176 ht_payjp_for_kintone_send_error_mail( $contact_form, $e->getMessage() ); 177 172 178 } catch ( \Payjp\Error\InvalidRequest $e ) { 173 179 // その他のPAY.JPエラーの場合 174 180 $abort = true; 175 181 $submission->set_response( $contact_form->filter_message( $e->getMessage() ) ); -
ht-pay-jp-for-kintone/tags/1.5.0/readme.txt
r2989122 r3190331 3 3 Donate link: 4 4 Tags: Contact Form 7, kintone, PAY.JP, form data to kintone 5 Requires at least: 4.5 6 Tested up to: 6.3.2 7 Stable tag: 1.4.1 5 Requires at least: 6.6 6 Tested up to: 6.7 7 Requires PHP: 7.4 8 Stable tag: 1.5.0 8 9 License: GPLv2 or later 9 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 53 54 54 55 == Changelog == 56 57 = 1.5.0( 2024-11-17 ) = 58 59 * Updated payjp/payjp-php version from 1.0.5 to 1.7.0 60 * Added error handling for \Payjp\Error\Card 55 61 56 62 = 1.4.1( 2023-11-05 ) = -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/autoload.php
r2149911 r3190331 3 3 // autoload.php @generated by Composer 4 4 5 if (PHP_VERSION_ID < 50600) { 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 21 } 22 5 23 require_once __DIR__ . '/composer/autoload_real.php'; 6 24 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/ClassLoader.php
r2149911 r3190331 38 38 * @author Fabien Potencier <fabien@symfony.com> 39 39 * @author Jordi Boggiano <j.boggiano@seld.be> 40 * @see http ://www.php-fig.org/psr/psr-0/41 * @see http ://www.php-fig.org/psr/psr-4/40 * @see https://www.php-fig.org/psr/psr-0/ 41 * @see https://www.php-fig.org/psr/psr-4/ 42 42 */ 43 43 class ClassLoader 44 44 { 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var string|null */ 49 private $vendorDir; 50 45 51 // PSR-4 52 /** 53 * @var array<string, array<string, int>> 54 */ 46 55 private $prefixLengthsPsr4 = array(); 56 /** 57 * @var array<string, list<string>> 58 */ 47 59 private $prefixDirsPsr4 = array(); 60 /** 61 * @var list<string> 62 */ 48 63 private $fallbackDirsPsr4 = array(); 49 64 50 65 // PSR-0 66 /** 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 72 */ 51 73 private $prefixesPsr0 = array(); 74 /** 75 * @var list<string> 76 */ 52 77 private $fallbackDirsPsr0 = array(); 53 78 79 /** @var bool */ 54 80 private $useIncludePath = false; 81 82 /** 83 * @var array<string, string> 84 */ 55 85 private $classMap = array(); 86 87 /** @var bool */ 56 88 private $classMapAuthoritative = false; 89 90 /** 91 * @var array<string, bool> 92 */ 57 93 private $missingClasses = array(); 94 95 /** @var string|null */ 58 96 private $apcuPrefix; 59 97 98 /** 99 * @var array<string, self> 100 */ 101 private static $registeredLoaders = array(); 102 103 /** 104 * @param string|null $vendorDir 105 */ 106 public function __construct($vendorDir = null) 107 { 108 $this->vendorDir = $vendorDir; 109 self::initializeIncludeClosure(); 110 } 111 112 /** 113 * @return array<string, list<string>> 114 */ 60 115 public function getPrefixes() 61 116 { 62 117 if (!empty($this->prefixesPsr0)) { 63 return call_user_func_array('array_merge', $this->prefixesPsr0);118 return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); 64 119 } 65 120 … … 67 122 } 68 123 124 /** 125 * @return array<string, list<string>> 126 */ 69 127 public function getPrefixesPsr4() 70 128 { … … 72 130 } 73 131 132 /** 133 * @return list<string> 134 */ 74 135 public function getFallbackDirs() 75 136 { … … 77 138 } 78 139 140 /** 141 * @return list<string> 142 */ 79 143 public function getFallbackDirsPsr4() 80 144 { … … 82 146 } 83 147 148 /** 149 * @return array<string, string> Array of classname => path 150 */ 84 151 public function getClassMap() 85 152 { … … 88 155 89 156 /** 90 * @param array $classMap Class to filename map 157 * @param array<string, string> $classMap Class to filename map 158 * 159 * @return void 91 160 */ 92 161 public function addClassMap(array $classMap) … … 103 172 * appending or prepending to the ones previously set for this prefix. 104 173 * 105 * @param string $prefix The prefix 106 * @param array|string $paths The PSR-0 root directories 107 * @param bool $prepend Whether to prepend the directories 174 * @param string $prefix The prefix 175 * @param list<string>|string $paths The PSR-0 root directories 176 * @param bool $prepend Whether to prepend the directories 177 * 178 * @return void 108 179 */ 109 180 public function add($prefix, $paths, $prepend = false) 110 181 { 182 $paths = (array) $paths; 111 183 if (!$prefix) { 112 184 if ($prepend) { 113 185 $this->fallbackDirsPsr0 = array_merge( 114 (array)$paths,186 $paths, 115 187 $this->fallbackDirsPsr0 116 188 ); … … 118 190 $this->fallbackDirsPsr0 = array_merge( 119 191 $this->fallbackDirsPsr0, 120 (array)$paths192 $paths 121 193 ); 122 194 } … … 127 199 $first = $prefix[0]; 128 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 129 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 130 202 131 203 return; … … 133 205 if ($prepend) { 134 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 135 (array)$paths,207 $paths, 136 208 $this->prefixesPsr0[$first][$prefix] 137 209 ); … … 139 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 140 212 $this->prefixesPsr0[$first][$prefix], 141 (array)$paths213 $paths 142 214 ); 143 215 } … … 148 220 * appending or prepending to the ones previously set for this namespace. 149 221 * 150 * @param string $prefix The prefix/namespace, with trailing '\\'151 * @param array|string $paths The PSR-4 base directories152 * @param bool $prepend Whether to prepend the directories222 * @param string $prefix The prefix/namespace, with trailing '\\' 223 * @param list<string>|string $paths The PSR-4 base directories 224 * @param bool $prepend Whether to prepend the directories 153 225 * 154 226 * @throws \InvalidArgumentException 227 * 228 * @return void 155 229 */ 156 230 public function addPsr4($prefix, $paths, $prepend = false) 157 231 { 232 $paths = (array) $paths; 158 233 if (!$prefix) { 159 234 // Register directories for the root namespace. 160 235 if ($prepend) { 161 236 $this->fallbackDirsPsr4 = array_merge( 162 (array)$paths,237 $paths, 163 238 $this->fallbackDirsPsr4 164 239 ); … … 166 241 $this->fallbackDirsPsr4 = array_merge( 167 242 $this->fallbackDirsPsr4, 168 (array)$paths243 $paths 169 244 ); 170 245 } … … 176 251 } 177 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 178 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 179 254 } elseif ($prepend) { 180 255 // Prepend directories for an already registered namespace. 181 256 $this->prefixDirsPsr4[$prefix] = array_merge( 182 (array)$paths,257 $paths, 183 258 $this->prefixDirsPsr4[$prefix] 184 259 ); … … 187 262 $this->prefixDirsPsr4[$prefix] = array_merge( 188 263 $this->prefixDirsPsr4[$prefix], 189 (array)$paths264 $paths 190 265 ); 191 266 } … … 196 271 * replacing any others previously set for this prefix. 197 272 * 198 * @param string $prefix The prefix 199 * @param array|string $paths The PSR-0 base directories 273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 275 * 276 * @return void 200 277 */ 201 278 public function set($prefix, $paths) … … 212 289 * replacing any others previously set for this namespace. 213 290 * 214 * @param string $prefix The prefix/namespace, with trailing '\\'215 * @param array|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 216 293 * 217 294 * @throws \InvalidArgumentException 295 * 296 * @return void 218 297 */ 219 298 public function setPsr4($prefix, $paths) … … 235 314 * 236 315 * @param bool $useIncludePath 316 * 317 * @return void 237 318 */ 238 319 public function setUseIncludePath($useIncludePath) … … 257 338 * 258 339 * @param bool $classMapAuthoritative 340 * 341 * @return void 259 342 */ 260 343 public function setClassMapAuthoritative($classMapAuthoritative) … … 277 360 * 278 361 * @param string|null $apcuPrefix 362 * 363 * @return void 279 364 */ 280 365 public function setApcuPrefix($apcuPrefix) … … 297 382 * 298 383 * @param bool $prepend Whether to prepend the autoloader or not 384 * 385 * @return void 299 386 */ 300 387 public function register($prepend = false) 301 388 { 302 389 spl_autoload_register(array($this, 'loadClass'), true, $prepend); 390 391 if (null === $this->vendorDir) { 392 return; 393 } 394 395 if ($prepend) { 396 self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; 397 } else { 398 unset(self::$registeredLoaders[$this->vendorDir]); 399 self::$registeredLoaders[$this->vendorDir] = $this; 400 } 303 401 } 304 402 305 403 /** 306 404 * Unregisters this instance as an autoloader. 405 * 406 * @return void 307 407 */ 308 408 public function unregister() 309 409 { 310 410 spl_autoload_unregister(array($this, 'loadClass')); 411 412 if (null !== $this->vendorDir) { 413 unset(self::$registeredLoaders[$this->vendorDir]); 414 } 311 415 } 312 416 … … 315 419 * 316 420 * @param string $class The name of the class 317 * @return bool|null True if loaded, null otherwise421 * @return true|null True if loaded, null otherwise 318 422 */ 319 423 public function loadClass($class) 320 424 { 321 425 if ($file = $this->findFile($class)) { 322 includeFile($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 323 428 324 429 return true; 325 430 } 431 432 return null; 326 433 } 327 434 … … 368 475 } 369 476 477 /** 478 * Returns the currently registered loaders keyed by their corresponding vendor directories. 479 * 480 * @return array<string, self> 481 */ 482 public static function getRegisteredLoaders() 483 { 484 return self::$registeredLoaders; 485 } 486 487 /** 488 * @param string $class 489 * @param string $ext 490 * @return string|false 491 */ 370 492 private function findFileWithExtension($class, $ext) 371 493 { … … 433 555 return false; 434 556 } 557 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 562 { 563 if (self::$includeFile !== null) { 564 return; 565 } 566 567 /** 568 * Scope isolated include. 569 * 570 * Prevents access to $this/self from included files. 571 * 572 * @param string $file 573 * @return void 574 */ 575 self::$includeFile = \Closure::bind(static function($file) { 576 include $file; 577 }, null, null); 578 } 435 579 } 436 437 /**438 * Scope isolated include.439 *440 * Prevents access to $this/self from included files.441 */442 function includeFile($file)443 {444 include $file;445 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/autoload_classmap.php
r2149911 r3190331 3 3 // autoload_classmap.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 8 8 return array( 9 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 9 10 ); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/autoload_namespaces.php
r2149911 r3190331 3 3 // autoload_namespaces.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/autoload_psr4.php
r2149911 r3190331 3 3 // autoload_psr4.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/autoload_real.php
r2149911 r3190331 14 14 } 15 15 16 /** 17 * @return \Composer\Autoload\ClassLoader 18 */ 16 19 public static function getLoader() 17 20 { … … 20 23 } 21 24 25 require __DIR__ . '/platform_check.php'; 26 22 27 spl_autoload_register(array('ComposerAutoloaderInit9a018c6d859c504697980df115517622', 'loadClassLoader'), true, true); 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader( );28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 24 29 spl_autoload_unregister(array('ComposerAutoloaderInit9a018c6d859c504697980df115517622', 'loadClassLoader')); 25 30 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 if ($useStaticLoader) { 28 require_once __DIR__ . '/autoload_static.php'; 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit9a018c6d859c504697980df115517622::getInitializer($loader)); 31 } else { 32 $map = require __DIR__ . '/autoload_namespaces.php'; 33 foreach ($map as $namespace => $path) { 34 $loader->set($namespace, $path); 35 } 36 37 $map = require __DIR__ . '/autoload_psr4.php'; 38 foreach ($map as $namespace => $path) { 39 $loader->setPsr4($namespace, $path); 40 } 41 42 $classMap = require __DIR__ . '/autoload_classmap.php'; 43 if ($classMap) { 44 $loader->addClassMap($classMap); 45 } 46 } 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit9a018c6d859c504697980df115517622::getInitializer($loader)); 47 33 48 34 $loader->register(true); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/autoload_static.php
r2149911 r3190331 21 21 ); 22 22 23 public static $classMap = array ( 24 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 25 ); 26 23 27 public static function getInitializer(ClassLoader $loader) 24 28 { … … 26 30 $loader->prefixLengthsPsr4 = ComposerStaticInit9a018c6d859c504697980df115517622::$prefixLengthsPsr4; 27 31 $loader->prefixDirsPsr4 = ComposerStaticInit9a018c6d859c504697980df115517622::$prefixDirsPsr4; 32 $loader->classMap = ComposerStaticInit9a018c6d859c504697980df115517622::$classMap; 28 33 29 34 }, null, ClassLoader::class); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/composer/installed.json
r2149911 r3190331 1 [ 2 { 3 "name": "payjp/payjp-php", 4 "version": "1.0.5", 5 "version_normalized": "1.0.5.0", 6 "source": { 7 "type": "git", 8 "url": "https://github.com/payjp/payjp-php.git", 9 "reference": "57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd" 10 }, 11 "dist": { 12 "type": "zip", 13 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd", 14 "reference": "57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd", 15 "shasum": "" 16 }, 17 "require": { 18 "ext-curl": "*", 19 "ext-json": "*", 20 "ext-mbstring": "*", 21 "php": ">=5.6" 22 }, 23 "require-dev": { 24 "phpunit/phpunit": "~4.0", 25 "satooshi/php-coveralls": "~0.6.1", 26 "squizlabs/php_codesniffer": "~2.0" 27 }, 28 "time": "2019-08-09T13:10:15+00:00", 29 "type": "library", 30 "extra": { 31 "branch-alias": { 32 "dev-master": "0.1.*-dev" 33 } 34 }, 35 "installation-source": "dist", 36 "autoload": { 37 "psr-4": { 38 "Payjp\\": "lib/" 39 } 40 }, 41 "notification-url": "https://packagist.org/downloads/", 42 "license": [ 43 "MIT" 1 { 2 "packages": [ 3 { 4 "name": "payjp/payjp-php", 5 "version": "1.7.0", 6 "version_normalized": "1.7.0.0", 7 "source": { 8 "type": "git", 9 "url": "https://github.com/payjp/payjp-php.git", 10 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175" 11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/f8fe3185fc0a481214c35421f051d8cc50f3f175", 15 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175", 16 "shasum": "" 17 }, 18 "require": { 19 "ext-curl": "*", 20 "ext-json": "*", 21 "ext-mbstring": "*", 22 "php": ">=5.6" 23 }, 24 "require-dev": { 25 "phpunit/phpunit": "~5.7 || ~9.5", 26 "squizlabs/php_codesniffer": "~3.6" 27 }, 28 "time": "2024-11-13T05:21:09+00:00", 29 "type": "library", 30 "extra": { 31 "branch-alias": { 32 "dev-master": "0.1.*-dev" 33 } 34 }, 35 "installation-source": "dist", 36 "autoload": { 37 "psr-4": { 38 "Payjp\\": "lib/" 39 } 40 }, 41 "notification-url": "https://packagist.org/downloads/", 42 "license": [ 43 "MIT" 44 ], 45 "authors": [ 46 { 47 "name": "Payjp and contributors", 48 "homepage": "https://github.com/payjp/payjp-php/graphs/contributors" 49 } 50 ], 51 "description": "Payjp PHP Library", 52 "homepage": "https://pay.jp/", 53 "keywords": [ 54 "api", 55 "payjp", 56 "payment processing" 57 ], 58 "support": { 59 "issues": "https://github.com/payjp/payjp-php/issues", 60 "source": "https://github.com/payjp/payjp-php/tree/1.7.0" 61 }, 62 "install-path": "../payjp/payjp-php" 63 } 44 64 ], 45 "authors": [ 46 { 47 "name": "Payjp and contributors", 48 "homepage": "https://github.com/payjp/payjp-php/graphs/contributors" 49 } 50 ], 51 "description": "Payjp PHP Library", 52 "homepage": "https://pay.jp/", 53 "keywords": [ 54 "api", 55 "payjp", 56 "payment processing" 57 ] 58 } 59 ] 65 "dev": true, 66 "dev-package-names": [] 67 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/.gitignore
r2685245 r3190331 21 21 # Ignore PHPUnit coverage file 22 22 clover.xml 23 24 # Ignore PHPUnit cache file 25 .phpunit.result.cache -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/README.md
r2149911 r3190331 1 1 # PAY.JP for PHP 2 2 3 [](https://travis-ci.org/payjp/payjp-php)3 [](https://github.com/payjp/payjp-php/actions) 4 4 5 5 ## Requirements … … 53 53 - Please see our official [documentation](https://pay.jp/docs/started). 54 54 55 ## Retry on HTTP Status Code 429 56 57 - See [Rate Limit Guideline](https://pay.jp/docs/guideline-rate-limit#2-%E3%83%AA%E3%83%88%E3%83%A9%E3%82%A4) 58 - When you exceeded rate-limit, you can retry request by setting `$maxRetry` 59 like `\Payjp\Payjp::setMaxRetry(3);` . 60 - The retry interval base value is `$retryInitialDelay` 61 Adjust the value like `\Payjp\Payjp::setRetryInitialDelay(4);` 62 The smaller is shorter. 63 - The retry interval calcurating is based on "Exponential backoff with equal jitter" algorithm. 64 See https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 65 66 ## Logging 67 68 - This library provides simple log output using `error_log` . You can set any logger that is compatible [PSR-3](https://www.php-fig.org/psr/psr-3/) logger interface. Like below 69 - `\Payjp\Payjp::setLogger($logger);` 70 - As the default behavior, this library output only error level information to stderr. 71 72 ### Logging Case 73 #### info 74 75 - Every retry on HTTP Status Code 429 76 77 #### error 78 79 - When you access inaccessible or non-existing property 80 55 81 ## Tests 56 82 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/VERSION
r2149911 r3190331 1 1. 0.51 1.7.0 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/build.php
r2149911 r3190331 31 31 32 32 $config = $autoload ? 'phpunit.xml' : 'phpunit.no_autoload.xml'; 33 passthru("./vendor/bin/phpunit -c $config ", $returnStatus);33 passthru("./vendor/bin/phpunit -c $config -d error_reporting=-1", $returnStatus); 34 34 if ($returnStatus !== 0) { 35 35 exit(1); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/composer.json
r2149911 r3190331 22 22 }, 23 23 "require-dev": { 24 "phpunit/phpunit": "~4.0", 25 "satooshi/php-coveralls": "~0.6.1", 26 "squizlabs/php_codesniffer": "~2.0" 24 "phpunit/phpunit": "~5.7 || ~9.5", 25 "squizlabs/php_codesniffer": "~3.6" 27 26 }, 28 27 "autoload": { … … 33 32 "dev-master": "0.1.*-dev" 34 33 } 34 }, 35 "scripts": { 36 "test": [ 37 "phpcs --standard=PSR2 -n lib tests *.php", 38 "phpunit" 39 ] 35 40 } 36 41 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/init.php
r2149911 r3190331 4 4 require(dirname(__FILE__) . '/lib/Payjp.php'); 5 5 6 // Utilities 6 // Logger 7 require(dirname(__FILE__) . '/lib/Logger/LoggerInterface.php'); 8 require(dirname(__FILE__) . '/lib/Logger/DefaultLogger.php'); 9 10 // UtilitiesL 7 11 require(dirname(__FILE__) . '/lib/Util/RequestOptions.php'); 8 12 require(dirname(__FILE__) . '/lib/Util/Set.php'); … … 31 35 // Payjp API Resources 32 36 require(dirname(__FILE__) . '/lib/Account.php'); 37 require(dirname(__FILE__) . '/lib/ApplicationUrl.php'); 38 require(dirname(__FILE__) . '/lib/Balance.php'); 33 39 require(dirname(__FILE__) . '/lib/Card.php'); 34 40 require(dirname(__FILE__) . '/lib/Charge.php'); … … 37 43 require(dirname(__FILE__) . '/lib/Event.php'); 38 44 require(dirname(__FILE__) . '/lib/Plan.php'); 45 require(dirname(__FILE__) . '/lib/Statement.php'); 46 require(dirname(__FILE__) . '/lib/StatementUrl.php'); 39 47 require(dirname(__FILE__) . '/lib/Subscription.php'); 48 require(dirname(__FILE__) . '/lib/Tenant.php'); 49 require(dirname(__FILE__) . '/lib/TenantTransfer.php'); 50 require(dirname(__FILE__) . '/lib/Term.php'); 51 require(dirname(__FILE__) . '/lib/ThreeDSecureRequest.php'); 40 52 require(dirname(__FILE__) . '/lib/Token.php'); 41 53 require(dirname(__FILE__) . '/lib/Transfer.php'); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/ApiRequestor.php
r2149911 r3190331 39 39 } 40 40 41 // @var int Number of digit for randomized sleep time seconds 42 private $digit_num_for_rand = 2; 43 44 /** 45 * Based on "Exponential backoff with equal jitter" algorithm. 46 * https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 47 * 48 * @param int $retryCount 49 * 50 * @return int retry delay seconds. 51 */ 52 private function getRetryDelay($retryCount) 53 { 54 $wait_half = min(Payjp::getRetryMaxDelay(), Payjp::getRetryInitialDelay() * pow(2, $retryCount)) / 2; 55 $scale = pow(10, $this->digit_num_for_rand); 56 return $wait_half + mt_rand(0, $wait_half * $scale) / $scale; 57 } 58 41 59 /** 42 60 * @param string $method … … 56 74 $headers = array(); 57 75 } 58 list($rbody, $rcode, $myApiKey) = 59 $this->_requestRaw($method, $url, $params, $headers); 76 77 for ($i = 0; $i <= Payjp::getMaxRetry(); $i++) { 78 list($rbody, $rcode, $myApiKey) = $this->_requestRaw($method, $url, $params, $headers); 79 if ($rcode == 429 && $i != Payjp::getMaxRetry()) { 80 $wait = $this->getRetryDelay($i); 81 Payjp::getLogger()->info("Retry after {$wait} seconds."); 82 usleep((int) $wait * 1000000); 83 } else { 84 break; 85 } 86 } 60 87 $resp = $this->_interpretResponse($rbody, $rcode); 61 88 return array($resp, $myApiKey); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/ApiResource.php
r2149911 r3190331 7 7 private static $HEADERS_TO_PERSIST = array('Payjp-Account' => true, 'Payjp-Version' => true); 8 8 9 public static function baseUrl()10 {11 return Payjp::$apiBase;12 }13 14 9 /** 15 10 * @return ApiResource The refreshed resource. … … 17 12 public function refresh() 18 13 { 19 $requestor = new ApiRequestor($this->_opts->apiKey , static::baseUrl());14 $requestor = new ApiRequestor($this->_opts->apiKey); 20 15 $url = $this->instanceUrl(); 21 16 … … 60 55 { 61 56 $base = static::className(); 62 return "/v1/ ${base}s";57 return "/v1/{$base}s"; 63 58 } 64 59 … … 93 88 } 94 89 90 /** 91 * @param string $method 92 * @param string $url 93 * @param array|null $params 94 * @param RequestOptions|array|string|null $options 95 * 96 * @return list(array, RequestOptions) 97 */ 95 98 protected function _request($method, $url, $params = array(), $options = null) 96 99 { … … 102 105 { 103 106 $opts = Util\RequestOptions::parse($options); 104 $requestor = new ApiRequestor($opts->apiKey , static::baseUrl());107 $requestor = new ApiRequestor($opts->apiKey); 105 108 list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); 106 109 foreach ($opts->headers as $k => $v) { … … 132 135 { 133 136 self::_validateParams($params); 134 $base = static::baseUrl();135 137 $url = static::classUrl(); 136 138 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Charge.php
r2149911 r3190331 75 75 return $this; 76 76 } 77 78 /** 79 * @param array|null $params 80 * @param array|string|null $options 81 * 82 * @return Charge The paid charge. 83 */ 84 public function tdsFinish($params = null, $options = null) 85 { 86 $url = $this->instanceUrl() . '/tds_finish'; 87 list($response, $opts) = $this->_request('post', $url, $params, $options); 88 $this->refreshFrom($response, $opts); 89 return $this; 90 } 77 91 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Customer.php
r2149911 r3190331 12 12 . "would be: \"Payjp\\Charge::create(array('amount' => 100, " 13 13 . "'currency' => 'usd', 'card' => array('number' => " 14 . "4242424242424242, 'exp_month' => 5, 'exp_year' => 2015)))\")";14 . "4242424242424242, 'exp_month' => 5, 'exp_year' => 2015)))\")"; 15 15 throw new Error\Api($message); 16 16 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Error/Base.php
r2149911 r3190331 7 7 abstract class Base extends Exception 8 8 { 9 public $httpStatus; 10 public $httpBody; 11 public $jsonBody; 12 9 13 public function __construct( 10 14 $message, -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Error/Card.php
r2149911 r3190331 5 5 class Card extends Base 6 6 { 7 public $param; 8 7 9 public function __construct( 8 10 $message, -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Error/InvalidRequest.php
r2149911 r3190331 5 5 class InvalidRequest extends Base 6 6 { 7 public $param; 8 7 9 public function __construct( 8 10 $message, -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Payjp.php
r2149911 r3190331 16 16 // @var boolean Defaults to true. 17 17 public static $verifySslCerts = true; 18 19 // @var \Payjp\Logger\LoggerInterface Default logger will output to error_log(). 20 public static $logger = null; 21 22 // @var int Max retry count for over_capacity 429 response. 23 public static $maxRetry = 0; 24 25 /** 26 * The retry interval base value for over_capacity 429 response. 27 * Based on "Exponential backoff with equal jitter" algorithm. 28 * See https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 29 * 30 * @var int 31 */ 32 public static $retryInitialDelay = 2; 33 34 // @var int Max retry delay seconds for over_capacity 429 response. 35 public static $retryMaxDelay = 32; 18 36 19 37 const VERSION = '1.0.0'; … … 69 87 self::$verifySslCerts = $verify; 70 88 } 89 90 /** 91 * @return \Payjp\Logger\LoggerInterface 92 */ 93 public static function getLogger() 94 { 95 if (self::$logger == null) { 96 return new \Payjp\Logger\DefaultLogger(); 97 } 98 return self::$logger; 99 } 100 101 /** 102 * @param \Payjp\Logger\LoggerInterface $logger 103 */ 104 public static function setLogger($logger) 105 { 106 self::$logger = $logger; 107 } 108 /** 109 * @return int 110 */ 111 public static function getMaxRetry() 112 { 113 return self::$maxRetry; 114 } 115 116 /** 117 * @param int $value 118 */ 119 public static function setMaxRetry($value) 120 { 121 self::$maxRetry = $value; 122 } 123 124 /** 125 * @return int 126 */ 127 public static function getRetryInitialDelay() 128 { 129 return self::$retryInitialDelay; 130 } 131 132 /** 133 * @param int $value 134 */ 135 public static function setRetryInitialDelay($value) 136 { 137 self::$retryInitialDelay = $value; 138 } 139 140 /** 141 * @return int 142 */ 143 public static function getRetryMaxDelay() 144 { 145 return self::$retryMaxDelay; 146 } 147 148 /** 149 * @param int $value 150 */ 151 public static function setRetryMaxDelay($value) 152 { 153 self::$retryMaxDelay = $value; 154 } 71 155 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/PayjpObject.php
r2149911 r3190331 102 102 . "probably as a result of a save(). The attributes currently " 103 103 . "available on this object are: $attrs"; 104 error_log($message);104 Payjp::getLogger()->error($message); 105 105 return null; 106 106 } else { 107 107 $class = get_class($this); 108 error_log("Payjp Notice: Undefined property of $class instance: $k");108 Payjp::getLogger()->error("Payjp Notice: Undefined property of $class instance: $k"); 109 109 return null; 110 110 } … … 112 112 113 113 // ArrayAccess methods 114 #[\ReturnTypeWillChange] 114 115 public function offsetSet($k, $v) 115 116 { … … 117 118 } 118 119 120 #[\ReturnTypeWillChange] 119 121 public function offsetExists($k) 120 122 { … … 122 124 } 123 125 126 #[\ReturnTypeWillChange] 124 127 public function offsetUnset($k) 125 128 { 126 129 unset($this->$k); 127 130 } 131 132 #[\ReturnTypeWillChange] 128 133 public function offsetGet($k) 129 134 { -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Token.php
r2149911 r3190331 26 26 return self::_create($params, $opts); 27 27 } 28 29 /** 30 * @param array|null $params 31 * @param array|string|null $options 32 * 33 * @return Token The paid token. 34 */ 35 public function tdsFinish($params = null, $options = null) 36 { 37 $url = $this->instanceUrl() . '/tds_finish'; 38 list($response, $opts) = $this->_request('post', $url, $params, $options); 39 $this->refreshFrom($response, $opts); 40 return $this; 41 } 28 42 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Transfer.php
r2149911 r3190331 7 7 /** 8 8 * @param string $id The ID of the transfer to retrieve. 9 * @param array|string|null $opts9 * @param RequestOptions|array|string|null $opts 10 10 * 11 11 * @return Transfer … … 18 18 /** 19 19 * @param array|null $params 20 * @param array|string|null $opts20 * @param RequestOptions|array|string|null $opts 21 21 * 22 22 * @return Transfer[] -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Util/Set.php
r2149911 r3190331 38 38 } 39 39 40 #[\ReturnTypeWillChange] 40 41 public function getIterator() 41 42 { -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/lib/Util/Util.php
r2149911 r3190331 7 7 abstract class Util 8 8 { 9 // todo wanna use 'private const' (only PHP >= v7.1.0) 10 private static $types = array( 11 'application_url' => \Payjp\ApplicationUrl::class, 12 'balance' => \Payjp\Balance::class, 13 'card' => \Payjp\Card::class, 14 'charge' => \Payjp\Charge::class, 15 'customer' => \Payjp\Customer::class, 16 'event' => \Payjp\Event::class, 17 'list' => \Payjp\Collection::class, 18 'plan' => \Payjp\Plan::class, 19 'statement' => \Payjp\Statement::class, 20 'statement_url' => \Payjp\StatementUrl::class, 21 'subscription' => \Payjp\Subscription::class, 22 'tenant' => \Payjp\Tenant::class, 23 'token' => \Payjp\Token::class, 24 'tenant_transfer' => \Payjp\TenantTransfer::class, 25 'term' => \Payjp\Term::class, 26 'transfer' => \Payjp\Transfer::class, 27 'three_d_secure_request' => \Payjp\ThreeDSecureRequest::class, 28 ); 29 9 30 /** 10 31 * Whether the provided array (or other) is a list rather than a dictionary. … … 39 60 foreach ($values as $k => $v) { 40 61 // FIXME: this is an encapsulation violation 41 if ( $k[0] == '_') {62 if (is_string($k) && $k[0] == '_') { 42 63 continue; 43 64 } … … 62 83 public static function convertToPayjpObject($resp, $opts) 63 84 { 64 $types = array(65 'account' => 'Payjp\\Account',66 'card' => 'Payjp\\Card',67 'charge' => 'Payjp\\Charge',68 'customer' => 'Payjp\\Customer',69 'list' => 'Payjp\\Collection',70 'event' => 'Payjp\\Event',71 'token' => 'Payjp\\Token',72 'transfer' => 'Payjp\\Transfer',73 'plan' => 'Payjp\\Plan',74 'subscription' => 'Payjp\\Subscription',75 );76 85 if (self::isList($resp)) { 77 86 $mapped = array(); … … 81 90 return $mapped; 82 91 } elseif (is_array($resp)) { 83 if (isset($resp['object']) && is_string($resp['object']) && isset( $types[$resp['object']])) {84 $class = $types[$resp['object']];92 if (isset($resp['object']) && is_string($resp['object']) && isset(self::$types[$resp['object']])) { 93 $class = self::$types[$resp['object']]; 85 94 } else { 86 95 $class = 'Payjp\\PayjpObject'; … … 101 110 { 102 111 if (is_string($value) && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") { 103 return utf8_encode($value); 112 if (\PHP_VERSION_ID >= 80200) { 113 return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1'); 114 } else { 115 return utf8_encode($value); 116 } 104 117 } else { 105 118 return $value; -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/AccountTest.php
r2149911 r3190331 7 7 private function managedAccountResponse($id) 8 8 { 9 return array( 10 'accounts_enabled' => array('merchant', 'customer'), 9 return [ 10 'accounts_enabled' => [ 11 'merchant', 12 'customer', 13 ], 11 14 'created' => 1432965397, 12 'customer' => array( 13 'cards' => array( 14 'count' => 1, 15 'data' => array( 16 array( 17 'address_city' => '\u8d64\u5742', 18 'address_line1' => '7-4', 19 'address_line2' => '203', 20 'address_state' => '\u6e2f\u533a', 21 'address_zip' => '1070050', 22 'address_zip_check' => 'passed', 23 'brand' => 'Visa', 24 'country' => self::COUNTRY, 25 'created' => 1432965397, 26 'cvc_check' => 'passed', 27 'exp_month' => 12, 28 'exp_year' => 2016, 29 'fingerprint' => 'e1d8225886e3a7211127df751c86787f', 30 'id' => 'car_99abf74cb5527ff68233a8b836dd', 31 'last4' => '4242', 32 'livemode' => true, 33 'name' => 'Test Hodler', 34 'object' => 'card' 35 ) 36 ), 37 'object' => 'list', 38 'url' => '/v1/accounts/cards' 39 ), 40 'created' => 1432965397, 41 'default_card' => null, 42 'description' => 'user customer', 43 'email' => null, 44 'id' => 'acct_cus_38153121efdb7964dd1e147', 45 'object' => 'customer' 46 ), 47 'email' => 'firstuser@mail.com', 48 'id' => $id, 49 'merchant' => array( 50 'bank_enabled' => false, 51 'brands_accepted' => array( 52 'Visa', 53 'American Express', 54 'MasterCard', 55 'JCB', 56 'Diners Club' 57 ), 58 'business_type' => 'personal', 59 'charge_type' => null, 60 'contact_phone' => null, 61 'country' => 'JP', 62 'created' => 1432965397, 63 'currencies_supported' => array( 64 self::CURRENCY 65 ), 66 'default_currency' => self::CURRENCY, 67 'details_submitted' => false, 68 'id' => 'acct_mch_002418151ef82e49f6edee1', 69 'livemode_activated_at' => 1432965401, 70 'livemode_enabled' => true, 71 'object' => 'merchant', 72 'product_detail' => null, 73 'product_name' => null, 74 'product_type' => null, 75 'site_published' => false, 76 'url' => null 77 ), 78 'object' => 'account' 79 80 ); 15 'customer' => [ 16 'cards' => [ 17 'count' => 1, 18 'data' => [ 19 [ 20 'address_city' => '\u8d64\u5742', 21 'address_line1' => '7-4', 22 'address_line2' => '203', 23 'address_state' => '\u6e2f\u533a', 24 'address_zip' => '1070050', 25 'address_zip_check' => 'passed', 26 'brand' => 'Visa', 27 'country' => self::COUNTRY, 28 'created' => 1432965397, 29 'cvc_check' => 'passed', 30 'exp_month' => 12, 31 'exp_year' => 2016, 32 'fingerprint' => 'e1d8225886e3a7211127df751c86787f', 33 'id' => 'car_99abf74cb5527ff68233a8b836dd', 34 'last4' => '4242', 35 'livemode' => true, 36 'name' => 'Test Hodler', 37 'object' => 'card' 38 ] 39 ], 40 'object' => 'list', 41 'url' => '/v1/accounts/cards' 42 ], 43 'created' => 1432965397, 44 'default_card' => null, 45 'description' => 'user customer', 46 'email' => null, 47 'id' => 'acct_cus_38153121efdb7964dd1e147', 48 'object' => 'customer' 49 ], 50 'email' => 'firstuser@mail.com', 51 'id' => $id, 52 'merchant' => [ 53 'bank_enabled' => false, 54 'brands_accepted' => [ 55 'Visa', 56 'American Express', 57 'MasterCard', 58 'JCB', 59 'Diners Club' 60 ], 61 'business_type' => 'personal', 62 'charge_type' => null, 63 'contact_phone' => null, 64 'country' => 'JP', 65 'created' => 1432965397, 66 'currencies_supported' => [ 67 self::CURRENCY 68 ], 69 'default_currency' => self::CURRENCY, 70 'details_submitted' => false, 71 'id' => 'acct_mch_002418151ef82e49f6edee1', 72 'livemode_activated_at' => 1432965401, 73 'livemode_enabled' => true, 74 'object' => 'merchant', 75 'product_detail' => null, 76 'product_name' => null, 77 'product_type' => null, 78 'site_published' => false, 79 'url' => null 80 ], 81 'object' => 'account' 82 ]; 81 83 } 82 84 83 85 public function testBasicRetrieve() 84 86 { 85 $this->mockRequest('GET', '/v1/accounts', array(), $this->managedAccountResponse('acct_ABC'));87 $this->mockRequest('GET', '/v1/accounts', [], $this->managedAccountResponse('acct_ABC')); 86 88 $account = Account::retrieve(); 87 89 88 90 $this->assertSame('acct_ABC', $account->id); 89 91 $this->assertSame('acct_cus_38153121efdb7964dd1e147', $account->customer->id); 90 92 $this->assertSame('acct_mch_002418151ef82e49f6edee1', $account->merchant->id); 91 93 } 92 93 public function testRetrieve()94 {95 $account = Account::retrieve();96 }97 94 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/ApiRequestorTest.php
r2149911 r3190331 5 5 class ApiRequestorTest extends TestCase 6 6 { 7 /** 8 * @before 9 */ 10 protected function setUpTestCase() 11 { 12 parent::setUpTestCase(); 13 # MaxRetryを戻してinitialDelayを短くする 14 Payjp::setMaxRetry(0); 15 Payjp::setRetryInitialDelay(0.1); 16 Payjp::setRetryMaxDelay(32); 17 } 18 19 /** 20 * @after 21 */ 22 protected function tearDownTestCase() 23 { 24 parent::tearDown(); 25 Payjp::setMaxRetry(0); 26 $this->setMaxRetryForCi(); 27 Payjp::setRetryInitialDelay(2); 28 Payjp::setRetryMaxDelay(32); 29 } 30 31 private $errorResponse = array('rcode'=>500, 'rbody'=>array('error' => array( 32 "code" => "payjp_wrong", 33 "message" => "An unexpected error occurred.", 34 "status" => 500, 35 "type" => "server_error", 36 ))); 37 private $rateLimitResponse = array('rcode'=>429, 'rbody'=>array('error' => array( 38 "code" => "over_capacity", 39 "message" => "The service is over capacity. Please try again later.", 40 "status" => 429, 41 "type" => "client_error", 42 ))); 43 private $successResponse = array('rcode'=>200, 'rbody'=>array('data'=>array())); 44 45 private function setUpResponses($responses) 46 { 47 $userCallCount = 0; 48 $mock = $this->setUpMockRequest(); 49 $mock->expects($this->exactly(count($responses))) 50 ->method('request') 51 // $userCallCount を使って、responses の中から適切なものを選択するために、参照渡しで渡す。 52 ->willReturnCallback(static function () use ($responses, &$userCallCount) { 53 $userCallCount++; 54 $response = $responses[$userCallCount - 1]; 55 return array(json_encode($response['rbody']), $response['rcode']); 56 }); 57 } 58 59 // _encodeObjects 60 7 61 public function testEncodeObjects() 8 62 { … … 25 79 $this->assertSame($enc, array('customer' => "\xc3\xa9")); 26 80 } 81 82 // request retry 83 84 public function testRetryDisabled() 85 { 86 $this->setUpResponses(array($this->rateLimitResponse)); 87 $requestor = new ApiRequestor(self::API_KEY); 88 89 try { 90 $response = $requestor->request('GET', '/v1/accounts'); 91 } catch (Error\Api $e) { 92 $this->assertSame($e->getMessage(), $this->rateLimitResponse['rbody']['error']['message']); 93 $this->assertSame($e->getHttpStatus(), $this->rateLimitResponse['rcode']); 94 } 95 } 96 97 public function testNoRetry() 98 { 99 $this->setUpResponses(array($this->errorResponse)); 100 $requestor = new ApiRequestor(self::API_KEY); 101 102 try { 103 $response = $requestor->request('GET', '/v1/accounts'); 104 } catch (Error\Api $e) { 105 $this->assertSame($e->getMessage(), $this->errorResponse['rbody']['error']['message']); 106 $this->assertSame($e->getHttpStatus(), $this->errorResponse['rcode']); 107 } 108 } 109 110 public function testFullRetryAndSuccess() 111 { 112 Payjp::setMaxRetry(2); 113 $this->setUpResponses(array($this->rateLimitResponse, $this->rateLimitResponse, $this->successResponse)); 114 $requestor = new ApiRequestor(self::API_KEY); 115 116 $response = $requestor->request('GET', '/v1/accounts'); 117 118 $this->assertSame($response[0], $this->successResponse['rbody']); 119 } 120 121 public function testFullRetryAndFailed() 122 { 123 Payjp::setMaxRetry(2); 124 $this->setUpResponses(array($this->rateLimitResponse, $this->rateLimitResponse, $this->rateLimitResponse)); 125 $requestor = new ApiRequestor(self::API_KEY); 126 127 try { 128 $response = $requestor->request('GET', '/v1/accounts'); 129 } catch (Error\Api $e) { 130 $this->assertSame($e->getMessage(), $this->rateLimitResponse['rbody']['error']['message']); 131 $this->assertSame($e->getHttpStatus(), $this->rateLimitResponse['rcode']); 132 } 133 } 134 135 public function testGetRetryDelay() 136 { 137 Payjp::setRetryInitialDelay(2); 138 $reflector = new \ReflectionClass('Payjp\\ApiRequestor'); 139 $method = $reflector->getMethod('getRetryDelay'); 140 $method->setAccessible(true); 141 $r = new ApiRequestor(self::API_KEY); 142 143 $this->assertTrue(1 <= $method->invoke($r, 0) && $method->invoke($r, 0) <= 2); 144 $this->assertTrue(2 <= $method->invoke($r, 1) && $method->invoke($r, 1) <= 4); 145 $this->assertTrue(4 <= $method->invoke($r, 2) && $method->invoke($r, 2) <= 8); 146 # not over retryMaxDelay 147 $this->assertTrue(16 <= $method->invoke($r, 4) && $method->invoke($r, 4) <= 32); 148 $this->assertTrue(16 <= $method->invoke($r, 10) && $method->invoke($r, 10) <= 32); 149 } 27 150 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/CardErrorTest.php
r2149911 r3190331 11 11 $params = [ 12 12 'card' => [ 13 "number" => "4242424242424242",14 "exp_month"=> 6,15 "exp_year" => date('Y') + 3,16 "cvc" => "314"13 'number' => '4242424242424242', 14 'exp_month' => 6, 15 'exp_year' => date('Y') - 1, 16 'cvc' => '314' 17 17 ] 18 18 ]; 19 19 20 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']);21 22 $charge = array(23 'amount' => 100,24 'currency' => self::CURRENCY,25 'card' => $card->id26 );27 28 20 try { 29 Charge::create($charge);21 Token::create($params, ['payjp_direct_token_generate' => 'true']); 30 22 } catch (Error\Card $e) { 31 23 $this->assertSame(402, $e->getHttpStatus()); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/ChargeTest.php
r2149911 r3190331 19 19 $params = [ 20 20 'card' => [ 21 "number" => "4242424242424242", 22 "exp_month" => "05", 23 'exp_year' => date('Y') + 1 24 ] 25 ]; 26 27 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 28 29 $c = Charge::create( 30 array( 31 'amount' => 100, 32 'currency' => self::CURRENCY, 33 'card' => $card->id 34 ) 35 ); 21 'number' => '4242424242424242', 22 'exp_month' => '05', 23 'exp_year' => date('Y') + 1, 24 'cvc' => '123', 25 ] 26 ]; 27 28 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 29 30 $c = Charge::create([ 31 'amount' => 100, 32 'currency' => self::CURRENCY, 33 'card' => $card->id, 34 ]); 36 35 $this->assertTrue($c->paid); 37 36 $this->assertFalse($c->refunded); … … 45 44 $params = [ 46 45 'card' => [ 47 "number" => "4242424242424242", 48 "exp_month" => 5, 49 'exp_year' => date('Y') + 1 50 ] 51 ]; 52 53 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 54 55 $c = Charge::create( 56 array( 57 'amount' => 100, 58 'currency' => self::CURRENCY, 59 'card' => $card->id 60 ), 61 array( 62 'idempotency_key' => self::generateRandomString(), 63 ) 64 ); 46 'number' => '4242424242424242', 47 'exp_month' => 5, 48 'exp_year' => date('Y') + 1, 49 'cvc' => '123', 50 ] 51 ]; 52 53 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 54 55 $c = Charge::create([ 56 'amount' => 100, 57 'currency' => self::CURRENCY, 58 'card' => $card->id 59 ], [ 60 'idempotency_key' => self::generateRandomString(), 61 ]); 65 62 66 63 $this->assertTrue($c->paid); … … 75 72 $params = [ 76 73 'card' => [ 77 "number" => "4242424242424242", 78 "exp_month" => 5, 79 "exp_year" => date('Y') + 1 80 ] 81 ]; 82 83 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 84 85 $c = Charge::create( 86 array( 87 'amount' => 100, 88 'currency' => self::CURRENCY, 89 'card' => $card->id 90 ) 91 ); 74 'number' => '4242424242424242', 75 'exp_month' => 5, 76 'exp_year' => date('Y') + 1, 77 'cvc' => '123', 78 ] 79 ]; 80 81 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 82 83 $c = Charge::create([ 84 'amount' => 100, 85 'currency' => self::CURRENCY, 86 'card' => $card->id 87 ]); 92 88 $d = Charge::retrieve($c->id); 93 89 $this->assertSame($d->id, $c->id); … … 99 95 self::authorizeFromEnv(); 100 96 101 $charges = Charge::all( 102 array( 103 'limit' => 3, 104 'offset' => 10 105 ) 106 ); 97 $charges = Charge::all([ 98 'limit' => 3, 99 'offset' => 10 100 ]); 107 101 108 102 $planID = 'gold-' . self::randomString(); … … 111 105 $customer = self::createTestCustomer(); 112 106 113 $charge = Charge::create( 114 array( 115 'amount' => 1000, 116 'currency' => self::CURRENCY, 117 'customer' => $customer->id 118 ) 119 ); 120 121 $charges_2 = Charge::all( 122 array( 123 'customer' => $customer->id 124 ) 125 ); 107 $charge = Charge::create([ 108 'amount' => 1000, 109 'currency' => self::CURRENCY, 110 'customer' => $customer->id 111 ]); 112 113 $charges_2 = Charge::all([ 114 'customer' => $customer->id 115 ]); 126 116 127 117 $this->assertSame(1, count($charges_2['data'])); 128 118 $this->assertSame($charge->id, $charges_2['data'][0]->id); 129 119 130 $charge_2 = Charge::create( 131 array( 132 'amount' => 1500, 133 'currency' => self::CURRENCY, 134 'customer' => $customer->id 135 ) 136 ); 137 138 $charges_3 = Charge::all( 139 array( 140 'limit' => 2, 141 'offset' => 0, 142 'customer' => $customer->id 143 ) 144 ); 120 $charge_2 = Charge::create([ 121 'amount' => 1500, 122 'currency' => self::CURRENCY, 123 'customer' => $customer->id 124 ]); 125 126 $charges_3 = Charge::all([ 127 'limit' => 2, 128 'offset' => 0, 129 'customer' => $customer->id 130 ]); 145 131 146 132 $this->assertSame(2, count($charges_3['data'])); … … 154 140 $params = [ 155 141 'card' => [ 156 "number" => "4242424242424242", 157 "exp_month" => 5, 158 "exp_year" => date('Y') + 1 159 ] 160 ]; 161 162 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 163 164 $charge = Charge::create( 165 array( 166 'amount' => 100, 167 'currency' => self::CURRENCY, 168 'card' => $card->id 169 ) 170 ); 142 'number' => '4242424242424242', 143 'exp_month' => 5, 144 'exp_year' => date('Y') + 1, 145 'cvc' => '123', 146 ] 147 ]; 148 149 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 150 151 $charge = Charge::create([ 152 'amount' => 100, 153 'currency' => self::CURRENCY, 154 'card' => $card->id 155 ]); 171 156 172 157 $charge->description = 'foo bar'; … … 185 170 $params = [ 186 171 'card' => [ 187 "number" => "4242424242424242", 188 "exp_month" => 5, 189 "exp_year" => date('Y') + 1 190 ] 191 ]; 192 193 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 194 195 $charge = Charge::create( 196 array( 197 'amount' => 100, 198 'currency' => self::CURRENCY, 199 'card' => $card->id, 200 'capture' => false 201 ) 202 ); 172 'number' => '4242424242424242', 173 'exp_month' => 5, 174 'exp_year' => date('Y') + 1, 175 'cvc' => '123', 176 ] 177 ]; 178 179 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 180 181 $charge = Charge::create([ 182 'amount' => 100, 183 'currency' => self::CURRENCY, 184 'card' => $card->id, 185 'capture' => false 186 ]); 203 187 204 188 $this->assertFalse($charge->captured); … … 216 200 $params = [ 217 201 'card' => [ 218 "number" => "4242424242424242", 219 "exp_month" => 5, 220 "exp_year" => date('Y') + 1 221 ] 222 ]; 223 224 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 225 226 $charge = Charge::create( 227 array( 228 'amount' => 100, 229 'currency' => self::CURRENCY, 230 'card' => $card->id, 231 'capture' => false 232 ) 233 ); 202 'number' => '4242424242424242', 203 'exp_month' => 5, 204 'exp_year' => date('Y') + 1, 205 'cvc' => '123', 206 ] 207 ]; 208 209 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 210 211 $charge = Charge::create([ 212 'amount' => 100, 213 'currency' => self::CURRENCY, 214 'card' => $card->id, 215 'capture' => false 216 ]); 234 217 235 218 $this->assertFalse($charge->captured); … … 247 230 $params = [ 248 231 'card' => [ 249 "number" => "4242424242424242", 250 "exp_month" => 5, 251 "exp_year" => date('Y') + 1 252 ] 253 ]; 254 255 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 256 257 $charge = Charge::create( 258 array( 259 'amount' => 100, 260 'currency' => self::CURRENCY, 261 'card' => $card->id, 262 ) 263 ); 232 'number' => '4242424242424242', 233 'exp_month' => 5, 234 'exp_year' => date('Y') + 1, 235 'cvc' => '123', 236 ] 237 ]; 238 239 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 240 241 $charge = Charge::create([ 242 'amount' => 100, 243 'currency' => self::CURRENCY, 244 'card' => $card->id, 245 ]); 264 246 265 247 $this->assertTrue($charge->captured); 266 248 267 $redundChargePart = $charge->refund( 268 array( 269 'amount' => 50, 270 'refund_reason' => 'foo bar 1' 271 ) 272 ); 249 $redundChargePart = $charge->refund([ 250 'amount' => 50, 251 'refund_reason' => 'foo bar 1' 252 ]); 273 253 274 254 $this->assertTrue($redundChargePart->refunded); … … 279 259 $this->assertSame(50, $charge->amount_refunded); 280 260 281 $refundChargeAll = $charge->refund( 282 array( 283 'refund_reason' => 'foo bar 2' 284 ) 285 ); 261 $refundChargeAll = $charge->refund([ 262 'refund_reason' => 'foo bar 2' 263 ]); 286 264 287 265 $this->assertTrue($refundChargeAll->refunded); … … 293 271 } 294 272 295 /**296 * @expectedException Payjp\Error\Card297 */298 273 public function testInvalidCard() 299 274 { 300 self::authorizeFromEnv(); 301 302 $params = [ 303 'card' => [ 304 "number" => "4242424242424241", 305 "exp_month" => 5, 306 "exp_year" => date('Y') + 1 307 ] 308 ]; 309 310 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 311 312 Charge::create( 313 array( 314 'amount' => 100, 315 'currency' => self::CURRENCY, 316 'card' => $card->id 317 ) 318 ); 275 $this->expectException('\Payjp\Error\Card'); 276 277 self::authorizeFromEnv(); 278 279 $params = [ 280 'card' => [ 281 'number' => '4242424242424241', 282 'exp_month' => 5, 283 'exp_year' => date('Y') + 1, 284 'cvc' => '123', 285 ] 286 ]; 287 288 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 289 290 Charge::create([ 291 'amount' => 100, 292 'currency' => self::CURRENCY, 293 'card' => $card->id 294 ]); 319 295 } 320 296 … … 326 302 $params = [ 327 303 'card' => [ 328 "number" => "4000000000000070", 329 "exp_month" => '05', 330 'exp_year' => (date('Y') + 1) 331 ] 332 ]; 333 334 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 335 336 $ch = Charge::create( 337 array( 338 'amount' => 100, 339 'currency' => self::CURRENCY, 340 'card' => $card->id 341 ) 342 ); 343 344 $this->assertSame("failed", $ch->card->address_zip_check); 304 'number' => '4000000000000070', 305 'exp_month' => '05', 306 'exp_year' => (date('Y') + 1), 307 'cvc' => '123', 308 ] 309 ]; 310 311 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 312 313 $ch = Charge::create([ 314 'amount' => 100, 315 'currency' => self::CURRENCY, 316 'card' => $card->id 317 ]); 318 319 $this->assertSame('failed', $ch->card->address_zip_check); 345 320 } 346 321 … … 351 326 $params = [ 352 327 'card' => [ 353 "number" => "4000000000000100", 354 "exp_month" => '05', 355 'exp_year' => (date('Y') + 1) 356 ] 357 ]; 358 359 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 360 361 $ch = Charge::create( 362 array( 363 'amount' => 100, 364 'currency' => self::CURRENCY, 365 'card' => $card->id 366 ) 367 ); 368 369 $this->assertSame("failed", $ch->card->cvc_check); 328 'number' => '4000000000000100', 329 'exp_month' => '05', 330 'exp_year' => (date('Y') + 1), 331 'cvc' => '123', 332 ] 333 ]; 334 335 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 336 337 $ch = Charge::create([ 338 'amount' => 100, 339 'currency' => self::CURRENCY, 340 'card' => $card->id 341 ]); 342 343 $this->assertSame('failed', $ch->card->cvc_check); 370 344 } 371 345 … … 376 350 $params = [ 377 351 'card' => [ 378 "number" => "4000000000000150", 379 "exp_month" => '05', 380 'exp_year' => (date('Y') + 1) 381 ] 382 ]; 383 384 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 385 386 $ch = Charge::create( 387 array( 388 'amount' => 100, 389 'currency' => self::CURRENCY, 390 'card' => $card->id 391 ) 392 ); 393 394 $this->assertSame("unavailable", $ch->card->cvc_check); 352 'number' => '4000000000000150', 353 'exp_month' => '05', 354 'exp_year' => (date('Y') + 1), 355 'cvc' => '123', 356 ] 357 ]; 358 359 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 360 361 $ch = Charge::create([ 362 'amount' => 100, 363 'currency' => self::CURRENCY, 364 'card' => $card->id 365 ]); 366 367 $this->assertSame('unavailable', $ch->card->cvc_check); 395 368 } 396 369 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/CustomerTest.php
r2149911 r3190331 8 8 public function testCreate() 9 9 { 10 $attribute = array(11 'email' => 'gdb@pay.jp',12 'description' => 'foo bar'13 );14 10 $attribute = [ 11 'email' => 'gdb@pay.jp', 12 'description' => 'foo bar' 13 ]; 14 15 15 $customer = self::createTestCustomer($attribute); 16 16 $this->assertSame($attribute['email'], $customer->email); 17 17 $this->assertSame($attribute['description'], $customer->description); 18 18 } 19 19 20 20 // GET/customers/:id 21 21 public function testRetrieve() … … 23 23 $customer = self::createTestCustomer(); 24 24 $retrieve_customer = Customer::retrieve($customer->id); 25 26 25 $this->assertSame($customer->id, $retrieve_customer->id); 27 26 } 28 27 29 28 // GET/customers/ 30 29 public function testAll() 31 30 { 32 $customers = Customer::all( 33 array( 34 'limit' => 3, 35 'offset' => 10 36 ) 37 ); 38 } 39 31 $customers = Customer::all([ 32 'limit' => 3, 33 'offset' => 10 34 ]); 35 $this->assertCount(3, $customers['data']); 36 } 37 40 38 // DELETE/customers/:id 41 39 public function testDeletion() … … 43 41 $customer = self::createTestCustomer(); 44 42 $id = $customer->id; 45 43 46 44 $delete_customer = $customer->delete(); 47 45 … … 49 47 $this->assertFalse($customer->livemode); 50 48 $this->assertTrue($customer->deleted); 51 49 52 50 $this->assertNull($customer['active_card']); 53 51 54 52 $this->assertSame($id, $delete_customer->id); 55 53 $this->assertFalse($delete_customer->livemode); 56 54 $this->assertTrue($delete_customer->deleted); 57 55 58 56 $this->assertNull($delete_customer['active_card']); 59 57 } 60 58 61 59 //POST /customers/:id 62 60 public function testSave() … … 83 81 } 84 82 85 /**86 * @expectedException Payjp\Error\InvalidRequest87 */88 83 public function testBogusAttribute() 89 84 { 85 $this->expectException('\Payjp\Error\InvalidRequest'); 90 86 $customer = self::createTestCustomer(); 91 87 $customer->bogus = 'bogus'; … … 93 89 } 94 90 95 /**96 * @expectedException InvalidArgumentException97 */98 91 public function testUpdateDescriptionEmpty() 99 92 { 93 $this->expectException('\InvalidArgumentException'); 100 94 $customer = self::createTestCustomer(); 101 95 $customer->description = ''; 102 103 $customer->save(); 104 96 97 $customer->save(); 98 105 99 $updatedCustomer = Customer::retrieve($customer->id); 106 100 $this->assertSame('123', $updatedCustomer->description); 107 101 } 108 102 109 103 public function testUpdateDescriptionNull() 110 104 { 111 $customer = self::createTestCustomer( array('description' => 'foo bar'));105 $customer = self::createTestCustomer(['description' => 'foo bar']); 112 106 $customer->description = null; 113 114 $customer->save(); 115 107 108 $customer->save(); 109 116 110 $updatedCustomer = Customer::retrieve($customer->id); 117 111 $this->assertSame('', $updatedCustomer->description); 118 112 $this->assertSame('', $customer->description); 119 113 } 120 114 121 115 //POST /customers/:id/cards 122 116 //GET /customers/:id/cards … … 124 118 { 125 119 $customer = $this->createTestCustomer(); 126 120 127 121 $defaultCard = $customer->cards->data[0]; 128 122 129 123 $params = [ 130 124 'card' => [ 131 "number" => "4242424242424242",132 "exp_month"=> 12,133 "exp_year"=> date('Y') + 3,134 "cvc" => "314"125 'number' => '4242424242424242', 126 'exp_month' => 12, 127 'exp_year' => date('Y') + 3, 128 'cvc' => '314' 135 129 ] 136 130 ]; 137 131 138 $token = Token::create($params, $options =['payjp_direct_token_generate' => 'true']);139 132 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 133 140 134 $params2 = [ 141 135 'card' => [ 142 "number" => "4242424242424242",143 "exp_month"=> 7,144 "exp_year"=> date('Y') + 3,145 "cvc" => "314"136 'number' => '4242424242424242', 137 'exp_month' => 7, 138 'exp_year' => date('Y') + 3, 139 'cvc' => '314' 146 140 ] 147 141 ]; 148 142 149 $card = Token::create($params2, $options = ['payjp_direct_token_generate' => 'true']); 150 151 $createdCard = $customer->cards->create(array("card" => $token->id)); 152 $createdCard_2 = $customer->cards->create(array("card" => $card->id)); 153 154 $updatedCustomer = Customer::retrieve($customer->id); 155 $cardList = $updatedCustomer->cards->all(); 156 $this->assertSame(count($cardList["data"]), 3); 157 158 $this->assertSame($createdCard_2->id, $cardList["data"][0]->id); 159 $this->assertSame($createdCard->id, $cardList["data"][1]->id); 160 $this->assertSame($defaultCard->id, $cardList["data"][2]->id); 161 162 $card = $customer->cards->retrieve($cardList["data"][1]->id); 163 $this->assertSame($card->id, $cardList["data"][1]->id); 164 165 $updatedCustomer = Customer::retrieve($customer->id); 166 $cardList = $updatedCustomer->cards->all( 167 array( 168 'limit' => 1, 169 'offset' => 1 170 ) 171 ); 172 $this->assertSame(count($cardList["data"]), 1); 173 } 174 143 $card = Token::create($params2, ['payjp_direct_token_generate' => 'true']); 144 145 $createdCard = $customer->cards->create(['card' => $token->id]); 146 $createdCard_2 = $customer->cards->create(['card' => $card->id]); 147 148 $updatedCustomer = Customer::retrieve($customer->id); 149 $cardList = $updatedCustomer->cards->all(); 150 $this->assertSame(count($cardList['data']), 3); 151 152 $this->assertSame($createdCard_2->id, $cardList['data'][0]->id); 153 $this->assertSame($createdCard->id, $cardList['data'][1]->id); 154 $this->assertSame($defaultCard->id, $cardList['data'][2]->id); 155 156 $card = $customer->cards->retrieve($cardList['data'][1]->id); 157 $this->assertSame($card->id, $cardList['data'][1]->id); 158 159 $updatedCustomer = Customer::retrieve($customer->id); 160 $cardList = $updatedCustomer->cards->all([ 161 'limit' => 1, 162 'offset' => 1 163 ]); 164 $this->assertSame(count($cardList['data']), 1); 165 } 166 175 167 //POST /customers/:id/cards/:card_id 176 168 public function testCustomerUpdateCard() 177 169 { 178 170 $customer = $this->createTestCustomer(); 179 171 180 172 $cards = $customer->cards->all(); 181 $this->assertSame(count($cards[ "data"]), 1);182 173 $this->assertSame(count($cards['data']), 1); 174 183 175 $card = $cards['data'][0]; 184 $card->name = "Littleorc";176 $card->name = 'Littleorc'; 185 177 $card->save(); 186 187 $updatedCustomer = Customer::retrieve($customer->id); 188 $cardList = $updatedCustomer->cards->all(); 189 $this->assertSame($cardList[ "data"][0]->name, "Littleorc");190 } 191 178 179 $updatedCustomer = Customer::retrieve($customer->id); 180 $cardList = $updatedCustomer->cards->all(); 181 $this->assertSame($cardList['data'][0]->name, 'Littleorc'); 182 } 183 192 184 public function testCustomerDeleteCard() 193 185 { 194 186 $params = [ 195 187 'card' => [ 196 "number" => "4242424242424242",197 "exp_month"=> 7,198 "exp_year"=> date('Y') + 3,199 "cvc" => "314"188 'number' => '4242424242424242', 189 'exp_month' => 7, 190 'exp_year' => date('Y') + 3, 191 'cvc' => '314' 200 192 ] 201 193 ]; 202 194 203 195 $token = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 204 196 205 197 $customer = $this->createTestCustomer(); 206 $createdCard = $customer->cards->create( array("card" => $token->id));207 208 $updatedCustomer = Customer::retrieve($customer->id); 209 $cardList = $updatedCustomer->cards->all(); 210 $this->assertSame(count($cardList[ "data"]), 2);211 198 $createdCard = $customer->cards->create(['card' => $token->id]); 199 200 $updatedCustomer = Customer::retrieve($customer->id); 201 $cardList = $updatedCustomer->cards->all(); 202 $this->assertSame(count($cardList['data']), 2); 203 212 204 $deleteStatus = $updatedCustomer->cards->retrieve($createdCard->id)->delete(); 213 205 $this->assertTrue($deleteStatus->deleted); 214 206 215 207 $postDeleteCustomer = Customer::retrieve($customer->id); 216 208 $postDeleteCards = $postDeleteCustomer->cards->all(); 217 $this->assertSame(count($postDeleteCards[ "data"]), 1);218 219 $cardList = $updatedCustomer->cards->all(); 220 $this->assertSame(count($cardList[ "data"]), 1);221 } 222 209 $this->assertSame(count($postDeleteCards['data']), 1); 210 211 $cardList = $updatedCustomer->cards->all(); 212 $this->assertSame(count($cardList['data']), 1); 213 } 214 223 215 public function testCustomerSubscriptionAllRetrieve() 224 216 { 225 217 $planID = 'gold-' . self::randomString(); 226 218 self::retrieveOrCreatePlan($planID); 227 228 $customer = self::createTestCustomer(); 229 230 $subscription = Subscription::create( 231 array( 232 'customer' => $customer->id, 233 'plan' => $planID 234 ) 235 ); 236 219 220 $customer = self::createTestCustomer(); 221 222 $subscription = Subscription::create([ 223 'customer' => $customer->id, 224 'plan' => $planID 225 ]); 226 237 227 $planID_2 = 'gold-2-' . self::randomString(); 238 228 self::retrieveOrCreatePlan($planID_2); 239 229 240 $subscription_2 = Subscription::create( 241 array( 242 'customer' => $customer->id, 243 'plan' => $planID_2 244 ) 245 ); 246 230 $subscription_2 = Subscription::create([ 231 'customer' => $customer->id, 232 'plan' => $planID_2 233 ]); 234 247 235 $customerRetrive = Customer::retrieve($customer->id); 248 236 $subscriptions = $customerRetrive->subscriptions->all(); … … 250 238 $this->assertSame($subscription_2->id, $subscriptions['data'][0]->id); 251 239 $this->assertSame($subscription->id, $subscriptions['data'][1]->id); 252 240 253 241 $this->assertSame(2, count($subscriptions['data'])); 254 242 $this->assertSame($customer->id, $subscriptions['data'][0]->customer); 255 243 $this->assertSame($planID_2, $subscriptions['data'][0]->plan->id); 256 244 257 245 $subscriptionRetrieve = $customerRetrive->subscriptions->retrieve($subscription->id); 258 246 $this->assertSame($subscription->id, $subscriptionRetrieve->id); 259 247 $this->assertSame($planID, $subscriptionRetrieve->plan->id); 260 248 } 261 249 262 250 public function testCustomerChargeAll() 263 251 { 264 252 $planID = 'gold-' . self::randomString(); 265 253 self::retrieveOrCreatePlan($planID); 266 267 $customer = self::createTestCustomer(); 268 269 $charge = Charge::create( 270 array( 271 'amount' => 1000, 272 'currency' => self::CURRENCY, 273 'customer' => $customer->id 274 ) 275 ); 276 254 255 $customer = self::createTestCustomer(); 256 257 $charge = Charge::create([ 258 'amount' => 1000, 259 'currency' => self::CURRENCY, 260 'customer' => $customer->id 261 ]); 262 277 263 $charges = $customer->charges(); 278 264 279 265 $this->assertSame(1, count($charges['data'])); 280 266 $this->assertSame($charge->id, $charges['data'][0]->id); 281 267 282 $charge_2 = Charge::create( 283 array( 284 'amount' => 1500, 285 'currency' => self::CURRENCY, 286 'customer' => $customer->id 287 ) 288 ); 289 268 $charge_2 = Charge::create([ 269 'amount' => 1500, 270 'currency' => self::CURRENCY, 271 'customer' => $customer->id 272 ]); 273 290 274 $charges_2 = $customer->charges(); 291 275 292 276 $this->assertSame(2, count($charges_2['data'])); 293 277 $this->assertSame($charge_2->id, $charges_2['data'][0]->id); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/PayjpObjectTest.php
r2149911 r3190331 49 49 $converted = $s->__toArray(); 50 50 51 $this->assert InternalType('array', $converted);51 $this->assertSame('array', gettype($converted)); 52 52 $this->assertArrayHasKey('foo', $converted); 53 53 $this->assertEquals('a', $converted['foo']); … … 64 64 $converted = $s->__toArray(true); 65 65 66 $this->assert InternalType('array', $converted);66 $this->assertSame('array', gettype($converted)); 67 67 $this->assertArrayHasKey('child', $converted); 68 $this->assert InternalType('array', $converted['child']);68 $this->assertSame('array', gettype($converted['child'])); 69 69 $this->assertArrayHasKey('foo', $converted['child']); 70 70 $this->assertEquals('a', $converted['child']['foo']); -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/PlanTest.php
r2149911 r3190331 8 8 { 9 9 self::authorizeFromEnv(); 10 $planI D= 'gold-' . self::randomString();11 $p = Plan::create( array(10 $planId = 'gold-' . self::randomString(); 11 $p = Plan::create([ 12 12 'amount' => 2000, 13 13 'interval' => 'month', 14 14 'currency' => self::CURRENCY, 15 15 'name' => 'Plan', 16 'id' => $planID 17 )); 18 19 $plan_retrieve = Plan::retrieve($planID); 20 $this->assertSame($planID, $plan_retrieve->id); 21 22 $planID_2 = 'foobar-2-' . self::randomString(); 23 $p_2 = Plan::create( 24 array( 25 'amount' => 3000, 26 'interval' => 'month', 27 'currency' => self::CURRENCY, 28 'name' => 'Plan_2', 29 'id' => $planID_2 30 ) 31 ); 16 'id' => $planId 17 ]); 32 18 33 $plans = Plan::all( 34 array( 35 'limit' => 2, 36 'offset' => 0 37 ) 38 ); 19 $plan_retrieve = Plan::retrieve($planId); 20 $this->assertSame($planId, $plan_retrieve->id); 21 22 $planId_2 = 'foobar-2-' . self::randomString(); 23 $p_2 = Plan::create([ 24 'amount' => 3000, 25 'interval' => 'month', 26 'currency' => self::CURRENCY, 27 'name' => 'Plan_2', 28 'id' => $planId_2 29 ]); 30 31 $plans = Plan::all([ 32 'limit' => 2, 33 'offset' => 0 34 ]); 39 35 $this->assertSame(2, count($plans['data'])); 40 36 } … … 43 39 { 44 40 self::authorizeFromEnv(); 45 $plan _ID= 'gold-' . self::randomString();46 $p = Plan::create( array(41 $planId = 'gold-' . self::randomString(); 42 $p = Plan::create([ 47 43 'amount' => 2000, 48 44 'interval' => 'month', 49 45 'currency' => self::CURRENCY, 50 46 'name' => 'Plan', 51 'id' => $plan _ID52 ));47 'id' => $planId 48 ]); 53 49 $p->delete(); 54 50 $this->assertTrue($p->deleted); 55 $this->assertSame($plan _ID, $p->id);51 $this->assertSame($planId, $p->id); 56 52 } 57 53 … … 59 55 { 60 56 try { 61 $retrievedPlan =Plan::retrieve('0');57 Plan::retrieve('0'); 62 58 } catch (Error\InvalidRequest $e) { 63 // Can either succeed or 404, all other errors are bad 64 if ($e->httpStatus !== 404) { 65 $this->fail(); 66 } 59 $this->assertSame(404, $e->httpStatus); 67 60 } 68 61 } … … 71 64 { 72 65 self::authorizeFromEnv(); 73 $planI D= 'gold-' . self::randomString();74 $p = Plan::create( array(66 $planId = 'gold-' . self::randomString(); 67 $p = Plan::create([ 75 68 'amount' => 2000, 76 69 'interval' => 'month', 77 70 'currency' => self::CURRENCY, 78 71 'name' => 'Plan', 79 'id' => $planI D80 ));72 'id' => $planId 73 ]); 81 74 $p->name = 'A new plan name'; 82 75 $p->save(); 83 76 $this->assertSame($p->name, 'A new plan name'); 84 77 85 $payjpPlan = Plan::retrieve($planI D);78 $payjpPlan = Plan::retrieve($planId); 86 79 $this->assertSame($p->name, $payjpPlan->name); 87 80 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/RequestOptionsTest.php
r2149911 r3190331 71 71 } 72 72 73 /**74 * @expectedException Payjp\Error\Api75 */76 73 public function testWrongType() 77 74 { 75 $this->expectException("\Payjp\Error\Api"); 78 76 $opts = Util\RequestOptions::parse(5); 79 77 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/TestCase.php
r2149911 r3190331 7 7 * objects. 8 8 */ 9 class TestCase extends \PHPUnit _Framework_TestCase9 class TestCase extends \PHPUnit\Framework\TestCase 10 10 { 11 11 const API_KEY = 'sk_test_c62fade9d045b54cd76d7036';// public api key for test … … 13 13 const COUNTRY = 'JP'; 14 14 15 pr ivate$mock;15 protected $mock; 16 16 17 17 protected static function authorizeFromEnv() … … 25 25 } 26 26 27 protected function setUp()27 protected static function setMaxRetryForCi() 28 28 { 29 $maxRetry = getenv('MAX_RETRY'); 30 if ($maxRetry) { 31 Payjp::setMaxRetry($maxRetry); 32 } 33 } 34 35 /** 36 * @before 37 */ 38 protected function setUpTestCase() 39 { 40 $this->setMaxRetryForCi(); 29 41 ApiRequestor::setHttpClient(HttpClient\CurlClient::instance()); 30 42 $this->mock = null; 31 $this->call = 0;32 43 } 33 44 … … 35 46 { 36 47 $mock = $this->setUpMockRequest(); 37 $mock->expects($this->at($this->call++)) 38 ->method('request') 39 ->with(strtolower($method), 'https://api.pay.jp' . $path, $this->anything(), $params, false) 40 ->willReturn(array(json_encode($return), 200)); 48 $mock->expects($this->once()) 49 ->method('request') 50 ->with( 51 strtolower($method), 52 'https://api.pay.jp' . $path, 53 $this->anything(), 54 $params, 55 false 56 ) 57 ->willReturn(array(json_encode($return), 200)); 41 58 } 42 59 43 private function setUpMockRequest() 44 { 45 if (!$this->mock) { 46 self::authorizeFromEnv(); 47 $this->mock = $this->getMock('\Payjp\HttpClient\ClientInterface'); 48 ApiRequestor::setHttpClient($this->mock); 49 } 50 return $this->mock; 51 } 52 53 /** 54 * Create a valid test charge. 55 */ 56 protected static function createTestCharge(array $attributes = array()) 60 protected function setUpMockRequest() 57 61 { 58 62 self::authorizeFromEnv(); 59 60 $params = [ 61 'card' => [ 62 "number" => "4242424242424242", 63 "exp_month" => 6, 64 "exp_year" => date('Y') + 3, 65 "cvc" => "314" 66 ] 67 ]; 68 69 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 70 71 return Charge::create( 72 $attributes + array( 73 'amount' => 2000, 74 'currency' => self::CURRENCY, 75 'description' => 'Charge for test@example.com', 76 'card' => $card 77 ) 78 ); 79 } 80 81 /** 82 * Create a valid test charge. 83 */ 84 protected static function createTestTransfer(array $attributes = array()) 85 { 86 self::authorizeFromEnv(); 87 88 $recipient = self::createTestRecipient(); 89 90 return Transfer::create( 91 $attributes + array( 92 'amount' => 2000, 93 'currency' => self::CURRENCY, 94 'description' => 'Transfer to test@example.com', 95 'recipient' => $recipient->id 96 ) 97 ); 63 $this->mock = $this->createMock('\Payjp\HttpClient\ClientInterface'); 64 ApiRequestor::setHttpClient($this->mock); 65 return $this->mock; 98 66 } 99 67 -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/TokenTest.php
r2149911 r3190331 11 11 $this->assertSame($token->instanceUrl(), '/v1/tokens/abcd%2Fefgh'); 12 12 } 13 13 14 14 public function testCreate() 15 15 { 16 16 self::authorizeFromEnv(); 17 17 18 18 $params = [ 19 19 'card' => [ 20 "number" => "4242424242424242",21 "exp_month"=> 6,22 "exp_year"=> date('Y') + 3,23 "cvc" => "314"20 'number' => '4242424242424242', 21 'exp_month' => 6, 22 'exp_year' => date('Y') + 3, 23 'cvc' => '314' 24 24 ] 25 25 ]; 26 27 $token = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 26 27 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 28 $this->assertNotNull($token); 28 29 } 29 30 30 31 public function testRetrieve() 31 32 { … … 34 35 $params = [ 35 36 'card' => [ 36 "number" => "4242424242424242",37 "exp_month"=> 6,38 "exp_year"=> date('Y') + 3,39 "cvc" => "314"37 'number' => '4242424242424242', 38 'exp_month' => 6, 39 'exp_year' => date('Y') + 3, 40 'cvc' => '314' 40 41 ] 41 42 ]; 42 43 $token = Token::create($params, $options =['payjp_direct_token_generate' => 'true']);44 43 44 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 45 45 46 $token_retrieve = Token::retrieve($token->id); 46 47 47 48 $this->assertSame($token->id, $token_retrieve->id); 48 49 } -
ht-pay-jp-for-kintone/tags/1.5.0/vendor/payjp/payjp-php/tests/TransferTest.php
r2149911 r3190331 8 8 { 9 9 self::authorizeFromEnv(); 10 11 $transfers = Transfer::all( 12 array( 13 'limit' => 3, 14 'offset' => 0 15 ) 16 ); 10 11 $transfers = Transfer::all([ 12 'limit' => 3, 13 'offset' => 0 14 ]); 17 15 18 16 if (count($transfers['data'])) { … … 21 19 } 22 20 } 23 21 24 22 public function testAllCharge() 25 23 { 26 24 self::authorizeFromEnv(); 27 28 $transfers = Transfer::all( 29 array( 25 26 $transfers = Transfer::all([ 27 'limit' => 3, 28 'offset' => 0 29 ]); 30 31 if (count($transfers['data'])) { 32 $transfer = Transfer::retrieve($transfers['data'][0]->id); 33 $charges = $transfer->charges->all([ 30 34 'limit' => 3, 31 35 'offset' => 0 32 ) 33 ); 34 35 if (count($transfers['data'])) { 36 $transfer = Transfer::retrieve($transfers['data'][0]->id); 37 $charges = $transfer->charges->all( 38 array( 39 'limit' => 3, 40 'offset' => 0 41 ) 42 ); 36 ]); 37 $this->markTestSkipped('Should be changed to mock.'); 38 // $this->assertTrue(count($charges['data']) > 0); 43 39 } 44 40 } -
ht-pay-jp-for-kintone/trunk/composer.lock
r2685245 r3190331 2 2 "_readme": [ 3 3 "This file locks the dependencies of your project to a known state", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md# composer-lock-the-lock-file",4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 5 "This file is @generated automatically" 6 6 ], … … 9 9 { 10 10 "name": "payjp/payjp-php", 11 "version": "1. 0.5",11 "version": "1.7.0", 12 12 "source": { 13 13 "type": "git", 14 14 "url": "https://github.com/payjp/payjp-php.git", 15 "reference": " 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd"15 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175" 16 16 }, 17 17 "dist": { 18 18 "type": "zip", 19 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/ 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd",20 "reference": " 57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd",19 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/f8fe3185fc0a481214c35421f051d8cc50f3f175", 20 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175", 21 21 "shasum": "" 22 22 }, … … 28 28 }, 29 29 "require-dev": { 30 "phpunit/phpunit": "~4.0", 31 "satooshi/php-coveralls": "~0.6.1", 32 "squizlabs/php_codesniffer": "~2.0" 30 "phpunit/phpunit": "~5.7 || ~9.5", 31 "squizlabs/php_codesniffer": "~3.6" 33 32 }, 34 33 "type": "library", … … 60 59 "payment processing" 61 60 ], 62 "time": "2019-08-09T13:10:15+00:00" 61 "support": { 62 "issues": "https://github.com/payjp/payjp-php/issues", 63 "source": "https://github.com/payjp/payjp-php/tree/1.7.0" 64 }, 65 "time": "2024-11-13T05:21:09+00:00" 63 66 } 64 67 ], … … 70 73 "prefer-lowest": false, 71 74 "platform": [], 72 "platform-dev": [] 75 "platform-dev": [], 76 "plugin-api-version": "2.6.0" 73 77 } -
ht-pay-jp-for-kintone/trunk/ht-payjp-for-kintone.php
r2989122 r3190331 8 8 * Text Domain: ht-pay-jp-for-kintone 9 9 * Domain Path: /languages 10 * Version: 1. 4.110 * Version: 1.5.0 11 11 * 12 12 * @package HT_Payjp_For_Kintone -
ht-pay-jp-for-kintone/trunk/includes/class-ht-payjp-for-kintone-Payment.php
r2989122 r3190331 170 170 ); 171 171 172 } catch ( \Payjp\Error\Card $e ) { 173 // カード決済エラーの場合 174 $abort = true; 175 $submission->set_response( $contact_form->filter_message( __( 'Card payment failed. Please check your card information.', 'payjp-for-kintone' ) ) ); 176 ht_payjp_for_kintone_send_error_mail( $contact_form, $e->getMessage() ); 177 172 178 } catch ( \Payjp\Error\InvalidRequest $e ) { 173 179 // その他のPAY.JPエラーの場合 174 180 $abort = true; 175 181 $submission->set_response( $contact_form->filter_message( $e->getMessage() ) ); -
ht-pay-jp-for-kintone/trunk/readme.txt
r2989122 r3190331 3 3 Donate link: 4 4 Tags: Contact Form 7, kintone, PAY.JP, form data to kintone 5 Requires at least: 4.5 6 Tested up to: 6.3.2 7 Stable tag: 1.4.1 5 Requires at least: 6.6 6 Tested up to: 6.7 7 Requires PHP: 7.4 8 Stable tag: 1.5.0 8 9 License: GPLv2 or later 9 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 53 54 54 55 == Changelog == 56 57 = 1.5.0( 2024-11-17 ) = 58 59 * Updated payjp/payjp-php version from 1.0.5 to 1.7.0 60 * Added error handling for \Payjp\Error\Card 55 61 56 62 = 1.4.1( 2023-11-05 ) = -
ht-pay-jp-for-kintone/trunk/vendor/autoload.php
r2149911 r3190331 3 3 // autoload.php @generated by Composer 4 4 5 if (PHP_VERSION_ID < 50600) { 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 21 } 22 5 23 require_once __DIR__ . '/composer/autoload_real.php'; 6 24 -
ht-pay-jp-for-kintone/trunk/vendor/composer/ClassLoader.php
r2149911 r3190331 38 38 * @author Fabien Potencier <fabien@symfony.com> 39 39 * @author Jordi Boggiano <j.boggiano@seld.be> 40 * @see http ://www.php-fig.org/psr/psr-0/41 * @see http ://www.php-fig.org/psr/psr-4/40 * @see https://www.php-fig.org/psr/psr-0/ 41 * @see https://www.php-fig.org/psr/psr-4/ 42 42 */ 43 43 class ClassLoader 44 44 { 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var string|null */ 49 private $vendorDir; 50 45 51 // PSR-4 52 /** 53 * @var array<string, array<string, int>> 54 */ 46 55 private $prefixLengthsPsr4 = array(); 56 /** 57 * @var array<string, list<string>> 58 */ 47 59 private $prefixDirsPsr4 = array(); 60 /** 61 * @var list<string> 62 */ 48 63 private $fallbackDirsPsr4 = array(); 49 64 50 65 // PSR-0 66 /** 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 72 */ 51 73 private $prefixesPsr0 = array(); 74 /** 75 * @var list<string> 76 */ 52 77 private $fallbackDirsPsr0 = array(); 53 78 79 /** @var bool */ 54 80 private $useIncludePath = false; 81 82 /** 83 * @var array<string, string> 84 */ 55 85 private $classMap = array(); 86 87 /** @var bool */ 56 88 private $classMapAuthoritative = false; 89 90 /** 91 * @var array<string, bool> 92 */ 57 93 private $missingClasses = array(); 94 95 /** @var string|null */ 58 96 private $apcuPrefix; 59 97 98 /** 99 * @var array<string, self> 100 */ 101 private static $registeredLoaders = array(); 102 103 /** 104 * @param string|null $vendorDir 105 */ 106 public function __construct($vendorDir = null) 107 { 108 $this->vendorDir = $vendorDir; 109 self::initializeIncludeClosure(); 110 } 111 112 /** 113 * @return array<string, list<string>> 114 */ 60 115 public function getPrefixes() 61 116 { 62 117 if (!empty($this->prefixesPsr0)) { 63 return call_user_func_array('array_merge', $this->prefixesPsr0);118 return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); 64 119 } 65 120 … … 67 122 } 68 123 124 /** 125 * @return array<string, list<string>> 126 */ 69 127 public function getPrefixesPsr4() 70 128 { … … 72 130 } 73 131 132 /** 133 * @return list<string> 134 */ 74 135 public function getFallbackDirs() 75 136 { … … 77 138 } 78 139 140 /** 141 * @return list<string> 142 */ 79 143 public function getFallbackDirsPsr4() 80 144 { … … 82 146 } 83 147 148 /** 149 * @return array<string, string> Array of classname => path 150 */ 84 151 public function getClassMap() 85 152 { … … 88 155 89 156 /** 90 * @param array $classMap Class to filename map 157 * @param array<string, string> $classMap Class to filename map 158 * 159 * @return void 91 160 */ 92 161 public function addClassMap(array $classMap) … … 103 172 * appending or prepending to the ones previously set for this prefix. 104 173 * 105 * @param string $prefix The prefix 106 * @param array|string $paths The PSR-0 root directories 107 * @param bool $prepend Whether to prepend the directories 174 * @param string $prefix The prefix 175 * @param list<string>|string $paths The PSR-0 root directories 176 * @param bool $prepend Whether to prepend the directories 177 * 178 * @return void 108 179 */ 109 180 public function add($prefix, $paths, $prepend = false) 110 181 { 182 $paths = (array) $paths; 111 183 if (!$prefix) { 112 184 if ($prepend) { 113 185 $this->fallbackDirsPsr0 = array_merge( 114 (array)$paths,186 $paths, 115 187 $this->fallbackDirsPsr0 116 188 ); … … 118 190 $this->fallbackDirsPsr0 = array_merge( 119 191 $this->fallbackDirsPsr0, 120 (array)$paths192 $paths 121 193 ); 122 194 } … … 127 199 $first = $prefix[0]; 128 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 129 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 130 202 131 203 return; … … 133 205 if ($prepend) { 134 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 135 (array)$paths,207 $paths, 136 208 $this->prefixesPsr0[$first][$prefix] 137 209 ); … … 139 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 140 212 $this->prefixesPsr0[$first][$prefix], 141 (array)$paths213 $paths 142 214 ); 143 215 } … … 148 220 * appending or prepending to the ones previously set for this namespace. 149 221 * 150 * @param string $prefix The prefix/namespace, with trailing '\\'151 * @param array|string $paths The PSR-4 base directories152 * @param bool $prepend Whether to prepend the directories222 * @param string $prefix The prefix/namespace, with trailing '\\' 223 * @param list<string>|string $paths The PSR-4 base directories 224 * @param bool $prepend Whether to prepend the directories 153 225 * 154 226 * @throws \InvalidArgumentException 227 * 228 * @return void 155 229 */ 156 230 public function addPsr4($prefix, $paths, $prepend = false) 157 231 { 232 $paths = (array) $paths; 158 233 if (!$prefix) { 159 234 // Register directories for the root namespace. 160 235 if ($prepend) { 161 236 $this->fallbackDirsPsr4 = array_merge( 162 (array)$paths,237 $paths, 163 238 $this->fallbackDirsPsr4 164 239 ); … … 166 241 $this->fallbackDirsPsr4 = array_merge( 167 242 $this->fallbackDirsPsr4, 168 (array)$paths243 $paths 169 244 ); 170 245 } … … 176 251 } 177 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 178 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 179 254 } elseif ($prepend) { 180 255 // Prepend directories for an already registered namespace. 181 256 $this->prefixDirsPsr4[$prefix] = array_merge( 182 (array)$paths,257 $paths, 183 258 $this->prefixDirsPsr4[$prefix] 184 259 ); … … 187 262 $this->prefixDirsPsr4[$prefix] = array_merge( 188 263 $this->prefixDirsPsr4[$prefix], 189 (array)$paths264 $paths 190 265 ); 191 266 } … … 196 271 * replacing any others previously set for this prefix. 197 272 * 198 * @param string $prefix The prefix 199 * @param array|string $paths The PSR-0 base directories 273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 275 * 276 * @return void 200 277 */ 201 278 public function set($prefix, $paths) … … 212 289 * replacing any others previously set for this namespace. 213 290 * 214 * @param string $prefix The prefix/namespace, with trailing '\\'215 * @param array|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 216 293 * 217 294 * @throws \InvalidArgumentException 295 * 296 * @return void 218 297 */ 219 298 public function setPsr4($prefix, $paths) … … 235 314 * 236 315 * @param bool $useIncludePath 316 * 317 * @return void 237 318 */ 238 319 public function setUseIncludePath($useIncludePath) … … 257 338 * 258 339 * @param bool $classMapAuthoritative 340 * 341 * @return void 259 342 */ 260 343 public function setClassMapAuthoritative($classMapAuthoritative) … … 277 360 * 278 361 * @param string|null $apcuPrefix 362 * 363 * @return void 279 364 */ 280 365 public function setApcuPrefix($apcuPrefix) … … 297 382 * 298 383 * @param bool $prepend Whether to prepend the autoloader or not 384 * 385 * @return void 299 386 */ 300 387 public function register($prepend = false) 301 388 { 302 389 spl_autoload_register(array($this, 'loadClass'), true, $prepend); 390 391 if (null === $this->vendorDir) { 392 return; 393 } 394 395 if ($prepend) { 396 self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; 397 } else { 398 unset(self::$registeredLoaders[$this->vendorDir]); 399 self::$registeredLoaders[$this->vendorDir] = $this; 400 } 303 401 } 304 402 305 403 /** 306 404 * Unregisters this instance as an autoloader. 405 * 406 * @return void 307 407 */ 308 408 public function unregister() 309 409 { 310 410 spl_autoload_unregister(array($this, 'loadClass')); 411 412 if (null !== $this->vendorDir) { 413 unset(self::$registeredLoaders[$this->vendorDir]); 414 } 311 415 } 312 416 … … 315 419 * 316 420 * @param string $class The name of the class 317 * @return bool|null True if loaded, null otherwise421 * @return true|null True if loaded, null otherwise 318 422 */ 319 423 public function loadClass($class) 320 424 { 321 425 if ($file = $this->findFile($class)) { 322 includeFile($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 323 428 324 429 return true; 325 430 } 431 432 return null; 326 433 } 327 434 … … 368 475 } 369 476 477 /** 478 * Returns the currently registered loaders keyed by their corresponding vendor directories. 479 * 480 * @return array<string, self> 481 */ 482 public static function getRegisteredLoaders() 483 { 484 return self::$registeredLoaders; 485 } 486 487 /** 488 * @param string $class 489 * @param string $ext 490 * @return string|false 491 */ 370 492 private function findFileWithExtension($class, $ext) 371 493 { … … 433 555 return false; 434 556 } 557 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 562 { 563 if (self::$includeFile !== null) { 564 return; 565 } 566 567 /** 568 * Scope isolated include. 569 * 570 * Prevents access to $this/self from included files. 571 * 572 * @param string $file 573 * @return void 574 */ 575 self::$includeFile = \Closure::bind(static function($file) { 576 include $file; 577 }, null, null); 578 } 435 579 } 436 437 /**438 * Scope isolated include.439 *440 * Prevents access to $this/self from included files.441 */442 function includeFile($file)443 {444 include $file;445 } -
ht-pay-jp-for-kintone/trunk/vendor/composer/autoload_classmap.php
r2149911 r3190331 3 3 // autoload_classmap.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 8 8 return array( 9 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 9 10 ); -
ht-pay-jp-for-kintone/trunk/vendor/composer/autoload_namespaces.php
r2149911 r3190331 3 3 // autoload_namespaces.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
ht-pay-jp-for-kintone/trunk/vendor/composer/autoload_psr4.php
r2149911 r3190331 3 3 // autoload_psr4.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
ht-pay-jp-for-kintone/trunk/vendor/composer/autoload_real.php
r2149911 r3190331 14 14 } 15 15 16 /** 17 * @return \Composer\Autoload\ClassLoader 18 */ 16 19 public static function getLoader() 17 20 { … … 20 23 } 21 24 25 require __DIR__ . '/platform_check.php'; 26 22 27 spl_autoload_register(array('ComposerAutoloaderInit9a018c6d859c504697980df115517622', 'loadClassLoader'), true, true); 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader( );28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 24 29 spl_autoload_unregister(array('ComposerAutoloaderInit9a018c6d859c504697980df115517622', 'loadClassLoader')); 25 30 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 if ($useStaticLoader) { 28 require_once __DIR__ . '/autoload_static.php'; 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit9a018c6d859c504697980df115517622::getInitializer($loader)); 31 } else { 32 $map = require __DIR__ . '/autoload_namespaces.php'; 33 foreach ($map as $namespace => $path) { 34 $loader->set($namespace, $path); 35 } 36 37 $map = require __DIR__ . '/autoload_psr4.php'; 38 foreach ($map as $namespace => $path) { 39 $loader->setPsr4($namespace, $path); 40 } 41 42 $classMap = require __DIR__ . '/autoload_classmap.php'; 43 if ($classMap) { 44 $loader->addClassMap($classMap); 45 } 46 } 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit9a018c6d859c504697980df115517622::getInitializer($loader)); 47 33 48 34 $loader->register(true); -
ht-pay-jp-for-kintone/trunk/vendor/composer/autoload_static.php
r2149911 r3190331 21 21 ); 22 22 23 public static $classMap = array ( 24 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 25 ); 26 23 27 public static function getInitializer(ClassLoader $loader) 24 28 { … … 26 30 $loader->prefixLengthsPsr4 = ComposerStaticInit9a018c6d859c504697980df115517622::$prefixLengthsPsr4; 27 31 $loader->prefixDirsPsr4 = ComposerStaticInit9a018c6d859c504697980df115517622::$prefixDirsPsr4; 32 $loader->classMap = ComposerStaticInit9a018c6d859c504697980df115517622::$classMap; 28 33 29 34 }, null, ClassLoader::class); -
ht-pay-jp-for-kintone/trunk/vendor/composer/installed.json
r2149911 r3190331 1 [ 2 { 3 "name": "payjp/payjp-php", 4 "version": "1.0.5", 5 "version_normalized": "1.0.5.0", 6 "source": { 7 "type": "git", 8 "url": "https://github.com/payjp/payjp-php.git", 9 "reference": "57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd" 10 }, 11 "dist": { 12 "type": "zip", 13 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd", 14 "reference": "57151949f8e1cd9de60f2566b0e2bf7b91a3f3bd", 15 "shasum": "" 16 }, 17 "require": { 18 "ext-curl": "*", 19 "ext-json": "*", 20 "ext-mbstring": "*", 21 "php": ">=5.6" 22 }, 23 "require-dev": { 24 "phpunit/phpunit": "~4.0", 25 "satooshi/php-coveralls": "~0.6.1", 26 "squizlabs/php_codesniffer": "~2.0" 27 }, 28 "time": "2019-08-09T13:10:15+00:00", 29 "type": "library", 30 "extra": { 31 "branch-alias": { 32 "dev-master": "0.1.*-dev" 33 } 34 }, 35 "installation-source": "dist", 36 "autoload": { 37 "psr-4": { 38 "Payjp\\": "lib/" 39 } 40 }, 41 "notification-url": "https://packagist.org/downloads/", 42 "license": [ 43 "MIT" 1 { 2 "packages": [ 3 { 4 "name": "payjp/payjp-php", 5 "version": "1.7.0", 6 "version_normalized": "1.7.0.0", 7 "source": { 8 "type": "git", 9 "url": "https://github.com/payjp/payjp-php.git", 10 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175" 11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/payjp/payjp-php/zipball/f8fe3185fc0a481214c35421f051d8cc50f3f175", 15 "reference": "f8fe3185fc0a481214c35421f051d8cc50f3f175", 16 "shasum": "" 17 }, 18 "require": { 19 "ext-curl": "*", 20 "ext-json": "*", 21 "ext-mbstring": "*", 22 "php": ">=5.6" 23 }, 24 "require-dev": { 25 "phpunit/phpunit": "~5.7 || ~9.5", 26 "squizlabs/php_codesniffer": "~3.6" 27 }, 28 "time": "2024-11-13T05:21:09+00:00", 29 "type": "library", 30 "extra": { 31 "branch-alias": { 32 "dev-master": "0.1.*-dev" 33 } 34 }, 35 "installation-source": "dist", 36 "autoload": { 37 "psr-4": { 38 "Payjp\\": "lib/" 39 } 40 }, 41 "notification-url": "https://packagist.org/downloads/", 42 "license": [ 43 "MIT" 44 ], 45 "authors": [ 46 { 47 "name": "Payjp and contributors", 48 "homepage": "https://github.com/payjp/payjp-php/graphs/contributors" 49 } 50 ], 51 "description": "Payjp PHP Library", 52 "homepage": "https://pay.jp/", 53 "keywords": [ 54 "api", 55 "payjp", 56 "payment processing" 57 ], 58 "support": { 59 "issues": "https://github.com/payjp/payjp-php/issues", 60 "source": "https://github.com/payjp/payjp-php/tree/1.7.0" 61 }, 62 "install-path": "../payjp/payjp-php" 63 } 44 64 ], 45 "authors": [ 46 { 47 "name": "Payjp and contributors", 48 "homepage": "https://github.com/payjp/payjp-php/graphs/contributors" 49 } 50 ], 51 "description": "Payjp PHP Library", 52 "homepage": "https://pay.jp/", 53 "keywords": [ 54 "api", 55 "payjp", 56 "payment processing" 57 ] 58 } 59 ] 65 "dev": true, 66 "dev-package-names": [] 67 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/.gitignore
r2685245 r3190331 21 21 # Ignore PHPUnit coverage file 22 22 clover.xml 23 24 # Ignore PHPUnit cache file 25 .phpunit.result.cache -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/README.md
r2149911 r3190331 1 1 # PAY.JP for PHP 2 2 3 [](https://travis-ci.org/payjp/payjp-php)3 [](https://github.com/payjp/payjp-php/actions) 4 4 5 5 ## Requirements … … 53 53 - Please see our official [documentation](https://pay.jp/docs/started). 54 54 55 ## Retry on HTTP Status Code 429 56 57 - See [Rate Limit Guideline](https://pay.jp/docs/guideline-rate-limit#2-%E3%83%AA%E3%83%88%E3%83%A9%E3%82%A4) 58 - When you exceeded rate-limit, you can retry request by setting `$maxRetry` 59 like `\Payjp\Payjp::setMaxRetry(3);` . 60 - The retry interval base value is `$retryInitialDelay` 61 Adjust the value like `\Payjp\Payjp::setRetryInitialDelay(4);` 62 The smaller is shorter. 63 - The retry interval calcurating is based on "Exponential backoff with equal jitter" algorithm. 64 See https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 65 66 ## Logging 67 68 - This library provides simple log output using `error_log` . You can set any logger that is compatible [PSR-3](https://www.php-fig.org/psr/psr-3/) logger interface. Like below 69 - `\Payjp\Payjp::setLogger($logger);` 70 - As the default behavior, this library output only error level information to stderr. 71 72 ### Logging Case 73 #### info 74 75 - Every retry on HTTP Status Code 429 76 77 #### error 78 79 - When you access inaccessible or non-existing property 80 55 81 ## Tests 56 82 -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/VERSION
r2149911 r3190331 1 1. 0.51 1.7.0 -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/build.php
r2149911 r3190331 31 31 32 32 $config = $autoload ? 'phpunit.xml' : 'phpunit.no_autoload.xml'; 33 passthru("./vendor/bin/phpunit -c $config ", $returnStatus);33 passthru("./vendor/bin/phpunit -c $config -d error_reporting=-1", $returnStatus); 34 34 if ($returnStatus !== 0) { 35 35 exit(1); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/composer.json
r2149911 r3190331 22 22 }, 23 23 "require-dev": { 24 "phpunit/phpunit": "~4.0", 25 "satooshi/php-coveralls": "~0.6.1", 26 "squizlabs/php_codesniffer": "~2.0" 24 "phpunit/phpunit": "~5.7 || ~9.5", 25 "squizlabs/php_codesniffer": "~3.6" 27 26 }, 28 27 "autoload": { … … 33 32 "dev-master": "0.1.*-dev" 34 33 } 34 }, 35 "scripts": { 36 "test": [ 37 "phpcs --standard=PSR2 -n lib tests *.php", 38 "phpunit" 39 ] 35 40 } 36 41 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/init.php
r2149911 r3190331 4 4 require(dirname(__FILE__) . '/lib/Payjp.php'); 5 5 6 // Utilities 6 // Logger 7 require(dirname(__FILE__) . '/lib/Logger/LoggerInterface.php'); 8 require(dirname(__FILE__) . '/lib/Logger/DefaultLogger.php'); 9 10 // UtilitiesL 7 11 require(dirname(__FILE__) . '/lib/Util/RequestOptions.php'); 8 12 require(dirname(__FILE__) . '/lib/Util/Set.php'); … … 31 35 // Payjp API Resources 32 36 require(dirname(__FILE__) . '/lib/Account.php'); 37 require(dirname(__FILE__) . '/lib/ApplicationUrl.php'); 38 require(dirname(__FILE__) . '/lib/Balance.php'); 33 39 require(dirname(__FILE__) . '/lib/Card.php'); 34 40 require(dirname(__FILE__) . '/lib/Charge.php'); … … 37 43 require(dirname(__FILE__) . '/lib/Event.php'); 38 44 require(dirname(__FILE__) . '/lib/Plan.php'); 45 require(dirname(__FILE__) . '/lib/Statement.php'); 46 require(dirname(__FILE__) . '/lib/StatementUrl.php'); 39 47 require(dirname(__FILE__) . '/lib/Subscription.php'); 48 require(dirname(__FILE__) . '/lib/Tenant.php'); 49 require(dirname(__FILE__) . '/lib/TenantTransfer.php'); 50 require(dirname(__FILE__) . '/lib/Term.php'); 51 require(dirname(__FILE__) . '/lib/ThreeDSecureRequest.php'); 40 52 require(dirname(__FILE__) . '/lib/Token.php'); 41 53 require(dirname(__FILE__) . '/lib/Transfer.php'); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/ApiRequestor.php
r2149911 r3190331 39 39 } 40 40 41 // @var int Number of digit for randomized sleep time seconds 42 private $digit_num_for_rand = 2; 43 44 /** 45 * Based on "Exponential backoff with equal jitter" algorithm. 46 * https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 47 * 48 * @param int $retryCount 49 * 50 * @return int retry delay seconds. 51 */ 52 private function getRetryDelay($retryCount) 53 { 54 $wait_half = min(Payjp::getRetryMaxDelay(), Payjp::getRetryInitialDelay() * pow(2, $retryCount)) / 2; 55 $scale = pow(10, $this->digit_num_for_rand); 56 return $wait_half + mt_rand(0, $wait_half * $scale) / $scale; 57 } 58 41 59 /** 42 60 * @param string $method … … 56 74 $headers = array(); 57 75 } 58 list($rbody, $rcode, $myApiKey) = 59 $this->_requestRaw($method, $url, $params, $headers); 76 77 for ($i = 0; $i <= Payjp::getMaxRetry(); $i++) { 78 list($rbody, $rcode, $myApiKey) = $this->_requestRaw($method, $url, $params, $headers); 79 if ($rcode == 429 && $i != Payjp::getMaxRetry()) { 80 $wait = $this->getRetryDelay($i); 81 Payjp::getLogger()->info("Retry after {$wait} seconds."); 82 usleep((int) $wait * 1000000); 83 } else { 84 break; 85 } 86 } 60 87 $resp = $this->_interpretResponse($rbody, $rcode); 61 88 return array($resp, $myApiKey); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/ApiResource.php
r2149911 r3190331 7 7 private static $HEADERS_TO_PERSIST = array('Payjp-Account' => true, 'Payjp-Version' => true); 8 8 9 public static function baseUrl()10 {11 return Payjp::$apiBase;12 }13 14 9 /** 15 10 * @return ApiResource The refreshed resource. … … 17 12 public function refresh() 18 13 { 19 $requestor = new ApiRequestor($this->_opts->apiKey , static::baseUrl());14 $requestor = new ApiRequestor($this->_opts->apiKey); 20 15 $url = $this->instanceUrl(); 21 16 … … 60 55 { 61 56 $base = static::className(); 62 return "/v1/ ${base}s";57 return "/v1/{$base}s"; 63 58 } 64 59 … … 93 88 } 94 89 90 /** 91 * @param string $method 92 * @param string $url 93 * @param array|null $params 94 * @param RequestOptions|array|string|null $options 95 * 96 * @return list(array, RequestOptions) 97 */ 95 98 protected function _request($method, $url, $params = array(), $options = null) 96 99 { … … 102 105 { 103 106 $opts = Util\RequestOptions::parse($options); 104 $requestor = new ApiRequestor($opts->apiKey , static::baseUrl());107 $requestor = new ApiRequestor($opts->apiKey); 105 108 list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); 106 109 foreach ($opts->headers as $k => $v) { … … 132 135 { 133 136 self::_validateParams($params); 134 $base = static::baseUrl();135 137 $url = static::classUrl(); 136 138 -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Charge.php
r2149911 r3190331 75 75 return $this; 76 76 } 77 78 /** 79 * @param array|null $params 80 * @param array|string|null $options 81 * 82 * @return Charge The paid charge. 83 */ 84 public function tdsFinish($params = null, $options = null) 85 { 86 $url = $this->instanceUrl() . '/tds_finish'; 87 list($response, $opts) = $this->_request('post', $url, $params, $options); 88 $this->refreshFrom($response, $opts); 89 return $this; 90 } 77 91 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Customer.php
r2149911 r3190331 12 12 . "would be: \"Payjp\\Charge::create(array('amount' => 100, " 13 13 . "'currency' => 'usd', 'card' => array('number' => " 14 . "4242424242424242, 'exp_month' => 5, 'exp_year' => 2015)))\")";14 . "4242424242424242, 'exp_month' => 5, 'exp_year' => 2015)))\")"; 15 15 throw new Error\Api($message); 16 16 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Error/Base.php
r2149911 r3190331 7 7 abstract class Base extends Exception 8 8 { 9 public $httpStatus; 10 public $httpBody; 11 public $jsonBody; 12 9 13 public function __construct( 10 14 $message, -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Error/Card.php
r2149911 r3190331 5 5 class Card extends Base 6 6 { 7 public $param; 8 7 9 public function __construct( 8 10 $message, -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Error/InvalidRequest.php
r2149911 r3190331 5 5 class InvalidRequest extends Base 6 6 { 7 public $param; 8 7 9 public function __construct( 8 10 $message, -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Payjp.php
r2149911 r3190331 16 16 // @var boolean Defaults to true. 17 17 public static $verifySslCerts = true; 18 19 // @var \Payjp\Logger\LoggerInterface Default logger will output to error_log(). 20 public static $logger = null; 21 22 // @var int Max retry count for over_capacity 429 response. 23 public static $maxRetry = 0; 24 25 /** 26 * The retry interval base value for over_capacity 429 response. 27 * Based on "Exponential backoff with equal jitter" algorithm. 28 * See https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/ 29 * 30 * @var int 31 */ 32 public static $retryInitialDelay = 2; 33 34 // @var int Max retry delay seconds for over_capacity 429 response. 35 public static $retryMaxDelay = 32; 18 36 19 37 const VERSION = '1.0.0'; … … 69 87 self::$verifySslCerts = $verify; 70 88 } 89 90 /** 91 * @return \Payjp\Logger\LoggerInterface 92 */ 93 public static function getLogger() 94 { 95 if (self::$logger == null) { 96 return new \Payjp\Logger\DefaultLogger(); 97 } 98 return self::$logger; 99 } 100 101 /** 102 * @param \Payjp\Logger\LoggerInterface $logger 103 */ 104 public static function setLogger($logger) 105 { 106 self::$logger = $logger; 107 } 108 /** 109 * @return int 110 */ 111 public static function getMaxRetry() 112 { 113 return self::$maxRetry; 114 } 115 116 /** 117 * @param int $value 118 */ 119 public static function setMaxRetry($value) 120 { 121 self::$maxRetry = $value; 122 } 123 124 /** 125 * @return int 126 */ 127 public static function getRetryInitialDelay() 128 { 129 return self::$retryInitialDelay; 130 } 131 132 /** 133 * @param int $value 134 */ 135 public static function setRetryInitialDelay($value) 136 { 137 self::$retryInitialDelay = $value; 138 } 139 140 /** 141 * @return int 142 */ 143 public static function getRetryMaxDelay() 144 { 145 return self::$retryMaxDelay; 146 } 147 148 /** 149 * @param int $value 150 */ 151 public static function setRetryMaxDelay($value) 152 { 153 self::$retryMaxDelay = $value; 154 } 71 155 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/PayjpObject.php
r2149911 r3190331 102 102 . "probably as a result of a save(). The attributes currently " 103 103 . "available on this object are: $attrs"; 104 error_log($message);104 Payjp::getLogger()->error($message); 105 105 return null; 106 106 } else { 107 107 $class = get_class($this); 108 error_log("Payjp Notice: Undefined property of $class instance: $k");108 Payjp::getLogger()->error("Payjp Notice: Undefined property of $class instance: $k"); 109 109 return null; 110 110 } … … 112 112 113 113 // ArrayAccess methods 114 #[\ReturnTypeWillChange] 114 115 public function offsetSet($k, $v) 115 116 { … … 117 118 } 118 119 120 #[\ReturnTypeWillChange] 119 121 public function offsetExists($k) 120 122 { … … 122 124 } 123 125 126 #[\ReturnTypeWillChange] 124 127 public function offsetUnset($k) 125 128 { 126 129 unset($this->$k); 127 130 } 131 132 #[\ReturnTypeWillChange] 128 133 public function offsetGet($k) 129 134 { -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Token.php
r2149911 r3190331 26 26 return self::_create($params, $opts); 27 27 } 28 29 /** 30 * @param array|null $params 31 * @param array|string|null $options 32 * 33 * @return Token The paid token. 34 */ 35 public function tdsFinish($params = null, $options = null) 36 { 37 $url = $this->instanceUrl() . '/tds_finish'; 38 list($response, $opts) = $this->_request('post', $url, $params, $options); 39 $this->refreshFrom($response, $opts); 40 return $this; 41 } 28 42 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Transfer.php
r2149911 r3190331 7 7 /** 8 8 * @param string $id The ID of the transfer to retrieve. 9 * @param array|string|null $opts9 * @param RequestOptions|array|string|null $opts 10 10 * 11 11 * @return Transfer … … 18 18 /** 19 19 * @param array|null $params 20 * @param array|string|null $opts20 * @param RequestOptions|array|string|null $opts 21 21 * 22 22 * @return Transfer[] -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Util/Set.php
r2149911 r3190331 38 38 } 39 39 40 #[\ReturnTypeWillChange] 40 41 public function getIterator() 41 42 { -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/lib/Util/Util.php
r2149911 r3190331 7 7 abstract class Util 8 8 { 9 // todo wanna use 'private const' (only PHP >= v7.1.0) 10 private static $types = array( 11 'application_url' => \Payjp\ApplicationUrl::class, 12 'balance' => \Payjp\Balance::class, 13 'card' => \Payjp\Card::class, 14 'charge' => \Payjp\Charge::class, 15 'customer' => \Payjp\Customer::class, 16 'event' => \Payjp\Event::class, 17 'list' => \Payjp\Collection::class, 18 'plan' => \Payjp\Plan::class, 19 'statement' => \Payjp\Statement::class, 20 'statement_url' => \Payjp\StatementUrl::class, 21 'subscription' => \Payjp\Subscription::class, 22 'tenant' => \Payjp\Tenant::class, 23 'token' => \Payjp\Token::class, 24 'tenant_transfer' => \Payjp\TenantTransfer::class, 25 'term' => \Payjp\Term::class, 26 'transfer' => \Payjp\Transfer::class, 27 'three_d_secure_request' => \Payjp\ThreeDSecureRequest::class, 28 ); 29 9 30 /** 10 31 * Whether the provided array (or other) is a list rather than a dictionary. … … 39 60 foreach ($values as $k => $v) { 40 61 // FIXME: this is an encapsulation violation 41 if ( $k[0] == '_') {62 if (is_string($k) && $k[0] == '_') { 42 63 continue; 43 64 } … … 62 83 public static function convertToPayjpObject($resp, $opts) 63 84 { 64 $types = array(65 'account' => 'Payjp\\Account',66 'card' => 'Payjp\\Card',67 'charge' => 'Payjp\\Charge',68 'customer' => 'Payjp\\Customer',69 'list' => 'Payjp\\Collection',70 'event' => 'Payjp\\Event',71 'token' => 'Payjp\\Token',72 'transfer' => 'Payjp\\Transfer',73 'plan' => 'Payjp\\Plan',74 'subscription' => 'Payjp\\Subscription',75 );76 85 if (self::isList($resp)) { 77 86 $mapped = array(); … … 81 90 return $mapped; 82 91 } elseif (is_array($resp)) { 83 if (isset($resp['object']) && is_string($resp['object']) && isset( $types[$resp['object']])) {84 $class = $types[$resp['object']];92 if (isset($resp['object']) && is_string($resp['object']) && isset(self::$types[$resp['object']])) { 93 $class = self::$types[$resp['object']]; 85 94 } else { 86 95 $class = 'Payjp\\PayjpObject'; … … 101 110 { 102 111 if (is_string($value) && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") { 103 return utf8_encode($value); 112 if (\PHP_VERSION_ID >= 80200) { 113 return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1'); 114 } else { 115 return utf8_encode($value); 116 } 104 117 } else { 105 118 return $value; -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/AccountTest.php
r2149911 r3190331 7 7 private function managedAccountResponse($id) 8 8 { 9 return array( 10 'accounts_enabled' => array('merchant', 'customer'), 9 return [ 10 'accounts_enabled' => [ 11 'merchant', 12 'customer', 13 ], 11 14 'created' => 1432965397, 12 'customer' => array( 13 'cards' => array( 14 'count' => 1, 15 'data' => array( 16 array( 17 'address_city' => '\u8d64\u5742', 18 'address_line1' => '7-4', 19 'address_line2' => '203', 20 'address_state' => '\u6e2f\u533a', 21 'address_zip' => '1070050', 22 'address_zip_check' => 'passed', 23 'brand' => 'Visa', 24 'country' => self::COUNTRY, 25 'created' => 1432965397, 26 'cvc_check' => 'passed', 27 'exp_month' => 12, 28 'exp_year' => 2016, 29 'fingerprint' => 'e1d8225886e3a7211127df751c86787f', 30 'id' => 'car_99abf74cb5527ff68233a8b836dd', 31 'last4' => '4242', 32 'livemode' => true, 33 'name' => 'Test Hodler', 34 'object' => 'card' 35 ) 36 ), 37 'object' => 'list', 38 'url' => '/v1/accounts/cards' 39 ), 40 'created' => 1432965397, 41 'default_card' => null, 42 'description' => 'user customer', 43 'email' => null, 44 'id' => 'acct_cus_38153121efdb7964dd1e147', 45 'object' => 'customer' 46 ), 47 'email' => 'firstuser@mail.com', 48 'id' => $id, 49 'merchant' => array( 50 'bank_enabled' => false, 51 'brands_accepted' => array( 52 'Visa', 53 'American Express', 54 'MasterCard', 55 'JCB', 56 'Diners Club' 57 ), 58 'business_type' => 'personal', 59 'charge_type' => null, 60 'contact_phone' => null, 61 'country' => 'JP', 62 'created' => 1432965397, 63 'currencies_supported' => array( 64 self::CURRENCY 65 ), 66 'default_currency' => self::CURRENCY, 67 'details_submitted' => false, 68 'id' => 'acct_mch_002418151ef82e49f6edee1', 69 'livemode_activated_at' => 1432965401, 70 'livemode_enabled' => true, 71 'object' => 'merchant', 72 'product_detail' => null, 73 'product_name' => null, 74 'product_type' => null, 75 'site_published' => false, 76 'url' => null 77 ), 78 'object' => 'account' 79 80 ); 15 'customer' => [ 16 'cards' => [ 17 'count' => 1, 18 'data' => [ 19 [ 20 'address_city' => '\u8d64\u5742', 21 'address_line1' => '7-4', 22 'address_line2' => '203', 23 'address_state' => '\u6e2f\u533a', 24 'address_zip' => '1070050', 25 'address_zip_check' => 'passed', 26 'brand' => 'Visa', 27 'country' => self::COUNTRY, 28 'created' => 1432965397, 29 'cvc_check' => 'passed', 30 'exp_month' => 12, 31 'exp_year' => 2016, 32 'fingerprint' => 'e1d8225886e3a7211127df751c86787f', 33 'id' => 'car_99abf74cb5527ff68233a8b836dd', 34 'last4' => '4242', 35 'livemode' => true, 36 'name' => 'Test Hodler', 37 'object' => 'card' 38 ] 39 ], 40 'object' => 'list', 41 'url' => '/v1/accounts/cards' 42 ], 43 'created' => 1432965397, 44 'default_card' => null, 45 'description' => 'user customer', 46 'email' => null, 47 'id' => 'acct_cus_38153121efdb7964dd1e147', 48 'object' => 'customer' 49 ], 50 'email' => 'firstuser@mail.com', 51 'id' => $id, 52 'merchant' => [ 53 'bank_enabled' => false, 54 'brands_accepted' => [ 55 'Visa', 56 'American Express', 57 'MasterCard', 58 'JCB', 59 'Diners Club' 60 ], 61 'business_type' => 'personal', 62 'charge_type' => null, 63 'contact_phone' => null, 64 'country' => 'JP', 65 'created' => 1432965397, 66 'currencies_supported' => [ 67 self::CURRENCY 68 ], 69 'default_currency' => self::CURRENCY, 70 'details_submitted' => false, 71 'id' => 'acct_mch_002418151ef82e49f6edee1', 72 'livemode_activated_at' => 1432965401, 73 'livemode_enabled' => true, 74 'object' => 'merchant', 75 'product_detail' => null, 76 'product_name' => null, 77 'product_type' => null, 78 'site_published' => false, 79 'url' => null 80 ], 81 'object' => 'account' 82 ]; 81 83 } 82 84 83 85 public function testBasicRetrieve() 84 86 { 85 $this->mockRequest('GET', '/v1/accounts', array(), $this->managedAccountResponse('acct_ABC'));87 $this->mockRequest('GET', '/v1/accounts', [], $this->managedAccountResponse('acct_ABC')); 86 88 $account = Account::retrieve(); 87 89 88 90 $this->assertSame('acct_ABC', $account->id); 89 91 $this->assertSame('acct_cus_38153121efdb7964dd1e147', $account->customer->id); 90 92 $this->assertSame('acct_mch_002418151ef82e49f6edee1', $account->merchant->id); 91 93 } 92 93 public function testRetrieve()94 {95 $account = Account::retrieve();96 }97 94 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/ApiRequestorTest.php
r2149911 r3190331 5 5 class ApiRequestorTest extends TestCase 6 6 { 7 /** 8 * @before 9 */ 10 protected function setUpTestCase() 11 { 12 parent::setUpTestCase(); 13 # MaxRetryを戻してinitialDelayを短くする 14 Payjp::setMaxRetry(0); 15 Payjp::setRetryInitialDelay(0.1); 16 Payjp::setRetryMaxDelay(32); 17 } 18 19 /** 20 * @after 21 */ 22 protected function tearDownTestCase() 23 { 24 parent::tearDown(); 25 Payjp::setMaxRetry(0); 26 $this->setMaxRetryForCi(); 27 Payjp::setRetryInitialDelay(2); 28 Payjp::setRetryMaxDelay(32); 29 } 30 31 private $errorResponse = array('rcode'=>500, 'rbody'=>array('error' => array( 32 "code" => "payjp_wrong", 33 "message" => "An unexpected error occurred.", 34 "status" => 500, 35 "type" => "server_error", 36 ))); 37 private $rateLimitResponse = array('rcode'=>429, 'rbody'=>array('error' => array( 38 "code" => "over_capacity", 39 "message" => "The service is over capacity. Please try again later.", 40 "status" => 429, 41 "type" => "client_error", 42 ))); 43 private $successResponse = array('rcode'=>200, 'rbody'=>array('data'=>array())); 44 45 private function setUpResponses($responses) 46 { 47 $userCallCount = 0; 48 $mock = $this->setUpMockRequest(); 49 $mock->expects($this->exactly(count($responses))) 50 ->method('request') 51 // $userCallCount を使って、responses の中から適切なものを選択するために、参照渡しで渡す。 52 ->willReturnCallback(static function () use ($responses, &$userCallCount) { 53 $userCallCount++; 54 $response = $responses[$userCallCount - 1]; 55 return array(json_encode($response['rbody']), $response['rcode']); 56 }); 57 } 58 59 // _encodeObjects 60 7 61 public function testEncodeObjects() 8 62 { … … 25 79 $this->assertSame($enc, array('customer' => "\xc3\xa9")); 26 80 } 81 82 // request retry 83 84 public function testRetryDisabled() 85 { 86 $this->setUpResponses(array($this->rateLimitResponse)); 87 $requestor = new ApiRequestor(self::API_KEY); 88 89 try { 90 $response = $requestor->request('GET', '/v1/accounts'); 91 } catch (Error\Api $e) { 92 $this->assertSame($e->getMessage(), $this->rateLimitResponse['rbody']['error']['message']); 93 $this->assertSame($e->getHttpStatus(), $this->rateLimitResponse['rcode']); 94 } 95 } 96 97 public function testNoRetry() 98 { 99 $this->setUpResponses(array($this->errorResponse)); 100 $requestor = new ApiRequestor(self::API_KEY); 101 102 try { 103 $response = $requestor->request('GET', '/v1/accounts'); 104 } catch (Error\Api $e) { 105 $this->assertSame($e->getMessage(), $this->errorResponse['rbody']['error']['message']); 106 $this->assertSame($e->getHttpStatus(), $this->errorResponse['rcode']); 107 } 108 } 109 110 public function testFullRetryAndSuccess() 111 { 112 Payjp::setMaxRetry(2); 113 $this->setUpResponses(array($this->rateLimitResponse, $this->rateLimitResponse, $this->successResponse)); 114 $requestor = new ApiRequestor(self::API_KEY); 115 116 $response = $requestor->request('GET', '/v1/accounts'); 117 118 $this->assertSame($response[0], $this->successResponse['rbody']); 119 } 120 121 public function testFullRetryAndFailed() 122 { 123 Payjp::setMaxRetry(2); 124 $this->setUpResponses(array($this->rateLimitResponse, $this->rateLimitResponse, $this->rateLimitResponse)); 125 $requestor = new ApiRequestor(self::API_KEY); 126 127 try { 128 $response = $requestor->request('GET', '/v1/accounts'); 129 } catch (Error\Api $e) { 130 $this->assertSame($e->getMessage(), $this->rateLimitResponse['rbody']['error']['message']); 131 $this->assertSame($e->getHttpStatus(), $this->rateLimitResponse['rcode']); 132 } 133 } 134 135 public function testGetRetryDelay() 136 { 137 Payjp::setRetryInitialDelay(2); 138 $reflector = new \ReflectionClass('Payjp\\ApiRequestor'); 139 $method = $reflector->getMethod('getRetryDelay'); 140 $method->setAccessible(true); 141 $r = new ApiRequestor(self::API_KEY); 142 143 $this->assertTrue(1 <= $method->invoke($r, 0) && $method->invoke($r, 0) <= 2); 144 $this->assertTrue(2 <= $method->invoke($r, 1) && $method->invoke($r, 1) <= 4); 145 $this->assertTrue(4 <= $method->invoke($r, 2) && $method->invoke($r, 2) <= 8); 146 # not over retryMaxDelay 147 $this->assertTrue(16 <= $method->invoke($r, 4) && $method->invoke($r, 4) <= 32); 148 $this->assertTrue(16 <= $method->invoke($r, 10) && $method->invoke($r, 10) <= 32); 149 } 27 150 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/CardErrorTest.php
r2149911 r3190331 11 11 $params = [ 12 12 'card' => [ 13 "number" => "4242424242424242",14 "exp_month"=> 6,15 "exp_year" => date('Y') + 3,16 "cvc" => "314"13 'number' => '4242424242424242', 14 'exp_month' => 6, 15 'exp_year' => date('Y') - 1, 16 'cvc' => '314' 17 17 ] 18 18 ]; 19 19 20 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']);21 22 $charge = array(23 'amount' => 100,24 'currency' => self::CURRENCY,25 'card' => $card->id26 );27 28 20 try { 29 Charge::create($charge);21 Token::create($params, ['payjp_direct_token_generate' => 'true']); 30 22 } catch (Error\Card $e) { 31 23 $this->assertSame(402, $e->getHttpStatus()); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/ChargeTest.php
r2149911 r3190331 19 19 $params = [ 20 20 'card' => [ 21 "number" => "4242424242424242", 22 "exp_month" => "05", 23 'exp_year' => date('Y') + 1 24 ] 25 ]; 26 27 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 28 29 $c = Charge::create( 30 array( 31 'amount' => 100, 32 'currency' => self::CURRENCY, 33 'card' => $card->id 34 ) 35 ); 21 'number' => '4242424242424242', 22 'exp_month' => '05', 23 'exp_year' => date('Y') + 1, 24 'cvc' => '123', 25 ] 26 ]; 27 28 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 29 30 $c = Charge::create([ 31 'amount' => 100, 32 'currency' => self::CURRENCY, 33 'card' => $card->id, 34 ]); 36 35 $this->assertTrue($c->paid); 37 36 $this->assertFalse($c->refunded); … … 45 44 $params = [ 46 45 'card' => [ 47 "number" => "4242424242424242", 48 "exp_month" => 5, 49 'exp_year' => date('Y') + 1 50 ] 51 ]; 52 53 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 54 55 $c = Charge::create( 56 array( 57 'amount' => 100, 58 'currency' => self::CURRENCY, 59 'card' => $card->id 60 ), 61 array( 62 'idempotency_key' => self::generateRandomString(), 63 ) 64 ); 46 'number' => '4242424242424242', 47 'exp_month' => 5, 48 'exp_year' => date('Y') + 1, 49 'cvc' => '123', 50 ] 51 ]; 52 53 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 54 55 $c = Charge::create([ 56 'amount' => 100, 57 'currency' => self::CURRENCY, 58 'card' => $card->id 59 ], [ 60 'idempotency_key' => self::generateRandomString(), 61 ]); 65 62 66 63 $this->assertTrue($c->paid); … … 75 72 $params = [ 76 73 'card' => [ 77 "number" => "4242424242424242", 78 "exp_month" => 5, 79 "exp_year" => date('Y') + 1 80 ] 81 ]; 82 83 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 84 85 $c = Charge::create( 86 array( 87 'amount' => 100, 88 'currency' => self::CURRENCY, 89 'card' => $card->id 90 ) 91 ); 74 'number' => '4242424242424242', 75 'exp_month' => 5, 76 'exp_year' => date('Y') + 1, 77 'cvc' => '123', 78 ] 79 ]; 80 81 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 82 83 $c = Charge::create([ 84 'amount' => 100, 85 'currency' => self::CURRENCY, 86 'card' => $card->id 87 ]); 92 88 $d = Charge::retrieve($c->id); 93 89 $this->assertSame($d->id, $c->id); … … 99 95 self::authorizeFromEnv(); 100 96 101 $charges = Charge::all( 102 array( 103 'limit' => 3, 104 'offset' => 10 105 ) 106 ); 97 $charges = Charge::all([ 98 'limit' => 3, 99 'offset' => 10 100 ]); 107 101 108 102 $planID = 'gold-' . self::randomString(); … … 111 105 $customer = self::createTestCustomer(); 112 106 113 $charge = Charge::create( 114 array( 115 'amount' => 1000, 116 'currency' => self::CURRENCY, 117 'customer' => $customer->id 118 ) 119 ); 120 121 $charges_2 = Charge::all( 122 array( 123 'customer' => $customer->id 124 ) 125 ); 107 $charge = Charge::create([ 108 'amount' => 1000, 109 'currency' => self::CURRENCY, 110 'customer' => $customer->id 111 ]); 112 113 $charges_2 = Charge::all([ 114 'customer' => $customer->id 115 ]); 126 116 127 117 $this->assertSame(1, count($charges_2['data'])); 128 118 $this->assertSame($charge->id, $charges_2['data'][0]->id); 129 119 130 $charge_2 = Charge::create( 131 array( 132 'amount' => 1500, 133 'currency' => self::CURRENCY, 134 'customer' => $customer->id 135 ) 136 ); 137 138 $charges_3 = Charge::all( 139 array( 140 'limit' => 2, 141 'offset' => 0, 142 'customer' => $customer->id 143 ) 144 ); 120 $charge_2 = Charge::create([ 121 'amount' => 1500, 122 'currency' => self::CURRENCY, 123 'customer' => $customer->id 124 ]); 125 126 $charges_3 = Charge::all([ 127 'limit' => 2, 128 'offset' => 0, 129 'customer' => $customer->id 130 ]); 145 131 146 132 $this->assertSame(2, count($charges_3['data'])); … … 154 140 $params = [ 155 141 'card' => [ 156 "number" => "4242424242424242", 157 "exp_month" => 5, 158 "exp_year" => date('Y') + 1 159 ] 160 ]; 161 162 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 163 164 $charge = Charge::create( 165 array( 166 'amount' => 100, 167 'currency' => self::CURRENCY, 168 'card' => $card->id 169 ) 170 ); 142 'number' => '4242424242424242', 143 'exp_month' => 5, 144 'exp_year' => date('Y') + 1, 145 'cvc' => '123', 146 ] 147 ]; 148 149 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 150 151 $charge = Charge::create([ 152 'amount' => 100, 153 'currency' => self::CURRENCY, 154 'card' => $card->id 155 ]); 171 156 172 157 $charge->description = 'foo bar'; … … 185 170 $params = [ 186 171 'card' => [ 187 "number" => "4242424242424242", 188 "exp_month" => 5, 189 "exp_year" => date('Y') + 1 190 ] 191 ]; 192 193 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 194 195 $charge = Charge::create( 196 array( 197 'amount' => 100, 198 'currency' => self::CURRENCY, 199 'card' => $card->id, 200 'capture' => false 201 ) 202 ); 172 'number' => '4242424242424242', 173 'exp_month' => 5, 174 'exp_year' => date('Y') + 1, 175 'cvc' => '123', 176 ] 177 ]; 178 179 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 180 181 $charge = Charge::create([ 182 'amount' => 100, 183 'currency' => self::CURRENCY, 184 'card' => $card->id, 185 'capture' => false 186 ]); 203 187 204 188 $this->assertFalse($charge->captured); … … 216 200 $params = [ 217 201 'card' => [ 218 "number" => "4242424242424242", 219 "exp_month" => 5, 220 "exp_year" => date('Y') + 1 221 ] 222 ]; 223 224 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 225 226 $charge = Charge::create( 227 array( 228 'amount' => 100, 229 'currency' => self::CURRENCY, 230 'card' => $card->id, 231 'capture' => false 232 ) 233 ); 202 'number' => '4242424242424242', 203 'exp_month' => 5, 204 'exp_year' => date('Y') + 1, 205 'cvc' => '123', 206 ] 207 ]; 208 209 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 210 211 $charge = Charge::create([ 212 'amount' => 100, 213 'currency' => self::CURRENCY, 214 'card' => $card->id, 215 'capture' => false 216 ]); 234 217 235 218 $this->assertFalse($charge->captured); … … 247 230 $params = [ 248 231 'card' => [ 249 "number" => "4242424242424242", 250 "exp_month" => 5, 251 "exp_year" => date('Y') + 1 252 ] 253 ]; 254 255 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 256 257 $charge = Charge::create( 258 array( 259 'amount' => 100, 260 'currency' => self::CURRENCY, 261 'card' => $card->id, 262 ) 263 ); 232 'number' => '4242424242424242', 233 'exp_month' => 5, 234 'exp_year' => date('Y') + 1, 235 'cvc' => '123', 236 ] 237 ]; 238 239 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 240 241 $charge = Charge::create([ 242 'amount' => 100, 243 'currency' => self::CURRENCY, 244 'card' => $card->id, 245 ]); 264 246 265 247 $this->assertTrue($charge->captured); 266 248 267 $redundChargePart = $charge->refund( 268 array( 269 'amount' => 50, 270 'refund_reason' => 'foo bar 1' 271 ) 272 ); 249 $redundChargePart = $charge->refund([ 250 'amount' => 50, 251 'refund_reason' => 'foo bar 1' 252 ]); 273 253 274 254 $this->assertTrue($redundChargePart->refunded); … … 279 259 $this->assertSame(50, $charge->amount_refunded); 280 260 281 $refundChargeAll = $charge->refund( 282 array( 283 'refund_reason' => 'foo bar 2' 284 ) 285 ); 261 $refundChargeAll = $charge->refund([ 262 'refund_reason' => 'foo bar 2' 263 ]); 286 264 287 265 $this->assertTrue($refundChargeAll->refunded); … … 293 271 } 294 272 295 /**296 * @expectedException Payjp\Error\Card297 */298 273 public function testInvalidCard() 299 274 { 300 self::authorizeFromEnv(); 301 302 $params = [ 303 'card' => [ 304 "number" => "4242424242424241", 305 "exp_month" => 5, 306 "exp_year" => date('Y') + 1 307 ] 308 ]; 309 310 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 311 312 Charge::create( 313 array( 314 'amount' => 100, 315 'currency' => self::CURRENCY, 316 'card' => $card->id 317 ) 318 ); 275 $this->expectException('\Payjp\Error\Card'); 276 277 self::authorizeFromEnv(); 278 279 $params = [ 280 'card' => [ 281 'number' => '4242424242424241', 282 'exp_month' => 5, 283 'exp_year' => date('Y') + 1, 284 'cvc' => '123', 285 ] 286 ]; 287 288 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 289 290 Charge::create([ 291 'amount' => 100, 292 'currency' => self::CURRENCY, 293 'card' => $card->id 294 ]); 319 295 } 320 296 … … 326 302 $params = [ 327 303 'card' => [ 328 "number" => "4000000000000070", 329 "exp_month" => '05', 330 'exp_year' => (date('Y') + 1) 331 ] 332 ]; 333 334 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 335 336 $ch = Charge::create( 337 array( 338 'amount' => 100, 339 'currency' => self::CURRENCY, 340 'card' => $card->id 341 ) 342 ); 343 344 $this->assertSame("failed", $ch->card->address_zip_check); 304 'number' => '4000000000000070', 305 'exp_month' => '05', 306 'exp_year' => (date('Y') + 1), 307 'cvc' => '123', 308 ] 309 ]; 310 311 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 312 313 $ch = Charge::create([ 314 'amount' => 100, 315 'currency' => self::CURRENCY, 316 'card' => $card->id 317 ]); 318 319 $this->assertSame('failed', $ch->card->address_zip_check); 345 320 } 346 321 … … 351 326 $params = [ 352 327 'card' => [ 353 "number" => "4000000000000100", 354 "exp_month" => '05', 355 'exp_year' => (date('Y') + 1) 356 ] 357 ]; 358 359 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 360 361 $ch = Charge::create( 362 array( 363 'amount' => 100, 364 'currency' => self::CURRENCY, 365 'card' => $card->id 366 ) 367 ); 368 369 $this->assertSame("failed", $ch->card->cvc_check); 328 'number' => '4000000000000100', 329 'exp_month' => '05', 330 'exp_year' => (date('Y') + 1), 331 'cvc' => '123', 332 ] 333 ]; 334 335 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 336 337 $ch = Charge::create([ 338 'amount' => 100, 339 'currency' => self::CURRENCY, 340 'card' => $card->id 341 ]); 342 343 $this->assertSame('failed', $ch->card->cvc_check); 370 344 } 371 345 … … 376 350 $params = [ 377 351 'card' => [ 378 "number" => "4000000000000150", 379 "exp_month" => '05', 380 'exp_year' => (date('Y') + 1) 381 ] 382 ]; 383 384 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 385 386 $ch = Charge::create( 387 array( 388 'amount' => 100, 389 'currency' => self::CURRENCY, 390 'card' => $card->id 391 ) 392 ); 393 394 $this->assertSame("unavailable", $ch->card->cvc_check); 352 'number' => '4000000000000150', 353 'exp_month' => '05', 354 'exp_year' => (date('Y') + 1), 355 'cvc' => '123', 356 ] 357 ]; 358 359 $card = Token::create($params, ['payjp_direct_token_generate' => 'true']); 360 361 $ch = Charge::create([ 362 'amount' => 100, 363 'currency' => self::CURRENCY, 364 'card' => $card->id 365 ]); 366 367 $this->assertSame('unavailable', $ch->card->cvc_check); 395 368 } 396 369 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/CustomerTest.php
r2149911 r3190331 8 8 public function testCreate() 9 9 { 10 $attribute = array(11 'email' => 'gdb@pay.jp',12 'description' => 'foo bar'13 );14 10 $attribute = [ 11 'email' => 'gdb@pay.jp', 12 'description' => 'foo bar' 13 ]; 14 15 15 $customer = self::createTestCustomer($attribute); 16 16 $this->assertSame($attribute['email'], $customer->email); 17 17 $this->assertSame($attribute['description'], $customer->description); 18 18 } 19 19 20 20 // GET/customers/:id 21 21 public function testRetrieve() … … 23 23 $customer = self::createTestCustomer(); 24 24 $retrieve_customer = Customer::retrieve($customer->id); 25 26 25 $this->assertSame($customer->id, $retrieve_customer->id); 27 26 } 28 27 29 28 // GET/customers/ 30 29 public function testAll() 31 30 { 32 $customers = Customer::all( 33 array( 34 'limit' => 3, 35 'offset' => 10 36 ) 37 ); 38 } 39 31 $customers = Customer::all([ 32 'limit' => 3, 33 'offset' => 10 34 ]); 35 $this->assertCount(3, $customers['data']); 36 } 37 40 38 // DELETE/customers/:id 41 39 public function testDeletion() … … 43 41 $customer = self::createTestCustomer(); 44 42 $id = $customer->id; 45 43 46 44 $delete_customer = $customer->delete(); 47 45 … … 49 47 $this->assertFalse($customer->livemode); 50 48 $this->assertTrue($customer->deleted); 51 49 52 50 $this->assertNull($customer['active_card']); 53 51 54 52 $this->assertSame($id, $delete_customer->id); 55 53 $this->assertFalse($delete_customer->livemode); 56 54 $this->assertTrue($delete_customer->deleted); 57 55 58 56 $this->assertNull($delete_customer['active_card']); 59 57 } 60 58 61 59 //POST /customers/:id 62 60 public function testSave() … … 83 81 } 84 82 85 /**86 * @expectedException Payjp\Error\InvalidRequest87 */88 83 public function testBogusAttribute() 89 84 { 85 $this->expectException('\Payjp\Error\InvalidRequest'); 90 86 $customer = self::createTestCustomer(); 91 87 $customer->bogus = 'bogus'; … … 93 89 } 94 90 95 /**96 * @expectedException InvalidArgumentException97 */98 91 public function testUpdateDescriptionEmpty() 99 92 { 93 $this->expectException('\InvalidArgumentException'); 100 94 $customer = self::createTestCustomer(); 101 95 $customer->description = ''; 102 103 $customer->save(); 104 96 97 $customer->save(); 98 105 99 $updatedCustomer = Customer::retrieve($customer->id); 106 100 $this->assertSame('123', $updatedCustomer->description); 107 101 } 108 102 109 103 public function testUpdateDescriptionNull() 110 104 { 111 $customer = self::createTestCustomer( array('description' => 'foo bar'));105 $customer = self::createTestCustomer(['description' => 'foo bar']); 112 106 $customer->description = null; 113 114 $customer->save(); 115 107 108 $customer->save(); 109 116 110 $updatedCustomer = Customer::retrieve($customer->id); 117 111 $this->assertSame('', $updatedCustomer->description); 118 112 $this->assertSame('', $customer->description); 119 113 } 120 114 121 115 //POST /customers/:id/cards 122 116 //GET /customers/:id/cards … … 124 118 { 125 119 $customer = $this->createTestCustomer(); 126 120 127 121 $defaultCard = $customer->cards->data[0]; 128 122 129 123 $params = [ 130 124 'card' => [ 131 "number" => "4242424242424242",132 "exp_month"=> 12,133 "exp_year"=> date('Y') + 3,134 "cvc" => "314"125 'number' => '4242424242424242', 126 'exp_month' => 12, 127 'exp_year' => date('Y') + 3, 128 'cvc' => '314' 135 129 ] 136 130 ]; 137 131 138 $token = Token::create($params, $options =['payjp_direct_token_generate' => 'true']);139 132 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 133 140 134 $params2 = [ 141 135 'card' => [ 142 "number" => "4242424242424242",143 "exp_month"=> 7,144 "exp_year"=> date('Y') + 3,145 "cvc" => "314"136 'number' => '4242424242424242', 137 'exp_month' => 7, 138 'exp_year' => date('Y') + 3, 139 'cvc' => '314' 146 140 ] 147 141 ]; 148 142 149 $card = Token::create($params2, $options = ['payjp_direct_token_generate' => 'true']); 150 151 $createdCard = $customer->cards->create(array("card" => $token->id)); 152 $createdCard_2 = $customer->cards->create(array("card" => $card->id)); 153 154 $updatedCustomer = Customer::retrieve($customer->id); 155 $cardList = $updatedCustomer->cards->all(); 156 $this->assertSame(count($cardList["data"]), 3); 157 158 $this->assertSame($createdCard_2->id, $cardList["data"][0]->id); 159 $this->assertSame($createdCard->id, $cardList["data"][1]->id); 160 $this->assertSame($defaultCard->id, $cardList["data"][2]->id); 161 162 $card = $customer->cards->retrieve($cardList["data"][1]->id); 163 $this->assertSame($card->id, $cardList["data"][1]->id); 164 165 $updatedCustomer = Customer::retrieve($customer->id); 166 $cardList = $updatedCustomer->cards->all( 167 array( 168 'limit' => 1, 169 'offset' => 1 170 ) 171 ); 172 $this->assertSame(count($cardList["data"]), 1); 173 } 174 143 $card = Token::create($params2, ['payjp_direct_token_generate' => 'true']); 144 145 $createdCard = $customer->cards->create(['card' => $token->id]); 146 $createdCard_2 = $customer->cards->create(['card' => $card->id]); 147 148 $updatedCustomer = Customer::retrieve($customer->id); 149 $cardList = $updatedCustomer->cards->all(); 150 $this->assertSame(count($cardList['data']), 3); 151 152 $this->assertSame($createdCard_2->id, $cardList['data'][0]->id); 153 $this->assertSame($createdCard->id, $cardList['data'][1]->id); 154 $this->assertSame($defaultCard->id, $cardList['data'][2]->id); 155 156 $card = $customer->cards->retrieve($cardList['data'][1]->id); 157 $this->assertSame($card->id, $cardList['data'][1]->id); 158 159 $updatedCustomer = Customer::retrieve($customer->id); 160 $cardList = $updatedCustomer->cards->all([ 161 'limit' => 1, 162 'offset' => 1 163 ]); 164 $this->assertSame(count($cardList['data']), 1); 165 } 166 175 167 //POST /customers/:id/cards/:card_id 176 168 public function testCustomerUpdateCard() 177 169 { 178 170 $customer = $this->createTestCustomer(); 179 171 180 172 $cards = $customer->cards->all(); 181 $this->assertSame(count($cards[ "data"]), 1);182 173 $this->assertSame(count($cards['data']), 1); 174 183 175 $card = $cards['data'][0]; 184 $card->name = "Littleorc";176 $card->name = 'Littleorc'; 185 177 $card->save(); 186 187 $updatedCustomer = Customer::retrieve($customer->id); 188 $cardList = $updatedCustomer->cards->all(); 189 $this->assertSame($cardList[ "data"][0]->name, "Littleorc");190 } 191 178 179 $updatedCustomer = Customer::retrieve($customer->id); 180 $cardList = $updatedCustomer->cards->all(); 181 $this->assertSame($cardList['data'][0]->name, 'Littleorc'); 182 } 183 192 184 public function testCustomerDeleteCard() 193 185 { 194 186 $params = [ 195 187 'card' => [ 196 "number" => "4242424242424242",197 "exp_month"=> 7,198 "exp_year"=> date('Y') + 3,199 "cvc" => "314"188 'number' => '4242424242424242', 189 'exp_month' => 7, 190 'exp_year' => date('Y') + 3, 191 'cvc' => '314' 200 192 ] 201 193 ]; 202 194 203 195 $token = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 204 196 205 197 $customer = $this->createTestCustomer(); 206 $createdCard = $customer->cards->create( array("card" => $token->id));207 208 $updatedCustomer = Customer::retrieve($customer->id); 209 $cardList = $updatedCustomer->cards->all(); 210 $this->assertSame(count($cardList[ "data"]), 2);211 198 $createdCard = $customer->cards->create(['card' => $token->id]); 199 200 $updatedCustomer = Customer::retrieve($customer->id); 201 $cardList = $updatedCustomer->cards->all(); 202 $this->assertSame(count($cardList['data']), 2); 203 212 204 $deleteStatus = $updatedCustomer->cards->retrieve($createdCard->id)->delete(); 213 205 $this->assertTrue($deleteStatus->deleted); 214 206 215 207 $postDeleteCustomer = Customer::retrieve($customer->id); 216 208 $postDeleteCards = $postDeleteCustomer->cards->all(); 217 $this->assertSame(count($postDeleteCards[ "data"]), 1);218 219 $cardList = $updatedCustomer->cards->all(); 220 $this->assertSame(count($cardList[ "data"]), 1);221 } 222 209 $this->assertSame(count($postDeleteCards['data']), 1); 210 211 $cardList = $updatedCustomer->cards->all(); 212 $this->assertSame(count($cardList['data']), 1); 213 } 214 223 215 public function testCustomerSubscriptionAllRetrieve() 224 216 { 225 217 $planID = 'gold-' . self::randomString(); 226 218 self::retrieveOrCreatePlan($planID); 227 228 $customer = self::createTestCustomer(); 229 230 $subscription = Subscription::create( 231 array( 232 'customer' => $customer->id, 233 'plan' => $planID 234 ) 235 ); 236 219 220 $customer = self::createTestCustomer(); 221 222 $subscription = Subscription::create([ 223 'customer' => $customer->id, 224 'plan' => $planID 225 ]); 226 237 227 $planID_2 = 'gold-2-' . self::randomString(); 238 228 self::retrieveOrCreatePlan($planID_2); 239 229 240 $subscription_2 = Subscription::create( 241 array( 242 'customer' => $customer->id, 243 'plan' => $planID_2 244 ) 245 ); 246 230 $subscription_2 = Subscription::create([ 231 'customer' => $customer->id, 232 'plan' => $planID_2 233 ]); 234 247 235 $customerRetrive = Customer::retrieve($customer->id); 248 236 $subscriptions = $customerRetrive->subscriptions->all(); … … 250 238 $this->assertSame($subscription_2->id, $subscriptions['data'][0]->id); 251 239 $this->assertSame($subscription->id, $subscriptions['data'][1]->id); 252 240 253 241 $this->assertSame(2, count($subscriptions['data'])); 254 242 $this->assertSame($customer->id, $subscriptions['data'][0]->customer); 255 243 $this->assertSame($planID_2, $subscriptions['data'][0]->plan->id); 256 244 257 245 $subscriptionRetrieve = $customerRetrive->subscriptions->retrieve($subscription->id); 258 246 $this->assertSame($subscription->id, $subscriptionRetrieve->id); 259 247 $this->assertSame($planID, $subscriptionRetrieve->plan->id); 260 248 } 261 249 262 250 public function testCustomerChargeAll() 263 251 { 264 252 $planID = 'gold-' . self::randomString(); 265 253 self::retrieveOrCreatePlan($planID); 266 267 $customer = self::createTestCustomer(); 268 269 $charge = Charge::create( 270 array( 271 'amount' => 1000, 272 'currency' => self::CURRENCY, 273 'customer' => $customer->id 274 ) 275 ); 276 254 255 $customer = self::createTestCustomer(); 256 257 $charge = Charge::create([ 258 'amount' => 1000, 259 'currency' => self::CURRENCY, 260 'customer' => $customer->id 261 ]); 262 277 263 $charges = $customer->charges(); 278 264 279 265 $this->assertSame(1, count($charges['data'])); 280 266 $this->assertSame($charge->id, $charges['data'][0]->id); 281 267 282 $charge_2 = Charge::create( 283 array( 284 'amount' => 1500, 285 'currency' => self::CURRENCY, 286 'customer' => $customer->id 287 ) 288 ); 289 268 $charge_2 = Charge::create([ 269 'amount' => 1500, 270 'currency' => self::CURRENCY, 271 'customer' => $customer->id 272 ]); 273 290 274 $charges_2 = $customer->charges(); 291 275 292 276 $this->assertSame(2, count($charges_2['data'])); 293 277 $this->assertSame($charge_2->id, $charges_2['data'][0]->id); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/PayjpObjectTest.php
r2149911 r3190331 49 49 $converted = $s->__toArray(); 50 50 51 $this->assert InternalType('array', $converted);51 $this->assertSame('array', gettype($converted)); 52 52 $this->assertArrayHasKey('foo', $converted); 53 53 $this->assertEquals('a', $converted['foo']); … … 64 64 $converted = $s->__toArray(true); 65 65 66 $this->assert InternalType('array', $converted);66 $this->assertSame('array', gettype($converted)); 67 67 $this->assertArrayHasKey('child', $converted); 68 $this->assert InternalType('array', $converted['child']);68 $this->assertSame('array', gettype($converted['child'])); 69 69 $this->assertArrayHasKey('foo', $converted['child']); 70 70 $this->assertEquals('a', $converted['child']['foo']); -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/PlanTest.php
r2149911 r3190331 8 8 { 9 9 self::authorizeFromEnv(); 10 $planI D= 'gold-' . self::randomString();11 $p = Plan::create( array(10 $planId = 'gold-' . self::randomString(); 11 $p = Plan::create([ 12 12 'amount' => 2000, 13 13 'interval' => 'month', 14 14 'currency' => self::CURRENCY, 15 15 'name' => 'Plan', 16 'id' => $planID 17 )); 18 19 $plan_retrieve = Plan::retrieve($planID); 20 $this->assertSame($planID, $plan_retrieve->id); 21 22 $planID_2 = 'foobar-2-' . self::randomString(); 23 $p_2 = Plan::create( 24 array( 25 'amount' => 3000, 26 'interval' => 'month', 27 'currency' => self::CURRENCY, 28 'name' => 'Plan_2', 29 'id' => $planID_2 30 ) 31 ); 16 'id' => $planId 17 ]); 32 18 33 $plans = Plan::all( 34 array( 35 'limit' => 2, 36 'offset' => 0 37 ) 38 ); 19 $plan_retrieve = Plan::retrieve($planId); 20 $this->assertSame($planId, $plan_retrieve->id); 21 22 $planId_2 = 'foobar-2-' . self::randomString(); 23 $p_2 = Plan::create([ 24 'amount' => 3000, 25 'interval' => 'month', 26 'currency' => self::CURRENCY, 27 'name' => 'Plan_2', 28 'id' => $planId_2 29 ]); 30 31 $plans = Plan::all([ 32 'limit' => 2, 33 'offset' => 0 34 ]); 39 35 $this->assertSame(2, count($plans['data'])); 40 36 } … … 43 39 { 44 40 self::authorizeFromEnv(); 45 $plan _ID= 'gold-' . self::randomString();46 $p = Plan::create( array(41 $planId = 'gold-' . self::randomString(); 42 $p = Plan::create([ 47 43 'amount' => 2000, 48 44 'interval' => 'month', 49 45 'currency' => self::CURRENCY, 50 46 'name' => 'Plan', 51 'id' => $plan _ID52 ));47 'id' => $planId 48 ]); 53 49 $p->delete(); 54 50 $this->assertTrue($p->deleted); 55 $this->assertSame($plan _ID, $p->id);51 $this->assertSame($planId, $p->id); 56 52 } 57 53 … … 59 55 { 60 56 try { 61 $retrievedPlan =Plan::retrieve('0');57 Plan::retrieve('0'); 62 58 } catch (Error\InvalidRequest $e) { 63 // Can either succeed or 404, all other errors are bad 64 if ($e->httpStatus !== 404) { 65 $this->fail(); 66 } 59 $this->assertSame(404, $e->httpStatus); 67 60 } 68 61 } … … 71 64 { 72 65 self::authorizeFromEnv(); 73 $planI D= 'gold-' . self::randomString();74 $p = Plan::create( array(66 $planId = 'gold-' . self::randomString(); 67 $p = Plan::create([ 75 68 'amount' => 2000, 76 69 'interval' => 'month', 77 70 'currency' => self::CURRENCY, 78 71 'name' => 'Plan', 79 'id' => $planI D80 ));72 'id' => $planId 73 ]); 81 74 $p->name = 'A new plan name'; 82 75 $p->save(); 83 76 $this->assertSame($p->name, 'A new plan name'); 84 77 85 $payjpPlan = Plan::retrieve($planI D);78 $payjpPlan = Plan::retrieve($planId); 86 79 $this->assertSame($p->name, $payjpPlan->name); 87 80 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/RequestOptionsTest.php
r2149911 r3190331 71 71 } 72 72 73 /**74 * @expectedException Payjp\Error\Api75 */76 73 public function testWrongType() 77 74 { 75 $this->expectException("\Payjp\Error\Api"); 78 76 $opts = Util\RequestOptions::parse(5); 79 77 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/TestCase.php
r2149911 r3190331 7 7 * objects. 8 8 */ 9 class TestCase extends \PHPUnit _Framework_TestCase9 class TestCase extends \PHPUnit\Framework\TestCase 10 10 { 11 11 const API_KEY = 'sk_test_c62fade9d045b54cd76d7036';// public api key for test … … 13 13 const COUNTRY = 'JP'; 14 14 15 pr ivate$mock;15 protected $mock; 16 16 17 17 protected static function authorizeFromEnv() … … 25 25 } 26 26 27 protected function setUp()27 protected static function setMaxRetryForCi() 28 28 { 29 $maxRetry = getenv('MAX_RETRY'); 30 if ($maxRetry) { 31 Payjp::setMaxRetry($maxRetry); 32 } 33 } 34 35 /** 36 * @before 37 */ 38 protected function setUpTestCase() 39 { 40 $this->setMaxRetryForCi(); 29 41 ApiRequestor::setHttpClient(HttpClient\CurlClient::instance()); 30 42 $this->mock = null; 31 $this->call = 0;32 43 } 33 44 … … 35 46 { 36 47 $mock = $this->setUpMockRequest(); 37 $mock->expects($this->at($this->call++)) 38 ->method('request') 39 ->with(strtolower($method), 'https://api.pay.jp' . $path, $this->anything(), $params, false) 40 ->willReturn(array(json_encode($return), 200)); 48 $mock->expects($this->once()) 49 ->method('request') 50 ->with( 51 strtolower($method), 52 'https://api.pay.jp' . $path, 53 $this->anything(), 54 $params, 55 false 56 ) 57 ->willReturn(array(json_encode($return), 200)); 41 58 } 42 59 43 private function setUpMockRequest() 44 { 45 if (!$this->mock) { 46 self::authorizeFromEnv(); 47 $this->mock = $this->getMock('\Payjp\HttpClient\ClientInterface'); 48 ApiRequestor::setHttpClient($this->mock); 49 } 50 return $this->mock; 51 } 52 53 /** 54 * Create a valid test charge. 55 */ 56 protected static function createTestCharge(array $attributes = array()) 60 protected function setUpMockRequest() 57 61 { 58 62 self::authorizeFromEnv(); 59 60 $params = [ 61 'card' => [ 62 "number" => "4242424242424242", 63 "exp_month" => 6, 64 "exp_year" => date('Y') + 3, 65 "cvc" => "314" 66 ] 67 ]; 68 69 $card = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 70 71 return Charge::create( 72 $attributes + array( 73 'amount' => 2000, 74 'currency' => self::CURRENCY, 75 'description' => 'Charge for test@example.com', 76 'card' => $card 77 ) 78 ); 79 } 80 81 /** 82 * Create a valid test charge. 83 */ 84 protected static function createTestTransfer(array $attributes = array()) 85 { 86 self::authorizeFromEnv(); 87 88 $recipient = self::createTestRecipient(); 89 90 return Transfer::create( 91 $attributes + array( 92 'amount' => 2000, 93 'currency' => self::CURRENCY, 94 'description' => 'Transfer to test@example.com', 95 'recipient' => $recipient->id 96 ) 97 ); 63 $this->mock = $this->createMock('\Payjp\HttpClient\ClientInterface'); 64 ApiRequestor::setHttpClient($this->mock); 65 return $this->mock; 98 66 } 99 67 -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/TokenTest.php
r2149911 r3190331 11 11 $this->assertSame($token->instanceUrl(), '/v1/tokens/abcd%2Fefgh'); 12 12 } 13 13 14 14 public function testCreate() 15 15 { 16 16 self::authorizeFromEnv(); 17 17 18 18 $params = [ 19 19 'card' => [ 20 "number" => "4242424242424242",21 "exp_month"=> 6,22 "exp_year"=> date('Y') + 3,23 "cvc" => "314"20 'number' => '4242424242424242', 21 'exp_month' => 6, 22 'exp_year' => date('Y') + 3, 23 'cvc' => '314' 24 24 ] 25 25 ]; 26 27 $token = Token::create($params, $options = ['payjp_direct_token_generate' => 'true']); 26 27 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 28 $this->assertNotNull($token); 28 29 } 29 30 30 31 public function testRetrieve() 31 32 { … … 34 35 $params = [ 35 36 'card' => [ 36 "number" => "4242424242424242",37 "exp_month"=> 6,38 "exp_year"=> date('Y') + 3,39 "cvc" => "314"37 'number' => '4242424242424242', 38 'exp_month' => 6, 39 'exp_year' => date('Y') + 3, 40 'cvc' => '314' 40 41 ] 41 42 ]; 42 43 $token = Token::create($params, $options =['payjp_direct_token_generate' => 'true']);44 43 44 $token = Token::create($params, ['payjp_direct_token_generate' => 'true']); 45 45 46 $token_retrieve = Token::retrieve($token->id); 46 47 47 48 $this->assertSame($token->id, $token_retrieve->id); 48 49 } -
ht-pay-jp-for-kintone/trunk/vendor/payjp/payjp-php/tests/TransferTest.php
r2149911 r3190331 8 8 { 9 9 self::authorizeFromEnv(); 10 11 $transfers = Transfer::all( 12 array( 13 'limit' => 3, 14 'offset' => 0 15 ) 16 ); 10 11 $transfers = Transfer::all([ 12 'limit' => 3, 13 'offset' => 0 14 ]); 17 15 18 16 if (count($transfers['data'])) { … … 21 19 } 22 20 } 23 21 24 22 public function testAllCharge() 25 23 { 26 24 self::authorizeFromEnv(); 27 28 $transfers = Transfer::all( 29 array( 25 26 $transfers = Transfer::all([ 27 'limit' => 3, 28 'offset' => 0 29 ]); 30 31 if (count($transfers['data'])) { 32 $transfer = Transfer::retrieve($transfers['data'][0]->id); 33 $charges = $transfer->charges->all([ 30 34 'limit' => 3, 31 35 'offset' => 0 32 ) 33 ); 34 35 if (count($transfers['data'])) { 36 $transfer = Transfer::retrieve($transfers['data'][0]->id); 37 $charges = $transfer->charges->all( 38 array( 39 'limit' => 3, 40 'offset' => 0 41 ) 42 ); 36 ]); 37 $this->markTestSkipped('Should be changed to mock.'); 38 // $this->assertTrue(count($charges['data']) > 0); 43 39 } 44 40 }
Note: See TracChangeset
for help on using the changeset viewer.