Modern Events Calendar Lite - Version 5.17.6

Version Description

17 March 2021 = - Added: Labels for all search fields - Added: An option to manage active day of monthly skin - Added: Speaker import to the XML import feature - Improved: The Show Only Expired Events feature to not show ongoing events in some cases - Updated: Stripe API to latest version (pro) - Fixed: Required checkbox fields in event custom fields - Fixed: GEO location of addresses when wrong latitude and longitude are set (pro) - Fixed: Event cost field - Fixed: Timezone intervals in RSS feed - Fixed: Yearly skin in showing navigation to previous year (pro) - Fixed: Showing Sold-out and other labels in multilingual websites (pro) - Fixed: Some console issues in block editor - Fixed: Some duplicate id issues in console - Fixed: An issue in Certain Weekdays repeat - Fixed: An issue in local time module - Fixed: An issue in breadcrumb - Fixed: Some notices

Download this release

Release Info

Developer webnus
Plugin Icon 128x128 Modern Events Calendar Lite
Version 5.17.6
Comparing to
See all releases

Code changes from version 5.17.5 to 5.17.6

Files changed (274) hide show
  1. app/api/Stripe/Account.php +267 -228
  2. app/api/Stripe/AccountLink.php +13 -7
  3. app/api/Stripe/AlipayAccount.php +27 -23
  4. app/api/Stripe/ApiOperations/All.php +10 -7
  5. app/api/Stripe/ApiOperations/Create.php +6 -3
  6. app/api/Stripe/ApiOperations/Delete.php +6 -3
  7. app/api/Stripe/ApiOperations/NestedResource.php +35 -18
  8. app/api/Stripe/ApiOperations/Request.php +15 -8
  9. app/api/Stripe/ApiOperations/Retrieve.php +6 -3
  10. app/api/Stripe/ApiOperations/Update.php +13 -7
  11. app/api/Stripe/ApiRequestor.php +167 -149
  12. app/api/Stripe/ApiResource.php +31 -23
  13. app/api/Stripe/ApiResponse.php +21 -8
  14. app/api/Stripe/ApplePayDomain.php +8 -4
  15. app/api/Stripe/ApplicationFee.php +45 -52
  16. app/api/Stripe/ApplicationFeeRefund.php +27 -20
  17. app/api/Stripe/Balance.php +26 -10
  18. app/api/Stripe/BalanceTransaction.php +55 -49
  19. app/api/Stripe/BankAccount.php +72 -48
  20. app/api/Stripe/BaseStripeClient.php +269 -0
  21. app/api/Stripe/BillingPortal/Configuration.php +31 -0
  22. app/api/Stripe/BillingPortal/Session.php +42 -0
  23. app/api/Stripe/BitcoinReceiver.php +37 -14
  24. app/api/Stripe/BitcoinTransaction.php +10 -4
  25. app/api/Stripe/Capability.php +40 -35
  26. app/api/Stripe/Card.php +73 -60
  27. app/api/Stripe/Charge.php +113 -173
  28. app/api/Stripe/Checkout/Session.php +72 -22
  29. app/api/Stripe/Collection.php +199 -25
  30. app/api/Stripe/CountrySpec.php +16 -11
  31. app/api/Stripe/Coupon.php +25 -19
  32. app/api/Stripe/CreditNote.php +77 -39
  33. app/api/Stripe/CreditNoteLineItem.php +26 -0
  34. app/api/Stripe/Customer.php +151 -194
  35. app/api/Stripe/CustomerBalanceTransaction.php +58 -43
  36. app/api/Stripe/Discount.php +13 -9
  37. app/api/Stripe/Dispute.php +54 -49
  38. app/api/Stripe/EphemeralKey.php +19 -16
  39. app/api/Stripe/Error/Api.php +0 -7
  40. app/api/Stripe/Error/ApiConnection.php +0 -7
  41. app/api/Stripe/Error/Authentication.php +0 -7
  42. app/api/Stripe/Error/Base.php +0 -69
  43. app/api/Stripe/Error/Card.php +0 -40
  44. app/api/Stripe/Error/Idempotency.php +0 -7
  45. app/api/Stripe/Error/InvalidRequest.php +0 -23
  46. app/api/Stripe/Error/OAuth/InvalidClient.php +0 -10
  47. app/api/Stripe/Error/OAuth/InvalidRequest.php +0 -11
  48. app/api/Stripe/Error/OAuth/InvalidScope.php +0 -10
  49. app/api/Stripe/Error/OAuth/OAuthBase.php +0 -23
  50. app/api/Stripe/Error/OAuth/UnsupportedGrantType.php +0 -11
  51. app/api/Stripe/Error/OAuth/UnsupportedResponseType.php +0 -11
  52. app/api/Stripe/Error/Permission.php +0 -7
  53. app/api/Stripe/Error/RateLimit.php +0 -7
  54. app/api/Stripe/Error/SignatureVerification.php +0 -20
  55. app/api/Stripe/ErrorObject.php +164 -0
  56. app/api/Stripe/Event.php +215 -151
  57. app/api/Stripe/Exception/ApiConnectionException.php +12 -0
  58. app/api/Stripe/Exception/ApiErrorException.php +219 -0
  59. app/api/Stripe/Exception/AuthenticationException.php +11 -0
  60. app/api/Stripe/Exception/BadMethodCallException.php +7 -0
  61. app/api/Stripe/Exception/CardException.php +84 -0
  62. app/api/Stripe/Exception/ExceptionInterface.php +22 -0
  63. app/api/Stripe/Exception/IdempotencyException.php +11 -0
  64. app/api/Stripe/Exception/InvalidArgumentException.php +7 -0
  65. app/api/Stripe/Exception/InvalidRequestException.php +60 -0
  66. app/api/Stripe/Exception/OAuth/ExceptionInterface.php +10 -0
  67. app/api/Stripe/Exception/OAuth/InvalidClientException.php +12 -0
  68. app/api/Stripe/{Error/OAuth/InvalidGrant.php → Exception/OAuth/InvalidGrantException.php} +3 -3
  69. app/api/Stripe/Exception/OAuth/InvalidRequestException.php +11 -0
  70. app/api/Stripe/Exception/OAuth/InvalidScopeException.php +10 -0
  71. app/api/Stripe/Exception/OAuth/OAuthErrorException.php +19 -0
  72. app/api/Stripe/Exception/OAuth/UnknownOAuthErrorException.php +12 -0
  73. app/api/Stripe/Exception/OAuth/UnsupportedGrantTypeException.php +11 -0
  74. app/api/Stripe/Exception/OAuth/UnsupportedResponseTypeException.php +11 -0
  75. app/api/Stripe/Exception/PermissionException.php +11 -0
  76. app/api/Stripe/Exception/RateLimitException.php +12 -0
  77. app/api/Stripe/Exception/SignatureVerificationException.php +74 -0
  78. app/api/Stripe/Exception/UnexpectedValueException.php +7 -0
  79. app/api/Stripe/Exception/UnknownApiErrorException.php +12 -0
  80. app/api/Stripe/ExchangeRate.php +17 -3
  81. app/api/Stripe/File.php +47 -27
  82. app/api/Stripe/FileLink.php +15 -13
  83. app/api/Stripe/FileUpload.php +0 -6
  84. app/api/Stripe/HttpClient/ClientInterface.php +7 -6
  85. app/api/Stripe/HttpClient/CurlClient.php +214 -123
  86. app/api/Stripe/Invoice.php +178 -119
  87. app/api/Stripe/InvoiceItem.php +32 -22
  88. app/api/Stripe/InvoiceLineItem.php +24 -23
  89. app/api/Stripe/IssuerFraudRecord.php +0 -24
  90. app/api/Stripe/Issuing/Authorization.php +48 -35
  91. app/api/Stripe/Issuing/Card.php +34 -26
  92. app/api/Stripe/Issuing/CardDetails.php +2 -4
  93. app/api/Stripe/Issuing/Cardholder.php +23 -14
  94. app/api/Stripe/Issuing/Dispute.php +37 -14
  95. app/api/Stripe/Issuing/Transaction.php +28 -20
  96. app/api/Stripe/LineItem.php +26 -0
  97. app/api/Stripe/LoginLink.php +6 -8
  98. app/api/Stripe/Mandate.php +27 -0
  99. app/api/Stripe/OAuth.php +25 -17
  100. app/api/Stripe/OAuthErrorObject.php +31 -0
  101. app/api/Stripe/Order.php +53 -35
  102. app/api/Stripe/OrderItem.php +2 -4
  103. app/api/Stripe/OrderReturn.php +18 -12
  104. app/api/Stripe/PaymentIntent.php +80 -61
  105. app/api/Stripe/PaymentMethod.php +49 -21
  106. app/api/Stripe/Payout.php +76 -60
  107. app/api/Stripe/Person.php +70 -57
  108. app/api/Stripe/Plan.php +40 -22
  109. app/api/Stripe/Price.php +62 -0
  110. app/api/Stripe/Product.php +34 -27
  111. app/api/Stripe/PromotionCode.php +33 -0
  112. app/api/Stripe/Radar/EarlyFraudWarning.php +21 -20
  113. app/api/Stripe/Radar/ValueList.php +18 -15
  114. app/api/Stripe/Radar/ValueListItem.php +15 -10
  115. app/api/Stripe/Recipient.php +27 -30
  116. app/api/Stripe/RecipientTransfer.php +4 -6
  117. app/api/Stripe/Refund.php +35 -37
  118. app/api/Stripe/Reporting/ReportRun.php +22 -13
  119. app/api/Stripe/Reporting/ReportType.php +20 -10
  120. app/api/Stripe/RequestTelemetry.php +3 -4
  121. app/api/Stripe/Review.php +36 -27
  122. app/api/Stripe/SKU.php +27 -17
  123. app/api/Stripe/Service/AbstractService.php +79 -0
  124. app/api/Stripe/Service/AbstractServiceFactory.php +59 -0
  125. app/api/Stripe/Service/AccountLinkService.php +25 -0
  126. app/api/Stripe/Service/AccountService.php +381 -0
  127. app/api/Stripe/Service/ApplePayDomainService.php +70 -0
  128. app/api/Stripe/Service/ApplicationFeeService.php +125 -0
  129. app/api/Stripe/Service/BalanceService.php +26 -0
  130. app/api/Stripe/Service/BalanceTransactionService.php +47 -0
  131. app/api/Stripe/Service/BillingPortal/BillingPortalServiceFactory.php +27 -0
  132. app/api/Stripe/Service/BillingPortal/ConfigurationService.php +73 -0
  133. app/api/Stripe/Service/BillingPortal/SessionService.php +23 -0
  134. app/api/Stripe/Service/ChargeService.php +101 -0
  135. app/api/Stripe/Service/Checkout/CheckoutServiceFactory.php +25 -0
  136. app/api/Stripe/Service/Checkout/SessionService.php +73 -0
  137. app/api/Stripe/Service/CoreServiceFactory.php +125 -0
  138. app/api/Stripe/Service/CountrySpecService.php +39 -0
  139. app/api/Stripe/Service/CouponService.php +104 -0
  140. app/api/Stripe/Service/CreditNoteService.php +156 -0
  141. app/api/Stripe/Service/CustomerService.php +353 -0
  142. app/api/Stripe/Service/DisputeService.php +83 -0
  143. app/api/Stripe/Service/EphemeralKeyService.php +43 -0
  144. app/api/Stripe/Service/EventService.php +44 -0
  145. app/api/Stripe/Service/ExchangeRateService.php +41 -0
  146. app/api/Stripe/Service/FileLinkService.php +70 -0
  147. app/api/Stripe/Service/FileService.php +66 -0
  148. app/api/Stripe/Service/InvoiceItemService.php +93 -0
  149. app/api/Stripe/Service/InvoiceService.php +272 -0
  150. app/api/Stripe/Service/Issuing/AuthorizationService.php +97 -0
  151. app/api/Stripe/Service/Issuing/CardService.php +73 -0
  152. app/api/Stripe/Service/Issuing/CardholderService.php +74 -0
  153. app/api/Stripe/Service/Issuing/DisputeService.php +99 -0
  154. app/api/Stripe/Service/Issuing/IssuingServiceFactory.php +33 -0
  155. app/api/Stripe/Service/Issuing/TransactionService.php +59 -0
  156. app/api/Stripe/Service/MandateService.php +24 -0
  157. app/api/Stripe/Service/OAuthService.php +150 -0
  158. app/api/Stripe/Service/OrderReturnService.php +42 -0
  159. app/api/Stripe/Service/OrderService.php +109 -0
  160. app/api/Stripe/Service/PaymentIntentService.php +181 -0
  161. app/api/Stripe/Service/PaymentMethodService.php +121 -0
  162. app/api/Stripe/Service/PayoutService.php +127 -0
  163. app/api/Stripe/Service/PlanService.php +91 -0
  164. app/api/Stripe/Service/PriceService.php +72 -0
  165. app/api/Stripe/Service/ProductService.php +92 -0
  166. app/api/Stripe/Service/PromotionCodeService.php +72 -0
  167. app/api/Stripe/Service/Radar/EarlyFraudWarningService.php +43 -0
  168. app/api/Stripe/Service/Radar/RadarServiceFactory.php +29 -0
  169. app/api/Stripe/Service/Radar/ValueListItemService.php +74 -0
  170. app/api/Stripe/Service/Radar/ValueListService.php +93 -0
  171. app/api/Stripe/Service/RefundService.php +76 -0
  172. app/api/Stripe/Service/Reporting/ReportRunService.php +57 -0
  173. app/api/Stripe/Service/Reporting/ReportTypeService.php +41 -0
  174. app/api/Stripe/Service/Reporting/ReportingServiceFactory.php +27 -0
  175. app/api/Stripe/Service/ReviewService.php +58 -0
  176. app/api/Stripe/Service/SetupAttemptService.php +23 -0
  177. app/api/Stripe/Service/SetupIntentService.php +127 -0
  178. app/api/Stripe/Service/Sigma/ScheduledQueryRunService.php +39 -0
  179. app/api/Stripe/Service/Sigma/SigmaServiceFactory.php +25 -0
  180. app/api/Stripe/Service/SkuService.php +95 -0
  181. app/api/Stripe/Service/SourceService.php +110 -0
  182. app/api/Stripe/Service/SubscriptionItemService.php +151 -0
  183. app/api/Stripe/Service/SubscriptionScheduleService.php +113 -0
  184. app/api/Stripe/Service/SubscriptionService.php +124 -0
  185. app/api/Stripe/Service/TaxRateService.php +71 -0
  186. app/api/Stripe/Service/Terminal/ConnectionTokenService.php +25 -0
  187. app/api/Stripe/Service/Terminal/LocationService.php +87 -0
  188. app/api/Stripe/Service/Terminal/ReaderService.php +87 -0
  189. app/api/Stripe/Service/Terminal/TerminalServiceFactory.php +29 -0
  190. app/api/Stripe/Service/TokenService.php +42 -0
  191. app/api/Stripe/Service/TopupService.php +89 -0
  192. app/api/Stripe/Service/TransferService.php +175 -0
  193. app/api/Stripe/Service/WebhookEndpointService.php +97 -0
  194. app/api/Stripe/SetupAttempt.php +32 -0
  195. app/api/Stripe/SetupIntent.php +78 -38
  196. app/api/Stripe/Sigma/ScheduledQueryRun.php +20 -16
  197. app/api/Stripe/SingletonApiResource.php +7 -7
  198. app/api/Stripe/Source.php +108 -93
  199. app/api/Stripe/SourceTransaction.php +3 -5
  200. app/api/Stripe/Stripe.php +48 -35
  201. app/api/Stripe/StripeClient.php +77 -0
  202. app/api/Stripe/StripeClientInterface.php +56 -0
  203. app/api/Stripe/StripeObject.php +146 -93
  204. app/api/Stripe/Subscription.php +73 -55
  205. app/api/Stripe/SubscriptionItem.php +50 -25
  206. app/api/Stripe/SubscriptionSchedule.php +36 -30
  207. app/api/Stripe/TaxId.php +67 -40
  208. app/api/Stripe/TaxRate.php +24 -14
  209. app/api/Stripe/Terminal/ConnectionToken.php +10 -4
  210. app/api/Stripe/Terminal/Location.php +13 -8
  211. app/api/Stripe/Terminal/Reader.php +18 -13
  212. app/api/Stripe/ThreeDSecure.php +21 -3
  213. app/api/Stripe/Token.php +41 -19
  214. app/api/Stripe/Topup.php +36 -32
  215. app/api/Stripe/Transfer.php +74 -64
  216. app/api/Stripe/TransferReversal.php +40 -22
  217. app/api/Stripe/UsageRecord.php +14 -32
  218. app/api/Stripe/UsageRecordSummary.php +10 -12
  219. app/api/Stripe/Util/AutoPagingIterator.php +0 -61
  220. app/api/Stripe/Util/CaseInsensitiveArray.php +21 -11
  221. app/api/Stripe/Util/DefaultLogger.php +14 -3
  222. app/api/Stripe/Util/LoggerInterface.php +0 -2
  223. app/api/Stripe/Util/ObjectTypes.php +100 -0
  224. app/api/Stripe/Util/RandomGenerator.php +5 -3
  225. app/api/Stripe/Util/RequestOptions.php +82 -22
  226. app/api/Stripe/Util/Set.php +2 -2
  227. app/api/Stripe/Util/Util.php +81 -176
  228. app/api/Stripe/Webhook.php +20 -18
  229. app/api/Stripe/WebhookEndpoint.php +24 -11
  230. app/api/Stripe/WebhookSignature.php +49 -42
  231. app/features/events.php +9 -1
  232. app/features/feed/rss2.php +3 -3
  233. app/features/ix.php +27 -0
  234. app/features/locations.php +2 -2
  235. app/features/mec/booking.php +1 -0
  236. app/features/mec/meta_boxes/display_options.php +10 -0
  237. app/features/mec/meta_boxes/search_form.php +11 -0
  238. app/features/organizers.php +2 -2
  239. app/features/popup.php +2 -0
  240. app/features/popup/event.php +2 -2
  241. app/features/speakers.php +0 -1
  242. app/features/updateTable.php +2 -0
  243. app/libraries/factory.php +0 -3
  244. app/libraries/main.php +88 -48
  245. app/libraries/render.php +5 -2
  246. app/libraries/skins.php +70 -35
  247. app/modules/local-time/type1.php +2 -0
  248. app/modules/local-time/type2.php +3 -1
  249. app/modules/local-time/type3.php +2 -0
  250. app/skins/agenda.php +1 -0
  251. app/skins/custom.php +1 -0
  252. app/skins/daily_view.php +1 -0
  253. app/skins/default_full_calendar.php +1 -0
  254. app/skins/default_full_calendar/tpl.php +2 -2
  255. app/skins/full_calendar.php +1 -0
  256. app/skins/full_calendar/tpl.php +11 -11
  257. app/skins/grid.php +1 -0
  258. app/skins/list.php +1 -0
  259. app/skins/map.php +1 -0
  260. app/skins/masonry.php +1 -0
  261. app/skins/monthly_view.php +11 -0
  262. app/skins/single.php +3 -2
  263. app/skins/single/default.php +2 -0
  264. app/skins/single/m1.php +16 -15
  265. app/skins/single/m2.php +11 -10
  266. app/skins/single/modern.php +20 -19
  267. app/skins/tile.php +1 -0
  268. app/skins/timeline.php +1 -0
  269. app/skins/timetable.php +1 -0
  270. app/skins/weekly_view.php +1 -0
  271. app/skins/yearly_view.php +1 -0
  272. app/skins/yearly_view/tpl.php +2 -2
  273. assets/css/frontend.css +15 -0
  274. assets/css/frontend.min.css +0 -1
app/api/Stripe/Account.php CHANGED
@@ -1,138 +1,170 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Account
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $business_profile
11
- * @property string $business_type
12
- * @property mixed $capabilities
13
- * @property bool $charges_enabled
14
- * @property mixed $company
15
- * @property string $country
16
- * @property int $created
17
- * @property string $default_currency
18
- * @property bool $details_submitted
19
- * @property string $email
20
- * @property Collection $external_accounts
21
- * @property mixed $individual
22
- * @property StripeObject $metadata
23
- * @property bool $payouts_enabled
24
- * @property mixed $requirements
25
- * @property mixed $settings
26
- * @property mixed $tos_acceptance
27
- * @property string $type
28
  *
29
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  */
31
  class Account extends ApiResource
32
  {
33
- const OBJECT_NAME = "account";
34
 
35
  use ApiOperations\All;
36
  use ApiOperations\Create;
37
  use ApiOperations\Delete;
38
  use ApiOperations\NestedResource;
39
- use ApiOperations\Retrieve {
40
- retrieve as protected _retrieve;
41
- }
42
  use ApiOperations\Update;
43
 
44
- /**
45
- * Possible string representations of an account's business type.
46
- * @link https://stripe.com/docs/api/accounts/object#account_object-business_type
47
- */
48
- const BUSINESS_TYPE_COMPANY = 'company';
49
  const BUSINESS_TYPE_INDIVIDUAL = 'individual';
 
50
 
51
- /**
52
- * Possible string representations of an account's capabilities.
53
- * @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
54
- */
55
- const CAPABILITY_CARD_PAYMENTS = 'card_payments';
56
- const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
57
  const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
 
58
 
59
- /**
60
- * Possible string representations of an account's capability status.
61
- * @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
62
- */
63
- const CAPABILITY_STATUS_ACTIVE = 'active';
64
  const CAPABILITY_STATUS_INACTIVE = 'inactive';
65
- const CAPABILITY_STATUS_PENDING = 'pending';
66
 
67
- /**
68
- * Possible string representations of an account's type.
69
- * @link https://stripe.com/docs/api/accounts/object#account_object-type
70
- */
71
- const TYPE_CUSTOM = 'custom';
72
- const TYPE_EXPRESS = 'express';
73
  const TYPE_STANDARD = 'standard';
74
 
 
 
 
 
75
  public static function getSavedNestedResources()
76
  {
77
  static $savedNestedResources = null;
78
- if ($savedNestedResources === null) {
79
  $savedNestedResources = new Util\Set([
80
  'external_account',
81
  'bank_account',
82
  ]);
83
  }
 
84
  return $savedNestedResources;
85
  }
86
 
87
- const PATH_CAPABILITIES = '/capabilities';
88
- const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
89
- const PATH_LOGIN_LINKS = '/login_links';
90
- const PATH_PERSONS = '/persons';
91
-
92
  public function instanceUrl()
93
  {
94
- if ($this['id'] === null) {
95
  return '/v1/account';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  } else {
97
- return parent::instanceUrl();
98
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
  /**
102
- * @param array|string|null $id The ID of the account to retrieve, or an
103
- * options array containing an `id` key.
104
- * @param array|string|null $opts
 
 
105
  *
106
- * @return Account
107
  */
108
  public static function retrieve($id = null, $opts = null)
109
  {
110
- if (!$opts && is_string($id) && substr($id, 0, 3) === 'sk_') {
111
  $opts = $id;
112
  $id = null;
113
  }
 
114
  return self::_retrieve($id, $opts);
115
  }
116
 
117
  /**
118
- * @param array|null $params
119
- * @param array|string|null $opts
120
  *
121
- * @return Account The rejected account.
122
- */
123
- public function reject($params = null, $opts = null)
124
- {
125
- $url = $this->instanceUrl() . '/reject';
126
- list($response, $opts) = $this->_request('post', $url, $params, $opts);
127
- $this->refreshFrom($response, $opts);
128
- return $this;
129
- }
130
-
131
- /**
132
- * @param array|null $clientId
133
- * @param array|string|null $opts
134
  *
135
- * @return StripeObject Object containing the response from the API.
136
  */
137
  public function deauthorize($clientId = null, $opts = null)
138
  {
@@ -140,48 +172,61 @@ class Account extends ApiResource
140
  'client_id' => $clientId,
141
  'stripe_user_id' => $this->id,
142
  ];
 
143
  return OAuth::deauthorize($params, $opts);
144
  }
145
 
146
- /*
147
- * Capabilities methods
148
- * We can not add the capabilities() method today as the Account object already has a
149
- * capabilities property which is a hash and not the sub-list of capabilities.
150
- */
151
-
152
-
153
  /**
154
- * @param string $id The ID of the account to which the capability belongs.
155
- * @param string $capabilityId The ID of the capability to retrieve.
156
- * @param array|null $params
157
- * @param array|string|null $opts
158
  *
159
- * @return Capability
 
 
160
  */
161
- public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null)
162
  {
163
- return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
 
 
 
 
 
164
  }
165
 
166
  /**
167
- * @param string $id The ID of the account to which the capability belongs.
168
- * @param string $capabilityId The ID of the capability to update.
169
- * @param array|null $params
170
- * @param array|string|null $opts
171
  *
172
- * @return Capability
173
  */
174
- public static function updateCapability($id, $capabilityId, $params = null, $opts = null)
175
  {
176
- return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
 
 
 
 
177
  }
178
 
 
 
 
 
 
 
 
 
179
  /**
180
- * @param string $id The ID of the account on which to retrieve the capabilities.
181
- * @param array|null $params
182
- * @param array|string|null $opts
183
  *
184
- * @return Collection The list of capabilities.
 
 
185
  */
186
  public static function allCapabilities($id, $params = null, $opts = null)
187
  {
@@ -189,140 +234,165 @@ class Account extends ApiResource
189
  }
190
 
191
  /**
192
- * @param string $id The ID of the account on which to create the external account.
193
- * @param array|null $params
194
- * @param array|string|null $opts
 
 
 
195
  *
196
- * @return BankAccount|Card
197
  */
198
- public static function createExternalAccount($id, $params = null, $opts = null)
199
  {
200
- return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
201
  }
202
 
203
  /**
204
- * @param string $id The ID of the account to which the external account belongs.
205
- * @param string $externalAccountId The ID of the external account to retrieve.
206
- * @param array|null $params
207
- * @param array|string|null $opts
 
 
208
  *
209
- * @return BankAccount|Card
210
  */
211
- public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
212
  {
213
- return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
214
  }
215
 
 
 
216
  /**
217
- * @param string $id The ID of the account to which the external account belongs.
218
- * @param string $externalAccountId The ID of the external account to update.
219
- * @param array|null $params
220
- * @param array|string|null $opts
 
221
  *
222
- * @return BankAccount|Card
223
  */
224
- public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
225
  {
226
- return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
227
  }
228
 
229
  /**
230
- * @param string $id The ID of the account to which the external account belongs.
231
- * @param string $externalAccountId The ID of the external account to delete.
232
- * @param array|null $params
233
- * @param array|string|null $opts
234
  *
235
- * @return BankAccount|Card
 
 
236
  */
237
- public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
238
  {
239
- return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
240
  }
241
 
242
  /**
243
- * @param string $id The ID of the account on which to retrieve the external accounts.
244
- * @param array|null $params
245
- * @param array|string|null $opts
 
246
  *
247
- * @return Collection The list of external accounts (BankAccount or Card).
 
 
248
  */
249
- public static function allExternalAccounts($id, $params = null, $opts = null)
250
  {
251
- return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
252
  }
253
 
254
  /**
255
- * @param string $id The ID of the account on which to create the login link.
256
- * @param array|null $params
257
- * @param array|string|null $opts
 
258
  *
259
- * @return LoginLink
 
 
260
  */
261
- public static function createLoginLink($id, $params = null, $opts = null)
262
  {
263
- return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
264
  }
265
 
266
  /**
267
- * @param array|null $params
268
- * @param array|string|null $options
 
 
 
 
269
  *
270
- * @return Collection The list of persons.
271
  */
272
- public function persons($params = null, $options = null)
273
  {
274
- $url = $this->instanceUrl() . '/persons';
275
- list($response, $opts) = $this->_request('get', $url, $params, $options);
276
- $obj = Util\Util::convertToStripeObject($response, $opts);
277
- $obj->setLastResponse($response);
278
- return $obj;
279
  }
280
 
 
 
281
  /**
282
- * @param string $id The ID of the account on which to create the person.
283
- * @param array|null $params
284
- * @param array|string|null $opts
285
  *
286
- * @return Person
 
 
287
  */
288
- public static function createPerson($id, $params = null, $opts = null)
289
  {
290
- return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
291
  }
292
 
 
 
293
  /**
294
- * @param string $id The ID of the account to which the person belongs.
295
- * @param string $personId The ID of the person to retrieve.
296
- * @param array|null $params
297
- * @param array|string|null $opts
298
  *
299
- * @return Person
 
 
300
  */
301
- public static function retrievePerson($id, $personId, $params = null, $opts = null)
302
  {
303
- return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
304
  }
305
 
306
  /**
307
- * @param string $id The ID of the account to which the person belongs.
308
- * @param string $personId The ID of the person to update.
309
- * @param array|null $params
310
- * @param array|string|null $opts
 
311
  *
312
- * @return Person
313
  */
314
- public static function updatePerson($id, $personId, $params = null, $opts = null)
315
  {
316
- return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
317
  }
318
 
319
  /**
320
- * @param string $id The ID of the account to which the person belongs.
321
- * @param string $personId The ID of the person to delete.
322
- * @param array|null $params
323
- * @param array|string|null $opts
324
  *
325
- * @return Person
 
 
326
  */
327
  public static function deletePerson($id, $personId, $params = null, $opts = null)
328
  {
@@ -330,63 +400,32 @@ class Account extends ApiResource
330
  }
331
 
332
  /**
333
- * @param string $id The ID of the account on which to retrieve the persons.
334
- * @param array|null $params
335
- * @param array|string|null $opts
 
 
 
336
  *
337
- * @return Collection The list of persons.
338
  */
339
- public static function allPersons($id, $params = null, $opts = null)
340
- {
341
- return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
342
- }
343
-
344
- public function serializeParameters($force = false)
345
  {
346
- $update = parent::serializeParameters($force);
347
- if (isset($this->_values['legal_entity'])) {
348
- $entity = $this['legal_entity'];
349
- if (isset($entity->_values['additional_owners'])) {
350
- $owners = $entity['additional_owners'];
351
- $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : [];
352
- $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners);
353
- $update['legal_entity'] = $entityUpdate;
354
- }
355
- }
356
- if (isset($this->_values['individual'])) {
357
- $individual = $this['individual'];
358
- if (($individual instanceof Person) && !isset($update['individual'])) {
359
- $update['individual'] = $individual->serializeParameters($force);
360
- }
361
- }
362
- return $update;
363
  }
364
 
365
- private function serializeAdditionalOwners($legalEntity, $additionalOwners)
 
 
 
 
 
 
 
 
 
 
366
  {
367
- if (isset($legalEntity->_originalValues['additional_owners'])) {
368
- $originalValue = $legalEntity->_originalValues['additional_owners'];
369
- } else {
370
- $originalValue = [];
371
- }
372
- if (($originalValue) && (count($originalValue) > count($additionalOwners))) {
373
- throw new \InvalidArgumentException(
374
- "You cannot delete an item from an array, you must instead set a new array"
375
- );
376
- }
377
-
378
- $updateArr = [];
379
- foreach ($additionalOwners as $i => $v) {
380
- $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v;
381
-
382
- if ($update !== []) {
383
- if (!$originalValue ||
384
- !array_key_exists($i, $originalValue) ||
385
- ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
386
- $updateArr[$i] = $update;
387
- }
388
- }
389
- }
390
- return $updateArr;
391
  }
392
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * This is an object representing a Stripe account. You can retrieve it to see
9
+ * properties on the account like its current e-mail address or if the account is
10
+ * enabled yet to make live charges.
11
  *
12
+ * Some properties, marked below, are available only to platforms that want to <a
13
+ * href="https://stripe.com/docs/connect/accounts">create and manage Express or
14
+ * Custom accounts</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property null|\Stripe\StripeObject $business_profile Business information about the account.
19
+ * @property null|string $business_type The business type.
20
+ * @property \Stripe\StripeObject $capabilities
21
+ * @property bool $charges_enabled Whether the account can create live charges.
22
+ * @property \Stripe\StripeObject $company
23
+ * @property string $country The account's country.
24
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
25
+ * @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that <a href="https://stripe.com/docs/payouts">Stripe supports in the account's country</a>.
26
+ * @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
27
+ * @property null|string $email The primary user's email address.
28
+ * @property \Stripe\Collection $external_accounts External accounts (bank accounts and debit cards) currently attached to this account
29
+ * @property \Stripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the <a href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding documentation</a> for information about platform pre-filling and account onboarding steps.</p><p>Related guide: <a href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling Identity Verification with the API</a>.</p>
30
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
31
+ * @property bool $payouts_enabled Whether Stripe can send payouts to this account.
32
+ * @property \Stripe\StripeObject $requirements
33
+ * @property null|\Stripe\StripeObject $settings Options for customizing how the account functions within Stripe.
34
+ * @property \Stripe\StripeObject $tos_acceptance
35
+ * @property string $type The Stripe account type. Can be <code>standard</code>, <code>express</code>, or <code>custom</code>.
36
  */
37
  class Account extends ApiResource
38
  {
39
+ const OBJECT_NAME = 'account';
40
 
41
  use ApiOperations\All;
42
  use ApiOperations\Create;
43
  use ApiOperations\Delete;
44
  use ApiOperations\NestedResource;
 
 
 
45
  use ApiOperations\Update;
46
 
47
+ const BUSINESS_TYPE_COMPANY = 'company';
48
+ const BUSINESS_TYPE_GOVERNMENT_ENTITY = 'government_entity';
 
 
 
49
  const BUSINESS_TYPE_INDIVIDUAL = 'individual';
50
+ const BUSINESS_TYPE_NON_PROFIT = 'non_profit';
51
 
52
+ const CAPABILITY_CARD_PAYMENTS = 'card_payments';
53
+ const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
 
 
 
 
54
  const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
55
+ const CAPABILITY_TRANSFERS = 'transfers';
56
 
57
+ const CAPABILITY_STATUS_ACTIVE = 'active';
 
 
 
 
58
  const CAPABILITY_STATUS_INACTIVE = 'inactive';
59
+ const CAPABILITY_STATUS_PENDING = 'pending';
60
 
61
+ const TYPE_CUSTOM = 'custom';
62
+ const TYPE_EXPRESS = 'express';
 
 
 
 
63
  const TYPE_STANDARD = 'standard';
64
 
65
+ use ApiOperations\Retrieve {
66
+ retrieve as protected _retrieve;
67
+ }
68
+
69
  public static function getSavedNestedResources()
70
  {
71
  static $savedNestedResources = null;
72
+ if (null === $savedNestedResources) {
73
  $savedNestedResources = new Util\Set([
74
  'external_account',
75
  'bank_account',
76
  ]);
77
  }
78
+
79
  return $savedNestedResources;
80
  }
81
 
 
 
 
 
 
82
  public function instanceUrl()
83
  {
84
+ if (null === $this['id']) {
85
  return '/v1/account';
86
+ }
87
+
88
+ return parent::instanceUrl();
89
+ }
90
+
91
+ public function serializeParameters($force = false)
92
+ {
93
+ $update = parent::serializeParameters($force);
94
+ if (isset($this->_values['legal_entity'])) {
95
+ $entity = $this['legal_entity'];
96
+ if (isset($entity->_values['additional_owners'])) {
97
+ $owners = $entity['additional_owners'];
98
+ $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : [];
99
+ $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners);
100
+ $update['legal_entity'] = $entityUpdate;
101
+ }
102
+ }
103
+ if (isset($this->_values['individual'])) {
104
+ $individual = $this['individual'];
105
+ if (($individual instanceof Person) && !isset($update['individual'])) {
106
+ $update['individual'] = $individual->serializeParameters($force);
107
+ }
108
+ }
109
+
110
+ return $update;
111
+ }
112
+
113
+ private function serializeAdditionalOwners($legalEntity, $additionalOwners)
114
+ {
115
+ if (isset($legalEntity->_originalValues['additional_owners'])) {
116
+ $originalValue = $legalEntity->_originalValues['additional_owners'];
117
  } else {
118
+ $originalValue = [];
119
  }
120
+ if (($originalValue) && (\count($originalValue) > \count($additionalOwners))) {
121
+ throw new Exception\InvalidArgumentException(
122
+ 'You cannot delete an item from an array, you must instead set a new array'
123
+ );
124
+ }
125
+
126
+ $updateArr = [];
127
+ foreach ($additionalOwners as $i => $v) {
128
+ $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v;
129
+
130
+ if ([] !== $update) {
131
+ if (!$originalValue
132
+ || !\array_key_exists($i, $originalValue)
133
+ || ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
134
+ $updateArr[$i] = $update;
135
+ }
136
+ }
137
+ }
138
+
139
+ return $updateArr;
140
  }
141
 
142
  /**
143
+ * @param null|array|string $id the ID of the account to retrieve, or an
144
+ * options array containing an `id` key
145
+ * @param null|array|string $opts
146
+ *
147
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
148
  *
149
+ * @return \Stripe\Account
150
  */
151
  public static function retrieve($id = null, $opts = null)
152
  {
153
+ if (!$opts && \is_string($id) && 'sk_' === \substr($id, 0, 3)) {
154
  $opts = $id;
155
  $id = null;
156
  }
157
+
158
  return self::_retrieve($id, $opts);
159
  }
160
 
161
  /**
162
+ * @param null|array $clientId
163
+ * @param null|array|string $opts
164
  *
165
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
 
 
166
  *
167
+ * @return \Stripe\StripeObject object containing the response from the API
168
  */
169
  public function deauthorize($clientId = null, $opts = null)
170
  {
172
  'client_id' => $clientId,
173
  'stripe_user_id' => $this->id,
174
  ];
175
+
176
  return OAuth::deauthorize($params, $opts);
177
  }
178
 
 
 
 
 
 
 
 
179
  /**
180
+ * @param null|array $params
181
+ * @param null|array|string $opts
 
 
182
  *
183
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
184
+ *
185
+ * @return \Stripe\Collection the list of persons
186
  */
187
+ public function persons($params = null, $opts = null)
188
  {
189
+ $url = $this->instanceUrl() . '/persons';
190
+ list($response, $opts) = $this->_request('get', $url, $params, $opts);
191
+ $obj = Util\Util::convertToStripeObject($response, $opts);
192
+ $obj->setLastResponse($response);
193
+
194
+ return $obj;
195
  }
196
 
197
  /**
198
+ * @param null|array $params
199
+ * @param null|array|string $opts
200
+ *
201
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
202
  *
203
+ * @return Account the rejected account
204
  */
205
+ public function reject($params = null, $opts = null)
206
  {
207
+ $url = $this->instanceUrl() . '/reject';
208
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
209
+ $this->refreshFrom($response, $opts);
210
+
211
+ return $this;
212
  }
213
 
214
+ /*
215
+ * Capabilities methods
216
+ * We can not add the capabilities() method today as the Account object already has a
217
+ * capabilities property which is a hash and not the sub-list of capabilities.
218
+ */
219
+
220
+ const PATH_CAPABILITIES = '/capabilities';
221
+
222
  /**
223
+ * @param string $id the ID of the account on which to retrieve the capabilities
224
+ * @param null|array $params
225
+ * @param null|array|string $opts
226
  *
227
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
228
+ *
229
+ * @return \Stripe\Collection the list of capabilities
230
  */
231
  public static function allCapabilities($id, $params = null, $opts = null)
232
  {
234
  }
235
 
236
  /**
237
+ * @param string $id the ID of the account to which the capability belongs
238
+ * @param string $capabilityId the ID of the capability to retrieve
239
+ * @param null|array $params
240
+ * @param null|array|string $opts
241
+ *
242
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
243
  *
244
+ * @return \Stripe\Capability
245
  */
246
+ public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null)
247
  {
248
+ return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
249
  }
250
 
251
  /**
252
+ * @param string $id the ID of the account to which the capability belongs
253
+ * @param string $capabilityId the ID of the capability to update
254
+ * @param null|array $params
255
+ * @param null|array|string $opts
256
+ *
257
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
258
  *
259
+ * @return \Stripe\Capability
260
  */
261
+ public static function updateCapability($id, $capabilityId, $params = null, $opts = null)
262
  {
263
+ return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
264
  }
265
 
266
+ const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
267
+
268
  /**
269
+ * @param string $id the ID of the account on which to retrieve the external accounts
270
+ * @param null|array $params
271
+ * @param null|array|string $opts
272
+ *
273
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
274
  *
275
+ * @return \Stripe\Collection the list of external accounts (BankAccount or Card)
276
  */
277
+ public static function allExternalAccounts($id, $params = null, $opts = null)
278
  {
279
+ return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
280
  }
281
 
282
  /**
283
+ * @param string $id the ID of the account on which to create the external account
284
+ * @param null|array $params
285
+ * @param null|array|string $opts
 
286
  *
287
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
288
+ *
289
+ * @return \Stripe\BankAccount|\Stripe\Card
290
  */
291
+ public static function createExternalAccount($id, $params = null, $opts = null)
292
  {
293
+ return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
294
  }
295
 
296
  /**
297
+ * @param string $id the ID of the account to which the external account belongs
298
+ * @param string $externalAccountId the ID of the external account to delete
299
+ * @param null|array $params
300
+ * @param null|array|string $opts
301
  *
302
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
303
+ *
304
+ * @return \Stripe\BankAccount|\Stripe\Card
305
  */
306
+ public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
307
  {
308
+ return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
309
  }
310
 
311
  /**
312
+ * @param string $id the ID of the account to which the external account belongs
313
+ * @param string $externalAccountId the ID of the external account to retrieve
314
+ * @param null|array $params
315
+ * @param null|array|string $opts
316
  *
317
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
318
+ *
319
+ * @return \Stripe\BankAccount|\Stripe\Card
320
  */
321
+ public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
322
  {
323
+ return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
324
  }
325
 
326
  /**
327
+ * @param string $id the ID of the account to which the external account belongs
328
+ * @param string $externalAccountId the ID of the external account to update
329
+ * @param null|array $params
330
+ * @param null|array|string $opts
331
+ *
332
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
333
  *
334
+ * @return \Stripe\BankAccount|\Stripe\Card
335
  */
336
+ public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
337
  {
338
+ return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
 
 
 
 
339
  }
340
 
341
+ const PATH_LOGIN_LINKS = '/login_links';
342
+
343
  /**
344
+ * @param string $id the ID of the account on which to create the login link
345
+ * @param null|array $params
346
+ * @param null|array|string $opts
347
  *
348
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
349
+ *
350
+ * @return \Stripe\LoginLink
351
  */
352
+ public static function createLoginLink($id, $params = null, $opts = null)
353
  {
354
+ return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
355
  }
356
 
357
+ const PATH_PERSONS = '/persons';
358
+
359
  /**
360
+ * @param string $id the ID of the account on which to retrieve the persons
361
+ * @param null|array $params
362
+ * @param null|array|string $opts
 
363
  *
364
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
365
+ *
366
+ * @return \Stripe\Collection the list of persons
367
  */
368
+ public static function allPersons($id, $params = null, $opts = null)
369
  {
370
+ return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
371
  }
372
 
373
  /**
374
+ * @param string $id the ID of the account on which to create the person
375
+ * @param null|array $params
376
+ * @param null|array|string $opts
377
+ *
378
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
379
  *
380
+ * @return \Stripe\Person
381
  */
382
+ public static function createPerson($id, $params = null, $opts = null)
383
  {
384
+ return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
385
  }
386
 
387
  /**
388
+ * @param string $id the ID of the account to which the person belongs
389
+ * @param string $personId the ID of the person to delete
390
+ * @param null|array $params
391
+ * @param null|array|string $opts
392
  *
393
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
394
+ *
395
+ * @return \Stripe\Person
396
  */
397
  public static function deletePerson($id, $personId, $params = null, $opts = null)
398
  {
400
  }
401
 
402
  /**
403
+ * @param string $id the ID of the account to which the person belongs
404
+ * @param string $personId the ID of the person to retrieve
405
+ * @param null|array $params
406
+ * @param null|array|string $opts
407
+ *
408
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
409
  *
410
+ * @return \Stripe\Person
411
  */
412
+ public static function retrievePerson($id, $personId, $params = null, $opts = null)
 
 
 
 
 
413
  {
414
+ return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  }
416
 
417
+ /**
418
+ * @param string $id the ID of the account to which the person belongs
419
+ * @param string $personId the ID of the person to update
420
+ * @param null|array $params
421
+ * @param null|array|string $opts
422
+ *
423
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
424
+ *
425
+ * @return \Stripe\Person
426
+ */
427
+ public static function updatePerson($id, $personId, $params = null, $opts = null)
428
  {
429
+ return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  }
431
  }
app/api/Stripe/AccountLink.php CHANGED
@@ -1,20 +1,26 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class AccountLink
 
 
7
  *
8
- * @property string $object
9
- * @property int $created
10
- * @property int $expires_at
11
- * @property string $url
12
  *
13
- * @package Stripe
 
 
 
14
  */
15
  class AccountLink extends ApiResource
16
  {
17
- const OBJECT_NAME = "account_link";
18
 
19
  use ApiOperations\Create;
20
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Account Links are the means by which a Connect platform grants a connected
9
+ * account permission to access Stripe-hosted applications, such as Connect
10
+ * Onboarding.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/connect/connect-onboarding">Connect
14
+ * Onboarding</a>.
 
15
  *
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18
+ * @property int $expires_at The timestamp at which this account link will expire.
19
+ * @property string $url The URL for the account link.
20
  */
21
  class AccountLink extends ApiResource
22
  {
23
+ const OBJECT_NAME = 'account_link';
24
 
25
  use ApiOperations\Create;
26
  }
app/api/Stripe/AlipayAccount.php CHANGED
@@ -3,16 +3,14 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class AlipayAccount
7
- *
8
- * @package Stripe
9
  *
10
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
11
- * @link https://stripe.com/docs/sources/alipay
12
  */
13
  class AlipayAccount extends ApiResource
14
  {
15
- const OBJECT_NAME = "alipay_account";
16
 
17
  use ApiOperations\Delete;
18
  use ApiOperations\Update;
@@ -28,44 +26,50 @@ class AlipayAccount extends ApiResource
28
  $parent = $this['customer'];
29
  $path = 'sources';
30
  } else {
31
- $msg = "Alipay accounts cannot be accessed without a customer ID.";
32
- throw new Error\InvalidRequest($msg, null);
 
33
  }
34
- $parentExtn = urlencode(Util\Util::utf8($parent));
35
- $extn = urlencode(Util\Util::utf8($this['id']));
36
- return "$base/$parentExtn/$path/$extn";
 
37
  }
38
 
39
  /**
40
  * @param array|string $_id
41
- * @param array|string|null $_opts
42
  *
43
- * @throws \Stripe\Error\InvalidRequest
44
  *
45
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
46
- * @link https://stripe.com/docs/sources/alipay
47
  */
48
  public static function retrieve($_id, $_opts = null)
49
  {
50
- $msg = "Alipay accounts cannot be accessed without a customer ID. " .
51
- "Retrieve an Alipay account using \$customer->sources->retrieve('alipay_account_id') instead.";
52
- throw new Error\InvalidRequest($msg, null);
 
 
53
  }
54
 
55
  /**
56
  * @param string $_id
57
- * @param array|null $_params
58
- * @param array|string|null $_options
59
  *
60
- * @throws \Stripe\Error\InvalidRequest
61
  *
62
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
63
- * @link https://stripe.com/docs/sources/alipay
64
  */
65
  public static function update($_id, $_params = null, $_options = null)
66
  {
67
- $msg = "Alipay accounts cannot be accessed without a customer ID. " .
68
- "Call save() on \$customer->sources->retrieve('alipay_account_id') instead.";
69
- throw new Error\InvalidRequest($msg, null);
 
 
70
  }
71
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class AlipayAccount.
 
 
7
  *
8
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
9
+ * @see https://stripe.com/docs/sources/alipay
10
  */
11
  class AlipayAccount extends ApiResource
12
  {
13
+ const OBJECT_NAME = 'alipay_account';
14
 
15
  use ApiOperations\Delete;
16
  use ApiOperations\Update;
26
  $parent = $this['customer'];
27
  $path = 'sources';
28
  } else {
29
+ $msg = 'Alipay accounts cannot be accessed without a customer ID.';
30
+
31
+ throw new Exception\UnexpectedValueException($msg);
32
  }
33
+ $parentExtn = \urlencode(Util\Util::utf8($parent));
34
+ $extn = \urlencode(Util\Util::utf8($this['id']));
35
+
36
+ return "{$base}/{$parentExtn}/{$path}/{$extn}";
37
  }
38
 
39
  /**
40
  * @param array|string $_id
41
+ * @param null|array|string $_opts
42
  *
43
+ * @throws \Stripe\Exception\BadMethodCallException
44
  *
45
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
46
+ * @see https://stripe.com/docs/sources/alipay
47
  */
48
  public static function retrieve($_id, $_opts = null)
49
  {
50
+ $msg = 'Alipay accounts cannot be retrieved without a customer ID. ' .
51
+ 'Retrieve an Alipay account using `Customer::retrieveSource(' .
52
+ "'customer_id', 'alipay_account_id')`.";
53
+
54
+ throw new Exception\BadMethodCallException($msg);
55
  }
56
 
57
  /**
58
  * @param string $_id
59
+ * @param null|array $_params
60
+ * @param null|array|string $_options
61
  *
62
+ * @throws \Stripe\Exception\BadMethodCallException
63
  *
64
  * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
65
+ * @see https://stripe.com/docs/sources/alipay
66
  */
67
  public static function update($_id, $_params = null, $_options = null)
68
  {
69
+ $msg = 'Alipay accounts cannot be updated without a customer ID. ' .
70
+ 'Update an Alipay account using `Customer::updateSource(' .
71
+ "'customer_id', 'alipay_account_id', \$updateParams)`.";
72
+
73
+ throw new Exception\BadMethodCallException($msg);
74
  }
75
  }
app/api/Stripe/ApiOperations/All.php CHANGED
@@ -10,8 +10,10 @@ namespace Stripe\ApiOperations;
10
  trait All
11
  {
12
  /**
13
- * @param array|null $params
14
- * @param array|string|null $opts
 
 
15
  *
16
  * @return \Stripe\Collection of ApiResources
17
  */
@@ -22,13 +24,14 @@ trait All
22
 
23
  list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
24
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
25
- if (!is_a($obj, 'Stripe\\Collection')) {
26
- $class = get_class($obj);
27
- $message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
28
- throw new \Stripe\Error\Api($message);
29
  }
30
  $obj->setLastResponse($response);
31
- $obj->setRequestParams($params);
 
32
  return $obj;
33
  }
34
  }
10
  trait All
11
  {
12
  /**
13
+ * @param null|array $params
14
+ * @param null|array|string $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
  *
18
  * @return \Stripe\Collection of ApiResources
19
  */
24
 
25
  list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
26
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
27
+ if (!($obj instanceof \Stripe\Collection)) {
28
+ throw new \Stripe\Exception\UnexpectedValueException(
29
+ 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
30
+ );
31
  }
32
  $obj->setLastResponse($response);
33
+ $obj->setFilters($params);
34
+
35
  return $obj;
36
  }
37
  }
app/api/Stripe/ApiOperations/Create.php CHANGED
@@ -10,10 +10,12 @@ namespace Stripe\ApiOperations;
10
  trait Create
11
  {
12
  /**
13
- * @param array|null $params
14
- * @param array|string|null $options
15
  *
16
- * @return static The created resource.
 
 
17
  */
18
  public static function create($params = null, $options = null)
19
  {
@@ -23,6 +25,7 @@ trait Create
23
  list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
24
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
25
  $obj->setLastResponse($response);
 
26
  return $obj;
27
  }
28
  }
10
  trait Create
11
  {
12
  /**
13
+ * @param null|array $params
14
+ * @param null|array|string $options
15
  *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return static the created resource
19
  */
20
  public static function create($params = null, $options = null)
21
  {
25
  list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
26
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
27
  $obj->setLastResponse($response);
28
+
29
  return $obj;
30
  }
31
  }
app/api/Stripe/ApiOperations/Delete.php CHANGED
@@ -10,10 +10,12 @@ namespace Stripe\ApiOperations;
10
  trait Delete
11
  {
12
  /**
13
- * @param array|null $params
14
- * @param array|string|null $opts
15
  *
16
- * @return static The deleted resource.
 
 
17
  */
18
  public function delete($params = null, $opts = null)
19
  {
@@ -22,6 +24,7 @@ trait Delete
22
  $url = $this->instanceUrl();
23
  list($response, $opts) = $this->_request('delete', $url, $params, $opts);
24
  $this->refreshFrom($response, $opts);
 
25
  return $this;
26
  }
27
  }
10
  trait Delete
11
  {
12
  /**
13
+ * @param null|array $params
14
+ * @param null|array|string $opts
15
  *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return static the deleted resource
19
  */
20
  public function delete($params = null, $opts = null)
21
  {
24
  $url = $this->instanceUrl();
25
  list($response, $opts) = $this->_request('delete', $url, $params, $opts);
26
  $this->refreshFrom($response, $opts);
27
+
28
  return $this;
29
  }
30
  }
app/api/Stripe/ApiOperations/NestedResource.php CHANGED
@@ -12,8 +12,8 @@ trait NestedResource
12
  /**
13
  * @param string $method
14
  * @param string $url
15
- * @param array|null $params
16
- * @param array|string|null $options
17
  *
18
  * @return \Stripe\StripeObject
19
  */
@@ -24,95 +24,112 @@ trait NestedResource
24
  list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
25
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
26
  $obj->setLastResponse($response);
 
27
  return $obj;
28
  }
29
 
30
  /**
31
  * @param string $id
32
  * @param string $nestedPath
33
- * @param string|null $nestedId
34
  *
35
  * @return string
36
  */
37
  protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
38
  {
39
  $url = static::resourceUrl($id) . $nestedPath;
40
- if ($nestedId !== null) {
41
- $url .= "/$nestedId";
42
  }
 
43
  return $url;
44
  }
45
 
46
  /**
47
  * @param string $id
48
  * @param string $nestedPath
49
- * @param array|null $params
50
- * @param array|string|null $options
 
 
51
  *
52
  * @return \Stripe\StripeObject
53
  */
54
  protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
55
  {
56
  $url = static::_nestedResourceUrl($id, $nestedPath);
 
57
  return self::_nestedResourceOperation('post', $url, $params, $options);
58
  }
59
 
60
  /**
61
  * @param string $id
62
  * @param string $nestedPath
63
- * @param string|null $nestedId
64
- * @param array|null $params
65
- * @param array|string|null $options
 
 
66
  *
67
  * @return \Stripe\StripeObject
68
  */
69
  protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
70
  {
71
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
 
72
  return self::_nestedResourceOperation('get', $url, $params, $options);
73
  }
74
 
75
  /**
76
  * @param string $id
77
  * @param string $nestedPath
78
- * @param string|null $nestedId
79
- * @param array|null $params
80
- * @param array|string|null $options
 
 
81
  *
82
  * @return \Stripe\StripeObject
83
  */
84
  protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
85
  {
86
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
 
87
  return self::_nestedResourceOperation('post', $url, $params, $options);
88
  }
89
 
90
  /**
91
  * @param string $id
92
  * @param string $nestedPath
93
- * @param string|null $nestedId
94
- * @param array|null $params
95
- * @param array|string|null $options
 
 
96
  *
97
  * @return \Stripe\StripeObject
98
  */
99
  protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
100
  {
101
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
 
102
  return self::_nestedResourceOperation('delete', $url, $params, $options);
103
  }
104
 
105
  /**
106
  * @param string $id
107
  * @param string $nestedPath
108
- * @param array|null $params
109
- * @param array|string|null $options
 
 
110
  *
111
  * @return \Stripe\StripeObject
112
  */
113
  protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
114
  {
115
  $url = static::_nestedResourceUrl($id, $nestedPath);
 
116
  return self::_nestedResourceOperation('get', $url, $params, $options);
117
  }
118
  }
12
  /**
13
  * @param string $method
14
  * @param string $url
15
+ * @param null|array $params
16
+ * @param null|array|string $options
17
  *
18
  * @return \Stripe\StripeObject
19
  */
24
  list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
25
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
26
  $obj->setLastResponse($response);
27
+
28
  return $obj;
29
  }
30
 
31
  /**
32
  * @param string $id
33
  * @param string $nestedPath
34
+ * @param null|string $nestedId
35
  *
36
  * @return string
37
  */
38
  protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
39
  {
40
  $url = static::resourceUrl($id) . $nestedPath;
41
+ if (null !== $nestedId) {
42
+ $url .= "/{$nestedId}";
43
  }
44
+
45
  return $url;
46
  }
47
 
48
  /**
49
  * @param string $id
50
  * @param string $nestedPath
51
+ * @param null|array $params
52
+ * @param null|array|string $options
53
+ *
54
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
55
  *
56
  * @return \Stripe\StripeObject
57
  */
58
  protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
59
  {
60
  $url = static::_nestedResourceUrl($id, $nestedPath);
61
+
62
  return self::_nestedResourceOperation('post', $url, $params, $options);
63
  }
64
 
65
  /**
66
  * @param string $id
67
  * @param string $nestedPath
68
+ * @param null|string $nestedId
69
+ * @param null|array $params
70
+ * @param null|array|string $options
71
+ *
72
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
73
  *
74
  * @return \Stripe\StripeObject
75
  */
76
  protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
77
  {
78
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
79
+
80
  return self::_nestedResourceOperation('get', $url, $params, $options);
81
  }
82
 
83
  /**
84
  * @param string $id
85
  * @param string $nestedPath
86
+ * @param null|string $nestedId
87
+ * @param null|array $params
88
+ * @param null|array|string $options
89
+ *
90
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
91
  *
92
  * @return \Stripe\StripeObject
93
  */
94
  protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
95
  {
96
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
97
+
98
  return self::_nestedResourceOperation('post', $url, $params, $options);
99
  }
100
 
101
  /**
102
  * @param string $id
103
  * @param string $nestedPath
104
+ * @param null|string $nestedId
105
+ * @param null|array $params
106
+ * @param null|array|string $options
107
+ *
108
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
109
  *
110
  * @return \Stripe\StripeObject
111
  */
112
  protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
113
  {
114
  $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
115
+
116
  return self::_nestedResourceOperation('delete', $url, $params, $options);
117
  }
118
 
119
  /**
120
  * @param string $id
121
  * @param string $nestedPath
122
+ * @param null|array $params
123
+ * @param null|array|string $options
124
+ *
125
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
126
  *
127
  * @return \Stripe\StripeObject
128
  */
129
  protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
130
  {
131
  $url = static::_nestedResourceUrl($id, $nestedPath);
132
+
133
  return self::_nestedResourceOperation('get', $url, $params, $options);
134
  }
135
  }
app/api/Stripe/ApiOperations/Request.php CHANGED
@@ -10,18 +10,19 @@ namespace Stripe\ApiOperations;
10
  trait Request
11
  {
12
  /**
13
- * @param array|null|mixed $params The list of parameters to validate
14
  *
15
- * @throws \Stripe\Error\Api if $params exists and is not an array
16
  */
17
  protected static function _validateParams($params = null)
18
  {
19
- if ($params && !is_array($params)) {
20
- $message = "You must pass an array as the first argument to Stripe API "
21
- . "method calls. (HINT: an example call to create a charge "
22
  . "would be: \"Stripe\\Charge::create(['amount' => 100, "
23
  . "'currency' => 'usd', 'source' => 'tok_1234'])\")";
24
- throw new \Stripe\Error\Api($message);
 
25
  }
26
  }
27
 
@@ -29,7 +30,9 @@ trait Request
29
  * @param string $method HTTP method ('get', 'post', etc.)
30
  * @param string $url URL for the request
31
  * @param array $params list of parameters for the request
32
- * @param array|string|null $options
 
 
33
  *
34
  * @return array tuple containing (the JSON response, $options)
35
  */
@@ -38,6 +41,7 @@ trait Request
38
  $opts = $this->_opts->merge($options);
39
  list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
40
  $this->setLastResponse($resp);
 
41
  return [$resp->json, $options];
42
  }
43
 
@@ -45,7 +49,9 @@ trait Request
45
  * @param string $method HTTP method ('get', 'post', etc.)
46
  * @param string $url URL for the request
47
  * @param array $params list of parameters for the request
48
- * @param array|string|null $options
 
 
49
  *
50
  * @return array tuple containing (the JSON response, $options)
51
  */
@@ -56,6 +62,7 @@ trait Request
56
  $requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
57
  list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
58
  $opts->discardNonPersistentHeaders();
 
59
  return [$response, $opts];
60
  }
61
  }
10
  trait Request
11
  {
12
  /**
13
+ * @param null|array|mixed $params The list of parameters to validate
14
  *
15
+ * @throws \Stripe\Exception\InvalidArgumentException if $params exists and is not an array
16
  */
17
  protected static function _validateParams($params = null)
18
  {
19
+ if ($params && !\is_array($params)) {
20
+ $message = 'You must pass an array as the first argument to Stripe API '
21
+ . 'method calls. (HINT: an example call to create a charge '
22
  . "would be: \"Stripe\\Charge::create(['amount' => 100, "
23
  . "'currency' => 'usd', 'source' => 'tok_1234'])\")";
24
+
25
+ throw new \Stripe\Exception\InvalidArgumentException($message);
26
  }
27
  }
28
 
30
  * @param string $method HTTP method ('get', 'post', etc.)
31
  * @param string $url URL for the request
32
  * @param array $params list of parameters for the request
33
+ * @param null|array|string $options
34
+ *
35
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
36
  *
37
  * @return array tuple containing (the JSON response, $options)
38
  */
41
  $opts = $this->_opts->merge($options);
42
  list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
43
  $this->setLastResponse($resp);
44
+
45
  return [$resp->json, $options];
46
  }
47
 
49
  * @param string $method HTTP method ('get', 'post', etc.)
50
  * @param string $url URL for the request
51
  * @param array $params list of parameters for the request
52
+ * @param null|array|string $options
53
+ *
54
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
55
  *
56
  * @return array tuple containing (the JSON response, $options)
57
  */
62
  $requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
63
  list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
64
  $opts->discardNonPersistentHeaders();
65
+
66
  return [$response, $opts];
67
  }
68
  }
app/api/Stripe/ApiOperations/Retrieve.php CHANGED
@@ -11,9 +11,11 @@ namespace Stripe\ApiOperations;
11
  trait Retrieve
12
  {
13
  /**
14
- * @param array|string $id The ID of the API resource to retrieve,
15
- * or an options array containing an `id` key.
16
- * @param array|string|null $opts
 
 
17
  *
18
  * @return static
19
  */
@@ -22,6 +24,7 @@ trait Retrieve
22
  $opts = \Stripe\Util\RequestOptions::parse($opts);
23
  $instance = new static($id, $opts);
24
  $instance->refresh();
 
25
  return $instance;
26
  }
27
  }
11
  trait Retrieve
12
  {
13
  /**
14
+ * @param array|string $id the ID of the API resource to retrieve,
15
+ * or an options array containing an `id` key
16
+ * @param null|array|string $opts
17
+ *
18
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
19
  *
20
  * @return static
21
  */
24
  $opts = \Stripe\Util\RequestOptions::parse($opts);
25
  $instance = new static($id, $opts);
26
  $instance->refresh();
27
+
28
  return $instance;
29
  }
30
  }
app/api/Stripe/ApiOperations/Update.php CHANGED
@@ -11,11 +11,13 @@ namespace Stripe\ApiOperations;
11
  trait Update
12
  {
13
  /**
14
- * @param string $id The ID of the resource to update.
15
- * @param array|null $params
16
- * @param array|string|null $opts
17
  *
18
- * @return static The updated resource.
 
 
19
  */
20
  public static function update($id, $params = null, $opts = null)
21
  {
@@ -25,22 +27,26 @@ trait Update
25
  list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
26
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
27
  $obj->setLastResponse($response);
 
28
  return $obj;
29
  }
30
 
31
  /**
32
- * @param array|string|null $opts
33
  *
34
- * @return static The saved resource.
 
 
35
  */
36
  public function save($opts = null)
37
  {
38
  $params = $this->serializeParameters();
39
- if (count($params) > 0) {
40
  $url = $this->instanceUrl();
41
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
42
  $this->refreshFrom($response, $opts);
43
  }
 
44
  return $this;
45
  }
46
  }
11
  trait Update
12
  {
13
  /**
14
+ * @param string $id the ID of the resource to update
15
+ * @param null|array $params
16
+ * @param null|array|string $opts
17
  *
18
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
19
+ *
20
+ * @return static the updated resource
21
  */
22
  public static function update($id, $params = null, $opts = null)
23
  {
27
  list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
28
  $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
29
  $obj->setLastResponse($response);
30
+
31
  return $obj;
32
  }
33
 
34
  /**
35
+ * @param null|array|string $opts
36
  *
37
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
38
+ *
39
+ * @return static the saved resource
40
  */
41
  public function save($opts = null)
42
  {
43
  $params = $this->serializeParameters();
44
+ if (\count($params) > 0) {
45
  $url = $this->instanceUrl();
46
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
47
  $this->refreshFrom($response, $opts);
48
  }
49
+
50
  return $this;
51
  }
52
  }
app/api/Stripe/ApiRequestor.php CHANGED
@@ -3,14 +3,12 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ApiRequestor
7
- *
8
- * @package Stripe
9
  */
10
  class ApiRequestor
11
  {
12
  /**
13
- * @var string|null
14
  */
15
  private $_apiKey;
16
 
@@ -29,11 +27,13 @@ class ApiRequestor
29
  */
30
  private static $requestTelemetry;
31
 
 
 
32
  /**
33
  * ApiRequestor constructor.
34
  *
35
- * @param string|null $apiKey
36
- * @param string|null $apiBase
37
  */
38
  public function __construct($apiKey = null, $apiBase = null)
39
  {
@@ -45,77 +45,71 @@ class ApiRequestor
45
  }
46
 
47
  /**
48
- * Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers
 
49
  * @static
50
  *
51
  * @param RequestTelemetry $requestTelemetry
 
52
  * @return string
53
  */
54
  private static function _telemetryJson($requestTelemetry)
55
  {
56
- $payload = array(
57
- 'last_request_metrics' => array(
58
  'request_id' => $requestTelemetry->requestId,
59
  'request_duration_ms' => $requestTelemetry->requestDuration,
60
- ));
 
61
 
62
- $result = json_encode($payload);
63
- if ($result != false) {
64
  return $result;
65
- } else {
66
- Stripe::getLogger()->error("Serializing telemetry payload failed!");
67
- return "{}";
68
  }
 
 
 
69
  }
70
 
71
  /**
72
  * @static
73
  *
74
- * @param ApiResource|bool|array|mixed $d
75
  *
76
- * @return ApiResource|array|string|mixed
77
  */
78
  private static function _encodeObjects($d)
79
  {
80
  if ($d instanceof ApiResource) {
81
  return Util\Util::utf8($d->id);
82
- } elseif ($d === true) {
 
83
  return 'true';
84
- } elseif ($d === false) {
 
85
  return 'false';
86
- } elseif (is_array($d)) {
 
87
  $res = [];
88
  foreach ($d as $k => $v) {
89
  $res[$k] = self::_encodeObjects($v);
90
  }
 
91
  return $res;
92
- } else {
93
- return Util\Util::utf8($d);
94
  }
 
 
95
  }
96
 
97
  /**
98
  * @param string $method
99
  * @param string $url
100
- * @param array|null $params
101
- * @param array|null $headers
102
  *
103
- * @return array An array whose first element is an API response and second
104
- * element is the API key used to make the request.
105
- * @throws Error\Api
106
- * @throws Error\Authentication
107
- * @throws Error\Card
108
- * @throws Error\InvalidRequest
109
- * @throws Error\OAuth\InvalidClient
110
- * @throws Error\OAuth\InvalidGrant
111
- * @throws Error\OAuth\InvalidRequest
112
- * @throws Error\OAuth\InvalidScope
113
- * @throws Error\OAuth\UnsupportedGrantType
114
- * @throws Error\OAuth\UnsupportedResponseType
115
- * @throws Error\Permission
116
- * @throws Error\RateLimit
117
- * @throws Error\Idempotency
118
- * @throws Error\ApiConnection
119
  */
120
  public function request($method, $url, $params = null, $headers = null)
121
  {
@@ -125,48 +119,32 @@ class ApiRequestor
125
  $this->_requestRaw($method, $url, $params, $headers);
126
  $json = $this->_interpretResponse($rbody, $rcode, $rheaders);
127
  $resp = new ApiResponse($rbody, $rcode, $rheaders, $json);
 
128
  return [$resp, $myApiKey];
129
  }
130
 
131
  /**
132
- * @param string $rbody A JSON string.
133
  * @param int $rcode
134
  * @param array $rheaders
135
  * @param array $resp
136
  *
137
- * @throws Error\InvalidRequest if the error is caused by the user.
138
- * @throws Error\Authentication if the error is caused by a lack of
139
- * permissions.
140
- * @throws Error\Permission if the error is caused by insufficient
141
- * permissions.
142
- * @throws Error\Card if the error is the error code is 402 (payment
143
- * required)
144
- * @throws Error\InvalidRequest if the error is caused by the user.
145
- * @throws Error\Idempotency if the error is caused by an idempotency key.
146
- * @throws Error\OAuth\InvalidClient
147
- * @throws Error\OAuth\InvalidGrant
148
- * @throws Error\OAuth\InvalidRequest
149
- * @throws Error\OAuth\InvalidScope
150
- * @throws Error\OAuth\UnsupportedGrantType
151
- * @throws Error\OAuth\UnsupportedResponseType
152
- * @throws Error\Permission if the error is caused by insufficient
153
- * permissions.
154
- * @throws Error\RateLimit if the error is caused by too many requests
155
- * hitting the API.
156
- * @throws Error\Api otherwise.
157
  */
158
  public function handleErrorResponse($rbody, $rcode, $rheaders, $resp)
159
  {
160
- if (!is_array($resp) || !isset($resp['error'])) {
161
- $msg = "Invalid response object from API: $rbody "
162
- . "(HTTP response code was $rcode)";
163
- throw new Error\Api($msg, $rcode, $rbody, $resp, $rheaders);
 
164
  }
165
 
166
  $errorData = $resp['error'];
167
 
168
  $error = null;
169
- if (is_string($errorData)) {
170
  $error = self::_specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorData);
171
  }
172
  if (!$error) {
@@ -185,7 +163,7 @@ class ApiRequestor
185
  * @param array $resp
186
  * @param array $errorData
187
  *
188
- * @return Error\RateLimit|Error\Idempotency|Error\InvalidRequest|Error\Authentication|Error\Card|Error\Permission|Error\Api
189
  */
190
  private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData)
191
  {
@@ -193,44 +171,50 @@ class ApiRequestor
193
  $param = isset($errorData['param']) ? $errorData['param'] : null;
194
  $code = isset($errorData['code']) ? $errorData['code'] : null;
195
  $type = isset($errorData['type']) ? $errorData['type'] : null;
 
196
 
197
  switch ($rcode) {
198
  case 400:
199
  // 'rate_limit' code is deprecated, but left here for backwards compatibility
200
  // for API versions earlier than 2015-09-08
201
- if ($code == 'rate_limit') {
202
- return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
203
  }
204
- if ($type == 'idempotency_error') {
205
- return new Error\Idempotency($msg, $rcode, $rbody, $resp, $rheaders);
206
  }
207
 
208
  // no break
209
  case 404:
210
- return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders);
 
211
  case 401:
212
- return new Error\Authentication($msg, $rcode, $rbody, $resp, $rheaders);
 
213
  case 402:
214
- return new Error\Card($msg, $param, $code, $rcode, $rbody, $resp, $rheaders);
 
215
  case 403:
216
- return new Error\Permission($msg, $rcode, $rbody, $resp, $rheaders);
 
217
  case 429:
218
- return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
 
219
  default:
220
- return new Error\Api($msg, $rcode, $rbody, $resp, $rheaders);
221
  }
222
  }
223
 
224
  /**
225
  * @static
226
  *
227
- * @param string|bool $rbody
228
  * @param int $rcode
229
  * @param array $rheaders
230
  * @param array $resp
231
  * @param string $errorCode
232
  *
233
- * @return null|Error\OAuth\InvalidClient|Error\OAuth\InvalidGrant|Error\OAuth\InvalidRequest|Error\OAuth\InvalidScope|Error\OAuth\UnsupportedGrantType|Error\OAuth\UnsupportedResponseType
234
  */
235
  private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode)
236
  {
@@ -238,20 +222,26 @@ class ApiRequestor
238
 
239
  switch ($errorCode) {
240
  case 'invalid_client':
241
- return new Error\OAuth\InvalidClient($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
 
242
  case 'invalid_grant':
243
- return new Error\OAuth\InvalidGrant($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
 
244
  case 'invalid_request':
245
- return new Error\OAuth\InvalidRequest($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
 
246
  case 'invalid_scope':
247
- return new Error\OAuth\InvalidScope($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
 
248
  case 'unsupported_grant_type':
249
- return new Error\OAuth\UnsupportedGrantType($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
 
250
  case 'unsupported_response_type':
251
- return new Error\OAuth\UnsupportedResponseType($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
252
- }
253
 
254
- return null;
 
 
255
  }
256
 
257
  /**
@@ -263,18 +253,40 @@ class ApiRequestor
263
  */
264
  private static function _formatAppInfo($appInfo)
265
  {
266
- if ($appInfo !== null) {
267
  $string = $appInfo['name'];
268
- if ($appInfo['version'] !== null) {
269
  $string .= '/' . $appInfo['version'];
270
  }
271
- if ($appInfo['url'] !== null) {
272
  $string .= ' (' . $appInfo['url'] . ')';
273
  }
 
274
  return $string;
275
- } else {
276
- return null;
277
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  }
279
 
280
  /**
@@ -289,8 +301,9 @@ class ApiRequestor
289
  {
290
  $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;
291
 
292
- $langVersion = phpversion();
293
- $uname = php_uname();
 
294
 
295
  $appInfo = Stripe::getAppInfo();
296
  $ua = [
@@ -301,31 +314,30 @@ class ApiRequestor
301
  'uname' => $uname,
302
  ];
303
  if ($clientInfo) {
304
- $ua = array_merge($clientInfo, $ua);
305
  }
306
- if ($appInfo !== null) {
307
  $uaString .= ' ' . self::_formatAppInfo($appInfo);
308
  $ua['application'] = $appInfo;
309
  }
310
 
311
- $defaultHeaders = [
312
- 'X-Stripe-Client-User-Agent' => json_encode($ua),
313
  'User-Agent' => $uaString,
314
  'Authorization' => 'Bearer ' . $apiKey,
315
  ];
316
- return $defaultHeaders;
317
  }
318
 
319
  /**
320
  * @param string $method
321
  * @param string $url
322
- * @param array $params
323
- * @param array $headers
 
 
 
324
  *
325
  * @return array
326
- * @throws Error\Api
327
- * @throws Error\ApiConnection
328
- * @throws Error\Authentication
329
  */
330
  private function _requestRaw($method, $url, $params, $headers)
331
  {
@@ -339,18 +351,34 @@ class ApiRequestor
339
  . '"Stripe::setApiKey(<API-KEY>)". You can generate API keys from '
340
  . 'the Stripe web interface. See https://stripe.com/api for '
341
  . 'details, or email support@stripe.com if you have any questions.';
342
- throw new Error\Authentication($msg);
 
343
  }
344
 
345
  // Clients can supply arbitrary additional keys to be included in the
346
  // X-Stripe-Client-User-Agent header via the optional getUserAgentInfo()
347
  // method
348
  $clientUAInfo = null;
349
- if (method_exists($this->httpClient(), 'getUserAgentInfo')) {
350
  $clientUAInfo = $this->httpClient()->getUserAgentInfo();
351
  }
352
 
353
- $absUrl = $this->_apiBase.$url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  $params = self::_encodeObjects($params);
355
  $defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo);
356
  if (Stripe::$apiVersion) {
@@ -361,17 +389,16 @@ class ApiRequestor
361
  $defaultHeaders['Stripe-Account'] = Stripe::$accountId;
362
  }
363
 
364
- if (Stripe::$enableTelemetry && self::$requestTelemetry != null) {
365
- $defaultHeaders["X-Stripe-Client-Telemetry"] = self::_telemetryJson(self::$requestTelemetry);
366
  }
367
 
368
  $hasFile = false;
369
- $hasCurlFile = class_exists('\CURLFile', false);
370
  foreach ($params as $k => $v) {
371
- if (is_resource($v)) {
372
  $hasFile = true;
373
- $params[$k] = self::_processResourceParam($v, $hasCurlFile);
374
- } elseif ($hasCurlFile && $v instanceof \CURLFile) {
375
  $hasFile = true;
376
  }
377
  }
@@ -382,7 +409,7 @@ class ApiRequestor
382
  $defaultHeaders['Content-Type'] = 'application/x-www-form-urlencoded';
383
  }
384
 
385
- $combinedHeaders = array_merge($defaultHeaders, $headers);
386
  $rawHeaders = [];
387
 
388
  foreach ($combinedHeaders as $header => $value) {
@@ -399,7 +426,9 @@ class ApiRequestor
399
  $hasFile
400
  );
401
 
402
- if (array_key_exists('request-id', $rheaders)) {
 
 
403
  self::$requestTelemetry = new RequestTelemetry(
404
  $rheaders['request-id'],
405
  Util\Util::currentTimeMillis() - $requestStartMs
@@ -411,32 +440,28 @@ class ApiRequestor
411
 
412
  /**
413
  * @param resource $resource
414
- * @param bool $hasCurlFile
 
415
  *
416
  * @return \CURLFile|string
417
- * @throws Error\Api
418
  */
419
- private function _processResourceParam($resource, $hasCurlFile)
420
  {
421
- if (get_resource_type($resource) !== 'stream') {
422
- throw new Error\Api(
423
  'Attempted to upload a resource that is not a stream'
424
  );
425
  }
426
 
427
- $metaData = stream_get_meta_data($resource);
428
- if ($metaData['wrapper_type'] !== 'plainfile') {
429
- throw new Error\Api(
430
  'Only plainfile resource streams are supported'
431
  );
432
  }
433
 
434
- if ($hasCurlFile) {
435
- // We don't have the filename or mimetype, but the API doesn't care
436
- return new \CURLFile($metaData['uri']);
437
- } else {
438
- return '@'.$metaData['uri'];
439
- }
440
  }
441
 
442
  /**
@@ -444,34 +469,26 @@ class ApiRequestor
444
  * @param int $rcode
445
  * @param array $rheaders
446
  *
447
- * @return mixed
448
- * @throws Error\Api
449
- * @throws Error\Authentication
450
- * @throws Error\Card
451
- * @throws Error\InvalidRequest
452
- * @throws Error\OAuth\InvalidClient
453
- * @throws Error\OAuth\InvalidGrant
454
- * @throws Error\OAuth\InvalidRequest
455
- * @throws Error\OAuth\InvalidScope
456
- * @throws Error\OAuth\UnsupportedGrantType
457
- * @throws Error\OAuth\UnsupportedResponseType
458
- * @throws Error\Permission
459
- * @throws Error\RateLimit
460
- * @throws Error\Idempotency
461
  */
462
  private function _interpretResponse($rbody, $rcode, $rheaders)
463
  {
464
- $resp = json_decode($rbody, true);
465
- $jsonError = json_last_error();
466
- if ($resp === null && $jsonError !== JSON_ERROR_NONE) {
467
- $msg = "Invalid response body from API: $rbody "
468
- . "(HTTP response code was $rcode, json_last_error() was $jsonError)";
469
- throw new Error\Api($msg, $rcode, $rbody);
 
470
  }
471
 
472
  if ($rcode < 200 || $rcode >= 300) {
473
  $this->handleErrorResponse($rbody, $rcode, $rheaders, $resp);
474
  }
 
475
  return $resp;
476
  }
477
 
@@ -503,6 +520,7 @@ class ApiRequestor
503
  if (!self::$_httpClient) {
504
  self::$_httpClient = HttpClient\CurlClient::instance();
505
  }
 
506
  return self::$_httpClient;
507
  }
508
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class ApiRequestor.
 
 
7
  */
8
  class ApiRequestor
9
  {
10
  /**
11
+ * @var null|string
12
  */
13
  private $_apiKey;
14
 
27
  */
28
  private static $requestTelemetry;
29
 
30
+ private static $OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version', 'api_base'];
31
+
32
  /**
33
  * ApiRequestor constructor.
34
  *
35
+ * @param null|string $apiKey
36
+ * @param null|string $apiBase
37
  */
38
  public function __construct($apiKey = null, $apiBase = null)
39
  {
45
  }
46
 
47
  /**
48
+ * Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers.
49
+ *
50
  * @static
51
  *
52
  * @param RequestTelemetry $requestTelemetry
53
+ *
54
  * @return string
55
  */
56
  private static function _telemetryJson($requestTelemetry)
57
  {
58
+ $payload = [
59
+ 'last_request_metrics' => [
60
  'request_id' => $requestTelemetry->requestId,
61
  'request_duration_ms' => $requestTelemetry->requestDuration,
62
+ ],
63
+ ];
64
 
65
+ $result = \json_encode($payload);
66
+ if (false !== $result) {
67
  return $result;
 
 
 
68
  }
69
+ Stripe::getLogger()->error('Serializing telemetry payload failed!');
70
+
71
+ return '{}';
72
  }
73
 
74
  /**
75
  * @static
76
  *
77
+ * @param ApiResource|array|bool|mixed $d
78
  *
79
+ * @return ApiResource|array|mixed|string
80
  */
81
  private static function _encodeObjects($d)
82
  {
83
  if ($d instanceof ApiResource) {
84
  return Util\Util::utf8($d->id);
85
+ }
86
+ if (true === $d) {
87
  return 'true';
88
+ }
89
+ if (false === $d) {
90
  return 'false';
91
+ }
92
+ if (\is_array($d)) {
93
  $res = [];
94
  foreach ($d as $k => $v) {
95
  $res[$k] = self::_encodeObjects($v);
96
  }
97
+
98
  return $res;
 
 
99
  }
100
+
101
+ return Util\Util::utf8($d);
102
  }
103
 
104
  /**
105
  * @param string $method
106
  * @param string $url
107
+ * @param null|array $params
108
+ * @param null|array $headers
109
  *
110
+ * @throws Exception\ApiErrorException
111
+ *
112
+ * @return array tuple containing (ApiReponse, API key)
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  */
114
  public function request($method, $url, $params = null, $headers = null)
115
  {
119
  $this->_requestRaw($method, $url, $params, $headers);
120
  $json = $this->_interpretResponse($rbody, $rcode, $rheaders);
121
  $resp = new ApiResponse($rbody, $rcode, $rheaders, $json);
122
+
123
  return [$resp, $myApiKey];
124
  }
125
 
126
  /**
127
+ * @param string $rbody a JSON string
128
  * @param int $rcode
129
  * @param array $rheaders
130
  * @param array $resp
131
  *
132
+ * @throws Exception\UnexpectedValueException
133
+ * @throws Exception\ApiErrorException
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  */
135
  public function handleErrorResponse($rbody, $rcode, $rheaders, $resp)
136
  {
137
+ if (!\is_array($resp) || !isset($resp['error'])) {
138
+ $msg = "Invalid response object from API: {$rbody} "
139
+ . "(HTTP response code was {$rcode})";
140
+
141
+ throw new Exception\UnexpectedValueException($msg);
142
  }
143
 
144
  $errorData = $resp['error'];
145
 
146
  $error = null;
147
+ if (\is_string($errorData)) {
148
  $error = self::_specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorData);
149
  }
150
  if (!$error) {
163
  * @param array $resp
164
  * @param array $errorData
165
  *
166
+ * @return Exception\ApiErrorException
167
  */
168
  private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData)
169
  {
171
  $param = isset($errorData['param']) ? $errorData['param'] : null;
172
  $code = isset($errorData['code']) ? $errorData['code'] : null;
173
  $type = isset($errorData['type']) ? $errorData['type'] : null;
174
+ $declineCode = isset($errorData['decline_code']) ? $errorData['decline_code'] : null;
175
 
176
  switch ($rcode) {
177
  case 400:
178
  // 'rate_limit' code is deprecated, but left here for backwards compatibility
179
  // for API versions earlier than 2015-09-08
180
+ if ('rate_limit' === $code) {
181
+ return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param);
182
  }
183
+ if ('idempotency_error' === $type) {
184
+ return Exception\IdempotencyException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
185
  }
186
 
187
  // no break
188
  case 404:
189
+ return Exception\InvalidRequestException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param);
190
+
191
  case 401:
192
+ return Exception\AuthenticationException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
193
+
194
  case 402:
195
+ return Exception\CardException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $declineCode, $param);
196
+
197
  case 403:
198
+ return Exception\PermissionException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
199
+
200
  case 429:
201
+ return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param);
202
+
203
  default:
204
+ return Exception\UnknownApiErrorException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
205
  }
206
  }
207
 
208
  /**
209
  * @static
210
  *
211
+ * @param bool|string $rbody
212
  * @param int $rcode
213
  * @param array $rheaders
214
  * @param array $resp
215
  * @param string $errorCode
216
  *
217
+ * @return Exception\OAuth\OAuthErrorException
218
  */
219
  private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode)
220
  {
222
 
223
  switch ($errorCode) {
224
  case 'invalid_client':
225
+ return Exception\OAuth\InvalidClientException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
226
+
227
  case 'invalid_grant':
228
+ return Exception\OAuth\InvalidGrantException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
229
+
230
  case 'invalid_request':
231
+ return Exception\OAuth\InvalidRequestException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
232
+
233
  case 'invalid_scope':
234
+ return Exception\OAuth\InvalidScopeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
235
+
236
  case 'unsupported_grant_type':
237
+ return Exception\OAuth\UnsupportedGrantTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
238
+
239
  case 'unsupported_response_type':
240
+ return Exception\OAuth\UnsupportedResponseTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
 
241
 
242
+ default:
243
+ return Exception\OAuth\UnknownOAuthErrorException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
244
+ }
245
  }
246
 
247
  /**
253
  */
254
  private static function _formatAppInfo($appInfo)
255
  {
256
+ if (null !== $appInfo) {
257
  $string = $appInfo['name'];
258
+ if (null !== $appInfo['version']) {
259
  $string .= '/' . $appInfo['version'];
260
  }
261
+ if (null !== $appInfo['url']) {
262
  $string .= ' (' . $appInfo['url'] . ')';
263
  }
264
+
265
  return $string;
 
 
266
  }
267
+
268
+ return null;
269
+ }
270
+
271
+ /**
272
+ * @static
273
+ *
274
+ * @param string $disabledFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions')
275
+ * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled
276
+ * @param mixed $disableFunctionsOutput
277
+ *
278
+ * @return bool
279
+ */
280
+ private static function _isDisabled($disableFunctionsOutput, $functionName)
281
+ {
282
+ $disabledFunctions = \explode(',', $disableFunctionsOutput);
283
+ foreach ($disabledFunctions as $disabledFunction) {
284
+ if (\trim($disabledFunction) === $functionName) {
285
+ return true;
286
+ }
287
+ }
288
+
289
+ return false;
290
  }
291
 
292
  /**
301
  {
302
  $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;
303
 
304
+ $langVersion = \PHP_VERSION;
305
+ $uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname');
306
+ $uname = $uname_disabled ? '(disabled)' : \php_uname();
307
 
308
  $appInfo = Stripe::getAppInfo();
309
  $ua = [
314
  'uname' => $uname,
315
  ];
316
  if ($clientInfo) {
317
+ $ua = \array_merge($clientInfo, $ua);
318
  }
319
+ if (null !== $appInfo) {
320
  $uaString .= ' ' . self::_formatAppInfo($appInfo);
321
  $ua['application'] = $appInfo;
322
  }
323
 
324
+ return [
325
+ 'X-Stripe-Client-User-Agent' => \json_encode($ua),
326
  'User-Agent' => $uaString,
327
  'Authorization' => 'Bearer ' . $apiKey,
328
  ];
 
329
  }
330
 
331
  /**
332
  * @param string $method
333
  * @param string $url
334
+ * @param array $params
335
+ * @param array $headers
336
+ *
337
+ * @throws Exception\AuthenticationException
338
+ * @throws Exception\ApiConnectionException
339
  *
340
  * @return array
 
 
 
341
  */
342
  private function _requestRaw($method, $url, $params, $headers)
343
  {
351
  . '"Stripe::setApiKey(<API-KEY>)". You can generate API keys from '
352
  . 'the Stripe web interface. See https://stripe.com/api for '
353
  . 'details, or email support@stripe.com if you have any questions.';
354
+
355
+ throw new Exception\AuthenticationException($msg);
356
  }
357
 
358
  // Clients can supply arbitrary additional keys to be included in the
359
  // X-Stripe-Client-User-Agent header via the optional getUserAgentInfo()
360
  // method
361
  $clientUAInfo = null;
362
+ if (\method_exists($this->httpClient(), 'getUserAgentInfo')) {
363
  $clientUAInfo = $this->httpClient()->getUserAgentInfo();
364
  }
365
 
366
+ if ($params && \is_array($params)) {
367
+ $optionKeysInParams = \array_filter(
368
+ static::$OPTIONS_KEYS,
369
+ function ($key) use ($params) {
370
+ return \array_key_exists($key, $params);
371
+ }
372
+ );
373
+ if (\count($optionKeysInParams) > 0) {
374
+ $message = \sprintf('Options found in $params: %s. Options should '
375
+ . 'be passed in their own array after $params. (HINT: pass an '
376
+ . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams));
377
+ \trigger_error($message, \E_USER_WARNING);
378
+ }
379
+ }
380
+
381
+ $absUrl = $this->_apiBase . $url;
382
  $params = self::_encodeObjects($params);
383
  $defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo);
384
  if (Stripe::$apiVersion) {
389
  $defaultHeaders['Stripe-Account'] = Stripe::$accountId;
390
  }
391
 
392
+ if (Stripe::$enableTelemetry && null !== self::$requestTelemetry) {
393
+ $defaultHeaders['X-Stripe-Client-Telemetry'] = self::_telemetryJson(self::$requestTelemetry);
394
  }
395
 
396
  $hasFile = false;
 
397
  foreach ($params as $k => $v) {
398
+ if (\is_resource($v)) {
399
  $hasFile = true;
400
+ $params[$k] = self::_processResourceParam($v);
401
+ } elseif ($v instanceof \CURLFile) {
402
  $hasFile = true;
403
  }
404
  }
409
  $defaultHeaders['Content-Type'] = 'application/x-www-form-urlencoded';
410
  }
411
 
412
+ $combinedHeaders = \array_merge($defaultHeaders, $headers);
413
  $rawHeaders = [];
414
 
415
  foreach ($combinedHeaders as $header => $value) {
426
  $hasFile
427
  );
428
 
429
+ if (isset($rheaders['request-id'])
430
+ && \is_string($rheaders['request-id'])
431
+ && \strlen($rheaders['request-id']) > 0) {
432
  self::$requestTelemetry = new RequestTelemetry(
433
  $rheaders['request-id'],
434
  Util\Util::currentTimeMillis() - $requestStartMs
440
 
441
  /**
442
  * @param resource $resource
443
+ *
444
+ * @throws Exception\InvalidArgumentException
445
  *
446
  * @return \CURLFile|string
 
447
  */
448
+ private function _processResourceParam($resource)
449
  {
450
+ if ('stream' !== \get_resource_type($resource)) {
451
+ throw new Exception\InvalidArgumentException(
452
  'Attempted to upload a resource that is not a stream'
453
  );
454
  }
455
 
456
+ $metaData = \stream_get_meta_data($resource);
457
+ if ('plainfile' !== $metaData['wrapper_type']) {
458
+ throw new Exception\InvalidArgumentException(
459
  'Only plainfile resource streams are supported'
460
  );
461
  }
462
 
463
+ // We don't have the filename or mimetype, but the API doesn't care
464
+ return new \CURLFile($metaData['uri']);
 
 
 
 
465
  }
466
 
467
  /**
469
  * @param int $rcode
470
  * @param array $rheaders
471
  *
472
+ * @throws Exception\UnexpectedValueException
473
+ * @throws Exception\ApiErrorException
474
+ *
475
+ * @return array
 
 
 
 
 
 
 
 
 
 
476
  */
477
  private function _interpretResponse($rbody, $rcode, $rheaders)
478
  {
479
+ $resp = \json_decode($rbody, true);
480
+ $jsonError = \json_last_error();
481
+ if (null === $resp && \JSON_ERROR_NONE !== $jsonError) {
482
+ $msg = "Invalid response body from API: {$rbody} "
483
+ . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})";
484
+
485
+ throw new Exception\UnexpectedValueException($msg, $rcode);
486
  }
487
 
488
  if ($rcode < 200 || $rcode >= 300) {
489
  $this->handleErrorResponse($rbody, $rcode, $rheaders, $resp);
490
  }
491
+
492
  return $resp;
493
  }
494
 
520
  if (!self::$_httpClient) {
521
  self::$_httpClient = HttpClient\CurlClient::instance();
522
  }
523
+
524
  return self::$_httpClient;
525
  }
526
  }
app/api/Stripe/ApiResource.php CHANGED
@@ -3,9 +3,7 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ApiResource
7
- *
8
- * @package Stripe
9
  */
10
  abstract class ApiResource extends StripeObject
11
  {
@@ -21,14 +19,15 @@ abstract class ApiResource extends StripeObject
21
  public static function getSavedNestedResources()
22
  {
23
  static $savedNestedResources = null;
24
- if ($savedNestedResources === null) {
25
  $savedNestedResources = new Util\Set();
26
  }
 
27
  return $savedNestedResources;
28
  }
29
 
30
  /**
31
- * @var boolean A flag that can be set a behavior that will cause this
32
  * resource to be encoded and sent up along with an update of its parent
33
  * resource. This is usually not desirable because resources are updated
34
  * individually on their own endpoints, but there are certain cases,
@@ -39,16 +38,17 @@ abstract class ApiResource extends StripeObject
39
  public function __set($k, $v)
40
  {
41
  parent::__set($k, $v);
42
- $v = $this->$k;
43
- if ((static::getSavedNestedResources()->includes($k)) &&
44
- ($v instanceof ApiResource)) {
45
  $v->saveWithParent = true;
46
  }
47
- return $v;
48
  }
49
 
50
  /**
51
- * @return ApiResource The refreshed resource.
 
 
52
  */
53
  public function refresh()
54
  {
@@ -63,11 +63,12 @@ abstract class ApiResource extends StripeObject
63
  );
64
  $this->setLastResponse($response);
65
  $this->refreshFrom($response->json, $this->_opts);
 
66
  return $this;
67
  }
68
 
69
  /**
70
- * @return string The base URL for the given class.
71
  */
72
  public static function baseUrl()
73
  {
@@ -75,35 +76,42 @@ abstract class ApiResource extends StripeObject
75
  }
76
 
77
  /**
78
- * @return string The endpoint URL for the given class.
79
  */
80
  public static function classUrl()
81
  {
82
  // Replace dots with slashes for namespaced resources, e.g. if the object's name is
83
  // "foo.bar", then its URL will be "/v1/foo/bars".
84
- $base = str_replace('.', '/', static::OBJECT_NAME);
85
- return "/v1/${base}s";
 
86
  }
87
 
88
  /**
89
- * @return string The instance endpoint URL for the given class.
 
 
 
 
90
  */
91
  public static function resourceUrl($id)
92
  {
93
- if ($id === null) {
94
- $class = get_called_class();
95
- $message = "Could not determine which URL to request: "
96
- . "$class instance has invalid ID: $id";
97
- throw new Error\InvalidRequest($message, null);
 
98
  }
99
  $id = Util\Util::utf8($id);
100
  $base = static::classUrl();
101
- $extn = urlencode($id);
102
- return "$base/$extn";
 
103
  }
104
 
105
  /**
106
- * @return string The full API URL for this API resource.
107
  */
108
  public function instanceUrl()
109
  {
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class ApiResource.
 
 
7
  */
8
  abstract class ApiResource extends StripeObject
9
  {
19
  public static function getSavedNestedResources()
20
  {
21
  static $savedNestedResources = null;
22
+ if (null === $savedNestedResources) {
23
  $savedNestedResources = new Util\Set();
24
  }
25
+
26
  return $savedNestedResources;
27
  }
28
 
29
  /**
30
+ * @var bool A flag that can be set a behavior that will cause this
31
  * resource to be encoded and sent up along with an update of its parent
32
  * resource. This is usually not desirable because resources are updated
33
  * individually on their own endpoints, but there are certain cases,
38
  public function __set($k, $v)
39
  {
40
  parent::__set($k, $v);
41
+ $v = $this->{$k};
42
+ if ((static::getSavedNestedResources()->includes($k))
43
+ && ($v instanceof ApiResource)) {
44
  $v->saveWithParent = true;
45
  }
 
46
  }
47
 
48
  /**
49
+ * @throws Exception\ApiErrorException
50
+ *
51
+ * @return ApiResource the refreshed resource
52
  */
53
  public function refresh()
54
  {
63
  );
64
  $this->setLastResponse($response);
65
  $this->refreshFrom($response->json, $this->_opts);
66
+
67
  return $this;
68
  }
69
 
70
  /**
71
+ * @return string the base URL for the given class
72
  */
73
  public static function baseUrl()
74
  {
76
  }
77
 
78
  /**
79
+ * @return string the endpoint URL for the given class
80
  */
81
  public static function classUrl()
82
  {
83
  // Replace dots with slashes for namespaced resources, e.g. if the object's name is
84
  // "foo.bar", then its URL will be "/v1/foo/bars".
85
+ $base = \str_replace('.', '/', static::OBJECT_NAME);
86
+
87
+ return "/v1/{$base}s";
88
  }
89
 
90
  /**
91
+ * @param null|string $id the ID of the resource
92
+ *
93
+ * @throws Exception\UnexpectedValueException if $id is null
94
+ *
95
+ * @return string the instance endpoint URL for the given class
96
  */
97
  public static function resourceUrl($id)
98
  {
99
+ if (null === $id) {
100
+ $class = static::class;
101
+ $message = 'Could not determine which URL to request: '
102
+ . "{$class} instance has invalid ID: {$id}";
103
+
104
+ throw new Exception\UnexpectedValueException($message);
105
  }
106
  $id = Util\Util::utf8($id);
107
  $base = static::classUrl();
108
+ $extn = \urlencode($id);
109
+
110
+ return "{$base}/{$extn}";
111
  }
112
 
113
  /**
114
+ * @return string the full API URL for this API resource
115
  */
116
  public function instanceUrl()
117
  {
app/api/Stripe/ApiResponse.php CHANGED
@@ -2,25 +2,38 @@
2
 
3
  namespace Stripe;
4
 
 
 
5
  /**
6
- * Class ApiResponse
7
- *
8
- * @package Stripe
9
  */
10
  class ApiResponse
11
  {
 
 
 
12
  public $headers;
 
 
 
 
13
  public $body;
 
 
 
 
14
  public $json;
 
 
 
 
15
  public $code;
16
 
17
  /**
18
  * @param string $body
19
- * @param integer $code
20
- * @param array|null $headers
21
- * @param array|null $json
22
- *
23
- * @return obj An APIResponse
24
  */
25
  public function __construct($body, $code, $headers, $json)
26
  {
2
 
3
  namespace Stripe;
4
 
5
+ use Stripe\Util\CaseInsensitiveArray;
6
+
7
  /**
8
+ * Class ApiResponse.
 
 
9
  */
10
  class ApiResponse
11
  {
12
+ /**
13
+ * @var null|array|CaseInsensitiveArray
14
+ */
15
  public $headers;
16
+
17
+ /**
18
+ * @var string
19
+ */
20
  public $body;
21
+
22
+ /**
23
+ * @var null|array
24
+ */
25
  public $json;
26
+
27
+ /**
28
+ * @var int
29
+ */
30
  public $code;
31
 
32
  /**
33
  * @param string $body
34
+ * @param int $code
35
+ * @param null|array|CaseInsensitiveArray $headers
36
+ * @param null|array $json
 
 
37
  */
38
  public function __construct($body, $code, $headers, $json)
39
  {
app/api/Stripe/ApplePayDomain.php CHANGED
@@ -1,15 +1,19 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ApplePayDomain
7
- *
8
- * @package Stripe
 
 
9
  */
10
  class ApplePayDomain extends ApiResource
11
  {
12
- const OBJECT_NAME = "apple_pay_domain";
13
 
14
  use ApiOperations\All;
15
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
11
+ * @property string $domain_name
12
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
13
  */
14
  class ApplePayDomain extends ApiResource
15
  {
16
+ const OBJECT_NAME = 'apple_pay_domain';
17
 
18
  use ApiOperations\All;
19
  use ApiOperations\Create;
app/api/Stripe/ApplicationFee.php CHANGED
@@ -1,30 +1,28 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ApplicationFee
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $account
11
- * @property int $amount
12
- * @property int $amount_refunded
13
- * @property string $application
14
- * @property string $balance_transaction
15
- * @property string $charge
16
- * @property int $created
17
- * @property string $currency
18
- * @property bool $livemode
19
- * @property string $originating_transaction
20
- * @property bool $refunded
21
- * @property Collection $refunds
22
- *
23
- * @package Stripe
24
  */
25
  class ApplicationFee extends ApiResource
26
  {
27
- const OBJECT_NAME = "application_fee";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\NestedResource;
@@ -33,24 +31,27 @@ class ApplicationFee extends ApiResource
33
  const PATH_REFUNDS = '/refunds';
34
 
35
  /**
36
- * @param array|null $params
37
- * @param array|string|null $opts
 
 
 
38
  *
39
- * @return ApplicationFee The refunded application fee.
40
  */
41
- public function refund($params = null, $opts = null)
42
  {
43
- $this->refunds->create($params, $opts);
44
- $this->refresh();
45
- return $this;
46
  }
47
 
48
  /**
49
- * @param string|null $id The ID of the application fee on which to create the refund.
50
- * @param array|null $params
51
- * @param array|string|null $opts
52
  *
53
- * @return ApplicationFeeRefund
 
 
54
  */
55
  public static function createRefund($id, $params = null, $opts = null)
56
  {
@@ -58,12 +59,14 @@ class ApplicationFee extends ApiResource
58
  }
59
 
60
  /**
61
- * @param string|null $id The ID of the application fee to which the refund belongs.
62
- * @param array|null $refundId The ID of the refund to retrieve.
63
- * @param array|null $params
64
- * @param array|string|null $opts
 
 
65
  *
66
- * @return ApplicationFeeRefund
67
  */
68
  public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
69
  {
@@ -71,27 +74,17 @@ class ApplicationFee extends ApiResource
71
  }
72
 
73
  /**
74
- * @param string|null $id The ID of the application fee to which the refund belongs.
75
- * @param array|null $refundId The ID of the refund to update.
76
- * @param array|null $params
77
- * @param array|string|null $opts
78
  *
79
- * @return ApplicationFeeRefund
 
 
80
  */
81
  public static function updateRefund($id, $refundId, $params = null, $opts = null)
82
  {
83
  return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
84
  }
85
-
86
- /**
87
- * @param string|null $id The ID of the application fee on which to retrieve the refunds.
88
- * @param array|null $params
89
- * @param array|string|null $opts
90
- *
91
- * @return Collection The list of refunds.
92
- */
93
- public static function allRefunds($id, $params = null, $opts = null)
94
- {
95
- return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
96
- }
97
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property string|\Stripe\Account $account ID of the Stripe account this fee was taken from.
11
+ * @property int $amount Amount earned, in %s.
12
+ * @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the fee if a partial refund was issued)
13
+ * @property string|\Stripe\StripeObject $application ID of the Connect application that earned the fee.
14
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
15
+ * @property string|\Stripe\Charge $charge ID of the charge that the application fee was taken from.
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
18
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
19
+ * @property null|string|\Stripe\Charge $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the <code>destination</code> parameter.
20
+ * @property bool $refunded Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
21
+ * @property \Stripe\Collection $refunds A list of refunds that have been applied to the fee.
 
 
 
 
22
  */
23
  class ApplicationFee extends ApiResource
24
  {
25
+ const OBJECT_NAME = 'application_fee';
26
 
27
  use ApiOperations\All;
28
  use ApiOperations\NestedResource;
31
  const PATH_REFUNDS = '/refunds';
32
 
33
  /**
34
+ * @param string $id the ID of the application fee on which to retrieve the fee refunds
35
+ * @param null|array $params
36
+ * @param null|array|string $opts
37
+ *
38
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
39
  *
40
+ * @return \Stripe\Collection the list of fee refunds
41
  */
42
+ public static function allRefunds($id, $params = null, $opts = null)
43
  {
44
+ return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
 
 
45
  }
46
 
47
  /**
48
+ * @param string $id the ID of the application fee on which to create the fee refund
49
+ * @param null|array $params
50
+ * @param null|array|string $opts
51
  *
52
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
53
+ *
54
+ * @return \Stripe\ApplicationFeeRefund
55
  */
56
  public static function createRefund($id, $params = null, $opts = null)
57
  {
59
  }
60
 
61
  /**
62
+ * @param string $id the ID of the application fee to which the fee refund belongs
63
+ * @param string $refundId the ID of the fee refund to retrieve
64
+ * @param null|array $params
65
+ * @param null|array|string $opts
66
+ *
67
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
68
  *
69
+ * @return \Stripe\ApplicationFeeRefund
70
  */
71
  public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
72
  {
74
  }
75
 
76
  /**
77
+ * @param string $id the ID of the application fee to which the fee refund belongs
78
+ * @param string $refundId the ID of the fee refund to update
79
+ * @param null|array $params
80
+ * @param null|array|string $opts
81
  *
82
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
83
+ *
84
+ * @return \Stripe\ApplicationFeeRefund
85
  */
86
  public static function updateRefund($id, $refundId, $params = null, $opts = null)
87
  {
88
  return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
89
  }
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
app/api/Stripe/ApplicationFeeRefund.php CHANGED
@@ -1,40 +1,46 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ApplicationFeeRefund
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $balance_transaction
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $fee
15
- * @property StripeObject $metadata
16
  *
17
- * @package Stripe
 
 
 
 
 
 
 
18
  */
19
  class ApplicationFeeRefund extends ApiResource
20
  {
21
- const OBJECT_NAME = "fee_refund";
22
 
23
  use ApiOperations\Update {
24
  save as protected _save;
25
  }
26
 
27
  /**
28
- * @return string The API URL for this Stripe refund.
29
  */
30
  public function instanceUrl()
31
  {
32
  $id = $this['id'];
33
  $fee = $this['fee'];
34
  if (!$id) {
35
- throw new Error\InvalidRequest(
36
- "Could not determine which URL to request: " .
37
- "class instance has invalid ID: $id",
38
  null
39
  );
40
  }
@@ -42,15 +48,16 @@ class ApplicationFeeRefund extends ApiResource
42
  $fee = Util\Util::utf8($fee);
43
 
44
  $base = ApplicationFee::classUrl();
45
- $feeExtn = urlencode($fee);
46
- $extn = urlencode($id);
47
- return "$base/$feeExtn/refunds/$extn";
 
48
  }
49
 
50
  /**
51
- * @param array|string|null $opts
52
  *
53
- * @return ApplicationFeeRefund The saved refund.
54
  */
55
  public function save($opts = null)
56
  {
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <code>Application Fee Refund</code> objects allow you to refund an application
9
+ * fee that has previously been created but not yet refunded. Funds will be
10
+ * refunded to the Stripe account from which the fee was originally collected.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/connect/destination-charges#refunding-app-fee">Refunding
14
+ * Application Fees</a>.
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount Amount, in %s.
19
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
20
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
22
+ * @property string|\Stripe\ApplicationFee $fee ID of the application fee that was refunded.
23
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
24
  */
25
  class ApplicationFeeRefund extends ApiResource
26
  {
27
+ const OBJECT_NAME = 'fee_refund';
28
 
29
  use ApiOperations\Update {
30
  save as protected _save;
31
  }
32
 
33
  /**
34
+ * @return string the API URL for this Stripe refund
35
  */
36
  public function instanceUrl()
37
  {
38
  $id = $this['id'];
39
  $fee = $this['fee'];
40
  if (!$id) {
41
+ throw new Exception\UnexpectedValueException(
42
+ 'Could not determine which URL to request: ' .
43
+ "class instance has invalid ID: {$id}",
44
  null
45
  );
46
  }
48
  $fee = Util\Util::utf8($fee);
49
 
50
  $base = ApplicationFee::classUrl();
51
+ $feeExtn = \urlencode($fee);
52
+ $extn = \urlencode($id);
53
+
54
+ return "{$base}/{$feeExtn}/refunds/{$extn}";
55
  }
56
 
57
  /**
58
+ * @param null|array|string $opts
59
  *
60
+ * @return ApplicationFeeRefund the saved refund
61
  */
62
  public function save($opts = null)
63
  {
app/api/Stripe/Balance.php CHANGED
@@ -1,26 +1,42 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Balance
 
 
 
 
 
7
  *
8
- * @property string $object
9
- * @property array $available
10
- * @property array $connect_reserved
11
- * @property bool $livemode
12
- * @property array $pending
13
  *
14
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
15
  */
16
  class Balance extends SingletonApiResource
17
  {
18
- const OBJECT_NAME = "balance";
19
 
20
  /**
21
- * @param array|string|null $opts
 
 
22
  *
23
- * @return Balance
24
  */
25
  public static function retrieve($opts = null)
26
  {
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * This is an object representing your Stripe balance. You can retrieve it to see
9
+ * the balance currently on your Stripe account.
10
+ *
11
+ * You can also retrieve the balance history, which contains a list of <a
12
+ * href="https://stripe.com/docs/reporting/balance-transaction-types">transactions</a>
13
+ * that contributed to the balance (charges, payouts, and so forth).
14
  *
15
+ * The available and pending amounts for each currency are broken down further by
16
+ * payment source types.
 
 
 
17
  *
18
+ * Related guide: <a
19
+ * href="https://stripe.com/docs/connect/account-balances">Understanding Connect
20
+ * Account Balances</a>.
21
+ *
22
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
23
+ * @property \Stripe\StripeObject[] $available Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. The available balance for each currency and payment type can be found in the <code>source_types</code> property.
24
+ * @property \Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the <code>source_types</code> property.
25
+ * @property \Stripe\StripeObject[] $instant_available Funds that can be paid out using Instant Payouts.
26
+ * @property \Stripe\StripeObject $issuing
27
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
28
+ * @property \Stripe\StripeObject[] $pending Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the <code>source_types</code> property.
29
  */
30
  class Balance extends SingletonApiResource
31
  {
32
+ const OBJECT_NAME = 'balance';
33
 
34
  /**
35
+ * @param null|array|string $opts
36
+ *
37
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
38
  *
39
+ * @return \Stripe\Balance
40
  */
41
  public static function retrieve($opts = null)
42
  {
app/api/Stripe/BalanceTransaction.php CHANGED
@@ -1,65 +1,71 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class BalanceTransaction
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $available_on
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $description
15
- * @property float $exchange_rate
16
- * @property int $fee
17
- * @property mixed $fee_details
18
- * @property int $net
19
- * @property string $source
20
- * @property string $status
21
- * @property string $type
22
  *
23
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  */
25
  class BalanceTransaction extends ApiResource
26
  {
27
- const OBJECT_NAME = "balance_transaction";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\Retrieve;
31
 
32
- /**
33
- * Possible string representations of the type of balance transaction.
34
- * @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type
35
- */
36
- const TYPE_ADJUSTMENT = 'adjustment';
37
- const TYPE_ADVANCE = 'advance';
38
- const TYPE_ADVANCE_FUNDING = 'advance_funding';
39
- const TYPE_APPLICATION_FEE = 'application_fee';
40
- const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
41
- const TYPE_CHARGE = 'charge';
42
- const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
43
- const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
44
  const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
45
- const TYPE_ISSUING_TRANSACTION = 'issuing_transaction';
46
- const TYPE_PAYMENT = 'payment';
47
- const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund';
48
- const TYPE_PAYMENT_REFUND = 'payment_refund';
49
- const TYPE_PAYOUT = 'payout';
50
- const TYPE_PAYOUT_CANCEL = 'payout_cancel';
51
- const TYPE_PAYOUT_FAILURE = 'payout_failure';
52
- const TYPE_REFUND = 'refund';
53
- const TYPE_REFUND_FAILURE = 'refund_failure';
54
- const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
55
- const TYPE_RESERVED_FUNDS = 'reserved_funds';
56
- const TYPE_STRIPE_FEE = 'stripe_fee';
57
- const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
58
- const TYPE_TAX_FEE = 'tax_fee';
59
- const TYPE_TOPUP = 'topup';
60
- const TYPE_TOPUP_REVERSAL = 'topup_reversal';
61
- const TYPE_TRANSFER = 'transfer';
62
- const TYPE_TRANSFER_CANCEL = 'transfer_cancel';
63
- const TYPE_TRANSFER_FAILURE = 'transfer_failure';
64
- const TYPE_TRANSFER_REFUND = 'transfer_refund';
 
65
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Balance transactions represent funds moving through your Stripe account. They're
9
+ * created for every type of transaction that comes into or flows out of your
10
+ * Stripe account balance.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/reports/balance-transaction-types">Balance
14
+ * Transaction Types</a>.
 
 
 
 
 
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount Gross amount of the transaction, in %s.
19
+ * @property int $available_on The date the transaction's net funds will become available in the Stripe balance.
20
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
22
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
23
+ * @property null|float $exchange_rate The exchange rate used, if applicable, for this transaction. Specifically, if money was converted from currency A to currency B, then the <code>amount</code> in currency A, times <code>exchange_rate</code>, would be the <code>amount</code> in currency B. For example, suppose you charged a customer 10.00 EUR. Then the PaymentIntent's <code>amount</code> would be <code>1000</code> and <code>currency</code> would be <code>eur</code>. Suppose this was converted into 12.34 USD in your Stripe account. Then the BalanceTransaction's <code>amount</code> would be <code>1234</code>, <code>currency</code> would be <code>usd</code>, and <code>exchange_rate</code> would be <code>1.234</code>.
24
+ * @property int $fee Fees (in %s) paid for this transaction.
25
+ * @property \Stripe\StripeObject[] $fee_details Detailed breakdown of fees (in %s) paid for this transaction.
26
+ * @property int $net Net amount of the transaction, in %s.
27
+ * @property string $reporting_category <a href="https://stripe.com/docs/reports/reporting-categories">Learn more</a> about how reporting categories can help you understand balance transactions from an accounting perspective.
28
+ * @property null|string|\Stripe\StripeObject $source The Stripe object to which this transaction is related.
29
+ * @property string $status If the transaction's net funds are available in the Stripe balance yet. Either <code>available</code> or <code>pending</code>.
30
+ * @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. <a href="https://stripe.com/docs/reports/balance-transaction-types">Learn more</a> about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider <code>reporting_category</code> instead.
31
  */
32
  class BalanceTransaction extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'balance_transaction';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Retrieve;
38
 
39
+ const TYPE_ADJUSTMENT = 'adjustment';
40
+ const TYPE_ADVANCE = 'advance';
41
+ const TYPE_ADVANCE_FUNDING = 'advance_funding';
42
+ const TYPE_ANTICIPATION_REPAYMENT = 'anticipation_repayment';
43
+ const TYPE_APPLICATION_FEE = 'application_fee';
44
+ const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
45
+ const TYPE_CHARGE = 'charge';
46
+ const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
47
+ const TYPE_CONTRIBUTION = 'contribution';
48
+ const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
 
 
49
  const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
50
+ const TYPE_ISSUING_DISPUTE = 'issuing_dispute';
51
+ const TYPE_ISSUING_TRANSACTION = 'issuing_transaction';
52
+ const TYPE_PAYMENT = 'payment';
53
+ const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund';
54
+ const TYPE_PAYMENT_REFUND = 'payment_refund';
55
+ const TYPE_PAYOUT = 'payout';
56
+ const TYPE_PAYOUT_CANCEL = 'payout_cancel';
57
+ const TYPE_PAYOUT_FAILURE = 'payout_failure';
58
+ const TYPE_REFUND = 'refund';
59
+ const TYPE_REFUND_FAILURE = 'refund_failure';
60
+ const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
61
+ const TYPE_RESERVED_FUNDS = 'reserved_funds';
62
+ const TYPE_STRIPE_FEE = 'stripe_fee';
63
+ const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
64
+ const TYPE_TAX_FEE = 'tax_fee';
65
+ const TYPE_TOPUP = 'topup';
66
+ const TYPE_TOPUP_REVERSAL = 'topup_reversal';
67
+ const TYPE_TRANSFER = 'transfer';
68
+ const TYPE_TRANSFER_CANCEL = 'transfer_cancel';
69
+ const TYPE_TRANSFER_FAILURE = 'transfer_failure';
70
+ const TYPE_TRANSFER_REFUND = 'transfer_refund';
71
  }
app/api/Stripe/BankAccount.php CHANGED
@@ -1,44 +1,57 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class BankAccount
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $account
11
- * @property string $account_holder_name
12
- * @property string $account_holder_type
13
- * @property string $bank_name
14
- * @property string $country
15
- * @property string $currency
16
- * @property string $customer
17
- * @property bool $default_for_currency
18
- * @property string $fingerprint
19
- * @property string $last4
20
- * @property StripeObject $metadata
21
- * @property string $routing_number
22
- * @property string $status
23
  *
24
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  */
26
  class BankAccount extends ApiResource
27
  {
28
- const OBJECT_NAME = "bank_account";
29
 
30
  use ApiOperations\Delete;
31
  use ApiOperations\Update;
32
 
33
  /**
34
  * Possible string representations of the bank verification status.
35
- * @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status
 
36
  */
37
- const STATUS_NEW = 'new';
38
- const STATUS_VALIDATED = 'validated';
39
- const STATUS_VERIFIED = 'verified';
40
  const STATUS_VERIFICATION_FAILED = 'verification_failed';
41
- const STATUS_ERRORED = 'errored';
42
 
43
  /**
44
  * @return string The instance URL for this resource. It needs to be special
@@ -55,54 +68,65 @@ class BankAccount extends ApiResource
55
  $parent = $this['account'];
56
  $path = 'external_accounts';
57
  } else {
58
- $msg = "Bank accounts cannot be accessed without a customer ID or account ID.";
59
- throw new Error\InvalidRequest($msg, null);
 
60
  }
61
- $parentExtn = urlencode(Util\Util::utf8($parent));
62
- $extn = urlencode(Util\Util::utf8($this['id']));
63
- return "$base/$parentExtn/$path/$extn";
 
64
  }
65
 
66
  /**
67
  * @param array|string $_id
68
- * @param array|string|null $_opts
69
  *
70
- * @throws \Stripe\Error\InvalidRequest
71
  */
72
  public static function retrieve($_id, $_opts = null)
73
  {
74
- $msg = "Bank accounts cannot be accessed without a customer ID or account ID. " .
75
- "Retrieve a bank account using \$customer->sources->retrieve('bank_account_id') or " .
76
- "\$account->external_accounts->retrieve('bank_account_id') instead.";
77
- throw new Error\InvalidRequest($msg, null);
 
 
 
78
  }
79
 
80
  /**
81
  * @param string $_id
82
- * @param array|null $_params
83
- * @param array|string|null $_options
84
  *
85
- * @throws \Stripe\Error\InvalidRequest
86
  */
87
  public static function update($_id, $_params = null, $_options = null)
88
  {
89
- $msg = "Bank accounts cannot be accessed without a customer ID or account ID. " .
90
- "Call save() on \$customer->sources->retrieve('bank_account_id') or " .
91
- "\$account->external_accounts->retrieve('bank_account_id') instead.";
92
- throw new Error\InvalidRequest($msg, null);
 
 
 
93
  }
94
 
95
  /**
96
- * @param array|null $params
97
- * @param array|string|null $options
98
- *
99
- * @return BankAccount The verified bank account.
100
- */
101
- public function verify($params = null, $options = null)
 
 
102
  {
103
  $url = $this->instanceUrl() . '/verify';
104
- list($response, $opts) = $this->_request('post', $url, $params, $options);
105
  $this->refreshFrom($response, $opts);
 
106
  return $this;
107
  }
108
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * These bank accounts are payment methods on <code>Customer</code> objects.
9
+ *
10
+ * On the other hand <a
11
+ * href="https://stripe.com/docs/api#external_accounts">External Accounts</a> are
12
+ * transfer destinations on <code>Account</code> objects for <a
13
+ * href="https://stripe.com/docs/connect/custom-accounts">Custom accounts</a>. They
14
+ * can be bank accounts or debit cards as well, and are documented in the links
15
+ * above.
16
  *
17
+ * Related guide: <a
18
+ * href="https://stripe.com/docs/payments/bank-debits-transfers">Bank Debits and
19
+ * Transfers</a>.
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
+ * @property string $id Unique identifier for the object.
22
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
23
+ * @property null|string|\Stripe\Account $account The ID of the account that the bank account is associated with.
24
+ * @property null|string $account_holder_name The name of the person or business that owns the bank account.
25
+ * @property null|string $account_holder_type The type of entity that holds the account. This can be either <code>individual</code> or <code>company</code>.
26
+ * @property null|string[] $available_payout_methods A set of available payout methods for this bank account. Only values from this set should be passed as the <code>method</code> when creating a payout.
27
+ * @property null|string $bank_name Name of the bank associated with the routing number (e.g., <code>WELLS FARGO</code>).
28
+ * @property string $country Two-letter ISO code representing the country the bank account is located in.
29
+ * @property string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for the currency</a> paid out to the bank account.
30
+ * @property null|string|\Stripe\Customer $customer The ID of the customer that the bank account is associated with.
31
+ * @property null|bool $default_for_currency Whether this bank account is the default external account for its currency.
32
+ * @property null|string $fingerprint Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
33
+ * @property string $last4 The last four digits of the bank account number.
34
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
35
+ * @property null|string $routing_number The routing transit number for the bank account.
36
+ * @property string $status <p>For bank accounts, possible values are <code>new</code>, <code>validated</code>, <code>verified</code>, <code>verification_failed</code>, or <code>errored</code>. A bank account that hasn't had any activity or validation performed is <code>new</code>. If Stripe can determine that the bank account exists, its status will be <code>validated</code>. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be <code>verified</code>. If the verification failed for any reason, such as microdeposit failure, the status will be <code>verification_failed</code>. If a transfer sent to this bank account fails, we'll set the status to <code>errored</code> and will not continue to send transfers until the bank details are updated.</p><p>For external accounts, possible values are <code>new</code> and <code>errored</code>. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to <code>errored</code> and transfers are stopped until account details are updated.</p>
37
  */
38
  class BankAccount extends ApiResource
39
  {
40
+ const OBJECT_NAME = 'bank_account';
41
 
42
  use ApiOperations\Delete;
43
  use ApiOperations\Update;
44
 
45
  /**
46
  * Possible string representations of the bank verification status.
47
+ *
48
+ * @see https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status
49
  */
50
+ const STATUS_NEW = 'new';
51
+ const STATUS_VALIDATED = 'validated';
52
+ const STATUS_VERIFIED = 'verified';
53
  const STATUS_VERIFICATION_FAILED = 'verification_failed';
54
+ const STATUS_ERRORED = 'errored';
55
 
56
  /**
57
  * @return string The instance URL for this resource. It needs to be special
68
  $parent = $this['account'];
69
  $path = 'external_accounts';
70
  } else {
71
+ $msg = 'Bank accounts cannot be accessed without a customer ID or account ID.';
72
+
73
+ throw new Exception\UnexpectedValueException($msg, null);
74
  }
75
+ $parentExtn = \urlencode(Util\Util::utf8($parent));
76
+ $extn = \urlencode(Util\Util::utf8($this['id']));
77
+
78
+ return "{$base}/{$parentExtn}/{$path}/{$extn}";
79
  }
80
 
81
  /**
82
  * @param array|string $_id
83
+ * @param null|array|string $_opts
84
  *
85
+ * @throws \Stripe\Exception\BadMethodCallException
86
  */
87
  public static function retrieve($_id, $_opts = null)
88
  {
89
+ $msg = 'Bank accounts cannot be retrieved without a customer ID or ' .
90
+ 'an account ID. Retrieve a bank account using ' .
91
+ "`Customer::retrieveSource('customer_id', " .
92
+ "'bank_account_id')` or `Account::retrieveExternalAccount(" .
93
+ "'account_id', 'bank_account_id')`.";
94
+
95
+ throw new Exception\BadMethodCallException($msg);
96
  }
97
 
98
  /**
99
  * @param string $_id
100
+ * @param null|array $_params
101
+ * @param null|array|string $_options
102
  *
103
+ * @throws \Stripe\Exception\BadMethodCallException
104
  */
105
  public static function update($_id, $_params = null, $_options = null)
106
  {
107
+ $msg = 'Bank accounts cannot be updated without a customer ID or an ' .
108
+ 'account ID. Update a bank account using ' .
109
+ "`Customer::updateSource('customer_id', 'bank_account_id', " .
110
+ '$updateParams)` or `Account::updateExternalAccount(' .
111
+ "'account_id', 'bank_account_id', \$updateParams)`.";
112
+
113
+ throw new Exception\BadMethodCallException($msg);
114
  }
115
 
116
  /**
117
+ * @param null|array $params
118
+ * @param null|array|string $opts
119
+ *
120
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
121
+ *
122
+ * @return BankAccount the verified bank account
123
+ */
124
+ public function verify($params = null, $opts = null)
125
  {
126
  $url = $this->instanceUrl() . '/verify';
127
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
128
  $this->refreshFrom($response, $opts);
129
+
130
  return $this;
131
  }
132
  }
app/api/Stripe/BaseStripeClient.php ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe;
4
+
5
+ class BaseStripeClient implements StripeClientInterface
6
+ {
7
+ /** @var string default base URL for Stripe's API */
8
+ const DEFAULT_API_BASE = 'https://api.stripe.com';
9
+
10
+ /** @var string default base URL for Stripe's OAuth API */
11
+ const DEFAULT_CONNECT_BASE = 'https://connect.stripe.com';
12
+
13
+ /** @var string default base URL for Stripe's Files API */
14
+ const DEFAULT_FILES_BASE = 'https://files.stripe.com';
15
+
16
+ /** @var array<string, mixed> */
17
+ private $config;
18
+
19
+ /** @var \Stripe\Util\RequestOptions */
20
+ private $defaultOpts;
21
+
22
+ /**
23
+ * Initializes a new instance of the {@link BaseStripeClient} class.
24
+ *
25
+ * The constructor takes a single argument. The argument can be a string, in which case it
26
+ * should be the API key. It can also be an array with various configuration settings.
27
+ *
28
+ * Configuration settings include the following options:
29
+ *
30
+ * - api_key (null|string): the Stripe API key, to be used in regular API requests.
31
+ * - client_id (null|string): the Stripe client ID, to be used in OAuth requests.
32
+ * - stripe_account (null|string): a Stripe account ID. If set, all requests sent by the client
33
+ * will automatically use the {@code Stripe-Account} header with that account ID.
34
+ * - stripe_version (null|string): a Stripe API verion. If set, all requests sent by the client
35
+ * will include the {@code Stripe-Version} header with that API version.
36
+ *
37
+ * The following configuration settings are also available, though setting these should rarely be necessary
38
+ * (only useful if you want to send requests to a mock server like stripe-mock):
39
+ *
40
+ * - api_base (string): the base URL for regular API requests. Defaults to
41
+ * {@link DEFAULT_API_BASE}.
42
+ * - connect_base (string): the base URL for OAuth requests. Defaults to
43
+ * {@link DEFAULT_CONNECT_BASE}.
44
+ * - files_base (string): the base URL for file creation requests. Defaults to
45
+ * {@link DEFAULT_FILES_BASE}.
46
+ *
47
+ * @param array<string, mixed>|string $config the API key as a string, or an array containing
48
+ * the client configuration settings
49
+ */
50
+ public function __construct($config = [])
51
+ {
52
+ if (\is_string($config)) {
53
+ $config = ['api_key' => $config];
54
+ } elseif (!\is_array($config)) {
55
+ throw new \Stripe\Exception\InvalidArgumentException('$config must be a string or an array');
56
+ }
57
+
58
+ $config = \array_merge($this->getDefaultConfig(), $config);
59
+ $this->validateConfig($config);
60
+
61
+ $this->config = $config;
62
+
63
+ $this->defaultOpts = \Stripe\Util\RequestOptions::parse([
64
+ 'stripe_account' => $config['stripe_account'],
65
+ 'stripe_version' => $config['stripe_version'],
66
+ ]);
67
+ }
68
+
69
+ /**
70
+ * Gets the API key used by the client to send requests.
71
+ *
72
+ * @return null|string the API key used by the client to send requests
73
+ */
74
+ public function getApiKey()
75
+ {
76
+ return $this->config['api_key'];
77
+ }
78
+
79
+ /**
80
+ * Gets the client ID used by the client in OAuth requests.
81
+ *
82
+ * @return null|string the client ID used by the client in OAuth requests
83
+ */
84
+ public function getClientId()
85
+ {
86
+ return $this->config['client_id'];
87
+ }
88
+
89
+ /**
90
+ * Gets the base URL for Stripe's API.
91
+ *
92
+ * @return string the base URL for Stripe's API
93
+ */
94
+ public function getApiBase()
95
+ {
96
+ return $this->config['api_base'];
97
+ }
98
+
99
+ /**
100
+ * Gets the base URL for Stripe's OAuth API.
101
+ *
102
+ * @return string the base URL for Stripe's OAuth API
103
+ */
104
+ public function getConnectBase()
105
+ {
106
+ return $this->config['connect_base'];
107
+ }
108
+
109
+ /**
110
+ * Gets the base URL for Stripe's Files API.
111
+ *
112
+ * @return string the base URL for Stripe's Files API
113
+ */
114
+ public function getFilesBase()
115
+ {
116
+ return $this->config['files_base'];
117
+ }
118
+
119
+ /**
120
+ * Sends a request to Stripe's API.
121
+ *
122
+ * @param string $method the HTTP method
123
+ * @param string $path the path of the request
124
+ * @param array $params the parameters of the request
125
+ * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
126
+ *
127
+ * @return \Stripe\StripeObject the object returned by Stripe's API
128
+ */
129
+ public function request($method, $path, $params, $opts)
130
+ {
131
+ $opts = $this->defaultOpts->merge($opts, true);
132
+ $baseUrl = $opts->apiBase ?: $this->getApiBase();
133
+ $requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl);
134
+ list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers);
135
+ $opts->discardNonPersistentHeaders();
136
+ $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
137
+ $obj->setLastResponse($response);
138
+
139
+ return $obj;
140
+ }
141
+
142
+ /**
143
+ * Sends a request to Stripe's API.
144
+ *
145
+ * @param string $method the HTTP method
146
+ * @param string $path the path of the request
147
+ * @param array $params the parameters of the request
148
+ * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
149
+ *
150
+ * @return \Stripe\Collection of ApiResources
151
+ */
152
+ public function requestCollection($method, $path, $params, $opts)
153
+ {
154
+ $obj = $this->request($method, $path, $params, $opts);
155
+ if (!($obj instanceof \Stripe\Collection)) {
156
+ $received_class = \get_class($obj);
157
+ $msg = "Expected to receive `Stripe\\Collection` object from Stripe API. Instead received `{$received_class}`.";
158
+
159
+ throw new \Stripe\Exception\UnexpectedValueException($msg);
160
+ }
161
+ $obj->setFilters($params);
162
+
163
+ return $obj;
164
+ }
165
+
166
+ /**
167
+ * @param \Stripe\Util\RequestOptions $opts
168
+ *
169
+ * @throws \Stripe\Exception\AuthenticationException
170
+ *
171
+ * @return string
172
+ */
173
+ private function apiKeyForRequest($opts)
174
+ {
175
+ $apiKey = $opts->apiKey ?: $this->getApiKey();
176
+
177
+ if (null === $apiKey) {
178
+ $msg = 'No API key provided. Set your API key when constructing the '
179
+ . 'StripeClient instance, or provide it on a per-request basis '
180
+ . 'using the `api_key` key in the $opts argument.';
181
+
182
+ throw new \Stripe\Exception\AuthenticationException($msg);
183
+ }
184
+
185
+ return $apiKey;
186
+ }
187
+
188
+ /**
189
+ * TODO: replace this with a private constant when we drop support for PHP < 5.
190
+ *
191
+ * @return array<string, mixed>
192
+ */
193
+ private function getDefaultConfig()
194
+ {
195
+ return [
196
+ 'api_key' => null,
197
+ 'client_id' => null,
198
+ 'stripe_account' => null,
199
+ 'stripe_version' => null,
200
+ 'api_base' => self::DEFAULT_API_BASE,
201
+ 'connect_base' => self::DEFAULT_CONNECT_BASE,
202
+ 'files_base' => self::DEFAULT_FILES_BASE,
203
+ ];
204
+ }
205
+
206
+ /**
207
+ * @param array<string, mixed> $config
208
+ *
209
+ * @throws \Stripe\Exception\InvalidArgumentException
210
+ */
211
+ private function validateConfig($config)
212
+ {
213
+ // api_key
214
+ if (null !== $config['api_key'] && !\is_string($config['api_key'])) {
215
+ throw new \Stripe\Exception\InvalidArgumentException('api_key must be null or a string');
216
+ }
217
+
218
+ if (null !== $config['api_key'] && ('' === $config['api_key'])) {
219
+ $msg = 'api_key cannot be the empty string';
220
+
221
+ throw new \Stripe\Exception\InvalidArgumentException($msg);
222
+ }
223
+
224
+ if (null !== $config['api_key'] && (\preg_match('/\s/', $config['api_key']))) {
225
+ $msg = 'api_key cannot contain whitespace';
226
+
227
+ throw new \Stripe\Exception\InvalidArgumentException($msg);
228
+ }
229
+
230
+ // client_id
231
+ if (null !== $config['client_id'] && !\is_string($config['client_id'])) {
232
+ throw new \Stripe\Exception\InvalidArgumentException('client_id must be null or a string');
233
+ }
234
+
235
+ // stripe_account
236
+ if (null !== $config['stripe_account'] && !\is_string($config['stripe_account'])) {
237
+ throw new \Stripe\Exception\InvalidArgumentException('stripe_account must be null or a string');
238
+ }
239
+
240
+ // stripe_version
241
+ if (null !== $config['stripe_version'] && !\is_string($config['stripe_version'])) {
242
+ throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be null or a string');
243
+ }
244
+
245
+ // api_base
246
+ if (!\is_string($config['api_base'])) {
247
+ throw new \Stripe\Exception\InvalidArgumentException('api_base must be a string');
248
+ }
249
+
250
+ // connect_base
251
+ if (!\is_string($config['connect_base'])) {
252
+ throw new \Stripe\Exception\InvalidArgumentException('connect_base must be a string');
253
+ }
254
+
255
+ // files_base
256
+ if (!\is_string($config['files_base'])) {
257
+ throw new \Stripe\Exception\InvalidArgumentException('files_base must be a string');
258
+ }
259
+
260
+ // check absence of extra keys
261
+ $extraConfigKeys = \array_diff(\array_keys($config), \array_keys($this->getDefaultConfig()));
262
+ if (!empty($extraConfigKeys)) {
263
+ // Wrap in single quote to more easily catch trailing spaces errors
264
+ $invalidKeys = "'" . \implode("', '", $extraConfigKeys) . "'";
265
+
266
+ throw new \Stripe\Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys);
267
+ }
268
+ }
269
+ }
app/api/Stripe/BillingPortal/Configuration.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\BillingPortal;
6
+
7
+ /**
8
+ * A portal configuration describes the functionality and behavior of a portal
9
+ * session.
10
+ *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property bool $active Whether the configuration is active and can be used to create portal sessions.
14
+ * @property null|string $application ID of the Connect Application that created the configuration.
15
+ * @property \Stripe\StripeObject $business_profile
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property null|string $default_return_url The default URL to redirect customers to when they click on the portal's link to return to your website. This can be <a href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a> when creating the session.
18
+ * @property \Stripe\StripeObject $features
19
+ * @property bool $is_default Whether the configuration is the default. If <code>true</code>, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
20
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
21
+ * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
22
+ */
23
+ class Configuration extends \Stripe\ApiResource
24
+ {
25
+ const OBJECT_NAME = 'billing_portal.configuration';
26
+
27
+ use \Stripe\ApiOperations\All;
28
+ use \Stripe\ApiOperations\Create;
29
+ use \Stripe\ApiOperations\Retrieve;
30
+ use \Stripe\ApiOperations\Update;
31
+ }
app/api/Stripe/BillingPortal/Session.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\BillingPortal;
6
+
7
+ /**
8
+ * The Billing customer portal is a Stripe-hosted UI for subscription and billing
9
+ * management.
10
+ *
11
+ * A portal configuration describes the functionality and features that you want to
12
+ * provide to your customers through the portal.
13
+ *
14
+ * A portal session describes the instantiation of the customer portal for a
15
+ * particular customer. By visiting the session's URL, the customer can manage
16
+ * their subscriptions and billing details. For security reasons, sessions are
17
+ * short-lived and will expire if the customer does not visit the URL. Create
18
+ * sessions on-demand when customers intend to manage their subscriptions and
19
+ * billing details.
20
+ *
21
+ * Learn more in the <a
22
+ * href="https://stripe.com/docs/billing/subscriptions/customer-portal">product
23
+ * overview</a> and <a
24
+ * href="https://stripe.com/docs/billing/subscriptions/integrating-customer-portal">integration
25
+ * guide</a>.
26
+ *
27
+ * @property string $id Unique identifier for the object.
28
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
29
+ * @property string|\Stripe\BillingPortal\Configuration $configuration The configuration used by this session, describing the features available.
30
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
31
+ * @property string $customer The ID of the customer for this session.
32
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
33
+ * @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this <code>on_behalf_of</code> account appear in the portal. For more information, see the <a href="https://stripe.com/docs/connect/charges-transfers#on-behalf-of">docs</a>. Use the <a href="https://stripe.com/docs/api/accounts/object#account_object-settings-branding">Accounts API</a> to modify the <code>on_behalf_of</code> account's branding settings, which the portal displays.
34
+ * @property string $return_url The URL to redirect customers to when they click on the portal's link to return to your website.
35
+ * @property string $url The short-lived URL of the session that gives customers access to the customer portal.
36
+ */
37
+ class Session extends \Stripe\ApiResource
38
+ {
39
+ const OBJECT_NAME = 'billing_portal.session';
40
+
41
+ use \Stripe\ApiOperations\Create;
42
+ }
app/api/Stripe/BitcoinReceiver.php CHANGED
@@ -1,18 +1,39 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class BitcoinReceiver
7
- *
8
- * @package Stripe
9
- *
10
  * @deprecated Bitcoin receivers are deprecated. Please use the sources API instead.
11
- * @link https://stripe.com/docs/sources/bitcoin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  */
13
  class BitcoinReceiver extends ApiResource
14
  {
15
- const OBJECT_NAME = "bitcoin_receiver";
16
 
17
  use ApiOperations\All;
18
  use ApiOperations\Retrieve;
@@ -23,7 +44,7 @@ class BitcoinReceiver extends ApiResource
23
  */
24
  public static function classUrl()
25
  {
26
- return "/v1/bitcoin/receivers";
27
  }
28
 
29
  /**
@@ -36,13 +57,15 @@ class BitcoinReceiver extends ApiResource
36
  $base = Customer::classUrl();
37
  $parent = $this['customer'];
38
  $path = 'sources';
39
- $parentExtn = urlencode(Util\Util::utf8($parent));
40
- $extn = urlencode(Util\Util::utf8($this['id']));
41
- return "$base/$parentExtn/$path/$extn";
42
- } else {
43
- $base = BitcoinReceiver::classUrl();
44
- $extn = urlencode(Util\Util::utf8($this['id']));
45
- return "$base/$extn";
46
  }
 
 
 
 
 
47
  }
48
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
 
 
 
 
8
  * @deprecated Bitcoin receivers are deprecated. Please use the sources API instead.
9
+ * @see https://stripe.com/docs/sources/bitcoin
10
+ *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property bool $active True when this bitcoin receiver has received a non-zero amount of bitcoin.
14
+ * @property int $amount The amount of <code>currency</code> that you are collecting as payment.
15
+ * @property int $amount_received The amount of <code>currency</code> to which <code>bitcoin_amount_received</code> has been converted.
16
+ * @property int $bitcoin_amount The amount of bitcoin that the customer should send to fill the receiver. The <code>bitcoin_amount</code> is denominated in Satoshi: there are 10^8 Satoshi in one bitcoin.
17
+ * @property int $bitcoin_amount_received The amount of bitcoin that has been sent by the customer to this receiver.
18
+ * @property string $bitcoin_uri This URI can be displayed to the customer as a clickable link (to activate their bitcoin client) or as a QR code (for mobile wallets).
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> to which the bitcoin will be converted.
21
+ * @property null|string $customer The customer ID of the bitcoin receiver.
22
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
23
+ * @property null|string $email The customer's email address, set by the API call that creates the receiver.
24
+ * @property bool $filled This flag is initially false and updates to true when the customer sends the <code>bitcoin_amount</code> to this receiver.
25
+ * @property string $inbound_address A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver.
26
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
27
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
28
+ * @property null|string $payment The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key.
29
+ * @property null|string $refund_address The refund address of this bitcoin receiver.
30
+ * @property \Stripe\Collection $transactions A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key.
31
+ * @property bool $uncaptured_funds This receiver contains uncaptured funds that can be used for a payment or refunded.
32
+ * @property null|bool $used_for_payment Indicate if this source is used for payment.
33
  */
34
  class BitcoinReceiver extends ApiResource
35
  {
36
+ const OBJECT_NAME = 'bitcoin_receiver';
37
 
38
  use ApiOperations\All;
39
  use ApiOperations\Retrieve;
44
  */
45
  public static function classUrl()
46
  {
47
+ return '/v1/bitcoin/receivers';
48
  }
49
 
50
  /**
57
  $base = Customer::classUrl();
58
  $parent = $this['customer'];
59
  $path = 'sources';
60
+ $parentExtn = \urlencode(Util\Util::utf8($parent));
61
+ $extn = \urlencode(Util\Util::utf8($this['id']));
62
+
63
+ return "{$base}/{$parentExtn}/{$path}/{$extn}";
 
 
 
64
  }
65
+
66
+ $base = BitcoinReceiver::classUrl();
67
+ $extn = \urlencode(Util\Util::utf8($this['id']));
68
+
69
+ return "{$base}/{$extn}";
70
  }
71
  }
app/api/Stripe/BitcoinTransaction.php CHANGED
@@ -1,13 +1,19 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class BitcoinTransaction
7
- *
8
- * @package Stripe
 
 
 
 
9
  */
10
  class BitcoinTransaction extends ApiResource
11
  {
12
- const OBJECT_NAME = "bitcoin_transaction";
13
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property int $amount The amount of <code>currency</code> that the transaction was converted to in real-time.
11
+ * @property int $bitcoin_amount The amount of bitcoin contained in the transaction.
12
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
13
+ * @property string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> to which this transaction was converted.
14
+ * @property string $receiver The receiver to which this transaction was sent.
15
  */
16
  class BitcoinTransaction extends ApiResource
17
  {
18
+ const OBJECT_NAME = 'bitcoin_transaction';
19
  }
app/api/Stripe/Capability.php CHANGED
@@ -1,46 +1,46 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Capability
7
  *
8
- * @package Stripe
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property string $account
13
- * @property bool $requested
14
- * @property int $requested_at
15
- * @property mixed $requirements
16
- * @property string $status
17
  */
18
  class Capability extends ApiResource
19
  {
20
- const OBJECT_NAME = "capability";
21
 
22
  use ApiOperations\Update;
23
 
24
- /**
25
- * Possible string representations of a capability's status.
26
- * @link https://stripe.com/docs/api/capabilities/object#capability_object-status
27
- */
28
- const STATUS_ACTIVE = 'active';
29
- const STATUS_INACTIVE = 'inactive';
30
- const STATUS_PENDING = 'pending';
31
  const STATUS_UNREQUESTED = 'unrequested';
32
 
33
  /**
34
- * @return string The API URL for this Stripe account reversal.
35
  */
36
  public function instanceUrl()
37
  {
38
  $id = $this['id'];
39
  $account = $this['account'];
40
  if (!$id) {
41
- throw new Error\InvalidRequest(
42
- "Could not determine which URL to request: " .
43
- "class instance has invalid ID: $id",
44
  null
45
  );
46
  }
@@ -48,35 +48,40 @@ class Capability extends ApiResource
48
  $account = Util\Util::utf8($account);
49
 
50
  $base = Account::classUrl();
51
- $accountExtn = urlencode($account);
52
- $extn = urlencode($id);
53
- return "$base/$accountExtn/capabilities/$extn";
 
54
  }
55
 
56
  /**
57
  * @param array|string $_id
58
- * @param array|string|null $_opts
59
  *
60
- * @throws \Stripe\Error\InvalidRequest
61
  */
62
  public static function retrieve($_id, $_opts = null)
63
  {
64
- $msg = "Capabilities cannot be accessed without an account ID. " .
65
- "Retrieve a Capability using \$account->retrieveCapability('acap_123') instead.";
66
- throw new Error\InvalidRequest($msg, null);
 
 
67
  }
68
 
69
  /**
70
  * @param string $_id
71
- * @param array|null $_params
72
- * @param array|string|null $_options
73
  *
74
- * @throws \Stripe\Error\InvalidRequest
75
  */
76
  public static function update($_id, $_params = null, $_options = null)
77
  {
78
- $msg = "Capabilities cannot be accessed without an account ID. " .
79
- "Update a Capability using \$account->updateCapability('acap_123') instead.";
80
- throw new Error\InvalidRequest($msg, null);
 
 
81
  }
82
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * This is an object representing a capability for a Stripe account.
9
  *
10
+ * Related guide: <a
11
+ * href="https://stripe.com/docs/connect/account-capabilities">Account
12
+ * capabilities</a>.
13
  *
14
+ * @property string $id The identifier for the capability.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property string|\Stripe\Account $account The account for which the capability enables functionality.
17
+ * @property bool $requested Whether the capability has been requested.
18
+ * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
19
+ * @property \Stripe\StripeObject $requirements
20
+ * @property string $status The status of the capability. Can be <code>active</code>, <code>inactive</code>, <code>pending</code>, or <code>unrequested</code>.
21
  */
22
  class Capability extends ApiResource
23
  {
24
+ const OBJECT_NAME = 'capability';
25
 
26
  use ApiOperations\Update;
27
 
28
+ const STATUS_ACTIVE = 'active';
29
+ const STATUS_INACTIVE = 'inactive';
30
+ const STATUS_PENDING = 'pending';
 
 
 
 
31
  const STATUS_UNREQUESTED = 'unrequested';
32
 
33
  /**
34
+ * @return string the API URL for this Stripe account reversal
35
  */
36
  public function instanceUrl()
37
  {
38
  $id = $this['id'];
39
  $account = $this['account'];
40
  if (!$id) {
41
+ throw new Exception\UnexpectedValueException(
42
+ 'Could not determine which URL to request: ' .
43
+ "class instance has invalid ID: {$id}",
44
  null
45
  );
46
  }
48
  $account = Util\Util::utf8($account);
49
 
50
  $base = Account::classUrl();
51
+ $accountExtn = \urlencode($account);
52
+ $extn = \urlencode($id);
53
+
54
+ return "{$base}/{$accountExtn}/capabilities/{$extn}";
55
  }
56
 
57
  /**
58
  * @param array|string $_id
59
+ * @param null|array|string $_opts
60
  *
61
+ * @throws \Stripe\Exception\BadMethodCallException
62
  */
63
  public static function retrieve($_id, $_opts = null)
64
  {
65
+ $msg = 'Capabilities cannot be retrieved without an account ID. ' .
66
+ 'Retrieve a capability using `Account::retrieveCapability(' .
67
+ "'account_id', 'capability_id')`.";
68
+
69
+ throw new Exception\BadMethodCallException($msg);
70
  }
71
 
72
  /**
73
  * @param string $_id
74
+ * @param null|array $_params
75
+ * @param null|array|string $_options
76
  *
77
+ * @throws \Stripe\Exception\BadMethodCallException
78
  */
79
  public static function update($_id, $_params = null, $_options = null)
80
  {
81
+ $msg = 'Capabilities cannot be updated without an account ID. ' .
82
+ 'Update a capability using `Account::updateCapability(' .
83
+ "'account_id', 'capability_id', \$updateParams)`.";
84
+
85
+ throw new Exception\BadMethodCallException($msg);
86
  }
87
  }
app/api/Stripe/Card.php CHANGED
@@ -1,71 +1,79 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Card
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $account
11
- * @property string $address_city
12
- * @property string $address_country
13
- * @property string $address_line1
14
- * @property string $address_line1_check
15
- * @property string $address_line2
16
- * @property string $address_state
17
- * @property string $address_zip
18
- * @property string $address_zip_check
19
- * @property string[] $available_payout_methods
20
- * @property string $brand
21
- * @property string $country
22
- * @property string $currency
23
- * @property string $customer
24
- * @property string $cvc_check
25
- * @property bool $default_for_currency
26
- * @property string $dynamic_last4
27
- * @property int $exp_month
28
- * @property int $exp_year
29
- * @property string $fingerprint
30
- * @property string $funding
31
- * @property string $last4
32
- * @property StripeObject $metadata
33
- * @property string $name
34
- * @property string $recipient
35
- * @property string $tokenization_method
36
  *
37
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
  class Card extends ApiResource
40
  {
41
- const OBJECT_NAME = "card";
42
 
43
  use ApiOperations\Delete;
44
  use ApiOperations\Update;
45
 
46
  /**
47
  * Possible string representations of the CVC check status.
48
- * @link https://stripe.com/docs/api/cards/object#card_object-cvc_check
 
49
  */
50
- const CVC_CHECK_FAIL = 'fail';
51
- const CVC_CHECK_PASS = 'pass';
52
  const CVC_CHECK_UNAVAILABLE = 'unavailable';
53
- const CVC_CHECK_UNCHECKED = 'unchecked';
54
 
55
  /**
56
  * Possible string representations of the funding of the card.
57
- * @link https://stripe.com/docs/api/cards/object#card_object-funding
 
58
  */
59
- const FUNDING_CREDIT = 'credit';
60
- const FUNDING_DEBIT = 'debit';
61
  const FUNDING_PREPAID = 'prepaid';
62
  const FUNDING_UNKNOWN = 'unknown';
63
 
64
  /**
65
  * Possible string representations of the tokenization method when using Apple Pay or Google Pay.
66
- * @link https://stripe.com/docs/api/cards/object#card_object-tokenization_method
 
67
  */
68
- const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay';
69
  const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay';
70
 
71
  /**
@@ -88,42 +96,47 @@ class Card extends ApiResource
88
  $parent = $this['recipient'];
89
  $path = 'cards';
90
  } else {
91
- $msg = "Cards cannot be accessed without a customer ID, account ID or recipient ID.";
92
- throw new Error\InvalidRequest($msg, null);
 
93
  }
94
- $parentExtn = urlencode(Util\Util::utf8($parent));
95
- $extn = urlencode(Util\Util::utf8($this['id']));
96
- return "$base/$parentExtn/$path/$extn";
 
97
  }
98
 
99
  /**
100
  * @param array|string $_id
101
- * @param array|string|null $_opts
102
  *
103
- * @throws \Stripe\Error\InvalidRequest
104
  */
105
  public static function retrieve($_id, $_opts = null)
106
  {
107
- $msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
108
- "Retrieve a card using \$customer->sources->retrieve('card_id'), " .
109
- "\$recipient->cards->retrieve('card_id'), or " .
110
- "\$account->external_accounts->retrieve('card_id') instead.";
111
- throw new Error\InvalidRequest($msg, null);
 
112
  }
113
 
114
  /**
115
  * @param string $_id
116
- * @param array|null $_params
117
- * @param array|string|null $_options
118
  *
119
- * @throws \Stripe\Error\InvalidRequest
120
  */
121
  public static function update($_id, $_params = null, $_options = null)
122
  {
123
- $msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
124
- "Call save() on \$customer->sources->retrieve('card_id'), " .
125
- "\$recipient->cards->retrieve('card_id'), or " .
126
- "\$account->external_accounts->retrieve('card_id') instead.";
127
- throw new Error\InvalidRequest($msg, null);
 
 
128
  }
129
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * You can store multiple cards on a customer in order to charge the customer
9
+ * later. You can also store multiple debit cards on a recipient in order to
10
+ * transfer to those cards later.
11
  *
12
+ * Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments
13
+ * with Sources</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property null|string|\Stripe\Account $account The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead.
18
+ * @property null|string $address_city City/District/Suburb/Town/Village.
19
+ * @property null|string $address_country Billing address country, if provided when creating card.
20
+ * @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name).
21
+ * @property null|string $address_line1_check If <code>address_line1</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>.
22
+ * @property null|string $address_line2 Address line 2 (Apartment/Suite/Unit/Building).
23
+ * @property null|string $address_state State/County/Province/Region.
24
+ * @property null|string $address_zip ZIP or postal code.
25
+ * @property null|string $address_zip_check If <code>address_zip</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>.
26
+ * @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the <code>method</code> when creating a payout.
27
+ * @property string $brand Card brand. Can be <code>American Express</code>, <code>Diners Club</code>, <code>Discover</code>, <code>JCB</code>, <code>MasterCard</code>, <code>UnionPay</code>, <code>Visa</code>, or <code>Unknown</code>.
28
+ * @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
29
+ * @property null|string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency.
30
+ * @property null|string|\Stripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
31
+ * @property null|string $cvc_check If a CVC was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see <a href="https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge">Check if a card is valid without a charge</a>.
32
+ * @property null|bool $default_for_currency Whether this card is the default external account for its currency.
33
+ * @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number.
34
+ * @property int $exp_month Two-digit number representing the card's expiration month.
35
+ * @property int $exp_year Four-digit number representing the card's expiration year.
36
+ * @property null|string $fingerprint Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
37
+ * @property string $funding Card funding type. Can be <code>credit</code>, <code>debit</code>, <code>prepaid</code>, or <code>unknown</code>.
38
+ * @property string $last4 The last four digits of the card.
39
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
40
+ * @property null|string $name Cardholder name.
41
+ * @property null|string|\Stripe\Recipient $recipient The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead.
42
+ * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be <code>android_pay</code> (includes Google Pay), <code>apple_pay</code>, <code>masterpass</code>, <code>visa_checkout</code>, or null.
43
  */
44
  class Card extends ApiResource
45
  {
46
+ const OBJECT_NAME = 'card';
47
 
48
  use ApiOperations\Delete;
49
  use ApiOperations\Update;
50
 
51
  /**
52
  * Possible string representations of the CVC check status.
53
+ *
54
+ * @see https://stripe.com/docs/api/cards/object#card_object-cvc_check
55
  */
56
+ const CVC_CHECK_FAIL = 'fail';
57
+ const CVC_CHECK_PASS = 'pass';
58
  const CVC_CHECK_UNAVAILABLE = 'unavailable';
59
+ const CVC_CHECK_UNCHECKED = 'unchecked';
60
 
61
  /**
62
  * Possible string representations of the funding of the card.
63
+ *
64
+ * @see https://stripe.com/docs/api/cards/object#card_object-funding
65
  */
66
+ const FUNDING_CREDIT = 'credit';
67
+ const FUNDING_DEBIT = 'debit';
68
  const FUNDING_PREPAID = 'prepaid';
69
  const FUNDING_UNKNOWN = 'unknown';
70
 
71
  /**
72
  * Possible string representations of the tokenization method when using Apple Pay or Google Pay.
73
+ *
74
+ * @see https://stripe.com/docs/api/cards/object#card_object-tokenization_method
75
  */
76
+ const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay';
77
  const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay';
78
 
79
  /**
96
  $parent = $this['recipient'];
97
  $path = 'cards';
98
  } else {
99
+ $msg = 'Cards cannot be accessed without a customer ID, account ID or recipient ID.';
100
+
101
+ throw new Exception\UnexpectedValueException($msg);
102
  }
103
+ $parentExtn = \urlencode(Util\Util::utf8($parent));
104
+ $extn = \urlencode(Util\Util::utf8($this['id']));
105
+
106
+ return "{$base}/{$parentExtn}/{$path}/{$extn}";
107
  }
108
 
109
  /**
110
  * @param array|string $_id
111
+ * @param null|array|string $_opts
112
  *
113
+ * @throws \Stripe\Exception\BadMethodCallException
114
  */
115
  public static function retrieve($_id, $_opts = null)
116
  {
117
+ $msg = 'Cards cannot be retrieved without a customer ID or an ' .
118
+ 'account ID. Retrieve a card using ' .
119
+ "`Customer::retrieveSource('customer_id', 'card_id')` or " .
120
+ "`Account::retrieveExternalAccount('account_id', 'card_id')`.";
121
+
122
+ throw new Exception\BadMethodCallException($msg);
123
  }
124
 
125
  /**
126
  * @param string $_id
127
+ * @param null|array $_params
128
+ * @param null|array|string $_options
129
  *
130
+ * @throws \Stripe\Exception\BadMethodCallException
131
  */
132
  public static function update($_id, $_params = null, $_options = null)
133
  {
134
+ $msg = 'Cards cannot be updated without a customer ID or an ' .
135
+ 'account ID. Update a card using ' .
136
+ "`Customer::updateSource('customer_id', 'card_id', " .
137
+ '$updateParams)` or `Account::updateExternalAccount(' .
138
+ "'account_id', 'card_id', \$updateParams)`.";
139
+
140
+ throw new Exception\BadMethodCallException($msg);
141
  }
142
  }
app/api/Stripe/Charge.php CHANGED
@@ -1,206 +1,146 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Charge
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $amount_refunded
12
- * @property string $application
13
- * @property string $application_fee
14
- * @property int $application_fee_amount
15
- * @property string $balance_transaction
16
- * @property mixed $billing_details
17
- * @property bool $captured
18
- * @property int $created
19
- * @property string $currency
20
- * @property string $customer
21
- * @property string $description
22
- * @property string $destination
23
- * @property string $dispute
24
- * @property string $failure_code
25
- * @property string $failure_message
26
- * @property mixed $fraud_details
27
- * @property string $invoice
28
- * @property bool $livemode
29
- * @property StripeObject $metadata
30
- * @property string $on_behalf_of
31
- * @property string $order
32
- * @property mixed $outcome
33
- * @property bool $paid
34
- * @property string $payment_intent
35
- * @property string $payment_method
36
- * @property mixed $payment_method_details
37
- * @property string $receipt_email
38
- * @property string $receipt_number
39
- * @property string $receipt_url
40
- * @property bool $refunded
41
- * @property Collection $refunds
42
- * @property string $review
43
- * @property mixed $shipping
44
- * @property mixed $source
45
- * @property string $source_transfer
46
- * @property string $statement_descriptor
47
- * @property string $status
48
- * @property string $transfer
49
- * @property mixed $transfer_data
50
- * @property string $transfer_group
51
  *
52
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  */
54
  class Charge extends ApiResource
55
  {
56
- const OBJECT_NAME = "charge";
57
 
58
  use ApiOperations\All;
59
  use ApiOperations\Create;
60
  use ApiOperations\Retrieve;
61
  use ApiOperations\Update;
62
 
63
- /**
64
- * Possible string representations of decline codes.
65
- * These strings are applicable to the decline_code property of the \Stripe\Error\Card exception.
66
- * @link https://stripe.com/docs/declines/codes
67
- */
68
- const DECLINED_APPROVE_WITH_ID = 'approve_with_id';
69
- const DECLINED_CALL_ISSUER = 'call_issuer';
70
- const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported';
71
- const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded';
72
- const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported';
73
- const DECLINED_DO_NOT_HONOR = 'do_not_honor';
74
- const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again';
75
- const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction';
76
- const DECLINED_EXPIRED_CARD = 'expired_card';
77
- const DECLINED_FRAUDULENT = 'fraudulent';
78
- const DECLINED_GENERIC_DECLINE = 'generic_decline';
79
- const DECLINED_INCORRECT_NUMBER = 'incorrect_number';
80
- const DECLINED_INCORRECT_CVC = 'incorrect_cvc';
81
- const DECLINED_INCORRECT_PIN = 'incorrect_pin';
82
- const DECLINED_INCORRECT_ZIP = 'incorrect_zip';
83
- const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds';
84
- const DECLINED_INVALID_ACCOUNT = 'invalid_account';
85
- const DECLINED_INVALID_AMOUNT = 'invalid_amount';
86
- const DECLINED_INVALID_CVC = 'invalid_cvc';
87
- const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
88
- const DECLINED_INVALID_NUMBER = 'invalid_number';
89
- const DECLINED_INVALID_PIN = 'invalid_pin';
90
- const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
91
- const DECLINED_LOST_CARD = 'lost_card';
92
- const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist';
93
- const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
94
- const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
95
- const DECLINED_NOT_PERMITTED = 'not_permitted';
96
- const DECLINED_PICKUP_CARD = 'pickup_card';
97
- const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded';
98
- const DECLINED_PROCESSING_ERROR = 'processing_error';
99
- const DECLINED_REENTER_TRANSACTION = 'reenter_transaction';
100
- const DECLINED_RESTRICTED_CARD = 'restricted_card';
101
- const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations';
102
- const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization';
103
- const DECLINED_SECURITY_VIOLATION = 'security_violation';
104
- const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed';
105
- const DECLINED_STOLEN_CARD = 'stolen_card';
106
- const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order';
107
- const DECLINED_TESTMODE_DECLINE = 'testmode_decline';
108
- const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed';
109
- const DECLINED_TRY_AGAIN_LATER = 'try_again_later';
110
- const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded';
111
-
112
- /**
113
- * Possible string representations of the status of the charge.
114
- * @link https://stripe.com/docs/api/charges/object#charge_object-status
115
- */
116
- const STATUS_FAILED = 'failed';
117
- const STATUS_PENDING = 'pending';
118
  const STATUS_SUCCEEDED = 'succeeded';
119
 
120
  /**
121
- * @param array|null $params
122
- * @param array|string|null $options
123
- *
124
- * @return Charge The refunded charge.
125
- */
126
- public function refund($params = null, $options = null)
127
- {
128
- $url = $this->instanceUrl() . '/refund';
129
- list($response, $opts) = $this->_request('post', $url, $params, $options);
130
- $this->refreshFrom($response, $opts);
131
- return $this;
132
- }
133
-
134
- /**
135
- * @param array|null $params
136
- * @param array|string|null $options
137
- *
138
- * @return Charge The captured charge.
139
- */
140
- public function capture($params = null, $options = null)
141
- {
142
- $url = $this->instanceUrl() . '/capture';
143
- list($response, $opts) = $this->_request('post', $url, $params, $options);
144
- $this->refreshFrom($response, $opts);
145
- return $this;
146
- }
147
-
148
- /**
149
- * @param array|null $params
150
- * @param array|string|null $options
151
- *
152
- * @deprecated Use the `save` method on the Dispute object
153
  *
154
- * @return array The updated dispute.
155
  */
156
- public function updateDispute($params = null, $options = null)
157
- {
158
- $url = $this->instanceUrl() . '/dispute';
159
- list($response, $opts) = $this->_request('post', $url, $params, $options);
160
- $this->refreshFrom(['dispute' => $response], $opts, true);
161
- return $this->dispute;
162
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  /**
165
- * @param array|string|null $options
 
166
  *
167
- * @deprecated Use the `close` method on the Dispute object
168
  *
169
- * @return Charge The updated charge.
170
  */
171
- public function closeDispute($options = null)
172
  {
173
- $url = $this->instanceUrl() . '/dispute/close';
174
- list($response, $opts) = $this->_request('post', $url, null, $options);
175
- $this->refreshFrom($response, $opts);
176
- return $this;
177
- }
178
-
179
- /**
180
- * @param array|string|null $opts
181
- *
182
- * @return Charge The updated charge.
183
- */
184
- public function markAsFraudulent($opts = null)
185
- {
186
- $params = ['fraud_details' => ['user_report' => 'fraudulent']];
187
- $url = $this->instanceUrl();
188
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
189
  $this->refreshFrom($response, $opts);
190
- return $this;
191
- }
192
 
193
- /**
194
- * @param array|string|null $opts
195
- *
196
- * @return Charge The updated charge.
197
- */
198
- public function markAsSafe($opts = null)
199
- {
200
- $params = ['fraud_details' => ['user_report' => 'safe']];
201
- $url = $this->instanceUrl();
202
- list($response, $opts) = $this->_request('post', $url, $params, $opts);
203
- $this->refreshFrom($response, $opts);
204
  return $this;
205
  }
206
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * To charge a credit or a debit card, you create a <code>Charge</code> object. You
9
+ * can retrieve and refund individual charges as well as list all charges. Charges
10
+ * are identified by a unique, random ID.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/payments/accept-a-payment-charges">Accept a
14
+ * payment with the Charges API</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount Amount intended to be collected by this payment. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
19
+ * @property int $amount_captured Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made).
20
+ * @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued).
21
+ * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the charge.
22
+ * @property null|string|\Stripe\ApplicationFee $application_fee The application fee (if any) for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
23
+ * @property null|int $application_fee_amount The amount of the application fee (if any) requested for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
24
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
25
+ * @property \Stripe\StripeObject $billing_details
26
+ * @property null|string $calculated_statement_descriptor The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
27
+ * @property bool $captured If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured.
28
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
29
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
30
+ * @property null|string|\Stripe\Customer $customer ID of the customer this charge is for if one exists.
31
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
32
+ * @property null|string|\Stripe\Account $destination ID of an existing, connected Stripe account to transfer funds to if <code>transfer_data</code> was specified in the charge request.
33
+ * @property null|string|\Stripe\Dispute $dispute Details about the dispute if the charge has been disputed.
34
+ * @property bool $disputed Whether the charge has been disputed.
35
+ * @property null|string $failure_code Error code explaining reason for charge failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes).
36
+ * @property null|string $failure_message Message to user further explaining reason for charge failure if available.
37
+ * @property null|\Stripe\StripeObject $fraud_details Information on fraud assessments for the charge.
38
+ * @property null|string|\Stripe\Invoice $invoice ID of the invoice this charge is for if one exists.
39
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
40
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
41
+ * @property null|string|\Stripe\Account $on_behalf_of The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the <a href="https://stripe.com/docs/connect/charges-transfers">Connect documentation</a> for details.
42
+ * @property null|string|\Stripe\Order $order ID of the order this charge is for if one exists.
43
+ * @property null|\Stripe\StripeObject $outcome Details about whether the payment was accepted, and why. See <a href="https://stripe.com/docs/declines">understanding declines</a> for details.
44
+ * @property bool $paid <code>true</code> if the charge succeeded, or was successfully authorized for later capture.
45
+ * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent associated with this charge, if one exists.
46
+ * @property null|string $payment_method ID of the payment method used in this charge.
47
+ * @property null|\Stripe\StripeObject $payment_method_details Details about the payment method at the time of the transaction.
48
+ * @property null|string $receipt_email This is the email address that the receipt for this charge was sent to.
49
+ * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this charge. This attribute will be <code>null</code> until a receipt has been sent.
50
+ * @property null|string $receipt_url This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt.
51
+ * @property bool $refunded Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
52
+ * @property \Stripe\Collection $refunds A list of refunds that have been applied to the charge.
53
+ * @property null|string|\Stripe\Review $review ID of the review associated with this charge if one exists.
54
+ * @property null|\Stripe\StripeObject $shipping Shipping information for the charge.
55
+ * @property null|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to <code>payment_method</code> or <code>payment_method_details</code> instead.
56
+ * @property null|string|\Stripe\Transfer $source_transfer The transfer ID which created this charge. Only present if the charge came from another Stripe account. <a href="https://stripe.com/docs/connect/destination-charges">See the Connect documentation</a> for details.
57
+ * @property null|string $statement_descriptor For card charges, use <code>statement_descriptor_suffix</code> instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.
58
+ * @property null|string $statement_descriptor_suffix Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
59
+ * @property string $status The status of the payment is either <code>succeeded</code>, <code>pending</code>, or <code>failed</code>.
60
+ * @property string|\Stripe\Transfer $transfer ID of the transfer to the <code>destination</code> account (only applicable if the charge was created using the <code>destination</code> parameter).
61
+ * @property null|\Stripe\StripeObject $transfer_data An optional dictionary including the account to automatically transfer to as part of a destination charge. <a href="https://stripe.com/docs/connect/destination-charges">See the Connect documentation</a> for details.
62
+ * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the <a href="https://stripe.com/docs/connect/charges-transfers#transfer-options">Connect documentation</a> for details.
63
  */
64
  class Charge extends ApiResource
65
  {
66
+ const OBJECT_NAME = 'charge';
67
 
68
  use ApiOperations\All;
69
  use ApiOperations\Create;
70
  use ApiOperations\Retrieve;
71
  use ApiOperations\Update;
72
 
73
+ const STATUS_FAILED = 'failed';
74
+ const STATUS_PENDING = 'pending';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  const STATUS_SUCCEEDED = 'succeeded';
76
 
77
  /**
78
+ * Possible string representations of decline codes.
79
+ * These strings are applicable to the decline_code property of the \Stripe\Exception\CardException exception.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  *
81
+ * @see https://stripe.com/docs/declines/codes
82
  */
83
+ const DECLINED_AUTHENTICATION_REQUIRED = 'authentication_required';
84
+ const DECLINED_APPROVE_WITH_ID = 'approve_with_id';
85
+ const DECLINED_CALL_ISSUER = 'call_issuer';
86
+ const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported';
87
+ const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded';
88
+ const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported';
89
+ const DECLINED_DO_NOT_HONOR = 'do_not_honor';
90
+ const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again';
91
+ const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction';
92
+ const DECLINED_EXPIRED_CARD = 'expired_card';
93
+ const DECLINED_FRAUDULENT = 'fraudulent';
94
+ const DECLINED_GENERIC_DECLINE = 'generic_decline';
95
+ const DECLINED_INCORRECT_NUMBER = 'incorrect_number';
96
+ const DECLINED_INCORRECT_CVC = 'incorrect_cvc';
97
+ const DECLINED_INCORRECT_PIN = 'incorrect_pin';
98
+ const DECLINED_INCORRECT_ZIP = 'incorrect_zip';
99
+ const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds';
100
+ const DECLINED_INVALID_ACCOUNT = 'invalid_account';
101
+ const DECLINED_INVALID_AMOUNT = 'invalid_amount';
102
+ const DECLINED_INVALID_CVC = 'invalid_cvc';
103
+ const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
104
+ const DECLINED_INVALID_NUMBER = 'invalid_number';
105
+ const DECLINED_INVALID_PIN = 'invalid_pin';
106
+ const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
107
+ const DECLINED_LOST_CARD = 'lost_card';
108
+ const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist';
109
+ const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
110
+ const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
111
+ const DECLINED_NOT_PERMITTED = 'not_permitted';
112
+ const DECLINED_OFFLINE_PIN_REQUIRED = 'offline_pin_required';
113
+ const DECLINED_ONLINE_OR_OFFLINE_PIN_REQUIRED = 'online_or_offline_pin_required';
114
+ const DECLINED_PICKUP_CARD = 'pickup_card';
115
+ const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded';
116
+ const DECLINED_PROCESSING_ERROR = 'processing_error';
117
+ const DECLINED_REENTER_TRANSACTION = 'reenter_transaction';
118
+ const DECLINED_RESTRICTED_CARD = 'restricted_card';
119
+ const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations';
120
+ const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization';
121
+ const DECLINED_SECURITY_VIOLATION = 'security_violation';
122
+ const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed';
123
+ const DECLINED_STOLEN_CARD = 'stolen_card';
124
+ const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order';
125
+ const DECLINED_TESTMODE_DECLINE = 'testmode_decline';
126
+ const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed';
127
+ const DECLINED_TRY_AGAIN_LATER = 'try_again_later';
128
+ const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded';
129
 
130
  /**
131
+ * @param null|array $params
132
+ * @param null|array|string $opts
133
  *
134
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
135
  *
136
+ * @return Charge the captured charge
137
  */
138
+ public function capture($params = null, $opts = null)
139
  {
140
+ $url = $this->instanceUrl() . '/capture';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
142
  $this->refreshFrom($response, $opts);
 
 
143
 
 
 
 
 
 
 
 
 
 
 
 
144
  return $this;
145
  }
146
  }
app/api/Stripe/Checkout/Session.php CHANGED
@@ -1,39 +1,89 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Checkout;
4
 
5
  /**
6
- * Class Session
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $cancel_url
11
- * @property string $client_reference_id
12
- * @property string $customer
13
- * @property string $customer_email
14
- * @property mixed $display_items
15
- * @property bool $livemode
16
- * @property string $payment_intent
17
- * @property string[] $payment_method_types
18
- * @property string $submit_type
19
- * @property string $subscription
20
- * @property string $success_url
21
  *
22
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  */
24
  class Session extends \Stripe\ApiResource
25
  {
26
- const OBJECT_NAME = "checkout.session";
27
 
 
28
  use \Stripe\ApiOperations\Create;
 
29
  use \Stripe\ApiOperations\Retrieve;
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  /**
32
- * Possible string representations of submit type.
33
- * @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type
 
 
 
 
 
34
  */
35
- const SUBMIT_TYPE_AUTO = 'auto';
36
- const SUBMIT_TYPE_BOOK = 'book';
37
- const SUBMIT_TYPE_DONATE = 'donate';
38
- const SUBMIT_TYPE_PAY = 'pay';
39
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Checkout;
6
 
7
  /**
8
+ * A Checkout Session represents your customer's session as they pay for one-time
9
+ * purchases or subscriptions through <a
10
+ * href="https://stripe.com/docs/payments/checkout">Checkout</a>. We recommend
11
+ * creating a new Session each time your customer attempts to pay.
12
+ *
13
+ * Once payment is successful, the Checkout Session will contain a reference to the
14
+ * <a href="https://stripe.com/docs/api/customers">Customer</a>, and either the
15
+ * successful <a
16
+ * href="https://stripe.com/docs/api/payment_intents">PaymentIntent</a> or an
17
+ * active <a href="https://stripe.com/docs/api/subscriptions">Subscription</a>.
18
  *
19
+ * You can create a Checkout Session on your server and pass its ID to the client
20
+ * to begin Checkout.
 
 
 
 
 
 
 
 
 
 
 
21
  *
22
+ * Related guide: <a href="https://stripe.com/docs/payments/checkout/api">Checkout
23
+ * Server Quickstart</a>.
24
+ *
25
+ * @property string $id Unique identifier for the object. Used to pass to <code>redirectToCheckout</code> in Stripe.js.
26
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
27
+ * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes.
28
+ * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied.
29
+ * @property null|int $amount_total Total of all items after discounts and taxes are applied.
30
+ * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address.
31
+ * @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website.
32
+ * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.
33
+ * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
34
+ * @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.
35
+ * @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs.
36
+ * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the <code>customer</code> attribute.
37
+ * @property \Stripe\Collection $line_items The line items purchased by the customer.
38
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
39
+ * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used.
40
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
41
+ * @property string $mode The mode of the Checkout Session.
42
+ * @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in <code>payment</code> mode.
43
+ * @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
44
+ * @property string $payment_status The payment status of the Checkout Session, one of <code>paid</code>, <code>unpaid</code>, or <code>no_payment_required</code>. You can use this value to decide when to fulfill your customer's order.
45
+ * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in <code>setup</code> mode.
46
+ * @property null|\Stripe\StripeObject $shipping Shipping information for this Checkout Session.
47
+ * @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer.
48
+ * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode, but not Checkout Sessions in <code>subscription</code> or <code>setup</code> mode.
49
+ * @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in <code>subscription</code> mode.
50
+ * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
51
+ * @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount.
52
  */
53
  class Session extends \Stripe\ApiResource
54
  {
55
+ const OBJECT_NAME = 'checkout.session';
56
 
57
+ use \Stripe\ApiOperations\All;
58
  use \Stripe\ApiOperations\Create;
59
+ use \Stripe\ApiOperations\NestedResource;
60
  use \Stripe\ApiOperations\Retrieve;
61
 
62
+ const BILLING_ADDRESS_COLLECTION_AUTO = 'auto';
63
+ const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required';
64
+
65
+ const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required';
66
+ const PAYMENT_STATUS_PAID = 'paid';
67
+ const PAYMENT_STATUS_UNPAID = 'unpaid';
68
+
69
+ const SUBMIT_TYPE_AUTO = 'auto';
70
+ const SUBMIT_TYPE_BOOK = 'book';
71
+ const SUBMIT_TYPE_DONATE = 'donate';
72
+ const SUBMIT_TYPE_PAY = 'pay';
73
+
74
+ const PATH_LINE_ITEMS = '/line_items';
75
+
76
  /**
77
+ * @param string $id the ID of the session on which to retrieve the items
78
+ * @param null|array $params
79
+ * @param null|array|string $opts
80
+ *
81
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
82
+ *
83
+ * @return \Stripe\Collection the list of items
84
  */
85
+ public static function allLineItems($id, $params = null, $opts = null)
86
+ {
87
+ return self::_allNestedResources($id, static::PATH_LINE_ITEMS, $params, $opts);
88
+ }
89
  }
app/api/Stripe/Collection.php CHANGED
@@ -3,73 +3,118 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Collection
7
  *
8
  * @property string $object
9
  * @property string $url
10
  * @property bool $has_more
11
- * @property mixed $data
12
- *
13
- * @package Stripe
14
  */
15
- class Collection extends StripeObject implements \IteratorAggregate
16
  {
17
- const OBJECT_NAME = "list";
18
 
19
  use ApiOperations\Request;
20
 
21
- protected $_requestParams = [];
 
22
 
23
  /**
24
- * @return string The base URL for the given class.
25
  */
26
  public static function baseUrl()
27
  {
28
  return Stripe::$apiBase;
29
  }
30
 
31
- public function setRequestParams($params)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  {
33
- $this->_requestParams = $params;
 
 
 
 
 
 
 
 
34
  }
35
 
36
  public function all($params = null, $opts = null)
37
  {
 
38
  list($url, $params) = $this->extractPathAndUpdateParams($params);
39
 
40
  list($response, $opts) = $this->_request('get', $url, $params, $opts);
41
- $this->_requestParams = $params;
42
- return Util\Util::convertToStripeObject($response, $opts);
 
 
 
 
 
 
 
43
  }
44
 
45
  public function create($params = null, $opts = null)
46
  {
 
47
  list($url, $params) = $this->extractPathAndUpdateParams($params);
48
 
49
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
50
- $this->_requestParams = $params;
51
  return Util\Util::convertToStripeObject($response, $opts);
52
  }
53
 
54
  public function retrieve($id, $params = null, $opts = null)
55
  {
 
56
  list($url, $params) = $this->extractPathAndUpdateParams($params);
57
 
58
  $id = Util\Util::utf8($id);
59
- $extn = urlencode($id);
60
  list($response, $opts) = $this->_request(
61
  'get',
62
- "$url/$extn",
63
  $params,
64
  $opts
65
  );
66
- $this->_requestParams = $params;
67
  return Util\Util::convertToStripeObject($response, $opts);
68
  }
69
 
70
  /**
71
- * @return \ArrayIterator An iterator that can be used to iterate
72
- * across objects in the current page.
 
 
 
 
 
 
 
 
73
  */
74
  public function getIterator()
75
  {
@@ -77,29 +122,158 @@ class Collection extends StripeObject implements \IteratorAggregate
77
  }
78
 
79
  /**
80
- * @return Util\AutoPagingIterator An iterator that can be used to iterate
81
- * across all objects across all pages. As page boundaries are
 
 
 
 
 
 
 
 
 
82
  * encountered, the next page will be fetched automatically for
83
  * continued iteration.
84
  */
85
  public function autoPagingIterator()
86
  {
87
- return new Util\AutoPagingIterator($this, $this->_requestParams);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  private function extractPathAndUpdateParams($params)
91
  {
92
- $url = parse_url($this->url);
93
  if (!isset($url['path'])) {
94
- throw new Error\Api("Could not parse list url into parts: $url");
95
  }
96
 
97
  if (isset($url['query'])) {
98
  // If the URL contains a query param, parse it out into $params so they
99
  // don't interact weirdly with each other.
100
  $query = [];
101
- parse_str($url['query'], $query);
102
- $params = array_merge($params ?: [], $query);
103
  }
104
 
105
  return [$url['path'], $params];
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class Collection.
7
  *
8
  * @property string $object
9
  * @property string $url
10
  * @property bool $has_more
11
+ * @property \Stripe\StripeObject[] $data
 
 
12
  */
13
+ class Collection extends StripeObject implements \Countable, \IteratorAggregate
14
  {
15
+ const OBJECT_NAME = 'list';
16
 
17
  use ApiOperations\Request;
18
 
19
+ /** @var array */
20
+ protected $filters = [];
21
 
22
  /**
23
+ * @return string the base URL for the given class
24
  */
25
  public static function baseUrl()
26
  {
27
  return Stripe::$apiBase;
28
  }
29
 
30
+ /**
31
+ * Returns the filters.
32
+ *
33
+ * @return array the filters
34
+ */
35
+ public function getFilters()
36
+ {
37
+ return $this->filters;
38
+ }
39
+
40
+ /**
41
+ * Sets the filters, removing paging options.
42
+ *
43
+ * @param array $filters the filters
44
+ */
45
+ public function setFilters($filters)
46
+ {
47
+ $this->filters = $filters;
48
+ }
49
+
50
+ public function offsetGet($k)
51
  {
52
+ if (\is_string($k)) {
53
+ return parent::offsetGet($k);
54
+ }
55
+ $msg = "You tried to access the {$k} index, but Collection " .
56
+ 'types only support string keys. (HINT: List calls ' .
57
+ 'return an object with a `data` (which is the data ' .
58
+ "array). You likely want to call ->data[{$k}])";
59
+
60
+ throw new Exception\InvalidArgumentException($msg);
61
  }
62
 
63
  public function all($params = null, $opts = null)
64
  {
65
+ self::_validateParams($params);
66
  list($url, $params) = $this->extractPathAndUpdateParams($params);
67
 
68
  list($response, $opts) = $this->_request('get', $url, $params, $opts);
69
+ $obj = Util\Util::convertToStripeObject($response, $opts);
70
+ if (!($obj instanceof \Stripe\Collection)) {
71
+ throw new \Stripe\Exception\UnexpectedValueException(
72
+ 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
73
+ );
74
+ }
75
+ $obj->setFilters($params);
76
+
77
+ return $obj;
78
  }
79
 
80
  public function create($params = null, $opts = null)
81
  {
82
+ self::_validateParams($params);
83
  list($url, $params) = $this->extractPathAndUpdateParams($params);
84
 
85
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
86
+
87
  return Util\Util::convertToStripeObject($response, $opts);
88
  }
89
 
90
  public function retrieve($id, $params = null, $opts = null)
91
  {
92
+ self::_validateParams($params);
93
  list($url, $params) = $this->extractPathAndUpdateParams($params);
94
 
95
  $id = Util\Util::utf8($id);
96
+ $extn = \urlencode($id);
97
  list($response, $opts) = $this->_request(
98
  'get',
99
+ "{$url}/{$extn}",
100
  $params,
101
  $opts
102
  );
103
+
104
  return Util\Util::convertToStripeObject($response, $opts);
105
  }
106
 
107
  /**
108
+ * @return int the number of objects in the current page
109
+ */
110
+ public function count()
111
+ {
112
+ return \count($this->data);
113
+ }
114
+
115
+ /**
116
+ * @return \ArrayIterator an iterator that can be used to iterate
117
+ * across objects in the current page
118
  */
119
  public function getIterator()
120
  {
122
  }
123
 
124
  /**
125
+ * @return \ArrayIterator an iterator that can be used to iterate
126
+ * backwards across objects in the current page
127
+ */
128
+ public function getReverseIterator()
129
+ {
130
+ return new \ArrayIterator(\array_reverse($this->data));
131
+ }
132
+
133
+ /**
134
+ * @return \Generator|StripeObject[] A generator that can be used to
135
+ * iterate across all objects across all pages. As page boundaries are
136
  * encountered, the next page will be fetched automatically for
137
  * continued iteration.
138
  */
139
  public function autoPagingIterator()
140
  {
141
+ $page = $this;
142
+
143
+ while (true) {
144
+ $filters = $this->filters ?: [];
145
+ if (\array_key_exists('ending_before', $filters)
146
+ && !\array_key_exists('starting_after', $filters)) {
147
+ foreach ($page->getReverseIterator() as $item) {
148
+ yield $item;
149
+ }
150
+ $page = $page->previousPage();
151
+ } else {
152
+ foreach ($page as $item) {
153
+ yield $item;
154
+ }
155
+ $page = $page->nextPage();
156
+ }
157
+
158
+ if ($page->isEmpty()) {
159
+ break;
160
+ }
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Returns an empty collection. This is returned from {@see nextPage()}
166
+ * when we know that there isn't a next page in order to replicate the
167
+ * behavior of the API when it attempts to return a page beyond the last.
168
+ *
169
+ * @param null|array|string $opts
170
+ *
171
+ * @return Collection
172
+ */
173
+ public static function emptyCollection($opts = null)
174
+ {
175
+ return Collection::constructFrom(['data' => []], $opts);
176
+ }
177
+
178
+ /**
179
+ * Returns true if the page object contains no element.
180
+ *
181
+ * @return bool
182
+ */
183
+ public function isEmpty()
184
+ {
185
+ return empty($this->data);
186
+ }
187
+
188
+ /**
189
+ * Fetches the next page in the resource list (if there is one).
190
+ *
191
+ * This method will try to respect the limit of the current page. If none
192
+ * was given, the default limit will be fetched again.
193
+ *
194
+ * @param null|array $params
195
+ * @param null|array|string $opts
196
+ *
197
+ * @return Collection
198
+ */
199
+ public function nextPage($params = null, $opts = null)
200
+ {
201
+ if (!$this->has_more) {
202
+ return static::emptyCollection($opts);
203
+ }
204
+
205
+ $lastId = \end($this->data)->id;
206
+
207
+ $params = \array_merge(
208
+ $this->filters ?: [],
209
+ ['starting_after' => $lastId],
210
+ $params ?: []
211
+ );
212
+
213
+ return $this->all($params, $opts);
214
+ }
215
+
216
+ /**
217
+ * Fetches the previous page in the resource list (if there is one).
218
+ *
219
+ * This method will try to respect the limit of the current page. If none
220
+ * was given, the default limit will be fetched again.
221
+ *
222
+ * @param null|array $params
223
+ * @param null|array|string $opts
224
+ *
225
+ * @return Collection
226
+ */
227
+ public function previousPage($params = null, $opts = null)
228
+ {
229
+ if (!$this->has_more) {
230
+ return static::emptyCollection($opts);
231
+ }
232
+
233
+ $firstId = $this->data[0]->id;
234
+
235
+ $params = \array_merge(
236
+ $this->filters ?: [],
237
+ ['ending_before' => $firstId],
238
+ $params ?: []
239
+ );
240
+
241
+ return $this->all($params, $opts);
242
+ }
243
+
244
+ /**
245
+ * Gets the first item from the current page. Returns `null` if the current page is empty.
246
+ *
247
+ * @return null|\Stripe\StripeObject
248
+ */
249
+ public function first()
250
+ {
251
+ return \count($this->data) > 0 ? $this->data[0] : null;
252
+ }
253
+
254
+ /**
255
+ * Gets the last item from the current page. Returns `null` if the current page is empty.
256
+ *
257
+ * @return null|\Stripe\StripeObject
258
+ */
259
+ public function last()
260
+ {
261
+ return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null;
262
  }
263
 
264
  private function extractPathAndUpdateParams($params)
265
  {
266
+ $url = \parse_url($this->url);
267
  if (!isset($url['path'])) {
268
+ throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}");
269
  }
270
 
271
  if (isset($url['query'])) {
272
  // If the URL contains a query param, parse it out into $params so they
273
  // don't interact weirdly with each other.
274
  $query = [];
275
+ \parse_str($url['query'], $query);
276
+ $params = \array_merge($params ?: [], $query);
277
  }
278
 
279
  return [$url['path'], $params];
app/api/Stripe/CountrySpec.php CHANGED
@@ -1,24 +1,29 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class CountrySpec
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $default_currency
11
- * @property mixed $supported_bank_account_currencies
12
- * @property string[] $supported_payment_currencies
13
- * @property string[] $supported_payment_methods
14
- * @property string[] $supported_transfer_countries
15
- * @property mixed $verification_fields
16
  *
17
- * @package Stripe
 
 
 
 
 
 
 
18
  */
19
  class CountrySpec extends ApiResource
20
  {
21
- const OBJECT_NAME = "country_spec";
22
 
23
  use ApiOperations\All;
24
  use ApiOperations\Retrieve;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Stripe needs to collect certain pieces of information about each account
9
+ * created. These requirements can differ depending on the account's country. The
10
+ * Country Specs API makes these rules available to your integration.
11
  *
12
+ * You can also view the information from this API call as <a
13
+ * href="/docs/connect/required-verification-information">an online guide</a>.
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object. Represented as the ISO country code for this country.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property string $default_currency The default currency for this country. This applies to both payment methods and bank accounts.
18
+ * @property \Stripe\StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers).
19
+ * @property string[] $supported_payment_currencies Currencies that can be accepted in the specified country (for payments).
20
+ * @property string[] $supported_payment_methods Payment methods available in the specified country. You may need to enable some payment methods (e.g., <a href="https://stripe.com/docs/ach">ACH</a>) on your account before they appear in this list. The <code>stripe</code> payment method refers to <a href="https://stripe.com/docs/connect/destination-charges">charging through your platform</a>.
21
+ * @property string[] $supported_transfer_countries Countries that can accept transfers from the specified country.
22
+ * @property \Stripe\StripeObject $verification_fields
23
  */
24
  class CountrySpec extends ApiResource
25
  {
26
+ const OBJECT_NAME = 'country_spec';
27
 
28
  use ApiOperations\All;
29
  use ApiOperations\Retrieve;
app/api/Stripe/Coupon.php CHANGED
@@ -1,31 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Coupon
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount_off
11
- * @property int $created
12
- * @property string $currency
13
- * @property string $duration
14
- * @property int $duration_in_months
15
- * @property bool $livemode
16
- * @property int $max_redemptions
17
- * @property StripeObject $metadata
18
- * @property string $name
19
- * @property float $percent_off
20
- * @property int $redeem_by
21
- * @property int $times_redeemed
22
- * @property bool $valid
23
  *
24
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  */
26
  class Coupon extends ApiResource
27
  {
28
- const OBJECT_NAME = "coupon";
29
 
30
  use ApiOperations\All;
31
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A coupon contains information about a percent-off or amount-off discount you
9
+ * might want to apply to a customer. Coupons may be applied to <a
10
+ * href="https://stripe.com/docs/api#invoices">invoices</a> or <a
11
+ * href="https://stripe.com/docs/api#create_order-coupon">orders</a>. Coupons do
12
+ * not work with conventional one-off <a
13
+ * href="https://stripe.com/docs/api#create_charge">charges</a>.
 
 
 
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property null|int $amount_off Amount (in the <code>currency</code> specified) that will be taken off the subtotal of any invoices for this customer.
18
+ * @property \Stripe\StripeObject $applies_to
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property null|string $currency If <code>amount_off</code> has been set, the three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> of the amount to take off.
21
+ * @property string $duration One of <code>forever</code>, <code>once</code>, and <code>repeating</code>. Describes how long a customer who applies this coupon will get the discount.
22
+ * @property null|int $duration_in_months If <code>duration</code> is <code>repeating</code>, the number of months the coupon applies. Null if coupon <code>duration</code> is <code>forever</code> or <code>once</code>.
23
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
24
+ * @property null|int $max_redemptions Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
25
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
26
+ * @property null|string $name Name of the coupon displayed to customers on for instance invoices or receipts.
27
+ * @property null|float $percent_off Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.
28
+ * @property null|int $redeem_by Date after which the coupon can no longer be redeemed.
29
+ * @property int $times_redeemed Number of times this coupon has been applied to a customer.
30
+ * @property bool $valid Taking account of the above properties, whether this coupon can still be applied to a customer.
31
  */
32
  class Coupon extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'coupon';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
app/api/Stripe/CreditNote.php CHANGED
@@ -1,73 +1,111 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class CreditNote
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $customer_balance_transaction
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $customer
15
- * @property string $invoice
16
- * @property bool $livemode
17
- * @property string $memo
18
- * @property StripeObject $metadata
19
- * @property string $number
20
- * @property string $pdf
21
- * @property string $reason
22
- * @property string $refund
23
- * @property string $status
24
- * @property string $type
25
  *
26
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  */
28
  class CreditNote extends ApiResource
29
  {
30
- const OBJECT_NAME = "credit_note";
31
 
32
  use ApiOperations\All;
33
  use ApiOperations\Create;
 
34
  use ApiOperations\Retrieve;
35
  use ApiOperations\Update;
36
 
37
- /**
38
- * Possible string representations of the credit note reason.
39
- * @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-reason
40
- */
41
- const REASON_DUPLICATE = 'duplicate';
42
- const REASON_FRAUDULENT = 'fraudulent';
43
- const REASON_ORDER_CHANGE = 'order_change';
44
  const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory';
45
 
46
- /**
47
- * Possible string representations of the credit note status.
48
- * @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
49
- */
50
  const STATUS_ISSUED = 'issued';
51
- const STATUS_VOID = 'void';
 
 
 
52
 
53
  /**
54
- * Possible string representations of the credit note type.
55
- * @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
 
 
 
 
56
  */
57
- const TYPE_POST_PAYMENT = 'post_payment';
58
- const TYPE_PRE_PAYMENT = 'pre_payment';
 
 
 
 
 
 
 
59
 
60
  /**
61
- * @param array|null $params
62
- * @param array|string|null $opts
 
 
63
  *
64
- * @return CreditNote The voided credit note.
65
  */
66
  public function voidCreditNote($params = null, $opts = null)
67
  {
68
  $url = $this->instanceUrl() . '/void';
69
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
70
  $this->refreshFrom($response, $opts);
 
71
  return $this;
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Issue a credit note to adjust an invoice's amount after the invoice is
9
+ * finalized.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/billing/invoices/credit-notes">Credit Notes</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property int $amount The integer amount in %s representing the total amount of the credit note, including tax.
17
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
19
+ * @property string|\Stripe\Customer $customer ID of the customer.
20
+ * @property null|string|\Stripe\CustomerBalanceTransaction $customer_balance_transaction Customer balance transaction related to this credit note.
21
+ * @property int $discount_amount The integer amount in %s representing the total amount of discount that was credited.
22
+ * @property \Stripe\StripeObject[] $discount_amounts The aggregate amounts calculated per discount for all line items.
23
+ * @property string|\Stripe\Invoice $invoice ID of the invoice.
24
+ * @property \Stripe\Collection $lines Line items that make up the credit note
25
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
26
+ * @property null|string $memo Customer-facing text that appears on the credit note PDF.
27
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
28
+ * @property string $number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
29
+ * @property null|int $out_of_band_amount Amount that was credited outside of Stripe.
30
+ * @property string $pdf The link to download the PDF of the credit note.
31
+ * @property null|string $reason Reason for issuing this credit note, one of <code>duplicate</code>, <code>fraudulent</code>, <code>order_change</code>, or <code>product_unsatisfactory</code>
32
+ * @property null|string|\Stripe\Refund $refund Refund related to this credit note.
33
+ * @property string $status Status of this credit note, one of <code>issued</code> or <code>void</code>. Learn more about <a href="https://stripe.com/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
34
+ * @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding tax and invoice level discounts.
35
+ * @property \Stripe\StripeObject[] $tax_amounts The aggregate amounts calculated per tax rate for all line items.
36
+ * @property int $total The integer amount in %s representing the total amount of the credit note, including tax and all discount.
37
+ * @property string $type Type of this credit note, one of <code>pre_payment</code> or <code>post_payment</code>. A <code>pre_payment</code> credit note means it was issued when the invoice was open. A <code>post_payment</code> credit note means it was issued when the invoice was paid.
38
+ * @property null|int $voided_at The time that the credit note was voided.
39
  */
40
  class CreditNote extends ApiResource
41
  {
42
+ const OBJECT_NAME = 'credit_note';
43
 
44
  use ApiOperations\All;
45
  use ApiOperations\Create;
46
+ use ApiOperations\NestedResource;
47
  use ApiOperations\Retrieve;
48
  use ApiOperations\Update;
49
 
50
+ const REASON_DUPLICATE = 'duplicate';
51
+ const REASON_FRAUDULENT = 'fraudulent';
52
+ const REASON_ORDER_CHANGE = 'order_change';
 
 
 
 
53
  const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory';
54
 
 
 
 
 
55
  const STATUS_ISSUED = 'issued';
56
+ const STATUS_VOID = 'void';
57
+
58
+ const TYPE_POST_PAYMENT = 'post_payment';
59
+ const TYPE_PRE_PAYMENT = 'pre_payment';
60
 
61
  /**
62
+ * @param null|array $params
63
+ * @param null|array|string $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\CreditNote the previewed credit note
68
  */
69
+ public static function preview($params = null, $opts = null)
70
+ {
71
+ $url = static::classUrl() . '/preview';
72
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
73
+ $obj = Util\Util::convertToStripeObject($response->json, $opts);
74
+ $obj->setLastResponse($response);
75
+
76
+ return $obj;
77
+ }
78
 
79
  /**
80
+ * @param null|array $params
81
+ * @param null|array|string $opts
82
+ *
83
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
84
  *
85
+ * @return CreditNote the voided credit note
86
  */
87
  public function voidCreditNote($params = null, $opts = null)
88
  {
89
  $url = $this->instanceUrl() . '/void';
90
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
91
  $this->refreshFrom($response, $opts);
92
+
93
  return $this;
94
  }
95
+
96
+ const PATH_LINES = '/lines';
97
+
98
+ /**
99
+ * @param string $id the ID of the credit note on which to retrieve the credit note line items
100
+ * @param null|array $params
101
+ * @param null|array|string $opts
102
+ *
103
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
104
+ *
105
+ * @return \Stripe\Collection the list of credit note line items
106
+ */
107
+ public static function allLines($id, $params = null, $opts = null)
108
+ {
109
+ return self::_allNestedResources($id, static::PATH_LINES, $params, $opts);
110
+ }
111
  }
app/api/Stripe/CreditNoteLineItem.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property int $amount The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
11
+ * @property null|string $description Description of the item being credited.
12
+ * @property int $discount_amount The integer amount in %s representing the discount being credited for this line item.
13
+ * @property \Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item
14
+ * @property string $invoice_line_item ID of the invoice line item being credited
15
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
16
+ * @property null|int $quantity The number of units of product being credited.
17
+ * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
18
+ * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
19
+ * @property string $type The type of the credit note line item, one of <code>invoice_line_item</code> or <code>custom_line_item</code>. When the type is <code>invoice_line_item</code> there is an additional <code>invoice_line_item</code> property on the resource the value of which is the id of the credited line item on the invoice.
20
+ * @property null|int $unit_amount The cost of each unit of product being credited.
21
+ * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
22
+ */
23
+ class CreditNoteLineItem extends ApiResource
24
+ {
25
+ const OBJECT_NAME = 'credit_note_line_item';
26
+ }
app/api/Stripe/Customer.php CHANGED
@@ -1,39 +1,47 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Customer
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $address
11
- * @property int $balance
12
- * @property string $created
13
- * @property string $currency
14
- * @property string $default_source
15
- * @property bool $delinquent
16
- * @property string $description
17
- * @property Discount $discount
18
- * @property string $email
19
- * @property string $invoice_prefix
20
- * @property mixed $invoice_settings
21
- * @property bool $livemode
22
- * @property StripeObject $metadata
23
- * @property string $name
24
- * @property string $phone
25
- * @property string[] preferred_locales
26
- * @property mixed $shipping
27
- * @property Collection $sources
28
- * @property Collection $subscriptions
29
- * @property string $tax_exempt
30
- * @property Collection $tax_ids
31
  *
32
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  */
34
  class Customer extends ApiResource
35
  {
36
- const OBJECT_NAME = "customer";
37
 
38
  use ApiOperations\All;
39
  use ApiOperations\Create;
@@ -42,162 +50,134 @@ class Customer extends ApiResource
42
  use ApiOperations\Retrieve;
43
  use ApiOperations\Update;
44
 
45
- /**
46
- * Possible string representations of the customer's type of tax exemption.
47
- * @link https://stripe.com/docs/api/customers/object#customer_object-tax_exempt
48
- */
49
- const TAX_EXEMPT_NONE = 'none';
50
- const TAX_EXEMPT_EXEMPT = 'exempt';
51
  const TAX_EXEMPT_REVERSE = 'reverse';
52
 
53
  public static function getSavedNestedResources()
54
  {
55
  static $savedNestedResources = null;
56
- if ($savedNestedResources === null) {
57
  $savedNestedResources = new Util\Set([
58
  'source',
59
  ]);
60
  }
 
61
  return $savedNestedResources;
62
  }
63
 
64
- const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
65
- const PATH_SOURCES = '/sources';
66
- const PATH_TAX_IDS = '/tax_ids';
67
-
68
  /**
69
- * @param array|null $params
 
70
  *
71
- * @return InvoiceItem The resulting invoice item.
72
  */
73
- public function addInvoiceItem($params = null)
74
  {
75
- $params = $params ?: [];
76
- $params['customer'] = $this->id;
77
- $ii = InvoiceItem::create($params, $this->_opts);
78
- return $ii;
79
  }
80
 
81
- /**
82
- * @param array|null $params
83
- *
84
- * @return array An array of the customer's Invoices.
85
- */
86
- public function invoices($params = null)
87
- {
88
- $params = $params ?: [];
89
- $params['customer'] = $this->id;
90
- $invoices = Invoice::all($params, $this->_opts);
91
- return $invoices;
92
- }
93
 
94
  /**
95
- * @param array|null $params
 
 
96
  *
97
- * @return array An array of the customer's InvoiceItems.
 
 
98
  */
99
- public function invoiceItems($params = null)
100
  {
101
- $params = $params ?: [];
102
- $params['customer'] = $this->id;
103
- $iis = InvoiceItem::all($params, $this->_opts);
104
- return $iis;
105
  }
106
 
107
  /**
108
- * @param array|null $params
 
 
109
  *
110
- * @return array An array of the customer's Charges.
 
 
111
  */
112
- public function charges($params = null)
113
  {
114
- $params = $params ?: [];
115
- $params['customer'] = $this->id;
116
- $charges = Charge::all($params, $this->_opts);
117
- return $charges;
118
  }
119
 
120
  /**
121
- * @param array|null $params
 
 
 
122
  *
123
- * @return Subscription The updated subscription.
 
 
124
  */
125
- public function updateSubscription($params = null)
126
  {
127
- $url = $this->instanceUrl() . '/subscription';
128
- list($response, $opts) = $this->_request('post', $url, $params);
129
- $this->refreshFrom(['subscription' => $response], $opts, true);
130
- return $this->subscription;
131
  }
132
 
133
  /**
134
- * @param array|null $params
 
 
 
135
  *
136
- * @return Subscription The cancelled subscription.
 
 
137
  */
138
- public function cancelSubscription($params = null)
139
  {
140
- $url = $this->instanceUrl() . '/subscription';
141
- list($response, $opts) = $this->_request('delete', $url, $params);
142
- $this->refreshFrom(['subscription' => $response], $opts, true);
143
- return $this->subscription;
144
  }
145
 
146
- /**
147
- * @return Customer The updated customer.
148
- */
149
- public function deleteDiscount()
150
- {
151
- $url = $this->instanceUrl() . '/discount';
152
- list($response, $opts) = $this->_request('delete', $url);
153
- $this->refreshFrom(['discount' => null], $opts, true);
154
- }
155
 
156
  /**
157
- * @param string|null $id The ID of the customer on which to create the source.
158
- * @param array|null $params
159
- * @param array|string|null $opts
160
  *
161
- * @return ApiResource
162
- */
163
- public static function createSource($id, $params = null, $opts = null)
164
- {
165
- return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts);
166
- }
167
-
168
- /**
169
- * @param string|null $id The ID of the customer to which the source belongs.
170
- * @param string|null $sourceId The ID of the source to retrieve.
171
- * @param array|null $params
172
- * @param array|string|null $opts
173
  *
174
- * @return ApiResource
175
  */
176
- public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
177
  {
178
- return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
179
  }
180
 
181
  /**
182
- * @param string|null $id The ID of the customer to which the source belongs.
183
- * @param string|null $sourceId The ID of the source to update.
184
- * @param array|null $params
185
- * @param array|string|null $opts
186
  *
187
- * @return ApiResource
 
 
188
  */
189
- public static function updateSource($id, $sourceId, $params = null, $opts = null)
190
  {
191
- return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
192
  }
193
 
194
  /**
195
- * @param string|null $id The ID of the customer to which the source belongs.
196
- * @param string|null $sourceId The ID of the source to delete.
197
- * @param array|null $params
198
- * @param array|string|null $opts
 
 
199
  *
200
- * @return ApiResource
201
  */
202
  public static function deleteSource($id, $sourceId, $params = null, $opts = null)
203
  {
@@ -205,61 +185,45 @@ class Customer extends ApiResource
205
  }
206
 
207
  /**
208
- * @param string|null $id The ID of the customer on which to retrieve the sources.
209
- * @param array|null $params
210
- * @param array|string|null $opts
 
211
  *
212
- * @return Collection The list of sources.
213
- */
214
- public static function allSources($id, $params = null, $opts = null)
215
- {
216
- return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
217
- }
218
-
219
- /**
220
- * @param string|null $id The ID of the customer on which to create the tax id.
221
- * @param array|null $params
222
- * @param array|string|null $opts
223
  *
224
- * @return ApiResource
225
  */
226
- public static function createTaxId($id, $params = null, $opts = null)
227
  {
228
- return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
229
  }
230
 
231
  /**
232
- * @param string|null $id The ID of the customer to which the tax id belongs.
233
- * @param string|null $taxIdId The ID of the tax id to retrieve.
234
- * @param array|null $params
235
- * @param array|string|null $opts
236
  *
237
- * @return ApiResource
238
- */
239
- public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
240
- {
241
- return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
242
- }
243
-
244
- /**
245
- * @param string|null $id The ID of the customer to which the tax id belongs.
246
- * @param string|null $taxIdId The ID of the tax id to delete.
247
- * @param array|null $params
248
- * @param array|string|null $opts
249
  *
250
- * @return ApiResource
251
  */
252
- public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
253
  {
254
- return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
255
  }
256
 
 
 
257
  /**
258
- * @param string|null $id The ID of the customer on which to retrieve the tax ids.
259
- * @param array|null $params
260
- * @param array|string|null $opts
261
  *
262
- * @return Collection The list of tax ids.
 
 
263
  */
264
  public static function allTaxIds($id, $params = null, $opts = null)
265
  {
@@ -267,53 +231,46 @@ class Customer extends ApiResource
267
  }
268
 
269
  /**
270
- * @param string|null $id The ID of the customer on which to create the balance transaction.
271
- * @param array|null $params
272
- * @param array|string|null $opts
273
  *
274
- * @return ApiResource
275
- */
276
- public static function createBalanceTransaction($id, $params = null, $opts = null)
277
- {
278
- return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
279
- }
280
-
281
- /**
282
- * @param string|null $id The ID of the customer to which the balance transaction belongs.
283
- * @param string|null $balanceTransactionId The ID of the balance transaction to retrieve.
284
- * @param array|null $params
285
- * @param array|string|null $opts
286
  *
287
- * @return ApiResource
288
  */
289
- public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
290
  {
291
- return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
292
  }
293
 
294
  /**
295
- * @param string|null $id The ID of the customer on which to update the balance transaction.
296
- * @param string|null $balanceTransactionId The ID of the balance transaction to update.
297
- * @param array|null $params
298
- * @param array|string|null $opts
299
  *
 
300
  *
301
- * @return ApiResource
302
  */
303
- public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
304
  {
305
- return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
306
  }
307
 
308
  /**
309
- * @param string|null $id The ID of the customer on which to retrieve the customer balance transactions.
310
- * @param array|null $params
311
- * @param array|string|null $opts
 
 
 
312
  *
313
- * @return Collection The list of customer balance transactions.
314
  */
315
- public static function allBalanceTransactions($id, $params = null, $opts = null)
316
  {
317
- return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
318
  }
319
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <code>Customer</code> objects allow you to perform recurring charges, and to
9
+ * track multiple charges, that are associated with the same customer. The API
10
+ * allows you to create, delete, and update your customers. You can retrieve
11
+ * individual customers as well as a list of all your customers.
12
  *
13
+ * Related guide: <a
14
+ * href="https://stripe.com/docs/payments/save-during-payment">Save a card during
15
+ * payment</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property null|\Stripe\StripeObject $address The customer's address.
20
+ * @property int $balance Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized.
21
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
22
+ * @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> the customer can be charged in for recurring billing purposes.
23
+ * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source <p>ID of the default payment source for the customer.</p><p>If you are using payment methods created via the PaymentMethods API, see the <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> field instead.</p>
24
+ * @property null|bool $delinquent <p>When the customer's latest invoice is billed by charging automatically, <code>delinquent</code> is <code>true</code> if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, <code>delinquent</code> is <code>true</code> if the invoice isn't paid by its due date.</p><p>If an invoice is marked uncollectible by <a href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, <code>delinquent</code> doesn't get reset to <code>false</code>.</p>
25
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
26
+ * @property null|\Stripe\Discount $discount Describes the current discount active on the customer, if there is one.
27
+ * @property null|string $email The customer's email address.
28
+ * @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers.
29
+ * @property \Stripe\StripeObject $invoice_settings
30
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
31
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
32
+ * @property null|string $name The customer's full name or business name.
33
+ * @property int $next_invoice_sequence The suffix of the customer's next invoice number, e.g., 0001.
34
+ * @property null|string $phone The customer's phone number.
35
+ * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference.
36
+ * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
37
+ * @property \Stripe\Collection $sources The customer's payment sources, if any.
38
+ * @property \Stripe\Collection $subscriptions The customer's current subscriptions, if any.
39
+ * @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>&quot;Reverse charge&quot;</strong>.
40
+ * @property \Stripe\Collection $tax_ids The customer's tax IDs.
41
  */
42
  class Customer extends ApiResource
43
  {
44
+ const OBJECT_NAME = 'customer';
45
 
46
  use ApiOperations\All;
47
  use ApiOperations\Create;
50
  use ApiOperations\Retrieve;
51
  use ApiOperations\Update;
52
 
53
+ const TAX_EXEMPT_EXEMPT = 'exempt';
54
+ const TAX_EXEMPT_NONE = 'none';
 
 
 
 
55
  const TAX_EXEMPT_REVERSE = 'reverse';
56
 
57
  public static function getSavedNestedResources()
58
  {
59
  static $savedNestedResources = null;
60
+ if (null === $savedNestedResources) {
61
  $savedNestedResources = new Util\Set([
62
  'source',
63
  ]);
64
  }
65
+
66
  return $savedNestedResources;
67
  }
68
 
 
 
 
 
69
  /**
70
+ * @param null|array $params
71
+ * @param null|array|string $opts
72
  *
73
+ * @return \Stripe\Customer the updated customer
74
  */
75
+ public function deleteDiscount($params = null, $opts = null)
76
  {
77
+ $url = $this->instanceUrl() . '/discount';
78
+ list($response, $opts) = $this->_request('delete', $url, $params, $opts);
79
+ $this->refreshFrom(['discount' => null], $opts, true);
 
80
  }
81
 
82
+ const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  /**
85
+ * @param string $id the ID of the customer on which to retrieve the customer balance transactions
86
+ * @param null|array $params
87
+ * @param null|array|string $opts
88
  *
89
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
90
+ *
91
+ * @return \Stripe\Collection the list of customer balance transactions
92
  */
93
+ public static function allBalanceTransactions($id, $params = null, $opts = null)
94
  {
95
+ return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
 
 
 
96
  }
97
 
98
  /**
99
+ * @param string $id the ID of the customer on which to create the customer balance transaction
100
+ * @param null|array $params
101
+ * @param null|array|string $opts
102
  *
103
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
104
+ *
105
+ * @return \Stripe\CustomerBalanceTransaction
106
  */
107
+ public static function createBalanceTransaction($id, $params = null, $opts = null)
108
  {
109
+ return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
 
 
 
110
  }
111
 
112
  /**
113
+ * @param string $id the ID of the customer to which the customer balance transaction belongs
114
+ * @param string $balanceTransactionId the ID of the customer balance transaction to retrieve
115
+ * @param null|array $params
116
+ * @param null|array|string $opts
117
  *
118
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
119
+ *
120
+ * @return \Stripe\CustomerBalanceTransaction
121
  */
122
+ public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
123
  {
124
+ return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
 
 
 
125
  }
126
 
127
  /**
128
+ * @param string $id the ID of the customer to which the customer balance transaction belongs
129
+ * @param string $balanceTransactionId the ID of the customer balance transaction to update
130
+ * @param null|array $params
131
+ * @param null|array|string $opts
132
  *
133
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
134
+ *
135
+ * @return \Stripe\CustomerBalanceTransaction
136
  */
137
+ public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
138
  {
139
+ return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
 
 
 
140
  }
141
 
142
+ const PATH_SOURCES = '/sources';
 
 
 
 
 
 
 
 
143
 
144
  /**
145
+ * @param string $id the ID of the customer on which to retrieve the payment sources
146
+ * @param null|array $params
147
+ * @param null|array|string $opts
148
  *
149
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
 
150
  *
151
+ * @return \Stripe\Collection the list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source)
152
  */
153
+ public static function allSources($id, $params = null, $opts = null)
154
  {
155
+ return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
156
  }
157
 
158
  /**
159
+ * @param string $id the ID of the customer on which to create the payment source
160
+ * @param null|array $params
161
+ * @param null|array|string $opts
 
162
  *
163
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
164
+ *
165
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
166
  */
167
+ public static function createSource($id, $params = null, $opts = null)
168
  {
169
+ return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts);
170
  }
171
 
172
  /**
173
+ * @param string $id the ID of the customer to which the payment source belongs
174
+ * @param string $sourceId the ID of the payment source to delete
175
+ * @param null|array $params
176
+ * @param null|array|string $opts
177
+ *
178
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
179
  *
180
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
181
  */
182
  public static function deleteSource($id, $sourceId, $params = null, $opts = null)
183
  {
185
  }
186
 
187
  /**
188
+ * @param string $id the ID of the customer to which the payment source belongs
189
+ * @param string $sourceId the ID of the payment source to retrieve
190
+ * @param null|array $params
191
+ * @param null|array|string $opts
192
  *
193
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
194
  *
195
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
196
  */
197
+ public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
198
  {
199
+ return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
200
  }
201
 
202
  /**
203
+ * @param string $id the ID of the customer to which the payment source belongs
204
+ * @param string $sourceId the ID of the payment source to update
205
+ * @param null|array $params
206
+ * @param null|array|string $opts
207
  *
208
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
 
209
  *
210
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
211
  */
212
+ public static function updateSource($id, $sourceId, $params = null, $opts = null)
213
  {
214
+ return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
215
  }
216
 
217
+ const PATH_TAX_IDS = '/tax_ids';
218
+
219
  /**
220
+ * @param string $id the ID of the customer on which to retrieve the tax ids
221
+ * @param null|array $params
222
+ * @param null|array|string $opts
223
  *
224
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
225
+ *
226
+ * @return \Stripe\Collection the list of tax ids
227
  */
228
  public static function allTaxIds($id, $params = null, $opts = null)
229
  {
231
  }
232
 
233
  /**
234
+ * @param string $id the ID of the customer on which to create the tax id
235
+ * @param null|array $params
236
+ * @param null|array|string $opts
237
  *
238
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
 
239
  *
240
+ * @return \Stripe\TaxId
241
  */
242
+ public static function createTaxId($id, $params = null, $opts = null)
243
  {
244
+ return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
245
  }
246
 
247
  /**
248
+ * @param string $id the ID of the customer to which the tax id belongs
249
+ * @param string $taxIdId the ID of the tax id to delete
250
+ * @param null|array $params
251
+ * @param null|array|string $opts
252
  *
253
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
254
  *
255
+ * @return \Stripe\TaxId
256
  */
257
+ public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
258
  {
259
+ return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
260
  }
261
 
262
  /**
263
+ * @param string $id the ID of the customer to which the tax id belongs
264
+ * @param string $taxIdId the ID of the tax id to retrieve
265
+ * @param null|array $params
266
+ * @param null|array|string $opts
267
+ *
268
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
269
  *
270
+ * @return \Stripe\TaxId
271
  */
272
+ public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
273
  {
274
+ return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
275
  }
276
  }
app/api/Stripe/CustomerBalanceTransaction.php CHANGED
@@ -1,52 +1,60 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class CustomerBalanceTransaction
 
 
 
 
 
 
7
  *
8
- * @package Stripe
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property int $amount
13
- * @property string $credit_note
14
- * @property int $created
15
- * @property string $currency
16
- * @property string $customer
17
- * @property string $description
18
- * @property int $ending_balance
19
- * @property string $invoice
20
- * @property bool $livemode
21
- * @property StripeObject $metadata
22
- * @property string $type
23
  */
24
  class CustomerBalanceTransaction extends ApiResource
25
  {
26
- const OBJECT_NAME = "customer_balance_transaction";
27
 
28
- /**
29
- * Possible string representations of a balance transaction's type.
30
- * @link https://stripe.com/docs/api/customers/customer_balance_transaction_object#customer_balance_transaction_object-type
31
- */
32
- const TYPE_ADJUSTEMENT = 'adjustment';
33
- const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
34
- const TYPE_CREDIT_NOTE = 'credit_note';
35
- const TYPE_INITIAL = 'initial';
36
- const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large';
37
- const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small';
38
  const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit';
39
 
 
 
40
  /**
41
- * @return string The API URL for this balance transaction.
42
  */
43
  public function instanceUrl()
44
  {
45
  $id = $this['id'];
46
  $customer = $this['customer'];
47
  if (!$id) {
48
- throw new Error\InvalidRequest(
49
- "Could not determine which URL to request: class instance has invalid ID: $id",
50
  null
51
  );
52
  }
@@ -54,35 +62,42 @@ class CustomerBalanceTransaction extends ApiResource
54
  $customer = Util\Util::utf8($customer);
55
 
56
  $base = Customer::classUrl();
57
- $customerExtn = urlencode($customer);
58
- $extn = urlencode($id);
59
- return "$base/$customerExtn/balance_transactions/$extn";
 
60
  }
61
 
62
  /**
63
  * @param array|string $_id
64
- * @param array|string|null $_opts
65
  *
66
- * @throws \Stripe\Error\InvalidRequest
67
  */
68
  public static function retrieve($_id, $_opts = null)
69
  {
70
- $msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
71
- "Retrieve a balance transaction using Customer::retrieveBalanceTransaction('cus_123', 'cbtxn_123') instead.";
72
- throw new Error\InvalidRequest($msg, null);
 
 
 
73
  }
74
 
75
  /**
76
  * @param string $_id
77
- * @param array|null $_params
78
- * @param array|string|null $_options
79
  *
80
- * @throws \Stripe\Error\InvalidRequest
81
  */
82
  public static function update($_id, $_params = null, $_options = null)
83
  {
84
- $msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
85
- "Update a balance transaction using Customer::updateBalanceTransaction('cus_123', 'cbtxn_123', \$params) instead.";
86
- throw new Error\InvalidRequest($msg, null);
 
 
 
87
  }
88
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Each customer has a <a
9
+ * href="https://stripe.com/docs/api/customers/object#customer_object-balance"><code>balance</code></a>
10
+ * value, which denotes a debit or credit that's automatically applied to their
11
+ * next invoice upon finalization. You may modify the value directly by using the
12
+ * <a href="https://stripe.com/docs/api/customers/update">update customer API</a>,
13
+ * or by creating a Customer Balance Transaction, which increments or decrements
14
+ * the customer's <code>balance</code> by the specified <code>amount</code>.
15
  *
16
+ * Related guide: <a
17
+ * href="https://stripe.com/docs/billing/customer/balance">Customer Balance</a> to
18
+ * learn more.
19
  *
20
+ * @property string $id Unique identifier for the object.
21
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
22
+ * @property int $amount The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's <code>balance</code>.
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property null|string|\Stripe\CreditNote $credit_note The ID of the credit note (if any) related to the transaction.
25
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
26
+ * @property string|\Stripe\Customer $customer The ID of the customer the transaction belongs to.
27
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
28
+ * @property int $ending_balance The customer's <code>balance</code> after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice.
29
+ * @property null|string|\Stripe\Invoice $invoice The ID of the invoice (if any) related to the transaction.
30
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
31
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
32
+ * @property string $type Transaction type: <code>adjustment</code>, <code>applied_to_invoice</code>, <code>credit_note</code>, <code>initial</code>, <code>invoice_too_large</code>, <code>invoice_too_small</code>, <code>unspent_receiver_credit</code>, or <code>unapplied_from_invoice</code>. See the <a href="https://stripe.com/docs/billing/customer/balance#types">Customer Balance page</a> to learn more about transaction types.
33
  */
34
  class CustomerBalanceTransaction extends ApiResource
35
  {
36
+ const OBJECT_NAME = 'customer_balance_transaction';
37
 
38
+ const TYPE_ADJUSTMENT = 'adjustment';
39
+ const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
40
+ const TYPE_CREDIT_NOTE = 'credit_note';
41
+ const TYPE_INITIAL = 'initial';
42
+ const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large';
43
+ const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small';
 
 
 
 
44
  const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit';
45
 
46
+ const TYPE_ADJUSTEMENT = 'adjustment';
47
+
48
  /**
49
+ * @return string the API URL for this balance transaction
50
  */
51
  public function instanceUrl()
52
  {
53
  $id = $this['id'];
54
  $customer = $this['customer'];
55
  if (!$id) {
56
+ throw new Exception\UnexpectedValueException(
57
+ "Could not determine which URL to request: class instance has invalid ID: {$id}",
58
  null
59
  );
60
  }
62
  $customer = Util\Util::utf8($customer);
63
 
64
  $base = Customer::classUrl();
65
+ $customerExtn = \urlencode($customer);
66
+ $extn = \urlencode($id);
67
+
68
+ return "{$base}/{$customerExtn}/balance_transactions/{$extn}";
69
  }
70
 
71
  /**
72
  * @param array|string $_id
73
+ * @param null|array|string $_opts
74
  *
75
+ * @throws \Stripe\Exception\BadMethodCallException
76
  */
77
  public static function retrieve($_id, $_opts = null)
78
  {
79
+ $msg = 'Customer Balance Transactions cannot be retrieved without a ' .
80
+ 'customer ID. Retrieve a Customer Balance Transaction using ' .
81
+ "`Customer::retrieveBalanceTransaction('customer_id', " .
82
+ "'balance_transaction_id')`.";
83
+
84
+ throw new Exception\BadMethodCallException($msg);
85
  }
86
 
87
  /**
88
  * @param string $_id
89
+ * @param null|array $_params
90
+ * @param null|array|string $_options
91
  *
92
+ * @throws \Stripe\Exception\BadMethodCallException
93
  */
94
  public static function update($_id, $_params = null, $_options = null)
95
  {
96
+ $msg = 'Customer Balance Transactions cannot be updated without a ' .
97
+ 'customer ID. Update a Customer Balance Transaction using ' .
98
+ "`Customer::updateBalanceTransaction('customer_id', " .
99
+ "'balance_transaction_id', \$updateParams)`.";
100
+
101
+ throw new Exception\BadMethodCallException($msg);
102
  }
103
  }
app/api/Stripe/Discount.php CHANGED
@@ -3,18 +3,22 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Discount
7
  *
8
  * @property string $object
9
- * @property Coupon $coupon
10
- * @property string $customer
11
- * @property int $end
12
- * @property int $start
13
- * @property string $subscription
14
- *
15
- * @package Stripe
 
 
 
 
16
  */
17
  class Discount extends StripeObject
18
  {
19
- const OBJECT_NAME = "discount";
20
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class Discount.
7
  *
8
  * @property string $object
9
+ * @property string $checkout_session The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
10
+ * @property \Stripe\Coupon $coupon Hash describing the coupon applied to create this discount.
11
+ * @property string|\Stripe\Customer $customer The ID of the customer associated with this discount.
12
+ * @property int $end If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
13
+ * @property string $id The ID of the discount object.
14
+ * @property string $invoice The invoice that the discount’s coupon was applied to, if it was applied directly to a particular invoice.
15
+ * @property string $invoice_item The invoice item id (or invoice line item id for invoice line items of type=‘subscription’) that the discount’s coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
16
+ * @property string $object String representing the object’s type. Objects of the same type share the same value.
17
+ * @property string $promotion_code The promotion code applied to create this discount.
18
+ * @property int $start Date that the coupon was applied.
19
+ * @property string $subscription The subscription that this coupon is applied to, if it is applied to a particular subscription.
20
  */
21
  class Discount extends StripeObject
22
  {
23
+ const OBJECT_NAME = 'discount';
24
  }
app/api/Stripe/Dispute.php CHANGED
@@ -1,77 +1,82 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Dispute
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property BalanceTransaction[] $balance_transactions
12
- * @property string $charge
13
- * @property int $created
14
- * @property string $currency
15
- * @property mixed $evidence
16
- * @property mixed $evidence_details
17
- * @property bool $is_charge_refundable
18
- * @property bool $livemode
19
- * @property StripeObject $metadata
20
- * @property string $reason
21
- * @property string $status
22
  *
23
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  */
25
  class Dispute extends ApiResource
26
  {
27
- const OBJECT_NAME = "dispute";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\Retrieve;
31
  use ApiOperations\Update;
32
 
33
- /**
34
- * Possible string representations of dispute reasons.
35
- * @link https://stripe.com/docs/api#dispute_object
36
- */
37
- const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
38
- const REASON_CHECK_RETURNED = 'check_returned';
39
- const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
40
- const REASON_CUSTOMER_INITIATED = 'customer_initiated';
41
- const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
42
- const REASON_DUPLICATE = 'duplicate';
43
- const REASON_FRAUDULENT = 'fraudulent';
44
- const REASON_GENERAL = 'general';
45
  const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
46
- const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds';
47
- const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received';
48
- const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable';
49
- const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled';
50
- const REASON_UNRECOGNIZED = 'unrecognized';
51
 
52
- /**
53
- * Possible string representations of dispute statuses.
54
- * @link https://stripe.com/docs/api#dispute_object
55
- */
56
- const STATUS_CHARGE_REFUNDED = 'charge_refunded';
57
- const STATUS_LOST = 'lost';
58
- const STATUS_NEEDS_RESPONSE = 'needs_response';
59
- const STATUS_UNDER_REVIEW = 'under_review';
60
- const STATUS_WARNING_CLOSED = 'warning_closed';
61
  const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
62
- const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review';
63
- const STATUS_WON = 'won';
64
 
65
  /**
66
- * @param array|string|null $options
 
 
67
  *
68
- * @return Dispute The closed dispute.
69
  */
70
- public function close($options = null)
 
71
  {
72
  $url = $this->instanceUrl() . '/close';
73
- list($response, $opts) = $this->_request('post', $url, null, $options);
74
  $this->refreshFrom($response, $opts);
 
75
  return $this;
76
  }
77
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A dispute occurs when a customer questions your charge with their card issuer.
9
+ * When this happens, you're given the opportunity to respond to the dispute with
10
+ * evidence that shows that the charge is legitimate. You can find more information
11
+ * about the dispute process in our <a href="/docs/disputes">Disputes and Fraud</a>
12
+ * documentation.
13
  *
14
+ * Related guide: <a href="https://stripe.com/docs/disputes">Disputes and
15
+ * Fraud</a>.
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property int $amount Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed).
20
+ * @property \Stripe\BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
21
+ * @property string|\Stripe\Charge $charge ID of the charge that was disputed.
22
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
23
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
24
+ * @property \Stripe\StripeObject $evidence
25
+ * @property \Stripe\StripeObject $evidence_details
26
+ * @property bool $is_charge_refundable If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute.
27
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
28
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29
+ * @property null|string $network_reason_code Network-dependent reason code for the dispute.
30
+ * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was disputed.
31
+ * @property string $reason Reason given by cardholder for dispute. Possible values are <code>bank_cannot_process</code>, <code>check_returned</code>, <code>credit_not_processed</code>, <code>customer_initiated</code>, <code>debit_not_authorized</code>, <code>duplicate</code>, <code>fraudulent</code>, <code>general</code>, <code>incorrect_account_details</code>, <code>insufficient_funds</code>, <code>product_not_received</code>, <code>product_unacceptable</code>, <code>subscription_canceled</code>, or <code>unrecognized</code>. Read more about <a href="https://stripe.com/docs/disputes/categories">dispute reasons</a>.
32
+ * @property string $status Current status of dispute. Possible values are <code>warning_needs_response</code>, <code>warning_under_review</code>, <code>warning_closed</code>, <code>needs_response</code>, <code>under_review</code>, <code>charge_refunded</code>, <code>won</code>, or <code>lost</code>.
33
  */
34
  class Dispute extends ApiResource
35
  {
36
+ const OBJECT_NAME = 'dispute';
37
 
38
  use ApiOperations\All;
39
  use ApiOperations\Retrieve;
40
  use ApiOperations\Update;
41
 
42
+ const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
43
+ const REASON_CHECK_RETURNED = 'check_returned';
44
+ const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
45
+ const REASON_CUSTOMER_INITIATED = 'customer_initiated';
46
+ const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
47
+ const REASON_DUPLICATE = 'duplicate';
48
+ const REASON_FRAUDULENT = 'fraudulent';
49
+ const REASON_GENERAL = 'general';
 
 
 
 
50
  const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
51
+ const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds';
52
+ const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received';
53
+ const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable';
54
+ const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled';
55
+ const REASON_UNRECOGNIZED = 'unrecognized';
56
 
57
+ const STATUS_CHARGE_REFUNDED = 'charge_refunded';
58
+ const STATUS_LOST = 'lost';
59
+ const STATUS_NEEDS_RESPONSE = 'needs_response';
60
+ const STATUS_UNDER_REVIEW = 'under_review';
61
+ const STATUS_WARNING_CLOSED = 'warning_closed';
 
 
 
 
62
  const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
63
+ const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review';
64
+ const STATUS_WON = 'won';
65
 
66
  /**
67
+ * @param null|array|string $opts
68
+ *
69
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
70
  *
71
+ * @return \Stripe\Dispute the closed dispute
72
  */
73
+ // TODO: add $params to standardize signature
74
+ public function close($opts = null)
75
  {
76
  $url = $this->instanceUrl() . '/close';
77
+ list($response, $opts) = $this->_request('post', $url, null, $opts);
78
  $this->refreshFrom($response, $opts);
79
+
80
  return $this;
81
  }
82
  }
app/api/Stripe/EphemeralKey.php CHANGED
@@ -1,40 +1,43 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class EphemeralKey
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property int $expires
12
- * @property bool $livemode
13
- * @property string $secret
14
  * @property array $associated_objects
15
- *
16
- * @package Stripe
17
  */
18
  class EphemeralKey extends ApiResource
19
  {
20
- const OBJECT_NAME = "ephemeral_key";
21
 
22
  use ApiOperations\Create {
23
  create as protected _create;
24
  }
 
25
  use ApiOperations\Delete;
26
 
27
  /**
28
- * @param array|null $params
29
- * @param array|string|null $opts
30
  *
31
- * @return EphemeralKey The created key.
 
 
 
32
  */
33
  public static function create($params = null, $opts = null)
34
  {
35
- if (!$opts['stripe_version']) {
36
- throw new \InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
37
  }
 
38
  return self::_create($params, $opts);
39
  }
40
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
11
+ * @property int $expires Time at which the key will expire. Measured in seconds since the Unix epoch.
12
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
13
+ * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API.
 
 
14
  * @property array $associated_objects
 
 
15
  */
16
  class EphemeralKey extends ApiResource
17
  {
18
+ const OBJECT_NAME = 'ephemeral_key';
19
 
20
  use ApiOperations\Create {
21
  create as protected _create;
22
  }
23
+
24
  use ApiOperations\Delete;
25
 
26
  /**
27
+ * @param null|array $params
28
+ * @param null|array|string $opts
29
  *
30
+ * @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\EphemeralKey the created key
34
  */
35
  public static function create($params = null, $opts = null)
36
  {
37
+ if (!$opts || !isset($opts['stripe_version'])) {
38
+ throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
39
  }
40
+
41
  return self::_create($params, $opts);
42
  }
43
  }
app/api/Stripe/Error/Api.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class Api extends Base
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/ApiConnection.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class ApiConnection extends Base
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/Authentication.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class Authentication extends Base
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/Base.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- use Exception;
6
-
7
- abstract class Base extends Exception
8
- {
9
- public function __construct(
10
- $message,
11
- $httpStatus = null,
12
- $httpBody = null,
13
- $jsonBody = null,
14
- $httpHeaders = null
15
- ) {
16
- parent::__construct($message);
17
- $this->httpStatus = $httpStatus;
18
- $this->httpBody = $httpBody;
19
- $this->jsonBody = $jsonBody;
20
- $this->httpHeaders = $httpHeaders;
21
- $this->requestId = null;
22
-
23
- // TODO: make this a proper constructor argument in the next major
24
- // release.
25
- $this->stripeCode = isset($jsonBody["error"]["code"]) ? $jsonBody["error"]["code"] : null;
26
-
27
- if ($httpHeaders && isset($httpHeaders['Request-Id'])) {
28
- $this->requestId = $httpHeaders['Request-Id'];
29
- }
30
- }
31
-
32
- public function getStripeCode()
33
- {
34
- return $this->stripeCode;
35
- }
36
-
37
- public function getHttpStatus()
38
- {
39
- return $this->httpStatus;
40
- }
41
-
42
- public function getHttpBody()
43
- {
44
- return $this->httpBody;
45
- }
46
-
47
- public function getJsonBody()
48
- {
49
- return $this->jsonBody;
50
- }
51
-
52
- public function getHttpHeaders()
53
- {
54
- return $this->httpHeaders;
55
- }
56
-
57
- public function getRequestId()
58
- {
59
- return $this->requestId;
60
- }
61
-
62
- public function __toString()
63
- {
64
- $id = $this->requestId ? " from API request '{$this->requestId}'": "";
65
- $message = explode("\n", parent::__toString());
66
- $message[0] .= $id;
67
- return implode("\n", $message);
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/Card.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class Card extends Base
6
- {
7
- public function __construct(
8
- $message,
9
- $stripeParam,
10
- $stripeCode,
11
- $httpStatus,
12
- $httpBody,
13
- $jsonBody,
14
- $httpHeaders = null
15
- ) {
16
- parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
17
- $this->stripeParam = $stripeParam;
18
-
19
- // TODO: once Error\Base accepts the error code as an argument, pass it
20
- // in the call to parent::__construct() and stop setting it here.
21
- $this->stripeCode = $stripeCode;
22
-
23
- // This one is not like the others because it was added later and we're
24
- // trying to do our best not to change the public interface of this class'
25
- // constructor.
26
- // TODO: make this a proper constructor argument in the next major
27
- // release.
28
- $this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null;
29
- }
30
-
31
- public function getDeclineCode()
32
- {
33
- return $this->declineCode;
34
- }
35
-
36
- public function getStripeParam()
37
- {
38
- return $this->stripeParam;
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/Idempotency.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class Idempotency extends Base
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/InvalidRequest.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class InvalidRequest extends Base
6
- {
7
- public function __construct(
8
- $message,
9
- $stripeParam,
10
- $httpStatus = null,
11
- $httpBody = null,
12
- $jsonBody = null,
13
- $httpHeaders = null
14
- ) {
15
- parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
16
- $this->stripeParam = $stripeParam;
17
- }
18
-
19
- public function getStripeParam()
20
- {
21
- return $this->stripeParam;
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/InvalidClient.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- /**
6
- * InvalidClient is raised when authentication fails.
7
- */
8
- class InvalidClient extends OAuthBase
9
- {
10
- }
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/InvalidRequest.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- /**
6
- * InvalidRequest is raised when a code, refresh token, or grant type
7
- * parameter is not provided, but was required.
8
- */
9
- class InvalidRequest extends OAuthBase
10
- {
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/InvalidScope.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- /**
6
- * InvalidScope is raised when an invalid scope parameter is provided.
7
- */
8
- class InvalidScope extends OAuthBase
9
- {
10
- }
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/OAuthBase.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- class OAuthBase extends \Stripe\Error\Base
6
- {
7
- public function __construct(
8
- $code,
9
- $description,
10
- $httpStatus = null,
11
- $httpBody = null,
12
- $jsonBody = null,
13
- $httpHeaders = null
14
- ) {
15
- parent::__construct($description, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
16
- $this->errorCode = $code;
17
- }
18
-
19
- public function getErrorCode()
20
- {
21
- return $this->errorCode;
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/UnsupportedGrantType.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- /**
6
- * UnsupportedGrantType is raised when an unuspported grant type
7
- * parameter is specified.
8
- */
9
- class UnsupportedGrantType extends OAuthBase
10
- {
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/OAuth/UnsupportedResponseType.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error\OAuth;
4
-
5
- /**
6
- * UnsupportedResponseType is raised when an unsupported response type
7
- * parameter is specified.
8
- */
9
- class UnsupportedResponseType extends OAuthBase
10
- {
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Error/Permission.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class Permission extends Base
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/RateLimit.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class RateLimit extends InvalidRequest
6
- {
7
- }
 
 
 
 
 
 
 
app/api/Stripe/Error/SignatureVerification.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Error;
4
-
5
- class SignatureVerification extends Base
6
- {
7
- public function __construct(
8
- $message,
9
- $sigHeader,
10
- $httpBody = null
11
- ) {
12
- parent::__construct($message, null, $httpBody, null, null);
13
- $this->sigHeader = $sigHeader;
14
- }
15
-
16
- public function getSigHeader()
17
- {
18
- return $this->sigHeader;
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/ErrorObject.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe;
4
+
5
+ /**
6
+ * Class ErrorObject.
7
+ *
8
+ * @property string $charge For card errors, the ID of the failed charge.
9
+ * @property string $code For some errors that could be handled
10
+ * programmatically, a short string indicating the error code reported.
11
+ * @property string $decline_code For card errors resulting from a card issuer
12
+ * decline, a short string indicating the card issuer's reason for the
13
+ * decline if they provide one.
14
+ * @property string $doc_url A URL to more information about the error code
15
+ * reported.
16
+ * @property string $message A human-readable message providing more details
17
+ * about the error. For card errors, these messages can be shown to your
18
+ * users.
19
+ * @property string $param If the error is parameter-specific, the parameter
20
+ * related to the error. For example, you can use this to display a message
21
+ * near the correct form field.
22
+ * @property PaymentIntent $payment_intent The PaymentIntent object for errors
23
+ * returned on a request involving a PaymentIntent.
24
+ * @property PaymentMethod $payment_method The PaymentMethod object for errors
25
+ * returned on a request involving a PaymentMethod.
26
+ * @property string $payment_method_type If the error is specific to the type
27
+ * of payment method, the payment method type that had a problem. This
28
+ * field is only populated for invoice-related errors.
29
+ * @property SetupIntent $setup_intent The SetupIntent object for errors
30
+ * returned on a request involving a SetupIntent.
31
+ * @property StripeObject $source The source object for errors returned on a
32
+ * request involving a source.
33
+ * @property string $type The type of error returned. One of
34
+ * `api_connection_error`, `api_error`, `authentication_error`,
35
+ * `card_error`, `idempotency_error`, `invalid_request_error`, or
36
+ * `rate_limit_error`.
37
+ */
38
+ class ErrorObject extends StripeObject
39
+ {
40
+ /**
41
+ * Possible string representations of an error's code.
42
+ *
43
+ * @see https://stripe.com/docs/error-codes
44
+ */
45
+ const CODE_ACCOUNT_ALREADY_EXISTS = 'account_already_exists';
46
+ const CODE_ACCOUNT_COUNTRY_INVALID_ADDRESS = 'account_country_invalid_address';
47
+ const CODE_ACCOUNT_INVALID = 'account_invalid';
48
+ const CODE_ACCOUNT_NUMBER_INVALID = 'account_number_invalid';
49
+ const CODE_ALIPAY_UPGRADE_REQUIRED = 'alipay_upgrade_required';
50
+ const CODE_AMOUNT_TOO_LARGE = 'amount_too_large';
51
+ const CODE_AMOUNT_TOO_SMALL = 'amount_too_small';
52
+ const CODE_API_KEY_EXPIRED = 'api_key_expired';
53
+ const CODE_BALANCE_INSUFFICIENT = 'balance_insufficient';
54
+ const CODE_BANK_ACCOUNT_EXISTS = 'bank_account_exists';
55
+ const CODE_BANK_ACCOUNT_UNUSABLE = 'bank_account_unusable';
56
+ const CODE_BANK_ACCOUNT_UNVERIFIED = 'bank_account_unverified';
57
+ const CODE_BITCOIN_UPGRADE_REQUIRED = 'bitcoin_upgrade_required';
58
+ const CODE_CARD_DECLINED = 'card_declined';
59
+ const CODE_CHARGE_ALREADY_CAPTURED = 'charge_already_captured';
60
+ const CODE_CHARGE_ALREADY_REFUNDED = 'charge_already_refunded';
61
+ const CODE_CHARGE_DISPUTED = 'charge_disputed';
62
+ const CODE_CHARGE_EXCEEDS_SOURCE_LIMIT = 'charge_exceeds_source_limit';
63
+ const CODE_CHARGE_EXPIRED_FOR_CAPTURE = 'charge_expired_for_capture';
64
+ const CODE_COUNTRY_UNSUPPORTED = 'country_unsupported';
65
+ const CODE_COUPON_EXPIRED = 'coupon_expired';
66
+ const CODE_CUSTOMER_MAX_SUBSCRIPTIONS = 'customer_max_subscriptions';
67
+ const CODE_EMAIL_INVALID = 'email_invalid';
68
+ const CODE_EXPIRED_CARD = 'expired_card';
69
+ const CODE_IDEMPOTENCY_KEY_IN_USE = 'idempotency_key_in_use';
70
+ const CODE_INCORRECT_ADDRESS = 'incorrect_address';
71
+ const CODE_INCORRECT_CVC = 'incorrect_cvc';
72
+ const CODE_INCORRECT_NUMBER = 'incorrect_number';
73
+ const CODE_INCORRECT_ZIP = 'incorrect_zip';
74
+ const CODE_INSTANT_PAYOUTS_UNSUPPORTED = 'instant_payouts_unsupported';
75
+ const CODE_INVALID_CARD_TYPE = 'invalid_card_type';
76
+ const CODE_INVALID_CHARGE_AMOUNT = 'invalid_charge_amount';
77
+ const CODE_INVALID_CVC = 'invalid_cvc';
78
+ const CODE_INVALID_EXPIRY_MONTH = 'invalid_expiry_month';
79
+ const CODE_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
80
+ const CODE_INVALID_NUMBER = 'invalid_number';
81
+ const CODE_INVALID_SOURCE_USAGE = 'invalid_source_usage';
82
+ const CODE_INVOICE_NO_CUSTOMER_LINE_ITEMS = 'invoice_no_customer_line_items';
83
+ const CODE_INVOICE_NO_SUBSCRIPTION_LINE_ITEMS = 'invoice_no_subscription_line_items';
84
+ const CODE_INVOICE_NOT_EDITABLE = 'invoice_not_editable';
85
+ const CODE_INVOICE_PAYMENT_INTENT_REQUIRES_ACTION = 'invoice_payment_intent_requires_action';
86
+ const CODE_INVOICE_UPCOMING_NONE = 'invoice_upcoming_none';
87
+ const CODE_LIVEMODE_MISMATCH = 'livemode_mismatch';
88
+ const CODE_LOCK_TIMEOUT = 'lock_timeout';
89
+ const CODE_MISSING = 'missing';
90
+ const CODE_NOT_ALLOWED_ON_STANDARD_ACCOUNT = 'not_allowed_on_standard_account';
91
+ const CODE_ORDER_CREATION_FAILED = 'order_creation_failed';
92
+ const CODE_ORDER_REQUIRED_SETTINGS = 'order_required_settings';
93
+ const CODE_ORDER_STATUS_INVALID = 'order_status_invalid';
94
+ const CODE_ORDER_UPSTREAM_TIMEOUT = 'order_upstream_timeout';
95
+ const CODE_OUT_OF_INVENTORY = 'out_of_inventory';
96
+ const CODE_PARAMETER_INVALID_EMPTY = 'parameter_invalid_empty';
97
+ const CODE_PARAMETER_INVALID_INTEGER = 'parameter_invalid_integer';
98
+ const CODE_PARAMETER_INVALID_STRING_BLANK = 'parameter_invalid_string_blank';
99
+ const CODE_PARAMETER_INVALID_STRING_EMPTY = 'parameter_invalid_string_empty';
100
+ const CODE_PARAMETER_MISSING = 'parameter_missing';
101
+ const CODE_PARAMETER_UNKNOWN = 'parameter_unknown';
102
+ const CODE_PARAMETERS_EXCLUSIVE = 'parameters_exclusive';
103
+ const CODE_PAYMENT_INTENT_AUTHENTICATION_FAILURE = 'payment_intent_authentication_failure';
104
+ const CODE_PAYMENT_INTENT_INCOMPATIBLE_PAYMENT_METHOD = 'payment_intent_incompatible_payment_method';
105
+ const CODE_PAYMENT_INTENT_INVALID_PARAMETER = 'payment_intent_invalid_parameter';
106
+ const CODE_PAYMENT_INTENT_PAYMENT_ATTEMPT_FAILED = 'payment_intent_payment_attempt_failed';
107
+ const CODE_PAYMENT_INTENT_UNEXPECTED_STATE = 'payment_intent_unexpected_state';
108
+ const CODE_PAYMENT_METHOD_UNACTIVATED = 'payment_method_unactivated';
109
+ const CODE_PAYMENT_METHOD_UNEXPECTED_STATE = 'payment_method_unexpected_state';
110
+ const CODE_PAYOUTS_NOT_ALLOWED = 'payouts_not_allowed';
111
+ const CODE_PLATFORM_API_KEY_EXPIRED = 'platform_api_key_expired';
112
+ const CODE_POSTAL_CODE_INVALID = 'postal_code_invalid';
113
+ const CODE_PROCESSING_ERROR = 'processing_error';
114
+ const CODE_PRODUCT_INACTIVE = 'product_inactive';
115
+ const CODE_RATE_LIMIT = 'rate_limit';
116
+ const CODE_RESOURCE_ALREADY_EXISTS = 'resource_already_exists';
117
+ const CODE_RESOURCE_MISSING = 'resource_missing';
118
+ const CODE_ROUTING_NUMBER_INVALID = 'routing_number_invalid';
119
+ const CODE_SECRET_KEY_REQUIRED = 'secret_key_required';
120
+ const CODE_SEPA_UNSUPPORTED_ACCOUNT = 'sepa_unsupported_account';
121
+ const CODE_SETUP_ATTEMPT_FAILED = 'setup_attempt_failed';
122
+ const CODE_SETUP_INTENT_AUTHENTICATION_FAILURE = 'setup_intent_authentication_failure';
123
+ const CODE_SETUP_INTENT_UNEXPECTED_STATE = 'setup_intent_unexpected_state';
124
+ const CODE_SHIPPING_CALCULATION_FAILED = 'shipping_calculation_failed';
125
+ const CODE_SKU_INACTIVE = 'sku_inactive';
126
+ const CODE_STATE_UNSUPPORTED = 'state_unsupported';
127
+ const CODE_TAX_ID_INVALID = 'tax_id_invalid';
128
+ const CODE_TAXES_CALCULATION_FAILED = 'taxes_calculation_failed';
129
+ const CODE_TESTMODE_CHARGES_ONLY = 'testmode_charges_only';
130
+ const CODE_TLS_VERSION_UNSUPPORTED = 'tls_version_unsupported';
131
+ const CODE_TOKEN_ALREADY_USED = 'token_already_used';
132
+ const CODE_TOKEN_IN_USE = 'token_in_use';
133
+ const CODE_TRANSFERS_NOT_ALLOWED = 'transfers_not_allowed';
134
+ const CODE_UPSTREAM_ORDER_CREATION_FAILED = 'upstream_order_creation_failed';
135
+ const CODE_URL_INVALID = 'url_invalid';
136
+
137
+ /**
138
+ * Refreshes this object using the provided values.
139
+ *
140
+ * @param array $values
141
+ * @param null|array|string|Util\RequestOptions $opts
142
+ * @param bool $partial defaults to false
143
+ */
144
+ public function refreshFrom($values, $opts, $partial = false)
145
+ {
146
+ // Unlike most other API resources, the API will omit attributes in
147
+ // error objects when they have a null value. We manually set default
148
+ // values here to facilitate generic error handling.
149
+ $values = \array_merge([
150
+ 'charge' => null,
151
+ 'code' => null,
152
+ 'decline_code' => null,
153
+ 'doc_url' => null,
154
+ 'message' => null,
155
+ 'param' => null,
156
+ 'payment_intent' => null,
157
+ 'payment_method' => null,
158
+ 'setup_intent' => null,
159
+ 'source' => null,
160
+ 'type' => null,
161
+ ], $values);
162
+ parent::refreshFrom($values, $opts, $partial);
163
+ }
164
+ }
app/api/Stripe/Event.php CHANGED
@@ -1,167 +1,231 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Event
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $account
11
- * @property string $api_version
12
- * @property int $created
13
- * @property mixed $data
14
- * @property bool $livemode
15
- * @property int $pending_webhooks
16
- * @property mixed $request
17
- * @property string $type
18
  *
19
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  */
21
  class Event extends ApiResource
22
  {
23
- const OBJECT_NAME = "event";
 
 
 
24
 
25
  /**
26
  * Possible string representations of event types.
27
- * @link https://stripe.com/docs/api#event_types
 
28
  */
29
- const ACCOUNT_UPDATED = 'account.updated';
30
- const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized';
31
- const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
32
- const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
33
- const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
34
- const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
35
- const APPLICATION_FEE_CREATED = 'application_fee.created';
36
- const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
37
- const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
38
- const BALANCE_AVAILABLE = 'balance.available';
39
- const CHARGE_CAPTURED = 'charge.captured';
40
- const CHARGE_EXPIRED = 'charge.expired';
41
- const CHARGE_FAILED = 'charge.failed';
42
- const CHARGE_PENDING = 'charge.pending';
43
- const CHARGE_REFUNDED = 'charge.refunded';
44
- const CHARGE_SUCCEEDED = 'charge.succeeded';
45
- const CHARGE_UPDATED = 'charge.updated';
46
- const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
47
- const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
48
- const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
49
- const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
50
- const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
51
- const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
52
- const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
53
- const COUPON_CREATED = 'coupon.created';
54
- const COUPON_DELETED = 'coupon.deleted';
55
- const COUPON_UPDATED = 'coupon.updated';
56
- const CREDIT_NOTE_CREATED = 'credit_note.created';
57
- const CREDIT_NOTE_UPDATED = 'credit_note.updated';
58
- const CREDIT_NOTE_VOIDED = 'credit_note.voided';
59
- const CUSTOMER_CREATED = 'customer.created';
60
- const CUSTOMER_DELETED = 'customer.deleted';
61
- const CUSTOMER_UPDATED = 'customer.updated';
62
- const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
63
- const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
64
- const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
65
- const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
66
- const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
67
- const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
68
- const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
69
- const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
70
- const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
71
- const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
72
- const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
73
- const FILE_CREATED = 'file.created';
74
- const INVOICE_CREATED = 'invoice.created';
75
- const INVOICE_DELETED = 'invoice.deleted';
76
- const INVOICE_FINALIZED = 'invoice.finalized';
77
- const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
78
- const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required';
79
- const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
80
- const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded';
81
- const INVOICE_SENT = 'invoice.sent';
82
- const INVOICE_UPCOMING = 'invoice.upcoming';
83
- const INVOICE_UPDATED = 'invoice.updated';
84
- const INVOICE_VOIDED = 'invoice.voided';
85
- const INVOICEITEM_CREATED = 'invoiceitem.created';
86
- const INVOICEITEM_DELETED = 'invoiceitem.deleted';
87
- const INVOICEITEM_UPDATED = 'invoiceitem.updated';
88
- const ISSUER_FRAUD_RECORD_CREATED = 'issuer_fraud_record.created';
89
- const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created';
90
- const ISSUING_AUTHORIZATION_REQUEST = 'issuing_authorization.request';
91
- const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated';
92
- const ISSUING_CARD_CREATED = 'issuing_card.created';
93
- const ISSUING_CARD_UPDATED = 'issuing_card.updated';
94
- const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created';
95
- const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated';
96
- const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created';
97
- const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated';
98
- const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created';
99
- const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated';
100
- const ORDER_CREATED = 'order.created';
101
- const ORDER_PAYMENT_FAILED = 'order.payment_failed';
102
- const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
103
- const ORDER_UPDATED = 'order.updated';
104
- const ORDER_RETURN_CREATED = 'order_return.created';
105
- const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated';
106
- const PAYMENT_INTENT_CREATED = 'payment_intent.created';
107
- const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed';
108
- const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded';
109
- const PAYMENT_METHOD_ATTACHED = 'payment_method.attached';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  const PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED = 'payment_method.card_automatically_updated';
111
- const PAYMENT_METHOD_DETACHED = 'payment_method.detached';
112
- const PAYMENT_METHOD_UPDATED = 'payment_method.updated';
113
- const PAYOUT_CANCELED = 'payout.canceled';
114
- const PAYOUT_CREATED = 'payout.created';
115
- const PAYOUT_FAILED = 'payout.failed';
116
- const PAYOUT_PAID = 'payout.paid';
117
- const PAYOUT_UPDATED = 'payout.updated';
118
- const PERSON_CREATED = 'person.created';
119
- const PERSON_DELETED = 'person.deleted';
120
- const PERSON_UPDATED = 'person.updated';
121
- const PING = 'ping';
122
- const PLAN_CREATED = 'plan.created';
123
- const PLAN_DELETED = 'plan.deleted';
124
- const PLAN_UPDATED = 'plan.updated';
125
- const PRODUCT_CREATED = 'product.created';
126
- const PRODUCT_DELETED = 'product.deleted';
127
- const PRODUCT_UPDATED = 'product.updated';
128
- const RECIPIENT_CREATED = 'recipient.created';
129
- const RECIPIENT_DELETED = 'recipient.deleted';
130
- const RECIPIENT_UPDATED = 'recipient.updated';
131
- const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed';
132
- const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded';
133
- const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated';
134
- const REVIEW_CLOSED = 'review.closed';
135
- const REVIEW_OPENED = 'review.opened';
136
- const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
137
- const SKU_CREATED = 'sku.created';
138
- const SKU_DELETED = 'sku.deleted';
139
- const SKU_UPDATED = 'sku.updated';
140
- const SOURCE_CANCELED = 'source.canceled';
141
- const SOURCE_CHARGEABLE = 'source.chargeable';
142
- const SOURCE_FAILED = 'source.failed';
143
- const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification';
144
- const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required';
145
- const SOURCE_TRANSACTION_CREATED = 'source.transaction.created';
146
- const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated';
147
- const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted';
148
- const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled';
149
- const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed';
150
- const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created';
151
- const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring';
152
- const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released';
153
- const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
154
- const TAX_RATE_CREATED = 'tax_rate.created';
155
- const TAX_RATE_UPDATED = 'tax_rate.updated';
156
- const TOPUP_CANCELED = 'topup.canceled';
157
- const TOPUP_CREATED = 'topup.created';
158
- const TOPUP_FAILED = 'topup.failed';
159
- const TOPUP_REVERSED = 'topup.reversed';
160
- const TOPUP_SUCCEEDED = 'topup.succeeded';
161
- const TRANSFER_CREATED = 'transfer.created';
162
- const TRANSFER_REVERSED = 'transfer.reversed';
163
- const TRANSFER_UPDATED = 'transfer.updated';
164
-
165
- use ApiOperations\All;
166
- use ApiOperations\Retrieve;
 
 
 
 
 
 
 
 
 
 
167
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Events are our way of letting you know when something interesting happens in
9
+ * your account. When an interesting event occurs, we create a new
10
+ * <code>Event</code> object. For example, when a charge succeeds, we create a
11
+ * <code>charge.succeeded</code> event; and when an invoice payment attempt fails,
12
+ * we create an <code>invoice.payment_failed</code> event. Note that many API
13
+ * requests may cause multiple events to be created. For example, if you create a
14
+ * new subscription for a customer, you will receive both a
15
+ * <code>customer.subscription.created</code> event and a
16
+ * <code>charge.succeeded</code> event.
17
+ *
18
+ * Events occur when the state of another API resource changes. The state of that
19
+ * resource at the time of the change is embedded in the event's data field. For
20
+ * example, a <code>charge.succeeded</code> event will contain a charge, and an
21
+ * <code>invoice.payment_failed</code> event will contain an invoice.
22
+ *
23
+ * As with other API resources, you can use endpoints to retrieve an <a
24
+ * href="https://stripe.com/docs/api#retrieve_event">individual event</a> or a <a
25
+ * href="https://stripe.com/docs/api#list_events">list of events</a> from the API.
26
+ * We also have a separate <a
27
+ * href="http://en.wikipedia.org/wiki/Webhook">webhooks</a> system for sending the
28
+ * <code>Event</code> objects directly to an endpoint on your server. Webhooks are
29
+ * managed in your <a href="https://dashboard.stripe.com/account/webhooks">account
30
+ * settings</a>, and our <a href="https://stripe.com/docs/webhooks">Using
31
+ * Webhooks</a> guide will help you get set up.
32
  *
33
+ * When using <a href="https://stripe.com/docs/connect">Connect</a>, you can also
34
+ * receive notifications of events that occur in connected accounts. For these
35
+ * events, there will be an additional <code>account</code> attribute in the
36
+ * received <code>Event</code> object.
 
 
 
 
 
 
37
  *
38
+ * <strong>NOTE:</strong> Right now, access to events through the <a
39
+ * href="https://stripe.com/docs/api#retrieve_event">Retrieve Event API</a> is
40
+ * guaranteed only for 30 days.
41
+ *
42
+ * @property string $id Unique identifier for the object.
43
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
44
+ * @property string $account The connected account that originated the event.
45
+ * @property null|string $api_version The Stripe API version used to render <code>data</code>. <em>Note: This property is populated only for events on or after October 31, 2014</em>.
46
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
47
+ * @property \Stripe\StripeObject $data
48
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
49
+ * @property int $pending_webhooks Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you've specified.
50
+ * @property null|\Stripe\StripeObject $request Information on the API request that instigated the event.
51
+ * @property string $type Description of the event (e.g., <code>invoice.created</code> or <code>charge.refunded</code>).
52
  */
53
  class Event extends ApiResource
54
  {
55
+ const OBJECT_NAME = 'event';
56
+
57
+ use ApiOperations\All;
58
+ use ApiOperations\Retrieve;
59
 
60
  /**
61
  * Possible string representations of event types.
62
+ *
63
+ * @see https://stripe.com/docs/api#event_types
64
  */
65
+ const ACCOUNT_UPDATED = 'account.updated';
66
+ const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized';
67
+ const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
68
+ const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
69
+ const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
70
+ const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
71
+ const APPLICATION_FEE_CREATED = 'application_fee.created';
72
+ const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
73
+ const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
74
+ const BALANCE_AVAILABLE = 'balance.available';
75
+ const CAPABILITY_UPDATED = 'capability.updated';
76
+ const CHARGE_CAPTURED = 'charge.captured';
77
+ const CHARGE_EXPIRED = 'charge.expired';
78
+ const CHARGE_FAILED = 'charge.failed';
79
+ const CHARGE_PENDING = 'charge.pending';
80
+ const CHARGE_REFUNDED = 'charge.refunded';
81
+ const CHARGE_SUCCEEDED = 'charge.succeeded';
82
+ const CHARGE_UPDATED = 'charge.updated';
83
+ const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
84
+ const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
85
+ const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
86
+ const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
87
+ const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
88
+ const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
89
+ const CHECKOUT_SESSION_ASYNC_PAYMENT_FAILED = 'checkout.session.async_payment_failed';
90
+ const CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded';
91
+ const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
92
+ const COUPON_CREATED = 'coupon.created';
93
+ const COUPON_DELETED = 'coupon.deleted';
94
+ const COUPON_UPDATED = 'coupon.updated';
95
+ const CREDIT_NOTE_CREATED = 'credit_note.created';
96
+ const CREDIT_NOTE_UPDATED = 'credit_note.updated';
97
+ const CREDIT_NOTE_VOIDED = 'credit_note.voided';
98
+ const CUSTOMER_CREATED = 'customer.created';
99
+ const CUSTOMER_DELETED = 'customer.deleted';
100
+ const CUSTOMER_UPDATED = 'customer.updated';
101
+ const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
102
+ const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
103
+ const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
104
+ const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
105
+ const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
106
+ const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
107
+ const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
108
+ const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
109
+ const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
110
+ const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied';
111
+ const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired';
112
+ const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
113
+ const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
114
+ const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created';
115
+ const CUSTOMER_TAX_ID_DELETED = 'customer.tax_id.deleted';
116
+ const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated';
117
+ const FILE_CREATED = 'file.created';
118
+ const INVOICE_CREATED = 'invoice.created';
119
+ const INVOICE_DELETED = 'invoice.deleted';
120
+ const INVOICE_FINALIZATION_FAILED = 'invoice.finalization_failed';
121
+ const INVOICE_FINALIZED = 'invoice.finalized';
122
+ const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
123
+ const INVOICE_PAID = 'invoice.paid';
124
+ const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required';
125
+ const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
126
+ const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded';
127
+ const INVOICE_SENT = 'invoice.sent';
128
+ const INVOICE_UPCOMING = 'invoice.upcoming';
129
+ const INVOICE_UPDATED = 'invoice.updated';
130
+ const INVOICE_VOIDED = 'invoice.voided';
131
+ const INVOICEITEM_CREATED = 'invoiceitem.created';
132
+ const INVOICEITEM_DELETED = 'invoiceitem.deleted';
133
+ const INVOICEITEM_UPDATED = 'invoiceitem.updated';
134
+ const ISSUER_FRAUD_RECORD_CREATED = 'issuer_fraud_record.created';
135
+ const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created';
136
+ const ISSUING_AUTHORIZATION_REQUEST = 'issuing_authorization.request';
137
+ const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated';
138
+ const ISSUING_CARD_CREATED = 'issuing_card.created';
139
+ const ISSUING_CARD_UPDATED = 'issuing_card.updated';
140
+ const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created';
141
+ const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated';
142
+ const ISSUING_DISPUTE_CLOSED = 'issuing_dispute.closed';
143
+ const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created';
144
+ const ISSUING_DISPUTE_FUNDS_REINSTATED = 'issuing_dispute.funds_reinstated';
145
+ const ISSUING_DISPUTE_SUBMITTED = 'issuing_dispute.submitted';
146
+ const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated';
147
+ const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created';
148
+ const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated';
149
+ const MANDATE_UPDATED = 'mandate.updated';
150
+ const ORDER_CREATED = 'order.created';
151
+ const ORDER_PAYMENT_FAILED = 'order.payment_failed';
152
+ const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
153
+ const ORDER_UPDATED = 'order.updated';
154
+ const ORDER_RETURN_CREATED = 'order_return.created';
155
+ const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated';
156
+ const PAYMENT_INTENT_CANCELED = 'payment_intent.canceled';
157
+ const PAYMENT_INTENT_CREATED = 'payment_intent.created';
158
+ const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed';
159
+ const PAYMENT_INTENT_PROCESSING = 'payment_intent.processing';
160
+ const PAYMENT_INTENT_REQUIRES_ACTION = 'payment_intent.requires_action';
161
+ const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded';
162
+ const PAYMENT_METHOD_ATTACHED = 'payment_method.attached';
163
+ const PAYMENT_METHOD_AUTOMATICALLY_UPDATED = 'payment_method.automatically_updated';
164
  const PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED = 'payment_method.card_automatically_updated';
165
+ const PAYMENT_METHOD_DETACHED = 'payment_method.detached';
166
+ const PAYMENT_METHOD_UPDATED = 'payment_method.updated';
167
+ const PAYOUT_CANCELED = 'payout.canceled';
168
+ const PAYOUT_CREATED = 'payout.created';
169
+ const PAYOUT_FAILED = 'payout.failed';
170
+ const PAYOUT_PAID = 'payout.paid';
171
+ const PAYOUT_UPDATED = 'payout.updated';
172
+ const PERSON_CREATED = 'person.created';
173
+ const PERSON_DELETED = 'person.deleted';
174
+ const PERSON_UPDATED = 'person.updated';
175
+ const PING = 'ping';
176
+ const PLAN_CREATED = 'plan.created';
177
+ const PLAN_DELETED = 'plan.deleted';
178
+ const PLAN_UPDATED = 'plan.updated';
179
+ const PRICE_CREATED = 'price.created';
180
+ const PRICE_DELETED = 'price.deleted';
181
+ const PRICE_UPDATED = 'price.updated';
182
+ const PRODUCT_CREATED = 'product.created';
183
+ const PRODUCT_DELETED = 'product.deleted';
184
+ const PRODUCT_UPDATED = 'product.updated';
185
+ const PROMOTION_CODE_CREATED = 'promotion_code.created';
186
+ const PROMOTION_CODE_DELETED = 'promotion_code.deleted';
187
+ const PROMOTION_CODE_UPDATED = 'promotion_code.updated';
188
+ const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created';
189
+ const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated';
190
+ const RECIPIENT_CREATED = 'recipient.created';
191
+ const RECIPIENT_DELETED = 'recipient.deleted';
192
+ const RECIPIENT_UPDATED = 'recipient.updated';
193
+ const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed';
194
+ const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded';
195
+ const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated';
196
+ const REVIEW_CLOSED = 'review.closed';
197
+ const REVIEW_OPENED = 'review.opened';
198
+ const SETUP_INTENT_CANCELED = 'setup_intent.canceled';
199
+ const SETUP_INTENT_CREATED = 'setup_intent.created';
200
+ const SETUP_INTENT_REQUIRES_ACTION = 'setup_intent.requires_action';
201
+ const SETUP_INTENT_SETUP_FAILED = 'setup_intent.setup_failed';
202
+ const SETUP_INTENT_SUCCEEDED = 'setup_intent.succeeded';
203
+ const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
204
+ const SKU_CREATED = 'sku.created';
205
+ const SKU_DELETED = 'sku.deleted';
206
+ const SKU_UPDATED = 'sku.updated';
207
+ const SOURCE_CANCELED = 'source.canceled';
208
+ const SOURCE_CHARGEABLE = 'source.chargeable';
209
+ const SOURCE_FAILED = 'source.failed';
210
+ const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification';
211
+ const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required';
212
+ const SOURCE_TRANSACTION_CREATED = 'source.transaction.created';
213
+ const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated';
214
+ const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted';
215
+ const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled';
216
+ const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed';
217
+ const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created';
218
+ const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring';
219
+ const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released';
220
+ const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
221
+ const TAX_RATE_CREATED = 'tax_rate.created';
222
+ const TAX_RATE_UPDATED = 'tax_rate.updated';
223
+ const TOPUP_CANCELED = 'topup.canceled';
224
+ const TOPUP_CREATED = 'topup.created';
225
+ const TOPUP_FAILED = 'topup.failed';
226
+ const TOPUP_REVERSED = 'topup.reversed';
227
+ const TOPUP_SUCCEEDED = 'topup.succeeded';
228
+ const TRANSFER_CREATED = 'transfer.created';
229
+ const TRANSFER_REVERSED = 'transfer.reversed';
230
+ const TRANSFER_UPDATED = 'transfer.updated';
231
  }
app/api/Stripe/Exception/ApiConnectionException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * ApiConnection is thrown in the event that the SDK can't connect to Stripe's
7
+ * servers. That can be for a variety of different reasons from a downed
8
+ * network to a bad TLS certificate.
9
+ */
10
+ class ApiConnectionException extends ApiErrorException
11
+ {
12
+ }
app/api/Stripe/Exception/ApiErrorException.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * Implements properties and methods common to all (non-SPL) Stripe exceptions.
7
+ */
8
+ abstract class ApiErrorException extends \Exception implements ExceptionInterface
9
+ {
10
+ protected $error;
11
+ protected $httpBody;
12
+ protected $httpHeaders;
13
+ protected $httpStatus;
14
+ protected $jsonBody;
15
+ protected $requestId;
16
+ protected $stripeCode;
17
+
18
+ /**
19
+ * Creates a new API error exception.
20
+ *
21
+ * @param string $message the exception message
22
+ * @param null|int $httpStatus the HTTP status code
23
+ * @param null|string $httpBody the HTTP body as a string
24
+ * @param null|array $jsonBody the JSON deserialized body
25
+ * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array
26
+ * @param null|string $stripeCode the Stripe error code
27
+ *
28
+ * @return static
29
+ */
30
+ public static function factory(
31
+ $message,
32
+ $httpStatus = null,
33
+ $httpBody = null,
34
+ $jsonBody = null,
35
+ $httpHeaders = null,
36
+ $stripeCode = null
37
+ ) {
38
+ $instance = new static($message);
39
+ $instance->setHttpStatus($httpStatus);
40
+ $instance->setHttpBody($httpBody);
41
+ $instance->setJsonBody($jsonBody);
42
+ $instance->setHttpHeaders($httpHeaders);
43
+ $instance->setStripeCode($stripeCode);
44
+
45
+ $instance->setRequestId(null);
46
+ if ($httpHeaders && isset($httpHeaders['Request-Id'])) {
47
+ $instance->setRequestId($httpHeaders['Request-Id']);
48
+ }
49
+
50
+ $instance->setError($instance->constructErrorObject());
51
+
52
+ return $instance;
53
+ }
54
+
55
+ /**
56
+ * Gets the Stripe error object.
57
+ *
58
+ * @return null|\Stripe\ErrorObject
59
+ */
60
+ public function getError()
61
+ {
62
+ return $this->error;
63
+ }
64
+
65
+ /**
66
+ * Sets the Stripe error object.
67
+ *
68
+ * @param null|\Stripe\ErrorObject $error
69
+ */
70
+ public function setError($error)
71
+ {
72
+ $this->error = $error;
73
+ }
74
+
75
+ /**
76
+ * Gets the HTTP body as a string.
77
+ *
78
+ * @return null|string
79
+ */
80
+ public function getHttpBody()
81
+ {
82
+ return $this->httpBody;
83
+ }
84
+
85
+ /**
86
+ * Sets the HTTP body as a string.
87
+ *
88
+ * @param null|string $httpBody
89
+ */
90
+ public function setHttpBody($httpBody)
91
+ {
92
+ $this->httpBody = $httpBody;
93
+ }
94
+
95
+ /**
96
+ * Gets the HTTP headers array.
97
+ *
98
+ * @return null|array|\Stripe\Util\CaseInsensitiveArray
99
+ */
100
+ public function getHttpHeaders()
101
+ {
102
+ return $this->httpHeaders;
103
+ }
104
+
105
+ /**
106
+ * Sets the HTTP headers array.
107
+ *
108
+ * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders
109
+ */
110
+ public function setHttpHeaders($httpHeaders)
111
+ {
112
+ $this->httpHeaders = $httpHeaders;
113
+ }
114
+
115
+ /**
116
+ * Gets the HTTP status code.
117
+ *
118
+ * @return null|int
119
+ */
120
+ public function getHttpStatus()
121
+ {
122
+ return $this->httpStatus;
123
+ }
124
+
125
+ /**
126
+ * Sets the HTTP status code.
127
+ *
128
+ * @param null|int $httpStatus
129
+ */
130
+ public function setHttpStatus($httpStatus)
131
+ {
132
+ $this->httpStatus = $httpStatus;
133
+ }
134
+
135
+ /**
136
+ * Gets the JSON deserialized body.
137
+ *
138
+ * @return null|array<string, mixed>
139
+ */
140
+ public function getJsonBody()
141
+ {
142
+ return $this->jsonBody;
143
+ }
144
+
145
+ /**
146
+ * Sets the JSON deserialized body.
147
+ *
148
+ * @param null|array<string, mixed> $jsonBody
149
+ */
150
+ public function setJsonBody($jsonBody)
151
+ {
152
+ $this->jsonBody = $jsonBody;
153
+ }
154
+
155
+ /**
156
+ * Gets the Stripe request ID.
157
+ *
158
+ * @return null|string
159
+ */
160
+ public function getRequestId()
161
+ {
162
+ return $this->requestId;
163
+ }
164
+
165
+ /**
166
+ * Sets the Stripe request ID.
167
+ *
168
+ * @param null|string $requestId
169
+ */
170
+ public function setRequestId($requestId)
171
+ {
172
+ $this->requestId = $requestId;
173
+ }
174
+
175
+ /**
176
+ * Gets the Stripe error code.
177
+ *
178
+ * Cf. the `CODE_*` constants on {@see \Stripe\ErrorObject} for possible
179
+ * values.
180
+ *
181
+ * @return null|string
182
+ */
183
+ public function getStripeCode()
184
+ {
185
+ return $this->stripeCode;
186
+ }
187
+
188
+ /**
189
+ * Sets the Stripe error code.
190
+ *
191
+ * @param null|string $stripeCode
192
+ */
193
+ public function setStripeCode($stripeCode)
194
+ {
195
+ $this->stripeCode = $stripeCode;
196
+ }
197
+
198
+ /**
199
+ * Returns the string representation of the exception.
200
+ *
201
+ * @return string
202
+ */
203
+ public function __toString()
204
+ {
205
+ $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) ";
206
+ $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) ";
207
+
208
+ return "{$statusStr}{$idStr}{$this->getMessage()}";
209
+ }
210
+
211
+ protected function constructErrorObject()
212
+ {
213
+ if (null === $this->jsonBody || !\array_key_exists('error', $this->jsonBody)) {
214
+ return null;
215
+ }
216
+
217
+ return \Stripe\ErrorObject::constructFrom($this->jsonBody['error']);
218
+ }
219
+ }
app/api/Stripe/Exception/AuthenticationException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * AuthenticationException is thrown when invalid credentials are used to
7
+ * connect to Stripe's servers.
8
+ */
9
+ class AuthenticationException extends ApiErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/BadMethodCallException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
6
+ {
7
+ }
app/api/Stripe/Exception/CardException.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * CardException is thrown when a user enters a card that can't be charged for
7
+ * some reason.
8
+ */
9
+ class CardException extends ApiErrorException
10
+ {
11
+ protected $declineCode;
12
+ protected $stripeParam;
13
+
14
+ /**
15
+ * Creates a new CardException exception.
16
+ *
17
+ * @param string $message the exception message
18
+ * @param null|int $httpStatus the HTTP status code
19
+ * @param null|string $httpBody the HTTP body as a string
20
+ * @param null|array $jsonBody the JSON deserialized body
21
+ * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array
22
+ * @param null|string $stripeCode the Stripe error code
23
+ * @param null|string $declineCode the decline code
24
+ * @param null|string $stripeParam the parameter related to the error
25
+ *
26
+ * @return CardException
27
+ */
28
+ public static function factory(
29
+ $message,
30
+ $httpStatus = null,
31
+ $httpBody = null,
32
+ $jsonBody = null,
33
+ $httpHeaders = null,
34
+ $stripeCode = null,
35
+ $declineCode = null,
36
+ $stripeParam = null
37
+ ) {
38
+ $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode);
39
+ $instance->setDeclineCode($declineCode);
40
+ $instance->setStripeParam($stripeParam);
41
+
42
+ return $instance;
43
+ }
44
+
45
+ /**
46
+ * Gets the decline code.
47
+ *
48
+ * @return null|string
49
+ */
50
+ public function getDeclineCode()
51
+ {
52
+ return $this->declineCode;
53
+ }
54
+
55
+ /**
56
+ * Sets the decline code.
57
+ *
58
+ * @param null|string $declineCode
59
+ */
60
+ public function setDeclineCode($declineCode)
61
+ {
62
+ $this->declineCode = $declineCode;
63
+ }
64
+
65
+ /**
66
+ * Gets the parameter related to the error.
67
+ *
68
+ * @return null|string
69
+ */
70
+ public function getStripeParam()
71
+ {
72
+ return $this->stripeParam;
73
+ }
74
+
75
+ /**
76
+ * Sets the parameter related to the error.
77
+ *
78
+ * @param null|string $stripeParam
79
+ */
80
+ public function setStripeParam($stripeParam)
81
+ {
82
+ $this->stripeParam = $stripeParam;
83
+ }
84
+ }
app/api/Stripe/Exception/ExceptionInterface.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ // TODO: remove this check once we drop support for PHP 5
6
+ if (\interface_exists(\Throwable::class, false)) {
7
+ /**
8
+ * The base interface for all Stripe exceptions.
9
+ */
10
+ interface ExceptionInterface extends \Throwable
11
+ {
12
+ }
13
+ } else {
14
+ /**
15
+ * The base interface for all Stripe exceptions.
16
+ */
17
+ // phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
18
+ interface ExceptionInterface
19
+ {
20
+ }
21
+ // phpcs:enable
22
+ }
app/api/Stripe/Exception/IdempotencyException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * IdempotencyException is thrown in cases where an idempotency key was used
7
+ * improperly.
8
+ */
9
+ class IdempotencyException extends ApiErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
6
+ {
7
+ }
app/api/Stripe/Exception/InvalidRequestException.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * InvalidRequestException is thrown when a request is initiated with invalid
7
+ * parameters.
8
+ */
9
+ class InvalidRequestException extends ApiErrorException
10
+ {
11
+ protected $stripeParam;
12
+
13
+ /**
14
+ * Creates a new InvalidRequestException exception.
15
+ *
16
+ * @param string $message the exception message
17
+ * @param null|int $httpStatus the HTTP status code
18
+ * @param null|string $httpBody the HTTP body as a string
19
+ * @param null|array $jsonBody the JSON deserialized body
20
+ * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array
21
+ * @param null|string $stripeCode the Stripe error code
22
+ * @param null|string $stripeParam the parameter related to the error
23
+ *
24
+ * @return InvalidRequestException
25
+ */
26
+ public static function factory(
27
+ $message,
28
+ $httpStatus = null,
29
+ $httpBody = null,
30
+ $jsonBody = null,
31
+ $httpHeaders = null,
32
+ $stripeCode = null,
33
+ $stripeParam = null
34
+ ) {
35
+ $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode);
36
+ $instance->setStripeParam($stripeParam);
37
+
38
+ return $instance;
39
+ }
40
+
41
+ /**
42
+ * Gets the parameter related to the error.
43
+ *
44
+ * @return null|string
45
+ */
46
+ public function getStripeParam()
47
+ {
48
+ return $this->stripeParam;
49
+ }
50
+
51
+ /**
52
+ * Sets the parameter related to the error.
53
+ *
54
+ * @param null|string $stripeParam
55
+ */
56
+ public function setStripeParam($stripeParam)
57
+ {
58
+ $this->stripeParam = $stripeParam;
59
+ }
60
+ }
app/api/Stripe/Exception/OAuth/ExceptionInterface.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * The base interface for all Stripe OAuth exceptions.
7
+ */
8
+ interface ExceptionInterface extends \Stripe\Exception\ExceptionInterface
9
+ {
10
+ }
app/api/Stripe/Exception/OAuth/InvalidClientException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * InvalidClientException is thrown when the client_id does not belong to you,
7
+ * the stripe_user_id does not exist or is not connected to your application,
8
+ * or the API key mode (live or test mode) does not match the client_id mode.
9
+ */
10
+ class InvalidClientException extends OAuthErrorException
11
+ {
12
+ }
app/api/Stripe/{Error/OAuth/InvalidGrant.php → Exception/OAuth/InvalidGrantException.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
- namespace Stripe\Error\OAuth;
4
 
5
  /**
6
- * InvalidGrant is raised when a specified code doesn't exist, is
7
  * expired, has been used, or doesn't belong to you; a refresh token doesn't
8
  * exist, or doesn't belong to you; or if an API key's mode (live or test)
9
  * doesn't match the mode of a code or refresh token.
10
  */
11
- class InvalidGrant extends OAuthBase
12
  {
13
  }
1
  <?php
2
 
3
+ namespace Stripe\Exception\OAuth;
4
 
5
  /**
6
+ * InvalidGrantException is thrown when a specified code doesn't exist, is
7
  * expired, has been used, or doesn't belong to you; a refresh token doesn't
8
  * exist, or doesn't belong to you; or if an API key's mode (live or test)
9
  * doesn't match the mode of a code or refresh token.
10
  */
11
+ class InvalidGrantException extends OAuthErrorException
12
  {
13
  }
app/api/Stripe/Exception/OAuth/InvalidRequestException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * InvalidRequestException is thrown when a code, refresh token, or grant
7
+ * type parameter is not provided, but was required.
8
+ */
9
+ class InvalidRequestException extends OAuthErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/OAuth/InvalidScopeException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * InvalidScopeException is thrown when an invalid scope parameter is provided.
7
+ */
8
+ class InvalidScopeException extends OAuthErrorException
9
+ {
10
+ }
app/api/Stripe/Exception/OAuth/OAuthErrorException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * Implements properties and methods common to all (non-SPL) Stripe OAuth
7
+ * exceptions.
8
+ */
9
+ abstract class OAuthErrorException extends \Stripe\Exception\ApiErrorException
10
+ {
11
+ protected function constructErrorObject()
12
+ {
13
+ if (null === $this->jsonBody) {
14
+ return null;
15
+ }
16
+
17
+ return \Stripe\OAuthErrorObject::constructFrom($this->jsonBody);
18
+ }
19
+ }
app/api/Stripe/Exception/OAuth/UnknownOAuthErrorException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * UnknownApiErrorException is thrown when the client library receives an
7
+ * error from the OAuth API it doesn't know about. Receiving this error usually
8
+ * means that your client library is outdated and should be upgraded.
9
+ */
10
+ class UnknownOAuthErrorException extends OAuthErrorException
11
+ {
12
+ }
app/api/Stripe/Exception/OAuth/UnsupportedGrantTypeException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * UnsupportedGrantTypeException is thrown when an unuspported grant type
7
+ * parameter is specified.
8
+ */
9
+ class UnsupportedGrantTypeException extends OAuthErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/OAuth/UnsupportedResponseTypeException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception\OAuth;
4
+
5
+ /**
6
+ * UnsupportedResponseTypeException is thrown when an unsupported response type
7
+ * parameter is specified.
8
+ */
9
+ class UnsupportedResponseTypeException extends OAuthErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/PermissionException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * PermissionException is thrown in cases where access was attempted on a
7
+ * resource that wasn't allowed.
8
+ */
9
+ class PermissionException extends ApiErrorException
10
+ {
11
+ }
app/api/Stripe/Exception/RateLimitException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * RateLimitException is thrown in cases where an account is putting too much
7
+ * load on Stripe's API servers (usually by performing too many requests).
8
+ * Please back off on request rate.
9
+ */
10
+ class RateLimitException extends InvalidRequestException
11
+ {
12
+ }
app/api/Stripe/Exception/SignatureVerificationException.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * SignatureVerificationException is thrown when the signature verification for
7
+ * a webhook fails.
8
+ */
9
+ class SignatureVerificationException extends \Exception implements ExceptionInterface
10
+ {
11
+ protected $httpBody;
12
+ protected $sigHeader;
13
+
14
+ /**
15
+ * Creates a new SignatureVerificationException exception.
16
+ *
17
+ * @param string $message the exception message
18
+ * @param null|string $httpBody the HTTP body as a string
19
+ * @param null|string $sigHeader the `Stripe-Signature` HTTP header
20
+ *
21
+ * @return SignatureVerificationException
22
+ */
23
+ public static function factory(
24
+ $message,
25
+ $httpBody = null,
26
+ $sigHeader = null
27
+ ) {
28
+ $instance = new static($message);
29
+ $instance->setHttpBody($httpBody);
30
+ $instance->setSigHeader($sigHeader);
31
+
32
+ return $instance;
33
+ }
34
+
35
+ /**
36
+ * Gets the HTTP body as a string.
37
+ *
38
+ * @return null|string
39
+ */
40
+ public function getHttpBody()
41
+ {
42
+ return $this->httpBody;
43
+ }
44
+
45
+ /**
46
+ * Sets the HTTP body as a string.
47
+ *
48
+ * @param null|string $httpBody
49
+ */
50
+ public function setHttpBody($httpBody)
51
+ {
52
+ $this->httpBody = $httpBody;
53
+ }
54
+
55
+ /**
56
+ * Gets the `Stripe-Signature` HTTP header.
57
+ *
58
+ * @return null|string
59
+ */
60
+ public function getSigHeader()
61
+ {
62
+ return $this->sigHeader;
63
+ }
64
+
65
+ /**
66
+ * Sets the `Stripe-Signature` HTTP header.
67
+ *
68
+ * @param null|string $sigHeader
69
+ */
70
+ public function setSigHeader($sigHeader)
71
+ {
72
+ $this->sigHeader = $sigHeader;
73
+ }
74
+ }
app/api/Stripe/Exception/UnexpectedValueException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface
6
+ {
7
+ }
app/api/Stripe/Exception/UnknownApiErrorException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Exception;
4
+
5
+ /**
6
+ * UnknownApiErrorException is thrown when the client library receives an
7
+ * error from the API it doesn't know about. Receiving this error usually
8
+ * means that your client library is outdated and should be upgraded.
9
+ */
10
+ class UnknownApiErrorException extends ApiErrorException
11
+ {
12
+ }
app/api/Stripe/ExchangeRate.php CHANGED
@@ -1,15 +1,29 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class ExchangeRate
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @package Stripe
 
 
9
  */
10
  class ExchangeRate extends ApiResource
11
  {
12
- const OBJECT_NAME = "exchange_rate";
13
 
14
  use ApiOperations\All;
15
  use ApiOperations\Retrieve;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <code>Exchange Rate</code> objects allow you to determine the rates that Stripe
9
+ * is currently using to convert from one currency to another. Since this number is
10
+ * variable throughout the day, there are various reasons why you might want to
11
+ * know the current rate (for example, to dynamically price an item for a user with
12
+ * a default payment in a foreign currency).
13
+ *
14
+ * If you want a guarantee that the charge is made with a certain exchange rate you
15
+ * expect is current, you can pass in <code>exchange_rate</code> to charges
16
+ * endpoints. If the value is no longer up to date, the charge won't go through.
17
+ * Please refer to our <a href="https://stripe.com/docs/exchange-rates">Exchange
18
+ * Rates API</a> guide for more details.
19
  *
20
+ * @property string $id Unique identifier for the object. Represented as the three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> in lowercase.
21
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
22
+ * @property \Stripe\StripeObject $rates Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency.
23
  */
24
  class ExchangeRate extends ApiResource
25
  {
26
+ const OBJECT_NAME = 'exchange_rate';
27
 
28
  use ApiOperations\All;
29
  use ApiOperations\Retrieve;
app/api/Stripe/File.php CHANGED
@@ -1,37 +1,58 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class File
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property string $filename
12
- * @property Collection $links
13
- * @property string $purpose
14
- * @property int $size
15
- * @property string $title
16
- * @property string $type
17
- * @property string $url
18
  *
19
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
20
  */
21
  class File extends ApiResource
22
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  // This resource can have two different object names. In latter API
24
  // versions, only `file` is used, but since stripe-php may be used with
25
  // any API version, we need to support deserializing the older
26
  // `file_upload` object into the same class.
27
- const OBJECT_NAME = "file";
28
- const OBJECT_NAME_ALT = "file_upload";
29
 
30
- use ApiOperations\All;
31
  use ApiOperations\Create {
32
  create as protected _create;
33
  }
34
- use ApiOperations\Retrieve;
35
 
36
  public static function classUrl()
37
  {
@@ -39,24 +60,23 @@ class File extends ApiResource
39
  }
40
 
41
  /**
42
- * @param array|null $params
43
- * @param array|string|null $options
 
 
44
  *
45
- * @return \Stripe\File The created resource.
46
  */
47
- public static function create($params = null, $options = null)
48
  {
49
- $opts = \Stripe\Util\RequestOptions::parse($options);
50
- if (is_null($opts->apiBase)) {
51
  $opts->apiBase = Stripe::$apiUploadBase;
52
  }
53
  // Manually flatten params, otherwise curl's multipart encoder will
54
  // choke on nested arrays.
55
- // TODO: use array_column() once we drop support for PHP 5.4
56
- $flatParams = [];
57
- foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
58
- $flatParams[$pair[0]] = $pair[1];
59
- }
60
  return static::_create($flatParams, $opts);
61
  }
62
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * This is an object representing a file hosted on Stripe's servers. The file may
9
+ * have been uploaded by yourself using the <a
10
+ * href="https://stripe.com/docs/api#create_file">create file</a> request (for
11
+ * example, when uploading dispute evidence) or it may have been created by Stripe
12
+ * (for example, the results of a <a href="#scheduled_queries">Sigma scheduled
13
+ * query</a>).
14
  *
15
+ * Related guide: <a href="https://stripe.com/docs/file-upload">File Upload
16
+ * Guide</a>.
 
 
 
 
 
 
 
 
17
  *
18
+ * @property string $id Unique identifier for the object.
19
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
20
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21
+ * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds.
22
+ * @property null|string $filename A filename for the file, suitable for saving to a filesystem.
23
+ * @property null|\Stripe\Collection $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
24
+ * @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file.
25
+ * @property int $size The size in bytes of the file object.
26
+ * @property null|string $title A user friendly title for the document.
27
+ * @property null|string $type The type of the file returned (e.g., <code>csv</code>, <code>pdf</code>, <code>jpg</code>, or <code>png</code>).
28
+ * @property null|string $url The URL from which the file can be downloaded using your live secret API key.
29
  */
30
  class File extends ApiResource
31
  {
32
+ const OBJECT_NAME = 'file';
33
+
34
+ use ApiOperations\All;
35
+ use ApiOperations\Retrieve;
36
+
37
+ const PURPOSE_ACCOUNT_REQUIREMENT = 'account_requirement';
38
+ const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification';
39
+ const PURPOSE_BUSINESS_ICON = 'business_icon';
40
+ const PURPOSE_BUSINESS_LOGO = 'business_logo';
41
+ const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature';
42
+ const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence';
43
+ const PURPOSE_IDENTITY_DOCUMENT = 'identity_document';
44
+ const PURPOSE_PCI_DOCUMENT = 'pci_document';
45
+ const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';
46
+
47
  // This resource can have two different object names. In latter API
48
  // versions, only `file` is used, but since stripe-php may be used with
49
  // any API version, we need to support deserializing the older
50
  // `file_upload` object into the same class.
51
+ const OBJECT_NAME_ALT = 'file_upload';
 
52
 
 
53
  use ApiOperations\Create {
54
  create as protected _create;
55
  }
 
56
 
57
  public static function classUrl()
58
  {
60
  }
61
 
62
  /**
63
+ * @param null|array $params
64
+ * @param null|array|string $opts
65
+ *
66
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
67
  *
68
+ * @return \Stripe\File the created file
69
  */
70
+ public static function create($params = null, $opts = null)
71
  {
72
+ $opts = \Stripe\Util\RequestOptions::parse($opts);
73
+ if (null === $opts->apiBase) {
74
  $opts->apiBase = Stripe::$apiUploadBase;
75
  }
76
  // Manually flatten params, otherwise curl's multipart encoder will
77
  // choke on nested arrays.
78
+ $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
79
+
 
 
 
80
  return static::_create($flatParams, $opts);
81
  }
82
  }
app/api/Stripe/FileLink.php CHANGED
@@ -1,25 +1,27 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class FileLink
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property bool $expired
12
- * @property int $expires_at
13
- * @property string $file
14
- * @property bool $livemode
15
- * @property StripeObject $metadata
16
- * @property string $url
17
  *
18
- * @package Stripe
 
 
 
 
 
 
 
 
19
  */
20
  class FileLink extends ApiResource
21
  {
22
- const OBJECT_NAME = "file_link";
23
 
24
  use ApiOperations\All;
25
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * To share the contents of a <code>File</code> object with non-Stripe users, you
9
+ * can create a <code>FileLink</code>. <code>FileLink</code>s contain a URL that
10
+ * can be used to retrieve the contents of the file without authentication.
 
 
 
 
 
 
 
 
11
  *
12
+ * @property string $id Unique identifier for the object.
13
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
14
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15
+ * @property bool $expired Whether this link is already expired.
16
+ * @property null|int $expires_at Time at which the link expires.
17
+ * @property string|\Stripe\File $file The file object this link points to.
18
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
19
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
20
+ * @property null|string $url The publicly accessible URL to download the file.
21
  */
22
  class FileLink extends ApiResource
23
  {
24
+ const OBJECT_NAME = 'file_link';
25
 
26
  use ApiOperations\All;
27
  use ApiOperations\Create;
app/api/Stripe/FileUpload.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe;
4
-
5
- // For backwards compatibility, the `File` class is aliased to `FileUpload`.
6
- class_alias('Stripe\\File', 'Stripe\\FileUpload');
 
 
 
 
 
 
app/api/Stripe/HttpClient/ClientInterface.php CHANGED
@@ -9,13 +9,14 @@ interface ClientInterface
9
  * @param string $absUrl The URL being requested, including domain and protocol
10
  * @param array $headers Headers to be used in the request (full strings, not KV pairs)
11
  * @param array $params KV pairs for parameters. Can be nested for arrays and hashes
12
- * @param boolean $hasFile Whether or not $params references a file (via an @ prefix or
13
- * CurlFile)
14
  *
15
- * @throws \Stripe\Error\Api
16
- * @throws \Stripe\Error\ApiConnection
17
- * @return array An array whose first element is raw request body, second
18
- * element is HTTP status code and third array of HTTP headers.
 
19
  */
20
  public function request($method, $absUrl, $headers, $params, $hasFile);
21
  }
9
  * @param string $absUrl The URL being requested, including domain and protocol
10
  * @param array $headers Headers to be used in the request (full strings, not KV pairs)
11
  * @param array $params KV pairs for parameters. Can be nested for arrays and hashes
12
+ * @param bool $hasFile Whether or not $params references a file (via an @ prefix or
13
+ * CURLFile)
14
  *
15
+ * @throws \Stripe\Exception\ApiConnectionException
16
+ * @throws \Stripe\Exception\UnexpectedValueException
17
+ *
18
+ * @return array an array whose first element is raw request body, second
19
+ * element is HTTP status code and third array of HTTP headers
20
  */
21
  public function request($method, $absUrl, $headers, $params, $hasFile);
22
  }
app/api/Stripe/HttpClient/CurlClient.php CHANGED
@@ -2,28 +2,26 @@
2
 
3
  namespace Stripe\HttpClient;
4
 
 
5
  use Stripe\Stripe;
6
- use Stripe\Error;
7
  use Stripe\Util;
8
 
9
- // cURL constants are not defined in PHP < 5.5
10
-
11
  // @codingStandardsIgnoreStart
12
  // PSR2 requires all constants be upper case. Sadly, the CURL_SSLVERSION
13
  // constants do not abide by those rules.
14
 
15
- // Note the values 1 and 6 come from their position in the enum that
16
  // defines them in cURL's source code.
17
- if (!defined('CURL_SSLVERSION_TLSv1')) {
18
- define('CURL_SSLVERSION_TLSv1', 1);
19
- }
20
- if (!defined('CURL_SSLVERSION_TLSv1_2')) {
21
- define('CURL_SSLVERSION_TLSv1_2', 6);
22
  }
23
  // @codingStandardsIgnoreEnd
24
 
25
- if (!defined('CURL_HTTP_VERSION_2TLS')) {
26
- define('CURL_HTTP_VERSION_2TLS', 4);
 
27
  }
28
 
29
  class CurlClient implements ClientInterface
@@ -35,18 +33,24 @@ class CurlClient implements ClientInterface
35
  if (!self::$instance) {
36
  self::$instance = new self();
37
  }
 
38
  return self::$instance;
39
  }
40
 
41
  protected $defaultOptions;
42
 
 
 
 
43
  protected $userAgentInfo;
44
 
45
- protected $enablePersistentConnections = null;
 
 
46
 
47
- protected $enableHttp2 = null;
48
 
49
- protected $curlHandle = null;
50
 
51
  /**
52
  * CurlClient constructor.
@@ -59,7 +63,8 @@ class CurlClient implements ClientInterface
59
  * Note that request() will silently ignore a non-callable, non-array $defaultOptions, and will
60
  * throw an exception if $defaultOptions returns a non-array value.
61
  *
62
- * @param array|callable|null $defaultOptions
 
63
  */
64
  public function __construct($defaultOptions = null, $randomGenerator = null)
65
  {
@@ -67,10 +72,6 @@ class CurlClient implements ClientInterface
67
  $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator();
68
  $this->initUserAgentInfo();
69
 
70
- // TODO: curl_reset requires PHP >= 5.5.0. Once we drop support for PHP 5.4, we can simply
71
- // initialize this to true.
72
- $this->enablePersistentConnections = function_exists('curl_reset');
73
-
74
  $this->enableHttp2 = $this->canSafelyUseHttp2();
75
  }
76
 
@@ -81,9 +82,9 @@ class CurlClient implements ClientInterface
81
 
82
  public function initUserAgentInfo()
83
  {
84
- $curlVersion = curl_version();
85
  $this->userAgentInfo = [
86
- 'httplib' => 'curl ' . $curlVersion['version'],
87
  'ssllib' => $curlVersion['ssl_version'],
88
  ];
89
  }
@@ -99,7 +100,7 @@ class CurlClient implements ClientInterface
99
  }
100
 
101
  /**
102
- * @return boolean
103
  */
104
  public function getEnablePersistentConnections()
105
  {
@@ -107,7 +108,7 @@ class CurlClient implements ClientInterface
107
  }
108
 
109
  /**
110
- * @param boolean $enable
111
  */
112
  public function setEnablePersistentConnections($enable)
113
  {
@@ -115,7 +116,7 @@ class CurlClient implements ClientInterface
115
  }
116
 
117
  /**
118
- * @return boolean
119
  */
120
  public function getEnableHttp2()
121
  {
@@ -123,13 +124,41 @@ class CurlClient implements ClientInterface
123
  }
124
 
125
  /**
126
- * @param boolean $enable
127
  */
128
  public function setEnableHttp2($enable)
129
  {
130
  $this->enableHttp2 = $enable;
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  // USER DEFINED TIMEOUTS
134
 
135
  const DEFAULT_TIMEOUT = 80;
@@ -140,13 +169,15 @@ class CurlClient implements ClientInterface
140
 
141
  public function setTimeout($seconds)
142
  {
143
- $this->timeout = (int) max($seconds, 0);
 
144
  return $this;
145
  }
146
 
147
  public function setConnectTimeout($seconds)
148
  {
149
- $this->connectTimeout = (int) max($seconds, 0);
 
150
  return $this;
151
  }
152
 
@@ -164,64 +195,52 @@ class CurlClient implements ClientInterface
164
 
165
  public function request($method, $absUrl, $headers, $params, $hasFile)
166
  {
167
- $method = strtolower($method);
168
 
169
  $opts = [];
170
- if (is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value
171
- $opts = call_user_func_array($this->defaultOptions, func_get_args());
172
- if (!is_array($opts)) {
173
- throw new Error\Api("Non-array value returned by defaultOptions CurlClient callback");
174
  }
175
- } elseif (is_array($this->defaultOptions)) { // set default curlopts from array
176
  $opts = $this->defaultOptions;
177
  }
178
 
179
  $params = Util\Util::objectsToIds($params);
180
 
181
- if ($method == 'get') {
182
  if ($hasFile) {
183
- throw new Error\Api(
184
- "Issuing a GET request with a file parameter"
185
  );
186
  }
187
- $opts[CURLOPT_HTTPGET] = 1;
188
- if (count($params) > 0) {
189
  $encoded = Util\Util::encodeParameters($params);
190
- $absUrl = "$absUrl?$encoded";
191
  }
192
- } elseif ($method == 'post') {
193
- $opts[CURLOPT_POST] = 1;
194
- $opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params);
195
- } elseif ($method == 'delete') {
196
- $opts[CURLOPT_CUSTOMREQUEST] = 'DELETE';
197
- if (count($params) > 0) {
198
  $encoded = Util\Util::encodeParameters($params);
199
- $absUrl = "$absUrl?$encoded";
200
  }
201
  } else {
202
- throw new Error\Api("Unrecognized method $method");
203
  }
204
 
205
  // It is only safe to retry network failures on POST requests if we
206
  // add an Idempotency-Key header
207
- if (($method == 'post') && (Stripe::$maxNetworkRetries > 0)) {
208
- if (!$this->hasHeader($headers, "Idempotency-Key")) {
209
- array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid());
210
  }
211
  }
212
 
213
- // Create a callback to capture HTTP headers for the response
214
- $rheaders = new Util\CaseInsensitiveArray();
215
- $headerCallback = function ($curl, $header_line) use (&$rheaders) {
216
- // Ignore the HTTP request line (HTTP/1.1 200 OK)
217
- if (strpos($header_line, ":") === false) {
218
- return strlen($header_line);
219
- }
220
- list($key, $value) = explode(":", trim($header_line), 2);
221
- $rheaders[trim($key)] = trim($value);
222
- return strlen($header_line);
223
- };
224
-
225
  // By default for large request body sizes (> 1024 bytes), cURL will
226
  // send a request without a body and with a `Expect: 100-continue`
227
  // header, which gives the server a chance to respond with an error
@@ -234,32 +253,36 @@ class CurlClient implements ClientInterface
234
  // we'll error under that condition. To compensate for that problem
235
  // for the time being, override cURL's behavior by simply always
236
  // sending an empty `Expect:` header.
237
- array_push($headers, 'Expect: ');
238
 
239
  $absUrl = Util\Util::utf8($absUrl);
240
- $opts[CURLOPT_URL] = $absUrl;
241
- $opts[CURLOPT_RETURNTRANSFER] = true;
242
- $opts[CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout;
243
- $opts[CURLOPT_TIMEOUT] = $this->timeout;
244
- $opts[CURLOPT_HEADERFUNCTION] = $headerCallback;
245
- $opts[CURLOPT_HTTPHEADER] = $headers;
246
- $opts[CURLOPT_CAINFO] = Stripe::getCABundlePath();
247
  if (!Stripe::getVerifySslCerts()) {
248
- $opts[CURLOPT_SSL_VERIFYPEER] = false;
249
  }
250
 
251
- if (!isset($opts[CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) {
252
  // For HTTPS requests, enable HTTP/2, if supported
253
- $opts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2TLS;
254
  }
255
 
256
- list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl);
 
 
 
 
257
 
258
  return [$rbody, $rcode, $rheaders];
259
  }
260
 
261
  /**
262
  * @param array $opts cURL options
 
263
  */
264
  private function executeRequestWithRetries($opts, $absUrl)
265
  {
@@ -268,35 +291,59 @@ class CurlClient implements ClientInterface
268
  while (true) {
269
  $rcode = 0;
270
  $errno = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  $this->resetCurlHandle();
273
- curl_setopt_array($this->curlHandle, $opts);
274
- $rbody = curl_exec($this->curlHandle);
275
 
276
- if ($rbody === false) {
277
- $errno = curl_errno($this->curlHandle);
278
- $message = curl_error($this->curlHandle);
279
  } else {
280
- $rcode = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
281
  }
282
  if (!$this->getEnablePersistentConnections()) {
283
  $this->closeCurlHandle();
284
  }
285
 
286
- if ($this->shouldRetry($errno, $rcode, $numRetries)) {
287
- $numRetries += 1;
288
- $sleepSeconds = $this->sleepTime($numRetries);
289
- usleep(intval($sleepSeconds * 1000000));
 
 
 
 
 
 
 
 
 
290
  } else {
291
  break;
292
  }
293
  }
294
 
295
- if ($rbody === false) {
296
  $this->handleCurlError($absUrl, $errno, $message, $numRetries);
297
  }
298
 
299
- return [$rbody, $rcode];
300
  }
301
 
302
  /**
@@ -304,83 +351,119 @@ class CurlClient implements ClientInterface
304
  * @param int $errno
305
  * @param string $message
306
  * @param int $numRetries
307
- * @throws Error\ApiConnection
 
308
  */
309
  private function handleCurlError($url, $errno, $message, $numRetries)
310
  {
311
  switch ($errno) {
312
- case CURLE_COULDNT_CONNECT:
313
- case CURLE_COULDNT_RESOLVE_HOST:
314
- case CURLE_OPERATION_TIMEOUTED:
315
- $msg = "Could not connect to Stripe ($url). Please check your "
316
- . "internet connection and try again. If this problem persists, "
317
  . "you should check Stripe's service status at "
318
- . "https://twitter.com/stripestatus, or";
 
319
  break;
320
- case CURLE_SSL_CACERT:
321
- case CURLE_SSL_PEER_CERTIFICATE:
 
322
  $msg = "Could not verify Stripe's SSL certificate. Please make sure "
323
- . "that your network is not intercepting certificates. "
324
- . "(Try going to $url in your browser.) "
325
- . "If this problem persists,";
 
326
  break;
 
327
  default:
328
- $msg = "Unexpected error communicating with Stripe. "
329
- . "If this problem persists,";
330
  }
331
- $msg .= " let us know at support@stripe.com.";
332
 
333
- $msg .= "\n\n(Network error [errno $errno]: $message)";
334
 
335
  if ($numRetries > 0) {
336
- $msg .= "\n\nRequest was retried $numRetries times.";
337
  }
338
 
339
- throw new Error\ApiConnection($msg);
340
  }
341
 
342
  /**
343
  * Checks if an error is a problem that we should retry on. This includes both
344
  * socket errors that may represent an intermittent problem and some special
345
  * HTTP statuses.
 
346
  * @param int $errno
347
  * @param int $rcode
 
348
  * @param int $numRetries
 
349
  * @return bool
350
  */
351
- private function shouldRetry($errno, $rcode, $numRetries)
352
  {
353
  if ($numRetries >= Stripe::getMaxNetworkRetries()) {
354
  return false;
355
  }
356
 
357
  // Retry on timeout-related problems (either on open or read).
358
- if ($errno === CURLE_OPERATION_TIMEOUTED) {
359
  return true;
360
  }
361
 
362
  // Destination refused the connection, the connection was reset, or a
363
  // variety of other connection failures. This could occur from a single
364
  // saturated server, so retry in case it's intermittent.
365
- if ($errno === CURLE_COULDNT_CONNECT) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  return true;
367
  }
368
 
369
- // 409 conflict
370
- if ($rcode === 409) {
 
 
 
 
371
  return true;
372
  }
373
 
374
  return false;
375
  }
376
 
377
- private function sleepTime($numRetries)
 
 
 
 
 
 
 
 
378
  {
379
  // Apply exponential backoff with $initialNetworkRetryDelay on the
380
  // number of $numRetries so far as inputs. Do not allow the number to exceed
381
  // $maxNetworkRetryDelay.
382
- $sleepSeconds = min(
383
- Stripe::getInitialNetworkRetryDelay() * 1.0 * pow(2, $numRetries - 1),
384
  Stripe::getMaxNetworkRetryDelay()
385
  );
386
 
@@ -389,7 +472,13 @@ class CurlClient implements ClientInterface
389
  $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat());
390
 
391
  // But never sleep less than the base sleep seconds.
392
- $sleepSeconds = max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds);
 
 
 
 
 
 
393
 
394
  return $sleepSeconds;
395
  }
@@ -400,7 +489,7 @@ class CurlClient implements ClientInterface
400
  private function initCurlHandle()
401
  {
402
  $this->closeCurlHandle();
403
- $this->curlHandle = curl_init();
404
  }
405
 
406
  /**
@@ -408,8 +497,8 @@ class CurlClient implements ClientInterface
408
  */
409
  private function closeCurlHandle()
410
  {
411
- if (!is_null($this->curlHandle)) {
412
- curl_close($this->curlHandle);
413
  $this->curlHandle = null;
414
  }
415
  }
@@ -420,8 +509,8 @@ class CurlClient implements ClientInterface
420
  */
421
  private function resetCurlHandle()
422
  {
423
- if (!is_null($this->curlHandle) && $this->getEnablePersistentConnections()) {
424
- curl_reset($this->curlHandle);
425
  } else {
426
  $this->initCurlHandle();
427
  }
@@ -430,14 +519,15 @@ class CurlClient implements ClientInterface
430
  /**
431
  * Indicates whether it is safe to use HTTP/2 or not.
432
  *
433
- * @return boolean
434
  */
435
  private function canSafelyUseHttp2()
436
  {
437
  // Versions of curl older than 7.60.0 don't respect GOAWAY frames
438
  // (cf. https://github.com/curl/curl/issues/2416), which Stripe use.
439
- $curlVersion = curl_version()['version'];
440
- return (version_compare($curlVersion, '7.60.0') >= 0);
 
441
  }
442
 
443
  /**
@@ -445,12 +535,13 @@ class CurlClient implements ClientInterface
445
  *
446
  * @param string[] $headers
447
  * @param string $name
448
- * @return boolean
 
449
  */
450
  private function hasHeader($headers, $name)
451
  {
452
  foreach ($headers as $header) {
453
- if (strncasecmp($header, "{$name}: ", strlen($name) + 2) === 0) {
454
  return true;
455
  }
456
  }
2
 
3
  namespace Stripe\HttpClient;
4
 
5
+ use Stripe\Exception;
6
  use Stripe\Stripe;
 
7
  use Stripe\Util;
8
 
 
 
9
  // @codingStandardsIgnoreStart
10
  // PSR2 requires all constants be upper case. Sadly, the CURL_SSLVERSION
11
  // constants do not abide by those rules.
12
 
13
+ // Note the values come from their position in the enums that
14
  // defines them in cURL's source code.
15
+
16
+ // Available since PHP 5.5.19 and 5.6.3
17
+ if (!\defined('CURL_SSLVERSION_TLSv1_2')) {
18
+ \define('CURL_SSLVERSION_TLSv1_2', 6);
 
19
  }
20
  // @codingStandardsIgnoreEnd
21
 
22
+ // Available since PHP 7.0.7 and cURL 7.47.0
23
+ if (!\defined('CURL_HTTP_VERSION_2TLS')) {
24
+ \define('CURL_HTTP_VERSION_2TLS', 4);
25
  }
26
 
27
  class CurlClient implements ClientInterface
33
  if (!self::$instance) {
34
  self::$instance = new self();
35
  }
36
+
37
  return self::$instance;
38
  }
39
 
40
  protected $defaultOptions;
41
 
42
+ /** @var \Stripe\Util\RandomGenerator */
43
+ protected $randomGenerator;
44
+
45
  protected $userAgentInfo;
46
 
47
+ protected $enablePersistentConnections = true;
48
+
49
+ protected $enableHttp2;
50
 
51
+ protected $curlHandle;
52
 
53
+ protected $requestStatusCallback;
54
 
55
  /**
56
  * CurlClient constructor.
63
  * Note that request() will silently ignore a non-callable, non-array $defaultOptions, and will
64
  * throw an exception if $defaultOptions returns a non-array value.
65
  *
66
+ * @param null|array|callable $defaultOptions
67
+ * @param null|\Stripe\Util\RandomGenerator $randomGenerator
68
  */
69
  public function __construct($defaultOptions = null, $randomGenerator = null)
70
  {
72
  $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator();
73
  $this->initUserAgentInfo();
74
 
 
 
 
 
75
  $this->enableHttp2 = $this->canSafelyUseHttp2();
76
  }
77
 
82
 
83
  public function initUserAgentInfo()
84
  {
85
+ $curlVersion = \curl_version();
86
  $this->userAgentInfo = [
87
+ 'httplib' => 'curl ' . $curlVersion['version'],
88
  'ssllib' => $curlVersion['ssl_version'],
89
  ];
90
  }
100
  }
101
 
102
  /**
103
+ * @return bool
104
  */
105
  public function getEnablePersistentConnections()
106
  {
108
  }
109
 
110
  /**
111
+ * @param bool $enable
112
  */
113
  public function setEnablePersistentConnections($enable)
114
  {
116
  }
117
 
118
  /**
119
+ * @return bool
120
  */
121
  public function getEnableHttp2()
122
  {
124
  }
125
 
126
  /**
127
+ * @param bool $enable
128
  */
129
  public function setEnableHttp2($enable)
130
  {
131
  $this->enableHttp2 = $enable;
132
  }
133
 
134
+ /**
135
+ * @return null|callable
136
+ */
137
+ public function getRequestStatusCallback()
138
+ {
139
+ return $this->requestStatusCallback;
140
+ }
141
+
142
+ /**
143
+ * Sets a callback that is called after each request. The callback will
144
+ * receive the following parameters:
145
+ * <ol>
146
+ * <li>string $rbody The response body</li>
147
+ * <li>integer $rcode The response status code</li>
148
+ * <li>\Stripe\Util\CaseInsensitiveArray $rheaders The response headers</li>
149
+ * <li>integer $errno The curl error number</li>
150
+ * <li>string|null $message The curl error message</li>
151
+ * <li>boolean $shouldRetry Whether the request will be retried</li>
152
+ * <li>integer $numRetries The number of the retry attempt</li>
153
+ * </ol>.
154
+ *
155
+ * @param null|callable $requestStatusCallback
156
+ */
157
+ public function setRequestStatusCallback($requestStatusCallback)
158
+ {
159
+ $this->requestStatusCallback = $requestStatusCallback;
160
+ }
161
+
162
  // USER DEFINED TIMEOUTS
163
 
164
  const DEFAULT_TIMEOUT = 80;
169
 
170
  public function setTimeout($seconds)
171
  {
172
+ $this->timeout = (int) \max($seconds, 0);
173
+
174
  return $this;
175
  }
176
 
177
  public function setConnectTimeout($seconds)
178
  {
179
+ $this->connectTimeout = (int) \max($seconds, 0);
180
+
181
  return $this;
182
  }
183
 
195
 
196
  public function request($method, $absUrl, $headers, $params, $hasFile)
197
  {
198
+ $method = \strtolower($method);
199
 
200
  $opts = [];
201
+ if (\is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value
202
+ $opts = \call_user_func_array($this->defaultOptions, \func_get_args());
203
+ if (!\is_array($opts)) {
204
+ throw new Exception\UnexpectedValueException('Non-array value returned by defaultOptions CurlClient callback');
205
  }
206
+ } elseif (\is_array($this->defaultOptions)) { // set default curlopts from array
207
  $opts = $this->defaultOptions;
208
  }
209
 
210
  $params = Util\Util::objectsToIds($params);
211
 
212
+ if ('get' === $method) {
213
  if ($hasFile) {
214
+ throw new Exception\UnexpectedValueException(
215
+ 'Issuing a GET request with a file parameter'
216
  );
217
  }
218
+ $opts[\CURLOPT_HTTPGET] = 1;
219
+ if (\count($params) > 0) {
220
  $encoded = Util\Util::encodeParameters($params);
221
+ $absUrl = "{$absUrl}?{$encoded}";
222
  }
223
+ } elseif ('post' === $method) {
224
+ $opts[\CURLOPT_POST] = 1;
225
+ $opts[\CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params);
226
+ } elseif ('delete' === $method) {
227
+ $opts[\CURLOPT_CUSTOMREQUEST] = 'DELETE';
228
+ if (\count($params) > 0) {
229
  $encoded = Util\Util::encodeParameters($params);
230
+ $absUrl = "{$absUrl}?{$encoded}";
231
  }
232
  } else {
233
+ throw new Exception\UnexpectedValueException("Unrecognized method {$method}");
234
  }
235
 
236
  // It is only safe to retry network failures on POST requests if we
237
  // add an Idempotency-Key header
238
+ if (('post' === $method) && (Stripe::$maxNetworkRetries > 0)) {
239
+ if (!$this->hasHeader($headers, 'Idempotency-Key')) {
240
+ $headers[] = 'Idempotency-Key: ' . $this->randomGenerator->uuid();
241
  }
242
  }
243
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  // By default for large request body sizes (> 1024 bytes), cURL will
245
  // send a request without a body and with a `Expect: 100-continue`
246
  // header, which gives the server a chance to respond with an error
253
  // we'll error under that condition. To compensate for that problem
254
  // for the time being, override cURL's behavior by simply always
255
  // sending an empty `Expect:` header.
256
+ $headers[] = 'Expect: ';
257
 
258
  $absUrl = Util\Util::utf8($absUrl);
259
+ $opts[\CURLOPT_URL] = $absUrl;
260
+ $opts[\CURLOPT_RETURNTRANSFER] = true;
261
+ $opts[\CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout;
262
+ $opts[\CURLOPT_TIMEOUT] = $this->timeout;
263
+ $opts[\CURLOPT_HTTPHEADER] = $headers;
264
+ $opts[\CURLOPT_CAINFO] = Stripe::getCABundlePath();
 
265
  if (!Stripe::getVerifySslCerts()) {
266
+ $opts[\CURLOPT_SSL_VERIFYPEER] = false;
267
  }
268
 
269
+ if (!isset($opts[\CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) {
270
  // For HTTPS requests, enable HTTP/2, if supported
271
+ $opts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2TLS;
272
  }
273
 
274
+ // Stripe's API servers are only accessible over IPv4. Force IPv4 resolving to avoid
275
+ // potential issues (cf. https://github.com/stripe/stripe-php/issues/1045).
276
+ $opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4;
277
+
278
+ list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl);
279
 
280
  return [$rbody, $rcode, $rheaders];
281
  }
282
 
283
  /**
284
  * @param array $opts cURL options
285
+ * @param string $absUrl
286
  */
287
  private function executeRequestWithRetries($opts, $absUrl)
288
  {
291
  while (true) {
292
  $rcode = 0;
293
  $errno = 0;
294
+ $message = null;
295
+
296
+ // Create a callback to capture HTTP headers for the response
297
+ $rheaders = new Util\CaseInsensitiveArray();
298
+ $headerCallback = function ($curl, $header_line) use (&$rheaders) {
299
+ // Ignore the HTTP request line (HTTP/1.1 200 OK)
300
+ if (false === \strpos($header_line, ':')) {
301
+ return \strlen($header_line);
302
+ }
303
+ list($key, $value) = \explode(':', \trim($header_line), 2);
304
+ $rheaders[\trim($key)] = \trim($value);
305
+
306
+ return \strlen($header_line);
307
+ };
308
+ $opts[\CURLOPT_HEADERFUNCTION] = $headerCallback;
309
 
310
  $this->resetCurlHandle();
311
+ \curl_setopt_array($this->curlHandle, $opts);
312
+ $rbody = \curl_exec($this->curlHandle);
313
 
314
+ if (false === $rbody) {
315
+ $errno = \curl_errno($this->curlHandle);
316
+ $message = \curl_error($this->curlHandle);
317
  } else {
318
+ $rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE);
319
  }
320
  if (!$this->getEnablePersistentConnections()) {
321
  $this->closeCurlHandle();
322
  }
323
 
324
+ $shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries);
325
+
326
+ if (\is_callable($this->getRequestStatusCallback())) {
327
+ \call_user_func_array(
328
+ $this->getRequestStatusCallback(),
329
+ [$rbody, $rcode, $rheaders, $errno, $message, $shouldRetry, $numRetries]
330
+ );
331
+ }
332
+
333
+ if ($shouldRetry) {
334
+ ++$numRetries;
335
+ $sleepSeconds = $this->sleepTime($numRetries, $rheaders);
336
+ \usleep((int) ($sleepSeconds * 1000000));
337
  } else {
338
  break;
339
  }
340
  }
341
 
342
+ if (false === $rbody) {
343
  $this->handleCurlError($absUrl, $errno, $message, $numRetries);
344
  }
345
 
346
+ return [$rbody, $rcode, $rheaders];
347
  }
348
 
349
  /**
351
  * @param int $errno
352
  * @param string $message
353
  * @param int $numRetries
354
+ *
355
+ * @throws Exception\ApiConnectionException
356
  */
357
  private function handleCurlError($url, $errno, $message, $numRetries)
358
  {
359
  switch ($errno) {
360
+ case \CURLE_COULDNT_CONNECT:
361
+ case \CURLE_COULDNT_RESOLVE_HOST:
362
+ case \CURLE_OPERATION_TIMEOUTED:
363
+ $msg = "Could not connect to Stripe ({$url}). Please check your "
364
+ . 'internet connection and try again. If this problem persists, '
365
  . "you should check Stripe's service status at "
366
+ . 'https://twitter.com/stripestatus, or';
367
+
368
  break;
369
+
370
+ case \CURLE_SSL_CACERT:
371
+ case \CURLE_SSL_PEER_CERTIFICATE:
372
  $msg = "Could not verify Stripe's SSL certificate. Please make sure "
373
+ . 'that your network is not intercepting certificates. '
374
+ . "(Try going to {$url} in your browser.) "
375
+ . 'If this problem persists,';
376
+
377
  break;
378
+
379
  default:
380
+ $msg = 'Unexpected error communicating with Stripe. '
381
+ . 'If this problem persists,';
382
  }
383
+ $msg .= ' let us know at support@stripe.com.';
384
 
385
+ $msg .= "\n\n(Network error [errno {$errno}]: {$message})";
386
 
387
  if ($numRetries > 0) {
388
+ $msg .= "\n\nRequest was retried {$numRetries} times.";
389
  }
390
 
391
+ throw new Exception\ApiConnectionException($msg);
392
  }
393
 
394
  /**
395
  * Checks if an error is a problem that we should retry on. This includes both
396
  * socket errors that may represent an intermittent problem and some special
397
  * HTTP statuses.
398
+ *
399
  * @param int $errno
400
  * @param int $rcode
401
+ * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders
402
  * @param int $numRetries
403
+ *
404
  * @return bool
405
  */
406
+ private function shouldRetry($errno, $rcode, $rheaders, $numRetries)
407
  {
408
  if ($numRetries >= Stripe::getMaxNetworkRetries()) {
409
  return false;
410
  }
411
 
412
  // Retry on timeout-related problems (either on open or read).
413
+ if (\CURLE_OPERATION_TIMEOUTED === $errno) {
414
  return true;
415
  }
416
 
417
  // Destination refused the connection, the connection was reset, or a
418
  // variety of other connection failures. This could occur from a single
419
  // saturated server, so retry in case it's intermittent.
420
+ if (\CURLE_COULDNT_CONNECT === $errno) {
421
+ return true;
422
+ }
423
+
424
+ // The API may ask us not to retry (eg; if doing so would be a no-op)
425
+ // or advise us to retry (eg; in cases of lock timeouts); we defer to that.
426
+ if (isset($rheaders['stripe-should-retry'])) {
427
+ if ('false' === $rheaders['stripe-should-retry']) {
428
+ return false;
429
+ }
430
+ if ('true' === $rheaders['stripe-should-retry']) {
431
+ return true;
432
+ }
433
+ }
434
+
435
+ // 409 Conflict
436
+ if (409 === $rcode) {
437
  return true;
438
  }
439
 
440
+ // Retry on 500, 503, and other internal errors.
441
+ //
442
+ // Note that we expect the stripe-should-retry header to be false
443
+ // in most cases when a 500 is returned, since our idempotency framework
444
+ // would typically replay it anyway.
445
+ if ($rcode >= 500) {
446
  return true;
447
  }
448
 
449
  return false;
450
  }
451
 
452
+ /**
453
+ * Provides the number of seconds to wait before retrying a request.
454
+ *
455
+ * @param int $numRetries
456
+ * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders
457
+ *
458
+ * @return int
459
+ */
460
+ private function sleepTime($numRetries, $rheaders)
461
  {
462
  // Apply exponential backoff with $initialNetworkRetryDelay on the
463
  // number of $numRetries so far as inputs. Do not allow the number to exceed
464
  // $maxNetworkRetryDelay.
465
+ $sleepSeconds = \min(
466
+ Stripe::getInitialNetworkRetryDelay() * 1.0 * 2 ** ($numRetries - 1),
467
  Stripe::getMaxNetworkRetryDelay()
468
  );
469
 
472
  $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat());
473
 
474
  // But never sleep less than the base sleep seconds.
475
+ $sleepSeconds = \max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds);
476
+
477
+ // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask.
478
+ $retryAfter = isset($rheaders['retry-after']) ? (float) ($rheaders['retry-after']) : 0.0;
479
+ if (\floor($retryAfter) === $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) {
480
+ $sleepSeconds = \max($sleepSeconds, $retryAfter);
481
+ }
482
 
483
  return $sleepSeconds;
484
  }
489
  private function initCurlHandle()
490
  {
491
  $this->closeCurlHandle();
492
+ $this->curlHandle = \curl_init();
493
  }
494
 
495
  /**
497
  */
498
  private function closeCurlHandle()
499
  {
500
+ if (null !== $this->curlHandle) {
501
+ \curl_close($this->curlHandle);
502
  $this->curlHandle = null;
503
  }
504
  }
509
  */
510
  private function resetCurlHandle()
511
  {
512
+ if (null !== $this->curlHandle && $this->getEnablePersistentConnections()) {
513
+ \curl_reset($this->curlHandle);
514
  } else {
515
  $this->initCurlHandle();
516
  }
519
  /**
520
  * Indicates whether it is safe to use HTTP/2 or not.
521
  *
522
+ * @return bool
523
  */
524
  private function canSafelyUseHttp2()
525
  {
526
  // Versions of curl older than 7.60.0 don't respect GOAWAY frames
527
  // (cf. https://github.com/curl/curl/issues/2416), which Stripe use.
528
+ $curlVersion = \curl_version()['version'];
529
+
530
+ return \version_compare($curlVersion, '7.60.0') >= 0;
531
  }
532
 
533
  /**
535
  *
536
  * @param string[] $headers
537
  * @param string $name
538
+ *
539
+ * @return bool
540
  */
541
  private function hasHeader($headers, $name)
542
  {
543
  foreach ($headers as $header) {
544
+ if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) {
545
  return true;
546
  }
547
  }
app/api/Stripe/Invoice.php CHANGED
@@ -1,76 +1,115 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Invoice
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $account_country
11
- * @property string $account_name
12
- * @property int $amount_due
13
- * @property int $amount_paid
14
- * @property int $amount_remaining
15
- * @property int $application_fee_amount
16
- * @property int $attempt_count
17
- * @property bool $attempted
18
- * @property bool $auto_advance
19
- * @property string $billing
20
- * @property string $billing_reason
21
- * @property string $charge
22
- * @property string $collection_method
23
- * @property int $created
24
- * @property string $currency
25
- * @property array $custom_fields
26
- * @property string $customer
27
- * @property mixed $customer_address
28
- * @property string $customer_email
29
- * @property string $customer_name
30
- * @property string $customer_phone
31
- * @property mixed $customer_shipping
32
- * @property string $customer_tax_exempt
33
- * @property array $customer_tax_ids
34
- * @property string $default_payment_method
35
- * @property string $default_source
36
- * @property array $default_tax_rates
37
- * @property string $description
38
- * @property Discount $discount
39
- * @property int $due_date
40
- * @property int $ending_balance
41
- * @property string $footer
42
- * @property string $hosted_invoice_url
43
- * @property string $invoice_pdf
44
- * @property Collection $lines
45
- * @property bool $livemode
46
- * @property StripeObject $metadata
47
- * @property int $next_payment_attempt
48
- * @property string $number
49
- * @property bool $paid
50
- * @property string $payment_intent
51
- * @property int $period_end
52
- * @property int $period_start
53
- * @property int $post_payment_credit_notes_amount
54
- * @property int $pre_payment_credit_notes_amount
55
- * @property string $receipt_number
56
- * @property int $starting_balance
57
- * @property string $statement_descriptor
58
- * @property string $status
59
- * @property mixed $status_transitions
60
- * @property string $subscription
61
- * @property int $subscription_proration_date
62
- * @property int $subtotal
63
- * @property int $tax
64
- * @property mixed $threshold_reason
65
- * @property int $total
66
- * @property array $total_tax_amounts
67
- * @property int $webhooks_delivered_at
68
  *
69
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  */
71
  class Invoice extends ApiResource
72
  {
73
- const OBJECT_NAME = "invoice";
74
 
75
  use ApiOperations\All;
76
  use ApiOperations\Create;
@@ -78,125 +117,145 @@ class Invoice extends ApiResource
78
  use ApiOperations\Retrieve;
79
  use ApiOperations\Update;
80
 
81
- /**
82
- * Possible string representations of the billing reason.
83
- * @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
84
- */
85
- const BILLING_REASON_MANUAL = 'manual';
86
- const BILLING_REASON_SUBSCRIPTION = 'subscription';
87
- const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
88
- const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
89
  const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
90
- const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
91
- const BILLING_REASON_UPCOMING = 'upcoming';
92
 
93
- /**
94
- * Possible string representations of the `collection_method` property.
95
- * @link https://stripe.com/docs/api/invoices/object#invoice_object-collection_method
96
- */
97
  const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
98
- const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  /**
101
- * Possible string representations of the invoice status.
102
- * @link https://stripe.com/docs/api/invoices/object#invoice_object-status
 
 
 
 
103
  */
104
- const STATUS_DRAFT = 'draft';
105
- const STATUS_OPEN = 'open';
106
- const STATUS_PAID = 'paid';
107
- const STATUS_UNCOLLECTIBLE = 'uncollectible';
108
- const STATUS_VOID = 'void';
 
 
 
 
109
 
110
  /**
111
- * Possible string representations of the `billing` property.
112
- * @deprecated Use `collection_method` instead.
113
- * @link https://stripe.com/docs/api/invoices/object#invoice_object-billing
 
 
 
 
114
  */
115
- const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
116
- const BILLING_SEND_INVOICE = 'send_invoice';
 
 
117
 
118
  /**
119
- * @param array|null $params
120
- * @param array|string|null $opts
 
 
121
  *
122
- * @return Invoice The finalized invoice.
123
  */
124
  public function finalizeInvoice($params = null, $opts = null)
125
  {
126
  $url = $this->instanceUrl() . '/finalize';
127
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
128
  $this->refreshFrom($response, $opts);
 
129
  return $this;
130
  }
131
 
132
  /**
133
- * @param array|null $params
134
- * @param array|string|null $opts
 
 
135
  *
136
- * @return Invoice The uncollectible invoice.
137
  */
138
  public function markUncollectible($params = null, $opts = null)
139
  {
140
  $url = $this->instanceUrl() . '/mark_uncollectible';
141
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
142
  $this->refreshFrom($response, $opts);
 
143
  return $this;
144
  }
145
 
146
  /**
147
- * @param array|null $params
148
- * @param array|string|null $opts
149
  *
150
- * @return Invoice The paid invoice.
 
 
151
  */
152
  public function pay($params = null, $opts = null)
153
  {
154
  $url = $this->instanceUrl() . '/pay';
155
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
156
  $this->refreshFrom($response, $opts);
 
157
  return $this;
158
  }
159
 
160
  /**
161
- * @param array|null $params
162
- * @param array|string|null $opts
 
 
163
  *
164
- * @return Invoice The sent invoice.
165
  */
166
  public function sendInvoice($params = null, $opts = null)
167
  {
168
  $url = $this->instanceUrl() . '/send';
169
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
170
  $this->refreshFrom($response, $opts);
 
171
  return $this;
172
  }
173
 
174
  /**
175
- * @param array|null $params
176
- * @param array|string|null $opts
177
  *
178
- * @return Invoice The upcoming invoice.
179
- */
180
- public static function upcoming($params = null, $opts = null)
181
- {
182
- $url = static::classUrl() . '/upcoming';
183
- list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
184
- $obj = Util\Util::convertToStripeObject($response->json, $opts);
185
- $obj->setLastResponse($response);
186
- return $obj;
187
- }
188
-
189
- /**
190
- * @param array|null $params
191
- * @param array|string|null $opts
192
  *
193
- * @return Invoice The voided invoice.
194
  */
195
  public function voidInvoice($params = null, $opts = null)
196
  {
197
  $url = $this->instanceUrl() . '/void';
198
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
199
  $this->refreshFrom($response, $opts);
 
200
  return $this;
201
  }
202
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Invoices are statements of amounts owed by a customer, and are either generated
9
+ * one-off, or generated periodically from a subscription.
10
+ *
11
+ * They contain <a href="https://stripe.com/docs/api#invoiceitems">invoice
12
+ * items</a>, and proration adjustments that may be caused by subscription
13
+ * upgrades/downgrades (if necessary).
14
+ *
15
+ * If your invoice is configured to be billed through automatic charges, Stripe
16
+ * automatically finalizes your invoice and attempts payment. Note that finalizing
17
+ * the invoice, <a
18
+ * href="https://stripe.com/docs/billing/invoices/workflow/#auto_advance">when
19
+ * automatic</a>, does not happen immediately as the invoice is created. Stripe
20
+ * waits until one hour after the last webhook was successfully sent (or the last
21
+ * webhook timed out after failing). If you (and the platforms you may have
22
+ * connected to) have no webhooks configured, Stripe waits one hour after creation
23
+ * to finalize the invoice.
24
+ *
25
+ * If your invoice is configured to be billed by sending an email, then based on
26
+ * your <a href="https://dashboard.stripe.com/account/billing/automatic'">email
27
+ * settings</a>, Stripe will email the invoice to your customer and await payment.
28
+ * These emails can contain a link to a hosted page to pay the invoice.
29
  *
30
+ * Stripe applies any customer credit on the account before determining the amount
31
+ * due for the invoice (i.e., the amount that will be actually charged). If the
32
+ * amount due for the invoice is less than Stripe's <a
33
+ * href="/docs/currencies#minimum-and-maximum-charge-amounts">minimum allowed
34
+ * charge per currency</a>, the invoice is automatically marked paid, and we add
35
+ * the amount due to the customer's credit balance which is applied to the next
36
+ * invoice.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  *
38
+ * More details on the customer's credit balance are <a
39
+ * href="https://stripe.com/docs/billing/customer/balance">here</a>.
40
+ *
41
+ * Related guide: <a href="https://stripe.com/docs/billing/invoices/sending">Send
42
+ * Invoices to Customers</a>.
43
+ *
44
+ * @property string $id Unique identifier for the object.
45
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
46
+ * @property null|string $account_country The country of the business associated with this invoice, most often the business creating the invoice.
47
+ * @property null|string $account_name The public name of the business associated with this invoice, most often the business creating the invoice.
48
+ * @property null|(string|\Stripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
49
+ * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the <code>amount_due</code> may be 0. If there is a positive <code>starting_balance</code> for the invoice (the customer owes money), the <code>amount_due</code> will also take that into account. The charge that gets generated for the invoice will be for the amount specified in <code>amount_due</code>.
50
+ * @property int $amount_paid The amount, in %s, that was paid.
51
+ * @property int $amount_remaining The amount remaining, in %s, that is due.
52
+ * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.
53
+ * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule.
54
+ * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the <code>invoice.created</code> webhook, for example, so you might not want to display that invoice as unpaid to your users.
55
+ * @property bool $auto_advance Controls whether Stripe will perform <a href="https://stripe.com/docs/billing/invoices/workflow/#auto_advance">automatic collection</a> of the invoice. When <code>false</code>, the invoice's state will not automatically advance without an explicit action.
56
+ * @property null|string $billing_reason Indicates the reason why the invoice was created. <code>subscription_cycle</code> indicates an invoice created by a subscription advancing into a new period. <code>subscription_create</code> indicates an invoice created due to creating a subscription. <code>subscription_update</code> indicates an invoice created due to updating a subscription. <code>subscription</code> is set for all old invoices to indicate either a change to a subscription or a period advancement. <code>manual</code> is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The <code>upcoming</code> value is reserved for simulated invoices per the upcoming invoice endpoint. <code>subscription_threshold</code> indicates an invoice created due to a billing threshold being reached.
57
+ * @property null|string|\Stripe\Charge $charge ID of the latest charge generated for this invoice, if any.
58
+ * @property null|string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
59
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
60
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
61
+ * @property null|\Stripe\StripeObject[] $custom_fields Custom fields displayed on the invoice.
62
+ * @property string|\Stripe\Customer $customer The ID of the customer who will be billed.
63
+ * @property null|\Stripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal <code>customer.address</code>. Once the invoice is finalized, this field will no longer be updated.
64
+ * @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal <code>customer.email</code>. Once the invoice is finalized, this field will no longer be updated.
65
+ * @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal <code>customer.name</code>. Once the invoice is finalized, this field will no longer be updated.
66
+ * @property null|string $customer_phone The customer's phone number. Until the invoice is finalized, this field will equal <code>customer.phone</code>. Once the invoice is finalized, this field will no longer be updated.
67
+ * @property null|\Stripe\StripeObject $customer_shipping The customer's shipping information. Until the invoice is finalized, this field will equal <code>customer.shipping</code>. Once the invoice is finalized, this field will no longer be updated.
68
+ * @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal <code>customer.tax_exempt</code>. Once the invoice is finalized, this field will no longer be updated.
69
+ * @property null|\Stripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as <code>customer.tax_ids</code>. Once the invoice is finalized, this field will no longer be updated.
70
+ * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
71
+ * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
72
+ * @property \Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any.
73
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
74
+ * @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts.
75
+ * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount.
76
+ * @property null|int $due_date The date on which payment for this invoice is due. This value will be <code>null</code> for invoices where <code>collection_method=charge_automatically</code>.
77
+ * @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
78
+ * @property null|string $footer Footer displayed on the invoice.
79
+ * @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
80
+ * @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
81
+ * @property null|\Stripe\ErrorObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
82
+ * @property \Stripe\Collection $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
83
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
84
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
85
+ * @property null|int $next_payment_attempt The time at which payment will next be attempted. This value will be <code>null</code> for invoices where <code>collection_method=send_invoice</code>.
86
+ * @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.
87
+ * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a> documentation for details.
88
+ * @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.
89
+ * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
90
+ * @property \Stripe\StripeObject $payment_settings
91
+ * @property int $period_end End of the usage period during which invoice items were added to this invoice.
92
+ * @property int $period_start Start of the usage period during which invoice items were added to this invoice.
93
+ * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice.
94
+ * @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice.
95
+ * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice.
96
+ * @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.
97
+ * @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement.
98
+ * @property null|string $status The status of the invoice, one of <code>draft</code>, <code>open</code>, <code>paid</code>, <code>uncollectible</code>, or <code>void</code>. <a href="https://stripe.com/docs/billing/invoices/workflow#workflow-overview">Learn more</a>
99
+ * @property \Stripe\StripeObject $status_transitions
100
+ * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice was prepared for, if any.
101
+ * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
102
+ * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
103
+ * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
104
+ * @property \Stripe\StripeObject $threshold_reason
105
+ * @property int $total Total after discounts and taxes.
106
+ * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items.
107
+ * @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items.
108
+ * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have <a href="https://stripe.com/docs/billing/webhooks#understand">been exhausted</a>. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
109
  */
110
  class Invoice extends ApiResource
111
  {
112
+ const OBJECT_NAME = 'invoice';
113
 
114
  use ApiOperations\All;
115
  use ApiOperations\Create;
117
  use ApiOperations\Retrieve;
118
  use ApiOperations\Update;
119
 
120
+ const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
121
+ const BILLING_SEND_INVOICE = 'send_invoice';
122
+
123
+ const BILLING_REASON_MANUAL = 'manual';
124
+ const BILLING_REASON_SUBSCRIPTION = 'subscription';
125
+ const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
126
+ const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
 
127
  const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
128
+ const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
129
+ const BILLING_REASON_UPCOMING = 'upcoming';
130
 
 
 
 
 
131
  const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
132
+ const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
133
+
134
+ const STATUS_DELETED = 'deleted';
135
+ const STATUS_DRAFT = 'draft';
136
+ const STATUS_OPEN = 'open';
137
+ const STATUS_PAID = 'paid';
138
+ const STATUS_UNCOLLECTIBLE = 'uncollectible';
139
+ const STATUS_VOID = 'void';
140
+
141
+ use ApiOperations\NestedResource;
142
+
143
+ const PATH_LINES = '/lines';
144
 
145
  /**
146
+ * @param null|array $params
147
+ * @param null|array|string $opts
148
+ *
149
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
150
+ *
151
+ * @return \Stripe\Invoice the upcoming invoice
152
  */
153
+ public static function upcoming($params = null, $opts = null)
154
+ {
155
+ $url = static::classUrl() . '/upcoming';
156
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
157
+ $obj = Util\Util::convertToStripeObject($response->json, $opts);
158
+ $obj->setLastResponse($response);
159
+
160
+ return $obj;
161
+ }
162
 
163
  /**
164
+ * @param string $id the ID of the invoice on which to retrieve the lines
165
+ * @param null|array $params
166
+ * @param null|array|string $opts
167
+ *
168
+ * @throws StripeExceptionApiErrorException if the request fails
169
+ *
170
+ * @return \Stripe\Collection the list of lines (InvoiceLineItem)
171
  */
172
+ public static function allLines($id, $params = null, $opts = null)
173
+ {
174
+ return self::_allNestedResources($id, static::PATH_LINES, $params, $opts);
175
+ }
176
 
177
  /**
178
+ * @param null|array $params
179
+ * @param null|array|string $opts
180
+ *
181
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
182
  *
183
+ * @return Invoice the finalized invoice
184
  */
185
  public function finalizeInvoice($params = null, $opts = null)
186
  {
187
  $url = $this->instanceUrl() . '/finalize';
188
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
189
  $this->refreshFrom($response, $opts);
190
+
191
  return $this;
192
  }
193
 
194
  /**
195
+ * @param null|array $params
196
+ * @param null|array|string $opts
197
+ *
198
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
199
  *
200
+ * @return Invoice the uncollectible invoice
201
  */
202
  public function markUncollectible($params = null, $opts = null)
203
  {
204
  $url = $this->instanceUrl() . '/mark_uncollectible';
205
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
206
  $this->refreshFrom($response, $opts);
207
+
208
  return $this;
209
  }
210
 
211
  /**
212
+ * @param null|array $params
213
+ * @param null|array|string $opts
214
  *
215
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
216
+ *
217
+ * @return Invoice the paid invoice
218
  */
219
  public function pay($params = null, $opts = null)
220
  {
221
  $url = $this->instanceUrl() . '/pay';
222
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
223
  $this->refreshFrom($response, $opts);
224
+
225
  return $this;
226
  }
227
 
228
  /**
229
+ * @param null|array $params
230
+ * @param null|array|string $opts
231
+ *
232
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
233
  *
234
+ * @return Invoice the sent invoice
235
  */
236
  public function sendInvoice($params = null, $opts = null)
237
  {
238
  $url = $this->instanceUrl() . '/send';
239
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
240
  $this->refreshFrom($response, $opts);
241
+
242
  return $this;
243
  }
244
 
245
  /**
246
+ * @param null|array $params
247
+ * @param null|array|string $opts
248
  *
249
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  *
251
+ * @return Invoice the voided invoice
252
  */
253
  public function voidInvoice($params = null, $opts = null)
254
  {
255
  $url = $this->instanceUrl() . '/void';
256
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
257
  $this->refreshFrom($response, $opts);
258
+
259
  return $this;
260
  }
261
  }
app/api/Stripe/InvoiceItem.php CHANGED
@@ -1,35 +1,45 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class InvoiceItem
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $currency
12
- * @property string $customer
13
- * @property int $date
14
- * @property string $description
15
- * @property bool $discountable
16
- * @property string $invoice
17
- * @property bool $livemode
18
- * @property StripeObject $metadata
19
- * @property mixed $period
20
- * @property Plan $plan
21
- * @property bool $proration
22
- * @property int $quantity
23
- * @property string $subscription
24
- * @property string $subscription_item
25
- * @property array $tax_rates
26
- * @property int $unit_amount
27
  *
28
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  */
30
  class InvoiceItem extends ApiResource
31
  {
32
- const OBJECT_NAME = "invoiceitem";
33
 
34
  use ApiOperations\All;
35
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Sometimes you want to add a charge or credit to a customer, but actually charge
9
+ * or credit the customer's card only at the end of a regular billing cycle. This
10
+ * is useful for combining several charges (to minimize per-transaction fees), or
11
+ * for having Stripe tabulate your usage-based billing totals.
12
  *
13
+ * Related guide: <a
14
+ * href="https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items">Subscription
15
+ * Invoices</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property int $amount Amount (in the <code>currency</code> specified) of the invoice item. This should always be equal to <code>unit_amount * quantity</code>.
20
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
21
+ * @property string|\Stripe\Customer $customer The ID of the customer who will be billed when this invoice item is billed.
22
+ * @property int $date Time at which the object was created. Measured in seconds since the Unix epoch.
23
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
24
+ * @property bool $discountable If true, discounts will apply to this invoice item. Always false for prorations.
25
+ * @property null|(string|\Stripe\Discount)[] $discounts The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount.
26
+ * @property null|string|\Stripe\Invoice $invoice The ID of the invoice this invoice item belongs to.
27
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
28
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29
+ * @property \Stripe\StripeObject $period
30
+ * @property null|\Stripe\Plan $plan If the invoice item is a proration, the plan of the subscription that the proration was computed for.
31
+ * @property null|\Stripe\Price $price The price of the invoice item.
32
+ * @property bool $proration Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.
33
+ * @property int $quantity Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for.
34
+ * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any.
35
+ * @property string $subscription_item The subscription item that this invoice item has been created for, if any.
36
+ * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item.
37
+ * @property null|int $unit_amount Unit amount (in the <code>currency</code> specified) of the invoice item.
38
+ * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
39
  */
40
  class InvoiceItem extends ApiResource
41
  {
42
+ const OBJECT_NAME = 'invoiceitem';
43
 
44
  use ApiOperations\All;
45
  use ApiOperations\Create;
app/api/Stripe/InvoiceLineItem.php CHANGED
@@ -1,32 +1,33 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class InvoiceLineItem
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $currency
12
- * @property string $description
13
- * @property bool $discountable
14
- * @property string $invoice_item
15
- * @property bool $livemode
16
- * @property StripeObject $metadata
17
- * @property mixed $period
18
- * @property Plan $plan
19
- * @property bool $proration
20
- * @property int $quantity
21
- * @property string $subscription
22
- * @property string $subscription_item
23
- * @property array $tax_amounts
24
- * @property array $tax_rates
25
- * @property string $type
26
- *
27
- * @package Stripe
28
  */
29
  class InvoiceLineItem extends ApiResource
30
  {
31
- const OBJECT_NAME = "line_item";
32
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property int $amount The amount, in %s.
11
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
12
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
13
+ * @property null|\Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item.
14
+ * @property bool $discountable If true, discounts will apply to this line item. Always false for prorations.
15
+ * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount.
16
+ * @property string $invoice_item The ID of the <a href="https://stripe.com/docs/api/invoiceitems">invoice item</a> associated with this line item if any.
17
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
18
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with <code>type=subscription</code> this will reflect the metadata of the subscription that caused the line item to be created.
19
+ * @property \Stripe\StripeObject $period
20
+ * @property null|\Stripe\Plan $plan The plan of the subscription, if the line item is a subscription or a proration.
21
+ * @property null|\Stripe\Price $price The price of the line item.
22
+ * @property bool $proration Whether this is a proration.
23
+ * @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration.
24
+ * @property null|string $subscription The subscription that the invoice item pertains to, if any.
25
+ * @property string $subscription_item The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription.
26
+ * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
27
+ * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
28
+ * @property string $type A string identifying the type of the source of this line item, either an <code>invoiceitem</code> or a <code>subscription</code>.
 
29
  */
30
  class InvoiceLineItem extends ApiResource
31
  {
32
+ const OBJECT_NAME = 'line_item';
33
  }
app/api/Stripe/IssuerFraudRecord.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe;
4
-
5
- /**
6
- * Class IssuerFraudRecord
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $charge
11
- * @property int $created
12
- * @property int $post_date
13
- * @property string $fraud_type
14
- * @property bool $livemode
15
- *
16
- * @package Stripe
17
- */
18
- class IssuerFraudRecord extends ApiResource
19
- {
20
- const OBJECT_NAME = "issuer_fraud_record";
21
-
22
- use ApiOperations\All;
23
- use ApiOperations\Retrieve;
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Issuing/Authorization.php CHANGED
@@ -1,68 +1,81 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class Authorization
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $approved
11
- * @property string $authorization_method
12
- * @property int $authorized_amount
13
- * @property string $authorized_currency
14
- * @property \Stripe\Collection $balance_transactions
15
- * @property Card $card
16
- * @property Cardholder $cardholder
17
- * @property int $created
18
- * @property int $held_amount
19
- * @property string $held_currency
20
- * @property bool $is_held_amount_controllable
21
- * @property bool $livemode
22
- * @property mixed $merchant_data
23
- * @property \Stripe\StripeObject $metadata
24
- * @property int $pending_authorized_amount
25
- * @property int $pending_held_amount
26
- * @property mixed $request_history
27
- * @property string $status
28
- * @property \Stripe\Collection $transactions
29
- * @property mixed $verification_data
30
  *
31
- * @package Stripe\Issuing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  */
33
  class Authorization extends \Stripe\ApiResource
34
  {
35
- const OBJECT_NAME = "issuing.authorization";
36
 
37
  use \Stripe\ApiOperations\All;
38
  use \Stripe\ApiOperations\Retrieve;
39
  use \Stripe\ApiOperations\Update;
40
 
41
  /**
42
- * @param array|null $params
43
- * @param array|string|null $options
 
 
44
  *
45
- * @return Authorization The approved authorization.
46
  */
47
- public function approve($params = null, $options = null)
48
  {
49
  $url = $this->instanceUrl() . '/approve';
50
- list($response, $opts) = $this->_request('post', $url, $params, $options);
51
  $this->refreshFrom($response, $opts);
 
52
  return $this;
53
  }
54
 
55
  /**
56
- * @param array|null $params
57
- * @param array|string|null $options
58
  *
59
- * @return Authorization The declined authorization.
 
 
60
  */
61
- public function decline($params = null, $options = null)
62
  {
63
  $url = $this->instanceUrl() . '/decline';
64
- list($response, $opts) = $this->_request('post', $url, $params, $options);
65
  $this->refreshFrom($response, $opts);
 
66
  return $this;
67
  }
68
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * When an <a href="https://stripe.com/docs/issuing">issued card</a> is used to
9
+ * make a purchase, an Issuing <code>Authorization</code> object is created. <a
10
+ * href="https://stripe.com/docs/issuing/purchases/authorizations">Authorizations</a>
11
+ * must be approved for the purchase to be completed successfully.
12
  *
13
+ * Related guide: <a
14
+ * href="https://stripe.com/docs/issuing/purchases/authorizations">Issued Card
15
+ * Authorizations</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
20
+ * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
21
+ * @property bool $approved Whether the authorization has been approved.
22
+ * @property string $authorization_method How the card details were provided.
23
+ * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization.
24
+ * @property \Stripe\Issuing\Card $card You can <a href="https://stripe.com/docs/issuing/cards">create physical or virtual cards</a> that are issued to cardholders.
25
+ * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs.
26
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
27
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
28
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
29
+ * @property int $merchant_amount The total amount that was authorized or rejected. This amount is in the <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
30
+ * @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
31
+ * @property \Stripe\StripeObject $merchant_data
32
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
33
+ * @property null|\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an <code>issuing_authorization.request</code> webhook.
34
+ * @property \Stripe\StripeObject[] $request_history History of every time <code>pending_request</code> was approved/denied, either by you directly or by Stripe (e.g. based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization</a>, you can look at this field to see the previous requests for the authorization.
35
+ * @property string $status The current status of the authorization in its lifecycle.
36
+ * @property \Stripe\Issuing\Transaction[] $transactions List of <a href="https://stripe.com/docs/api/issuing/transactions">transactions</a> associated with this authorization.
37
+ * @property \Stripe\StripeObject $verification_data
38
+ * @property null|string $wallet What, if any, digital wallet was used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
39
  */
40
  class Authorization extends \Stripe\ApiResource
41
  {
42
+ const OBJECT_NAME = 'issuing.authorization';
43
 
44
  use \Stripe\ApiOperations\All;
45
  use \Stripe\ApiOperations\Retrieve;
46
  use \Stripe\ApiOperations\Update;
47
 
48
  /**
49
+ * @param null|array $params
50
+ * @param null|array|string $opts
51
+ *
52
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
53
  *
54
+ * @return Authorization the approved authorization
55
  */
56
+ public function approve($params = null, $opts = null)
57
  {
58
  $url = $this->instanceUrl() . '/approve';
59
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
60
  $this->refreshFrom($response, $opts);
61
+
62
  return $this;
63
  }
64
 
65
  /**
66
+ * @param null|array $params
67
+ * @param null|array|string $opts
68
  *
69
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
70
+ *
71
+ * @return Authorization the declined authorization
72
  */
73
+ public function decline($params = null, $opts = null)
74
  {
75
  $url = $this->instanceUrl() . '/decline';
76
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
77
  $this->refreshFrom($response, $opts);
78
+
79
  return $this;
80
  }
81
  }
app/api/Stripe/Issuing/Card.php CHANGED
@@ -1,33 +1,38 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class Card
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $authorization_controls
11
- * @property mixed $billing
12
- * @property string $brand
13
- * @property Cardholder $cardholder
14
- * @property int $created
15
- * @property string $currency
16
- * @property int $exp_month
17
- * @property int $exp_year
18
- * @property string $last4
19
- * @property bool $livemode
20
- * @property \Stripe\StripeObject $metadata
21
- * @property string $name
22
- * @property mixed $shipping
23
- * @property string $status
24
- * @property string $type
25
  *
26
- * @package Stripe\Issuing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  */
28
  class Card extends \Stripe\ApiResource
29
  {
30
- const OBJECT_NAME = "issuing.card";
31
 
32
  use \Stripe\ApiOperations\All;
33
  use \Stripe\ApiOperations\Create;
@@ -35,17 +40,20 @@ class Card extends \Stripe\ApiResource
35
  use \Stripe\ApiOperations\Update;
36
 
37
  /**
38
- * @param array|null $params
39
- * @param array|string|null $options
40
  *
41
- * @return CardDetails The card details associated with that issuing card.
 
 
42
  */
43
- public function details($params = null, $options = null)
44
  {
45
  $url = $this->instanceUrl() . '/details';
46
- list($response, $opts) = $this->_request('get', $url, $params, $options);
47
  $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
48
  $obj->setLastResponse($response);
 
49
  return $obj;
50
  }
51
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * You can <a href="https://stripe.com/docs/issuing/cards">create physical or
9
+ * virtual cards</a> that are issued to cardholders.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property string $brand The brand of the card.
14
+ * @property null|string $cancellation_reason The reason why the card was canceled.
15
+ * @property \Stripe\Issuing\Cardholder $cardholder <p>An Issuing <code>Cardholder</code> object represents an individual or business entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards.</p><p>Related guide: <a href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a Cardholder</a></p>
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
18
+ * @property string $cvc The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">&quot;Retrieve a card&quot; endpoint</a>, not via &quot;List all cards&quot; or any other endpoint.
19
+ * @property int $exp_month The expiration month of the card.
20
+ * @property int $exp_year The expiration year of the card.
21
+ * @property string $last4 The last 4 digits of the card number.
22
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
23
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
24
+ * @property string $number The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">&quot;Retrieve a card&quot; endpoint</a>, not via &quot;List all cards&quot; or any other endpoint.
25
+ * @property null|string|\Stripe\Issuing\Card $replaced_by The latest card that replaces this card, if any.
26
+ * @property null|string|\Stripe\Issuing\Card $replacement_for The card this card replaces, if any.
27
+ * @property null|string $replacement_reason The reason why the previous card needed to be replaced.
28
+ * @property null|\Stripe\StripeObject $shipping Where and how the card will be shipped.
29
+ * @property \Stripe\StripeObject $spending_controls
30
+ * @property string $status Whether authorizations can be approved on this card.
31
+ * @property string $type The type of the card.
32
  */
33
  class Card extends \Stripe\ApiResource
34
  {
35
+ const OBJECT_NAME = 'issuing.card';
36
 
37
  use \Stripe\ApiOperations\All;
38
  use \Stripe\ApiOperations\Create;
40
  use \Stripe\ApiOperations\Update;
41
 
42
  /**
43
+ * @param null|array $params
44
+ * @param null|array|string $opts
45
  *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\Issuing\CardDetails the card details associated with that issuing card
49
  */
50
+ public function details($params = null, $opts = null)
51
  {
52
  $url = $this->instanceUrl() . '/details';
53
+ list($response, $opts) = $this->_request('get', $url, $params, $opts);
54
  $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
55
  $obj->setLastResponse($response);
56
+
57
  return $obj;
58
  }
59
  }
app/api/Stripe/Issuing/CardDetails.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class CardDetails
7
  *
8
  * @property string $id
9
  * @property string $object
@@ -12,10 +12,8 @@ namespace Stripe\Issuing;
12
  * @property int $exp_month
13
  * @property int $exp_year
14
  * @property string $number
15
- *
16
- * @package Stripe\Issuing
17
  */
18
  class CardDetails extends \Stripe\ApiResource
19
  {
20
- const OBJECT_NAME = "issuing.card_details";
21
  }
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
+ * Class CardDetails.
7
  *
8
  * @property string $id
9
  * @property string $object
12
  * @property int $exp_month
13
  * @property int $exp_year
14
  * @property string $number
 
 
15
  */
16
  class CardDetails extends \Stripe\ApiResource
17
  {
18
+ const OBJECT_NAME = 'issuing.card_details';
19
  }
app/api/Stripe/Issuing/Cardholder.php CHANGED
@@ -1,27 +1,36 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class Cardholder
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $billing
11
- * @property int $created
12
- * @property string $email
13
- * @property bool $livemode
14
- * @property \Stripe\StripeObject $metadata
15
- * @property string $name
16
- * @property string $phone_number
17
- * @property string $status
18
- * @property string $type
19
  *
20
- * @package Stripe\Issuing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
  class Cardholder extends \Stripe\ApiResource
23
  {
24
- const OBJECT_NAME = "issuing.cardholder";
25
 
26
  use \Stripe\ApiOperations\All;
27
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * An Issuing <code>Cardholder</code> object represents an individual or business
9
+ * entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a
13
+ * Cardholder</a>
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property \Stripe\StripeObject $billing
18
+ * @property null|\Stripe\StripeObject $company Additional information about a <code>company</code> cardholder.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property null|string $email The cardholder's email address.
21
+ * @property null|\Stripe\StripeObject $individual Additional information about an <code>individual</code> cardholder.
22
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
23
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
24
+ * @property string $name The cardholder's name. This will be printed on cards issued to them.
25
+ * @property null|string $phone_number The cardholder's phone number.
26
+ * @property \Stripe\StripeObject $requirements
27
+ * @property null|\Stripe\StripeObject $spending_controls Rules that control spending across this cardholder's cards. Refer to our <a href="https://stripe.com/docs/issuing/controls/spending-controls">documentation</a> for more details.
28
+ * @property string $status Specifies whether to permit authorizations on this cardholder's cards.
29
+ * @property string $type One of <code>individual</code> or <code>company</code>.
30
  */
31
  class Cardholder extends \Stripe\ApiResource
32
  {
33
+ const OBJECT_NAME = 'issuing.cardholder';
34
 
35
  use \Stripe\ApiOperations\All;
36
  use \Stripe\ApiOperations\Create;
app/api/Stripe/Issuing/Dispute.php CHANGED
@@ -1,30 +1,53 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class Dispute
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $created
12
- * @property string $currency
13
- * @property mixed $evidence
14
- * @property bool $livemode
15
- * @property \Stripe\StripeObject $metadata
16
- * @property string $reason
17
- * @property string $status
18
- * @property Transaction $transaction
19
  *
20
- * @package Stripe\Issuing
 
 
 
 
 
 
 
 
 
 
21
  */
22
  class Dispute extends \Stripe\ApiResource
23
  {
24
- const OBJECT_NAME = "issuing.dispute";
25
 
26
  use \Stripe\ApiOperations\All;
27
  use \Stripe\ApiOperations\Create;
28
  use \Stripe\ApiOperations\Retrieve;
29
  use \Stripe\ApiOperations\Update;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can dispute
9
+ * transactions that the cardholder does not recognize, suspects to be fraudulent,
10
+ * or has other issues with.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/issuing/purchases/disputes">Disputing
14
+ * Transactions</a>
 
 
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount Disputed amount. Usually the amount of the <code>transaction</code>, but can differ (usually because of currency fluctuation).
19
+ * @property null|\Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute.
20
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21
+ * @property string $currency The currency the <code>transaction</code> was made in.
22
+ * @property \Stripe\StripeObject $evidence
23
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
24
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
25
+ * @property string $status Current status of the dispute.
26
+ * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
27
  */
28
  class Dispute extends \Stripe\ApiResource
29
  {
30
+ const OBJECT_NAME = 'issuing.dispute';
31
 
32
  use \Stripe\ApiOperations\All;
33
  use \Stripe\ApiOperations\Create;
34
  use \Stripe\ApiOperations\Retrieve;
35
  use \Stripe\ApiOperations\Update;
36
+
37
+ /**
38
+ * @param null|array $params
39
+ * @param null|array|string $opts
40
+ *
41
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
42
+ *
43
+ * @return Dispute the submited dispute
44
+ */
45
+ public function submit($params = null, $opts = null)
46
+ {
47
+ $url = $this->instanceUrl() . '/submit';
48
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
49
+ $this->refreshFrom($response, $opts);
50
+
51
+ return $this;
52
+ }
53
  }
app/api/Stripe/Issuing/Transaction.php CHANGED
@@ -1,35 +1,43 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * Class Transaction
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $authorization
12
- * @property string $balance_transaction
13
- * @property string $card
14
- * @property string $cardholder
15
- * @property int $created
16
- * @property string $currency
17
- * @property string $dispute
18
- * @property bool $livemode
19
- * @property mixed $merchant_data
20
- * @property int $merchant_amount
21
- * @property string $merchant_currency
22
- * @property \Stripe\StripeObject $metadata
23
- * @property string $type
24
  *
25
- * @package Stripe\Issuing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  */
27
  class Transaction extends \Stripe\ApiResource
28
  {
29
- const OBJECT_NAME = "issuing.transaction";
30
 
31
  use \Stripe\ApiOperations\All;
32
- use \Stripe\ApiOperations\Create;
33
  use \Stripe\ApiOperations\Retrieve;
34
  use \Stripe\ApiOperations\Update;
35
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * Any use of an <a href="https://stripe.com/docs/issuing">issued card</a> that
9
+ * results in funds entering or leaving your Stripe account, such as a completed
10
+ * purchase or refund, is represented by an Issuing <code>Transaction</code>
11
+ * object.
12
  *
13
+ * Related guide: <a
14
+ * href="https://stripe.com/docs/issuing/purchases/transactions">Issued Card
15
+ * Transactions</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
20
+ * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
21
+ * @property null|string|\Stripe\Issuing\Authorization $authorization The <code>Authorization</code> object that led to this transaction.
22
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a> associated with this transaction.
23
+ * @property string|\Stripe\Issuing\Card $card The card used to make this transaction.
24
+ * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs.
25
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
26
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
27
+ * @property null|string|\Stripe\Issuing\Dispute $dispute If you've disputed the transaction, the ID of the dispute.
28
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
29
+ * @property int $merchant_amount The amount that the merchant will receive, denominated in <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. It will be different from <code>amount</code> if the merchant is taking payment in a different currency.
30
+ * @property string $merchant_currency The currency with which the merchant is taking payment.
31
+ * @property \Stripe\StripeObject $merchant_data
32
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
33
+ * @property null|\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant.
34
+ * @property string $type The nature of the transaction.
35
  */
36
  class Transaction extends \Stripe\ApiResource
37
  {
38
+ const OBJECT_NAME = 'issuing.transaction';
39
 
40
  use \Stripe\ApiOperations\All;
 
41
  use \Stripe\ApiOperations\Retrieve;
42
  use \Stripe\ApiOperations\Update;
43
  }
app/api/Stripe/LineItem.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * A line item.
9
+ *
10
+ * @property string $id Unique identifier for the object.
11
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
12
+ * @property int $amount_subtotal Total before any discounts or taxes are applied.
13
+ * @property int $amount_total Total after discounts and taxes.
14
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
15
+ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.
16
+ * @property \Stripe\StripeObject[] $discounts The discounts applied to the line item.
17
+ * @property null|\Stripe\Price $price The price used to generate the line item.
18
+ * @property null|int $quantity The quantity of products being purchased.
19
+ * @property \Stripe\StripeObject[] $taxes The taxes applied to the line item.
20
+ */
21
+ class LineItem extends ApiResource
22
+ {
23
+ const OBJECT_NAME = 'item';
24
+
25
+ use ApiOperations\All;
26
+ }
app/api/Stripe/LoginLink.php CHANGED
@@ -1,17 +1,15 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class LoginLink
7
- *
8
- * @property string $object
9
- * @property int $created
10
- * @property string $url
11
- *
12
- * @package Stripe
13
  */
14
  class LoginLink extends ApiResource
15
  {
16
- const OBJECT_NAME = "login_link";
17
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
9
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
10
+ * @property string $url The URL for the login link.
 
 
 
 
11
  */
12
  class LoginLink extends ApiResource
13
  {
14
+ const OBJECT_NAME = 'login_link';
15
  }
app/api/Stripe/Mandate.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * A Mandate is a record of the permission a customer has given you to debit their
9
+ * payment method.
10
+ *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property \Stripe\StripeObject $customer_acceptance
14
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
15
+ * @property \Stripe\StripeObject $multi_use
16
+ * @property string|\Stripe\PaymentMethod $payment_method ID of the payment method associated with this mandate.
17
+ * @property \Stripe\StripeObject $payment_method_details
18
+ * @property \Stripe\StripeObject $single_use
19
+ * @property string $status The status of the mandate, which indicates whether it can be used to initiate a payment.
20
+ * @property string $type The type of the mandate.
21
+ */
22
+ class Mandate extends ApiResource
23
+ {
24
+ const OBJECT_NAME = 'mandate';
25
+
26
+ use ApiOperations\Retrieve;
27
+ }
app/api/Stripe/OAuth.php CHANGED
@@ -7,19 +7,19 @@ abstract class OAuth
7
  /**
8
  * Generates a URL to Stripe's OAuth form.
9
  *
10
- * @param array|null $params
11
- * @param array|null $opts
12
  *
13
- * @return string The URL to Stripe's OAuth form.
14
  */
15
  public static function authorizeUrl($params = null, $opts = null)
16
  {
17
  $params = $params ?: [];
18
 
19
- $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
20
 
21
  $params['client_id'] = self::_getClientId($params);
22
- if (!array_key_exists('response_type', $params)) {
23
  $params['response_type'] = 'code';
24
  }
25
  $query = Util\Util::encodeParameters($params);
@@ -31,14 +31,16 @@ abstract class OAuth
31
  * Use an authoriztion code to connect an account to your platform and
32
  * fetch the user's credentials.
33
  *
34
- * @param array|null $params
35
- * @param array|null $opts
36
  *
37
- * @return StripeObject Object containing the response from the API.
 
 
38
  */
39
  public static function token($params = null, $opts = null)
40
  {
41
- $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
42
  $requestor = new ApiRequestor(null, $base);
43
  list($response, $apiKey) = $requestor->request(
44
  'post',
@@ -46,21 +48,24 @@ abstract class OAuth
46
  $params,
47
  null
48
  );
 
49
  return Util\Util::convertToStripeObject($response->json, $opts);
50
  }
51
 
52
  /**
53
  * Disconnects an account from your platform.
54
  *
55
- * @param array|null $params
56
- * @param array|null $opts
 
 
57
  *
58
- * @return StripeObject Object containing the response from the API.
59
  */
60
  public static function deauthorize($params = null, $opts = null)
61
  {
62
  $params = $params ?: [];
63
- $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
64
  $requestor = new ApiRequestor(null, $base);
65
  $params['client_id'] = self::_getClientId($params);
66
  list($response, $apiKey) = $requestor->request(
@@ -69,16 +74,17 @@ abstract class OAuth
69
  $params,
70
  null
71
  );
 
72
  return Util\Util::convertToStripeObject($response->json, $opts);
73
  }
74
 
75
  private static function _getClientId($params = null)
76
  {
77
- $clientId = ($params && array_key_exists('client_id', $params)) ? $params['client_id'] : null;
78
- if ($clientId === null) {
79
  $clientId = Stripe::getClientId();
80
  }
81
- if ($clientId === null) {
82
  $msg = 'No client_id provided. (HINT: set your client_id using '
83
  . '"Stripe::setClientId(<CLIENT-ID>)". You can find your client_ids '
84
  . 'in your Stripe dashboard at '
@@ -86,8 +92,10 @@ abstract class OAuth
86
  . 'after registering your account as a platform. See '
87
  . 'https://stripe.com/docs/connect/standard-accounts for details, '
88
  . 'or email support@stripe.com if you have any questions.';
89
- throw new Error\Authentication($msg);
 
90
  }
 
91
  return $clientId;
92
  }
93
  }
7
  /**
8
  * Generates a URL to Stripe's OAuth form.
9
  *
10
+ * @param null|array $params
11
+ * @param null|array $opts
12
  *
13
+ * @return string the URL to Stripe's OAuth form
14
  */
15
  public static function authorizeUrl($params = null, $opts = null)
16
  {
17
  $params = $params ?: [];
18
 
19
+ $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
20
 
21
  $params['client_id'] = self::_getClientId($params);
22
+ if (!\array_key_exists('response_type', $params)) {
23
  $params['response_type'] = 'code';
24
  }
25
  $query = Util\Util::encodeParameters($params);
31
  * Use an authoriztion code to connect an account to your platform and
32
  * fetch the user's credentials.
33
  *
34
+ * @param null|array $params
35
+ * @param null|array $opts
36
  *
37
+ * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
38
+ *
39
+ * @return StripeObject object containing the response from the API
40
  */
41
  public static function token($params = null, $opts = null)
42
  {
43
+ $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
44
  $requestor = new ApiRequestor(null, $base);
45
  list($response, $apiKey) = $requestor->request(
46
  'post',
48
  $params,
49
  null
50
  );
51
+
52
  return Util\Util::convertToStripeObject($response->json, $opts);
53
  }
54
 
55
  /**
56
  * Disconnects an account from your platform.
57
  *
58
+ * @param null|array $params
59
+ * @param null|array $opts
60
+ *
61
+ * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
62
  *
63
+ * @return StripeObject object containing the response from the API
64
  */
65
  public static function deauthorize($params = null, $opts = null)
66
  {
67
  $params = $params ?: [];
68
+ $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;
69
  $requestor = new ApiRequestor(null, $base);
70
  $params['client_id'] = self::_getClientId($params);
71
  list($response, $apiKey) = $requestor->request(
74
  $params,
75
  null
76
  );
77
+
78
  return Util\Util::convertToStripeObject($response->json, $opts);
79
  }
80
 
81
  private static function _getClientId($params = null)
82
  {
83
+ $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null;
84
+ if (null === $clientId) {
85
  $clientId = Stripe::getClientId();
86
  }
87
+ if (null === $clientId) {
88
  $msg = 'No client_id provided. (HINT: set your client_id using '
89
  . '"Stripe::setClientId(<CLIENT-ID>)". You can find your client_ids '
90
  . 'in your Stripe dashboard at '
92
  . 'after registering your account as a platform. See '
93
  . 'https://stripe.com/docs/connect/standard-accounts for details, '
94
  . 'or email support@stripe.com if you have any questions.';
95
+
96
+ throw new Exception\AuthenticationException($msg);
97
  }
98
+
99
  return $clientId;
100
  }
101
  }
app/api/Stripe/OAuthErrorObject.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe;
4
+
5
+ /**
6
+ * Class OAuthErrorObject.
7
+ *
8
+ * @property string $error
9
+ * @property string $error_description
10
+ */
11
+ class OAuthErrorObject extends StripeObject
12
+ {
13
+ /**
14
+ * Refreshes this object using the provided values.
15
+ *
16
+ * @param array $values
17
+ * @param null|array|string|Util\RequestOptions $opts
18
+ * @param bool $partial defaults to false
19
+ */
20
+ public function refreshFrom($values, $opts, $partial = false)
21
+ {
22
+ // Unlike most other API resources, the API will omit attributes in
23
+ // error objects when they have a null value. We manually set default
24
+ // values here to facilitate generic error handling.
25
+ $values = \array_merge([
26
+ 'error' => null,
27
+ 'error_description' => null,
28
+ ], $values);
29
+ parent::refreshFrom($values, $opts, $partial);
30
+ }
31
+ }
app/api/Stripe/Order.php CHANGED
@@ -1,39 +1,45 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Order
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $amount_returned
12
- * @property string $application
13
- * @property int $application_fee
14
- * @property string $charge
15
- * @property int $created
16
- * @property string $currency
17
- * @property string $customer
18
- * @property string $email
19
- * @property string $external_coupon_code
20
- * @property OrderItem[] $items
21
- * @property bool $livemode
22
- * @property StripeObject $metadata
23
- * @property Collection $returns
24
- * @property string $selected_shipping_method
25
- * @property mixed $shipping
26
- * @property array $shipping_methods
27
- * @property string $status
28
- * @property mixed $status_transitions
29
- * @property int $updated
30
- * @property string $upstream_id
31
  *
32
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  */
34
  class Order extends ApiResource
35
  {
36
- const OBJECT_NAME = "order";
37
 
38
  use ApiOperations\All;
39
  use ApiOperations\Create;
@@ -41,23 +47,35 @@ class Order extends ApiResource
41
  use ApiOperations\Update;
42
 
43
  /**
44
- * @return Order The paid order.
 
 
 
 
 
45
  */
46
- public function pay($params = null, $opts = null)
47
  {
48
- $url = $this->instanceUrl() . '/pay';
49
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
50
- $this->refreshFrom($response, $opts);
51
- return $this;
52
  }
53
 
54
  /**
55
- * @return OrderReturn The newly created return.
 
 
 
 
 
56
  */
57
- public function returnOrder($params = null, $opts = null)
58
  {
59
- $url = $this->instanceUrl() . '/returns';
60
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
61
- return Util\Util::convertToStripeObject($response, $opts);
 
 
62
  }
63
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Order objects are created to handle end customers' purchases of previously
9
+ * defined <a href="https://stripe.com/docs/api#products">products</a>. You can
10
+ * create, retrieve, and pay individual orders, as well as list all orders. Orders
11
+ * are identified by a unique, random ID.
12
  *
13
+ * Related guide: <a href="https://stripe.com/docs/orders">Tax, Shipping, and
14
+ * Inventory</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.
19
+ * @property null|int $amount_returned The total amount that was returned to the customer.
20
+ * @property null|string $application ID of the Connect Application that created the order.
21
+ * @property null|int $application_fee A fee in cents that will be applied to the order and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation.
22
+ * @property null|string|\Stripe\Charge $charge The ID of the payment used to pay for the order. Present if the order status is <code>paid</code>, <code>fulfilled</code>, or <code>refunded</code>.
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
25
+ * @property null|string|\Stripe\Customer $customer The customer used for the order.
26
+ * @property null|string $email The email address of the customer placing the order.
27
+ * @property string $external_coupon_code External coupon code to load for this order.
28
+ * @property \Stripe\OrderItem[] $items List of items constituting the order. An order can have up to 25 items.
29
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
30
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
31
+ * @property null|\Stripe\Collection $returns A list of returns that have taken place for this order.
32
+ * @property null|string $selected_shipping_method The shipping method that is currently selected for this order, if any. If present, it is equal to one of the <code>id</code>s of shipping methods in the <code>shipping_methods</code> array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method.
33
+ * @property null|\Stripe\StripeObject $shipping The shipping address for the order. Present if the order is for goods to be shipped.
34
+ * @property null|\Stripe\StripeObject[] $shipping_methods A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it.
35
+ * @property string $status Current order status. One of <code>created</code>, <code>paid</code>, <code>canceled</code>, <code>fulfilled</code>, or <code>returned</code>. More details in the <a href="https://stripe.com/docs/orders/guide#understanding-order-statuses">Orders Guide</a>.
36
+ * @property null|\Stripe\StripeObject $status_transitions The timestamps at which the order status was updated.
37
+ * @property null|int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
38
+ * @property string $upstream_id The user's order ID if it is different from the Stripe order ID.
39
  */
40
  class Order extends ApiResource
41
  {
42
+ const OBJECT_NAME = 'order';
43
 
44
  use ApiOperations\All;
45
  use ApiOperations\Create;
47
  use ApiOperations\Update;
48
 
49
  /**
50
+ * @param null|array $params
51
+ * @param null|array|string $opts
52
+ *
53
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
54
+ *
55
+ * @return \Stripe\OrderReturn the newly created return
56
  */
57
+ public function returnOrder($params = null, $opts = null)
58
  {
59
+ $url = $this->instanceUrl() . '/returns';
60
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
61
+
62
+ return Util\Util::convertToStripeObject($response, $opts);
63
  }
64
 
65
  /**
66
+ * @param null|array $params
67
+ * @param null|array|string $opts
68
+ *
69
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
70
+ *
71
+ * @return Order the paid order
72
  */
73
+ public function pay($params = null, $opts = null)
74
  {
75
+ $url = $this->instanceUrl() . '/pay';
76
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
77
+ $this->refreshFrom($response, $opts);
78
+
79
+ return $this;
80
  }
81
  }
app/api/Stripe/OrderItem.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class OrderItem
7
  *
8
  * @property string $object
9
  * @property int $amount
@@ -12,10 +12,8 @@ namespace Stripe;
12
  * @property string $parent
13
  * @property int $quantity
14
  * @property string $type
15
- *
16
- * @package Stripe
17
  */
18
  class OrderItem extends StripeObject
19
  {
20
- const OBJECT_NAME = "order_item";
21
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class OrderItem.
7
  *
8
  * @property string $object
9
  * @property int $amount
12
  * @property string $parent
13
  * @property int $quantity
14
  * @property string $type
 
 
15
  */
16
  class OrderItem extends StripeObject
17
  {
18
+ const OBJECT_NAME = 'order_item';
19
  }
app/api/Stripe/OrderReturn.php CHANGED
@@ -1,25 +1,31 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class OrderReturn
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $created
12
- * @property string $currency
13
- * @property OrderItem[] $items
14
- * @property bool $livemode
15
- * @property string $order
16
- * @property string $refund
17
  *
18
- * @package Stripe
 
 
 
 
 
 
 
 
19
  */
20
  class OrderReturn extends ApiResource
21
  {
22
- const OBJECT_NAME = "order_return";
23
 
24
  use ApiOperations\All;
25
  use ApiOperations\Retrieve;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A return represents the full or partial return of a number of <a
9
+ * href="https://stripe.com/docs/api#order_items">order items</a>. Returns always
10
+ * belong to an order, and may optionally contain a refund.
11
  *
12
+ * Related guide: <a
13
+ * href="https://stripe.com/docs/orders/guide#handling-returns">Handling
14
+ * Returns</a>.
 
 
 
 
 
 
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the returned line item.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
21
+ * @property \Stripe\OrderItem[] $items The items included in this order return.
22
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
23
+ * @property null|string|\Stripe\Order $order The order that this return includes items from.
24
+ * @property null|string|\Stripe\Refund $refund The ID of the refund issued for this return.
25
  */
26
  class OrderReturn extends ApiResource
27
  {
28
+ const OBJECT_NAME = 'order_return';
29
 
30
  use ApiOperations\All;
31
  use ApiOperations\Retrieve;
app/api/Stripe/PaymentIntent.php CHANGED
@@ -1,106 +1,125 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class PaymentIntent
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $amount_capturable
12
- * @property int $amount_received
13
- * @property string $application
14
- * @property int $application_fee_amount
15
- * @property int $canceled_at
16
- * @property string $cancellation_reason
17
- * @property string $capture_method
18
- * @property Collection $charges
19
- * @property string $client_secret
20
- * @property string $confirmation_method
21
- * @property int $created
22
- * @property string $currency
23
- * @property string $customer
24
- * @property string $description
25
- * @property mixed $last_payment_error
26
- * @property bool $livemode
27
- * @property StripeObject $metadata
28
- * @property mixed $next_action
29
- * @property string $on_behalf_of
30
- * @property string $payment_method
31
- * @property string[] $payment_method_types
32
- * @property string $receipt_email
33
- * @property string $review
34
- * @property mixed $shipping
35
- * @property string $source
36
- * @property string $statement_descriptor
37
- * @property string $status
38
- * @property mixed $transfer_data
39
- * @property string $transfer_group
40
  *
41
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  */
43
  class PaymentIntent extends ApiResource
44
  {
45
- const OBJECT_NAME = "payment_intent";
46
 
47
  use ApiOperations\All;
48
  use ApiOperations\Create;
49
  use ApiOperations\Retrieve;
50
  use ApiOperations\Update;
51
 
52
- /**
53
- * These constants are possible representations of the status field.
54
- *
55
- * @link https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
56
- */
57
- const STATUS_CANCELED = 'canceled';
58
- const STATUS_PROCESSING = 'processing';
59
- const STATUS_REQUIRES_ACTION = 'requires_action';
60
- const STATUS_REQUIRES_CAPTURE = 'requires_capture';
61
- const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
62
  const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
63
- const STATUS_SUCCEEDED = 'succeeded';
64
 
65
  /**
66
- * @param array|null $params
67
- * @param array|string|null $options
68
  *
69
- * @return PaymentIntent The canceled payment intent.
 
 
70
  */
71
- public function cancel($params = null, $options = null)
72
  {
73
  $url = $this->instanceUrl() . '/cancel';
74
- list($response, $opts) = $this->_request('post', $url, $params, $options);
75
  $this->refreshFrom($response, $opts);
 
76
  return $this;
77
  }
78
 
79
  /**
80
- * @param array|null $params
81
- * @param array|string|null $options
 
 
82
  *
83
- * @return PaymentIntent The captured payment intent.
84
  */
85
- public function capture($params = null, $options = null)
86
  {
87
  $url = $this->instanceUrl() . '/capture';
88
- list($response, $opts) = $this->_request('post', $url, $params, $options);
89
  $this->refreshFrom($response, $opts);
 
90
  return $this;
91
  }
92
 
93
  /**
94
- * @param array|null $params
95
- * @param array|string|null $options
 
 
96
  *
97
- * @return PaymentIntent The confirmed payment intent.
98
  */
99
- public function confirm($params = null, $options = null)
100
  {
101
  $url = $this->instanceUrl() . '/confirm';
102
- list($response, $opts) = $this->_request('post', $url, $params, $options);
103
  $this->refreshFrom($response, $opts);
 
104
  return $this;
105
  }
106
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A PaymentIntent guides you through the process of collecting a payment from your
9
+ * customer. We recommend that you create exactly one PaymentIntent for each order
10
+ * or customer session in your system. You can reference the PaymentIntent later to
11
+ * see the history of payment attempts for a particular session.
12
  *
13
+ * A PaymentIntent transitions through <a
14
+ * href="https://stripe.com/docs/payments/intents#intent-statuses">multiple
15
+ * statuses</a> throughout its lifetime as it interfaces with Stripe.js to perform
16
+ * authentication flows and ultimately creates at most one successful charge.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  *
18
+ * Related guide: <a
19
+ * href="https://stripe.com/docs/payments/payment-intents">Payment Intents API</a>.
20
+ *
21
+ * @property string $id Unique identifier for the object.
22
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
23
+ * @property int $amount Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
24
+ * @property int $amount_capturable Amount that can be captured from this PaymentIntent.
25
+ * @property int $amount_received Amount that was collected by this PaymentIntent.
26
+ * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the PaymentIntent.
27
+ * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a>.
28
+ * @property null|int $canceled_at Populated when <code>status</code> is <code>canceled</code>, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch.
29
+ * @property null|string $cancellation_reason Reason for cancellation of this PaymentIntent, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, <code>requested_by_customer</code>, or <code>abandoned</code>) or generated by Stripe internally (<code>failed_invoice</code>, <code>void_invoice</code>, or <code>automatic</code>).
30
+ * @property string $capture_method Controls when the funds will be captured from the customer's account.
31
+ * @property \Stripe\Collection $charges Charges that were created by this PaymentIntent, if any.
32
+ * @property null|string $client_secret <p>The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/payments/accept-a-payment?integration=elements">accept a payment</a> and learn about how <code>client_secret</code> should be handled.</p>
33
+ * @property string $confirmation_method
34
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
35
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
36
+ * @property null|string|\Stripe\Customer $customer <p>ID of the Customer this PaymentIntent belongs to, if one exists.</p><p>Payment methods attached to other Customers cannot be used with this PaymentIntent.</p><p>If present in combination with <a href="https://stripe.com/docs/api#payment_intent_object-setup_future_usage">setup_future_usage</a>, this PaymentIntent's payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.</p>
37
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
38
+ * @property null|string|\Stripe\Invoice $invoice ID of the invoice that created this PaymentIntent, if it exists.
39
+ * @property null|\Stripe\ErrorObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason.
40
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
41
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the <a href="https://stripe.com/docs/payments/payment-intents/creating-payment-intents#storing-information-in-metadata">documentation</a>.
42
+ * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source.
43
+ * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details.
44
+ * @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used in this PaymentIntent.
45
+ * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for this PaymentIntent.
46
+ * @property string[] $payment_method_types The list of payment method types (e.g. card) that this PaymentIntent is allowed to use.
47
+ * @property null|string $receipt_email Email address that the receipt for the resulting payment will be sent to. If <code>receipt_email</code> is specified for a payment in live mode, a receipt will be sent regardless of your <a href="https://dashboard.stripe.com/account/emails">email settings</a>.
48
+ * @property null|string|\Stripe\Review $review ID of the review associated with this PaymentIntent, if any.
49
+ * @property null|string $setup_future_usage <p>Indicates that you intend to make future payments with this PaymentIntent's payment method.</p><p>Providing this parameter will <a href="https://stripe.com/docs/payments/save-during-payment">attach the payment method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be <a href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer after the transaction completes.</p><p>When processing card payments, Stripe also uses <code>setup_future_usage</code> to dynamically optimize your payment flow and comply with regional legislation and network rules, such as <a href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.</p>
50
+ * @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent.
51
+ * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied.
52
+ * @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.
53
+ * @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
54
+ * @property string $status Status of this PaymentIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>requires_capture</code>, <code>canceled</code>, or <code>succeeded</code>. Read more about each PaymentIntent <a href="https://stripe.com/docs/payments/intents#intent-statuses">status</a>.
55
+ * @property null|\Stripe\StripeObject $transfer_data The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details.
56
+ * @property null|string $transfer_group A string that identifies the resulting payment as part of a group. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details.
57
  */
58
  class PaymentIntent extends ApiResource
59
  {
60
+ const OBJECT_NAME = 'payment_intent';
61
 
62
  use ApiOperations\All;
63
  use ApiOperations\Create;
64
  use ApiOperations\Retrieve;
65
  use ApiOperations\Update;
66
 
67
+ const STATUS_CANCELED = 'canceled';
68
+ const STATUS_PROCESSING = 'processing';
69
+ const STATUS_REQUIRES_ACTION = 'requires_action';
70
+ const STATUS_REQUIRES_CAPTURE = 'requires_capture';
71
+ const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
 
 
 
 
 
72
  const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
73
+ const STATUS_SUCCEEDED = 'succeeded';
74
 
75
  /**
76
+ * @param null|array $params
77
+ * @param null|array|string $opts
78
  *
79
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
80
+ *
81
+ * @return PaymentIntent the canceled payment intent
82
  */
83
+ public function cancel($params = null, $opts = null)
84
  {
85
  $url = $this->instanceUrl() . '/cancel';
86
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
87
  $this->refreshFrom($response, $opts);
88
+
89
  return $this;
90
  }
91
 
92
  /**
93
+ * @param null|array $params
94
+ * @param null|array|string $opts
95
+ *
96
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
97
  *
98
+ * @return PaymentIntent the captured payment intent
99
  */
100
+ public function capture($params = null, $opts = null)
101
  {
102
  $url = $this->instanceUrl() . '/capture';
103
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
104
  $this->refreshFrom($response, $opts);
105
+
106
  return $this;
107
  }
108
 
109
  /**
110
+ * @param null|array $params
111
+ * @param null|array|string $opts
112
+ *
113
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
114
  *
115
+ * @return PaymentIntent the confirmed payment intent
116
  */
117
+ public function confirm($params = null, $opts = null)
118
  {
119
  $url = $this->instanceUrl() . '/confirm';
120
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
121
  $this->refreshFrom($response, $opts);
122
+
123
  return $this;
124
  }
125
  }
app/api/Stripe/PaymentMethod.php CHANGED
@@ -1,28 +1,50 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class PaymentMethod
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $billing_details
11
- * @property mixed $card
12
- * @property mixed $card_present
13
- * @property int $created
14
- * @property string $customer
15
- * @property mixed $ideal
16
- * @property bool $livemode
17
- * @property StripeObject $metadata
18
- * @property mixed $sepa_debit
19
- * @property string $type
20
  *
21
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  */
23
  class PaymentMethod extends ApiResource
24
  {
25
- const OBJECT_NAME = "payment_method";
26
 
27
  use ApiOperations\All;
28
  use ApiOperations\Create;
@@ -30,30 +52,36 @@ class PaymentMethod extends ApiResource
30
  use ApiOperations\Update;
31
 
32
  /**
33
- * @param array|null $params
34
- * @param array|string|null $opts
 
 
35
  *
36
- * @return PaymentMethod The attached payment method.
37
  */
38
  public function attach($params = null, $opts = null)
39
  {
40
  $url = $this->instanceUrl() . '/attach';
41
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
42
  $this->refreshFrom($response, $opts);
 
43
  return $this;
44
  }
45
 
46
  /**
47
- * @param array|null $params
48
- * @param array|string|null $opts
49
  *
50
- * @return PaymentMethod The detached payment method.
 
 
51
  */
52
  public function detach($params = null, $opts = null)
53
  {
54
  $url = $this->instanceUrl() . '/detach';
55
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
56
  $this->refreshFrom($response, $opts);
 
57
  return $this;
58
  }
59
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * PaymentMethod objects represent your customer's payment instruments. They can be
9
+ * used with <a
10
+ * href="https://stripe.com/docs/payments/payment-intents">PaymentIntents</a> to
11
+ * collect payments or saved to Customer objects to store instrument details for
12
+ * future payments.
13
  *
14
+ * Related guides: <a
15
+ * href="https://stripe.com/docs/payments/payment-methods">Payment Methods</a> and
16
+ * <a href="https://stripe.com/docs/payments/more-payment-scenarios">More Payment
17
+ * Scenarios</a>.
 
 
 
 
 
 
 
 
18
  *
19
+ * @property string $id Unique identifier for the object.
20
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property \Stripe\StripeObject $afterpay_clearpay
22
+ * @property \Stripe\StripeObject $alipay
23
+ * @property \Stripe\StripeObject $au_becs_debit
24
+ * @property \Stripe\StripeObject $bacs_debit
25
+ * @property \Stripe\StripeObject $bancontact
26
+ * @property \Stripe\StripeObject $billing_details
27
+ * @property \Stripe\StripeObject $card
28
+ * @property \Stripe\StripeObject $card_present
29
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
30
+ * @property null|string|\Stripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.
31
+ * @property \Stripe\StripeObject $eps
32
+ * @property \Stripe\StripeObject $fpx
33
+ * @property \Stripe\StripeObject $giropay
34
+ * @property \Stripe\StripeObject $grabpay
35
+ * @property \Stripe\StripeObject $ideal
36
+ * @property \Stripe\StripeObject $interac_present
37
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
38
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
39
+ * @property \Stripe\StripeObject $oxxo
40
+ * @property \Stripe\StripeObject $p24
41
+ * @property \Stripe\StripeObject $sepa_debit
42
+ * @property \Stripe\StripeObject $sofort
43
+ * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
44
  */
45
  class PaymentMethod extends ApiResource
46
  {
47
+ const OBJECT_NAME = 'payment_method';
48
 
49
  use ApiOperations\All;
50
  use ApiOperations\Create;
52
  use ApiOperations\Update;
53
 
54
  /**
55
+ * @param null|array $params
56
+ * @param null|array|string $opts
57
+ *
58
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
59
  *
60
+ * @return PaymentMethod the attached payment method
61
  */
62
  public function attach($params = null, $opts = null)
63
  {
64
  $url = $this->instanceUrl() . '/attach';
65
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
66
  $this->refreshFrom($response, $opts);
67
+
68
  return $this;
69
  }
70
 
71
  /**
72
+ * @param null|array $params
73
+ * @param null|array|string $opts
74
  *
75
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
76
+ *
77
+ * @return PaymentMethod the detached payment method
78
  */
79
  public function detach($params = null, $opts = null)
80
  {
81
  $url = $this->instanceUrl() . '/detach';
82
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
83
  $this->refreshFrom($response, $opts);
84
+
85
  return $this;
86
  }
87
  }
app/api/Stripe/Payout.php CHANGED
@@ -1,92 +1,108 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Payout
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $arrival_date
12
- * @property bool $automatic
13
- * @property string $balance_transaction
14
- * @property int $created
15
- * @property string $currency
16
- * @property string $description
17
- * @property string $destination
18
- * @property string $failure_balance_transaction
19
- * @property string $failure_code
20
- * @property string $failure_message
21
- * @property bool $livemode
22
- * @property StripeObject $metadata
23
- * @property string $method
24
- * @property string $source_type
25
- * @property string $statement_descriptor
26
- * @property string $status
27
- * @property string $type
28
  *
29
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  */
31
  class Payout extends ApiResource
32
  {
33
- const OBJECT_NAME = "payout";
34
 
35
  use ApiOperations\All;
36
  use ApiOperations\Create;
37
  use ApiOperations\Retrieve;
38
  use ApiOperations\Update;
39
 
40
- /**
41
- * Types of payout failure codes.
42
- * @link https://stripe.com/docs/api#payout_failures
43
- */
44
- const FAILURE_ACCOUNT_CLOSED = 'account_closed';
45
- const FAILURE_ACCOUNT_FROZEN = 'account_frozen';
46
- const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted';
47
- const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed';
48
- const FAILURE_COULD_NOT_PROCESS = 'could_not_process';
49
- const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
50
- const FAILURE_DECLINED = 'declined';
51
  const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name';
52
- const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds';
53
- const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number';
54
- const FAILURE_INVALID_CURRENCY = 'invalid_currency';
55
- const FAILURE_NO_ACCOUNT = 'no_account';
56
- const FAILURE_UNSUPPORTED_CARD = 'unsupported_card';
57
 
58
- /**
59
- * Possible string representations of the payout methods.
60
- * @link https://stripe.com/docs/api/payouts/object#payout_object-method
61
- */
62
  const METHOD_STANDARD = 'standard';
63
- const METHOD_INSTANT = 'instant';
64
 
65
- /**
66
- * Possible string representations of the status of the payout.
67
- * @link https://stripe.com/docs/api/payouts/object#payout_object-status
68
- */
69
- const STATUS_CANCELED = 'canceled';
70
  const STATUS_IN_TRANSIT = 'in_transit';
71
- const STATUS_FAILED = 'failed';
72
- const STATUS_PAID = 'paid';
73
- const STATUS_PENDING = 'pending';
74
 
75
- /**
76
- * Possible string representations of the type of payout.
77
- * @link https://stripe.com/docs/api/payouts/object#payout_object-type
78
- */
79
  const TYPE_BANK_ACCOUNT = 'bank_account';
80
- const TYPE_CARD = 'card';
81
 
82
  /**
83
- * @return Payout The canceled payout.
 
 
 
 
 
84
  */
85
- public function cancel()
86
  {
87
  $url = $this->instanceUrl() . '/cancel';
88
- list($response, $opts) = $this->_request('post', $url);
89
  $this->refreshFrom($response, $opts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  return $this;
91
  }
92
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A <code>Payout</code> object is created when you receive funds from Stripe, or
9
+ * when you initiate a payout to either a bank account or debit card of a <a
10
+ * href="/docs/connect/bank-debit-card-payouts">connected Stripe account</a>. You
11
+ * can retrieve individual payouts, as well as list all payouts. Payouts are made
12
+ * on <a href="/docs/connect/manage-payout-schedule">varying schedules</a>,
13
+ * depending on your country and industry.
14
  *
15
+ * Related guide: <a href="https://stripe.com/docs/payouts">Receiving Payouts</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
+ * @property string $id Unique identifier for the object.
18
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
19
+ * @property int $amount Amount (in %s) to be transferred to your bank account or debit card.
20
+ * @property int $arrival_date Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays.
21
+ * @property bool $automatic Returns <code>true</code> if the payout was created by an <a href="https://stripe.com/docs/payouts#payout-schedule">automated payout schedule</a>, and <code>false</code> if it was <a href="https://stripe.com/docs/payouts#manual-payouts">requested manually</a>.
22
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this payout on your account balance.
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
25
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
26
+ * @property null|string|\Stripe\BankAccount|\Stripe\Card $destination ID of the bank account or card the payout was sent to.
27
+ * @property null|string|\Stripe\BalanceTransaction $failure_balance_transaction If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance.
28
+ * @property null|string $failure_code Error code explaining reason for payout failure if available. See <a href="https://stripe.com/docs/api#payout_failures">Types of payout failures</a> for a list of failure codes.
29
+ * @property null|string $failure_message Message to user further explaining reason for payout failure if available.
30
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
31
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
32
+ * @property string $method The method used to send this payout, which can be <code>standard</code> or <code>instant</code>. <code>instant</code> is only supported for payouts to debit cards. (See <a href="https://stripe.com/blog/instant-payouts-for-marketplaces">Instant payouts for marketplaces</a> for more information.)
33
+ * @property null|string|\Stripe\Payout $original_payout If the payout reverses another, this is the ID of the original payout.
34
+ * @property null|string|\Stripe\Payout $reversed_by If the payout was reversed, this is the ID of the payout that reverses this payout.
35
+ * @property string $source_type The source balance this payout came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>.
36
+ * @property null|string $statement_descriptor Extra information about a payout to be displayed on the user's bank statement.
37
+ * @property string $status Current status of the payout: <code>paid</code>, <code>pending</code>, <code>in_transit</code>, <code>canceled</code> or <code>failed</code>. A payout is <code>pending</code> until it is submitted to the bank, when it becomes <code>in_transit</code>. The status then changes to <code>paid</code> if the transaction goes through, or to <code>failed</code> or <code>canceled</code> (within 5 business days). Some failed payouts may initially show as <code>paid</code> but then change to <code>failed</code>.
38
+ * @property string $type Can be <code>bank_account</code> or <code>card</code>.
39
  */
40
  class Payout extends ApiResource
41
  {
42
+ const OBJECT_NAME = 'payout';
43
 
44
  use ApiOperations\All;
45
  use ApiOperations\Create;
46
  use ApiOperations\Retrieve;
47
  use ApiOperations\Update;
48
 
49
+ const FAILURE_ACCOUNT_CLOSED = 'account_closed';
50
+ const FAILURE_ACCOUNT_FROZEN = 'account_frozen';
51
+ const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted';
52
+ const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed';
53
+ const FAILURE_COULD_NOT_PROCESS = 'could_not_process';
54
+ const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
55
+ const FAILURE_DECLINED = 'declined';
 
 
 
 
56
  const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name';
57
+ const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds';
58
+ const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number';
59
+ const FAILURE_INVALID_CURRENCY = 'invalid_currency';
60
+ const FAILURE_NO_ACCOUNT = 'no_account';
61
+ const FAILURE_UNSUPPORTED_CARD = 'unsupported_card';
62
 
63
+ const METHOD_INSTANT = 'instant';
 
 
 
64
  const METHOD_STANDARD = 'standard';
 
65
 
66
+ const STATUS_CANCELED = 'canceled';
67
+ const STATUS_FAILED = 'failed';
 
 
 
68
  const STATUS_IN_TRANSIT = 'in_transit';
69
+ const STATUS_PAID = 'paid';
70
+ const STATUS_PENDING = 'pending';
 
71
 
 
 
 
 
72
  const TYPE_BANK_ACCOUNT = 'bank_account';
73
+ const TYPE_CARD = 'card';
74
 
75
  /**
76
+ * @param null|array $params
77
+ * @param null|array|string $opts
78
+ *
79
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
80
+ *
81
+ * @return Payout the canceled payout
82
  */
83
+ public function cancel($params = null, $opts = null)
84
  {
85
  $url = $this->instanceUrl() . '/cancel';
86
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
87
  $this->refreshFrom($response, $opts);
88
+
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * @param null|array $params
94
+ * @param null|array|string $opts
95
+ *
96
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
97
+ *
98
+ * @return Payout the reversed payout
99
+ */
100
+ public function reverse($params = null, $opts = null)
101
+ {
102
+ $url = $this->instanceUrl() . '/reverse';
103
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
104
+ $this->refreshFrom($response, $opts);
105
+
106
  return $this;
107
  }
108
  }
app/api/Stripe/Person.php CHANGED
@@ -1,71 +1,79 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Person
 
 
 
 
 
 
 
 
7
  *
8
- * @package Stripe
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property string $account
13
- * @property mixed $address
14
- * @property mixed $address_kana
15
- * @property mixed $address_kanji
16
- * @property int $created
17
- * @property bool $deleted
18
- * @property mixed $dob
19
- * @property string $email
20
- * @property string $first_name
21
- * @property string $first_name_kana
22
- * @property string $first_name_kanji
23
- * @property string $gender
24
- * @property bool $id_number_provided
25
- * @property string $last_name
26
- * @property string $last_name_kana
27
- * @property string $last_name_kanji
28
- * @property string $maiden_name
29
- * @property StripeObject $metadata
30
- * @property string $phone
31
- * @property mixed $relationship
32
- * @property mixed $requirements
33
- * @property bool $ssn_last_4_provided
34
- * @property mixed $verification
 
35
  */
36
  class Person extends ApiResource
37
  {
38
- const OBJECT_NAME = "person";
39
 
40
  use ApiOperations\Delete;
41
  use ApiOperations\Update;
42
 
43
- /**
44
- * Possible string representations of a person's gender.
45
- * @link https://stripe.com/docs/api/persons/object#person_object-gender
46
- */
47
- const GENDER_MALE = 'male';
48
  const GENDER_FEMALE = 'female';
 
49
 
50
- /**
51
- * Possible string representations of a person's verification status.
52
- * @link https://stripe.com/docs/api/persons/object#person_object-verification-status
53
- */
54
- const VERIFICATION_STATUS_PENDING = 'pending';
55
  const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
56
- const VERIFICATION_STATUS_VERIFIED = 'verified';
57
 
58
  /**
59
- * @return string The API URL for this Stripe account reversal.
60
  */
61
  public function instanceUrl()
62
  {
63
  $id = $this['id'];
64
  $account = $this['account'];
65
  if (!$id) {
66
- throw new Error\InvalidRequest(
67
- "Could not determine which URL to request: " .
68
- "class instance has invalid ID: $id",
69
  null
70
  );
71
  }
@@ -73,35 +81,40 @@ class Person extends ApiResource
73
  $account = Util\Util::utf8($account);
74
 
75
  $base = Account::classUrl();
76
- $accountExtn = urlencode($account);
77
- $extn = urlencode($id);
78
- return "$base/$accountExtn/persons/$extn";
 
79
  }
80
 
81
  /**
82
  * @param array|string $_id
83
- * @param array|string|null $_opts
84
  *
85
- * @throws \Stripe\Error\InvalidRequest
86
  */
87
  public static function retrieve($_id, $_opts = null)
88
  {
89
- $msg = "Persons cannot be accessed without an account ID. " .
90
- "Retrieve a Person using \$account->retrievePerson('person_id') instead.";
91
- throw new Error\InvalidRequest($msg, null);
 
 
92
  }
93
 
94
  /**
95
  * @param string $_id
96
- * @param array|null $_params
97
- * @param array|string|null $_options
98
  *
99
- * @throws \Stripe\Error\InvalidRequest
100
  */
101
  public static function update($_id, $_params = null, $_options = null)
102
  {
103
- $msg = "Persons cannot be accessed without an account ID. " .
104
- "Retrieve a Person using \$account->retrievePerson('person_id') instead.";
105
- throw new Error\InvalidRequest($msg, null);
 
 
106
  }
107
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * This is an object representing a person associated with a Stripe account.
9
+ *
10
+ * A platform cannot access a Standard or Express account's persons after the
11
+ * account starts onboarding, such as after generating an account link for the
12
+ * account. See the <a
13
+ * href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a>
14
+ * or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding
15
+ * documentation</a> for information about platform pre-filling and account
16
+ * onboarding steps.
17
  *
18
+ * Related guide: <a
19
+ * href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling
20
+ * Identity Verification with the API</a>.
21
  *
22
+ * @property string $id Unique identifier for the object.
23
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
24
+ * @property string $account The account the person is associated with.
25
+ * @property \Stripe\StripeObject $address
26
+ * @property null|\Stripe\StripeObject $address_kana The Kana variation of the person's address (Japan only).
27
+ * @property null|\Stripe\StripeObject $address_kanji The Kanji variation of the person's address (Japan only).
28
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
29
+ * @property \Stripe\StripeObject $dob
30
+ * @property null|string $email The person's email address.
31
+ * @property null|string $first_name The person's first name.
32
+ * @property null|string $first_name_kana The Kana variation of the person's first name (Japan only).
33
+ * @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only).
34
+ * @property null|string $gender The person's gender (International regulations require either &quot;male&quot; or &quot;female&quot;).
35
+ * @property bool $id_number_provided Whether the person's <code>id_number</code> was provided.
36
+ * @property null|string $last_name The person's last name.
37
+ * @property null|string $last_name_kana The Kana variation of the person's last name (Japan only).
38
+ * @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only).
39
+ * @property null|string $maiden_name The person's maiden name.
40
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
41
+ * @property null|string $nationality The country where the person is a national.
42
+ * @property null|string $phone The person's phone number.
43
+ * @property string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
44
+ * @property \Stripe\StripeObject $relationship
45
+ * @property null|\Stripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when.
46
+ * @property bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only).
47
+ * @property \Stripe\StripeObject $verification
48
  */
49
  class Person extends ApiResource
50
  {
51
+ const OBJECT_NAME = 'person';
52
 
53
  use ApiOperations\Delete;
54
  use ApiOperations\Update;
55
 
 
 
 
 
 
56
  const GENDER_FEMALE = 'female';
57
+ const GENDER_MALE = 'male';
58
 
59
+ const POLITICAL_EXPOSURE_EXISTING = 'existing';
60
+ const POLITICAL_EXPOSURE_NONE = 'none';
61
+
62
+ const VERIFICATION_STATUS_PENDING = 'pending';
 
63
  const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
64
+ const VERIFICATION_STATUS_VERIFIED = 'verified';
65
 
66
  /**
67
+ * @return string the API URL for this Stripe account reversal
68
  */
69
  public function instanceUrl()
70
  {
71
  $id = $this['id'];
72
  $account = $this['account'];
73
  if (!$id) {
74
+ throw new Exception\UnexpectedValueException(
75
+ 'Could not determine which URL to request: ' .
76
+ "class instance has invalid ID: {$id}",
77
  null
78
  );
79
  }
81
  $account = Util\Util::utf8($account);
82
 
83
  $base = Account::classUrl();
84
+ $accountExtn = \urlencode($account);
85
+ $extn = \urlencode($id);
86
+
87
+ return "{$base}/{$accountExtn}/persons/{$extn}";
88
  }
89
 
90
  /**
91
  * @param array|string $_id
92
+ * @param null|array|string $_opts
93
  *
94
+ * @throws \Stripe\Exception\BadMethodCallException
95
  */
96
  public static function retrieve($_id, $_opts = null)
97
  {
98
+ $msg = 'Persons cannot be retrieved without an account ID. Retrieve ' .
99
+ "a person using `Account::retrievePerson('account_id', " .
100
+ "'person_id')`.";
101
+
102
+ throw new Exception\BadMethodCallException($msg);
103
  }
104
 
105
  /**
106
  * @param string $_id
107
+ * @param null|array $_params
108
+ * @param null|array|string $_options
109
  *
110
+ * @throws \Stripe\Exception\BadMethodCallException
111
  */
112
  public static function update($_id, $_params = null, $_options = null)
113
  {
114
+ $msg = 'Persons cannot be updated without an account ID. Update ' .
115
+ "a person using `Account::updatePerson('account_id', " .
116
+ "'person_id', \$updateParams)`.";
117
+
118
+ throw new Exception\BadMethodCallException($msg);
119
  }
120
  }
app/api/Stripe/Plan.php CHANGED
@@ -1,35 +1,53 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Plan
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @package Stripe
 
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property bool $active
13
- * @property string $aggregate_usage
14
- * @property int $amount
15
- * @property string $billing_scheme
16
- * @property int $created
17
- * @property string $currency
18
- * @property string $interval
19
- * @property int $interval_count
20
- * @property bool $livemode
21
- * @property StripeObject $metadata
22
- * @property string $nickname
23
- * @property string $product
24
- * @property mixed $tiers
25
- * @property string $tiers_mode
26
- * @property mixed $transform_usage
27
- * @property int $trial_period_days
28
- * @property string $usage_type
 
29
  */
30
  class Plan extends ApiResource
31
  {
32
- const OBJECT_NAME = "plan";
33
 
34
  use ApiOperations\All;
35
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * You can now model subscriptions more flexibly using the <a
9
+ * href="https://stripe.com/docs/api#prices">Prices API</a>. It replaces the Plans
10
+ * API and is backwards compatible to simplify your migration.
11
+ *
12
+ * Plans define the base price, currency, and billing cycle for recurring purchases
13
+ * of products. <a href="https://stripe.com/docs/api#products">Products</a> help
14
+ * you track inventory or provisioning, and plans help you track pricing. Different
15
+ * physical goods or levels of service should be represented by products, and
16
+ * pricing options should be represented by plans. This approach lets you change
17
+ * prices without having to change your provisioning scheme.
18
+ *
19
+ * For example, you might have a single &quot;gold&quot; product that has plans for
20
+ * $10/month, $100/year, €9/month, and €90/year.
21
  *
22
+ * Related guides: <a
23
+ * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
24
+ * a subscription</a> and more about <a
25
+ * href="https://stripe.com/docs/billing/prices-guide">products and prices</a>.
26
  *
27
+ * @property string $id Unique identifier for the object.
28
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
29
+ * @property bool $active Whether the plan can be used for new purchases.
30
+ * @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of <code>usage_type=metered</code>. Allowed values are <code>sum</code> for summing up all usage during a period, <code>last_during_period</code> for using the last usage record reported within a period, <code>last_ever</code> for using the last usage record ever (across period bounds) or <code>max</code> which uses the usage record with the maximum reported usage during a period. Defaults to <code>sum</code>.
31
+ * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>.
32
+ * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>.
33
+ * @property string $billing_scheme Describes how to compute the price per period. Either <code>per_unit</code> or <code>tiered</code>. <code>per_unit</code> indicates that the fixed amount (specified in <code>amount</code>) will be charged per unit in <code>quantity</code> (for plans with <code>usage_type=licensed</code>), or per unit of total usage (for plans with <code>usage_type=metered</code>). <code>tiered</code> indicates that the unit pricing will be computed using a tiering strategy as defined using the <code>tiers</code> and <code>tiers_mode</code> attributes.
34
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
35
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
36
+ * @property string $interval The frequency at which a subscription is billed. One of <code>day</code>, <code>week</code>, <code>month</code> or <code>year</code>.
37
+ * @property int $interval_count The number of intervals (specified in the <code>interval</code> attribute) between subscription billings. For example, <code>interval=month</code> and <code>interval_count=3</code> bills every 3 months.
38
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
39
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
40
+ * @property null|string $nickname A brief description of the plan, hidden from customers.
41
+ * @property null|string|\Stripe\Product $product The product whose pricing this plan determines.
42
+ * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
43
+ * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
44
+ * @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
45
+ * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using <a href="https://stripe.com/docs/api#create_subscription-trial_from_plan"><code>trial_from_plan=true</code></a>.
46
+ * @property string $usage_type Configures how the quantity per period should be determined. Can be either <code>metered</code> or <code>licensed</code>. <code>licensed</code> automatically bills the <code>quantity</code> set when adding it to a subscription. <code>metered</code> aggregates the total usage based on usage records. Defaults to <code>licensed</code>.
47
  */
48
  class Plan extends ApiResource
49
  {
50
+ const OBJECT_NAME = 'plan';
51
 
52
  use ApiOperations\All;
53
  use ApiOperations\Create;
app/api/Stripe/Price.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * Prices define the unit cost, currency, and (optional) billing cycle for both
9
+ * recurring and one-time purchases of products. <a
10
+ * href="https://stripe.com/docs/api#products">Products</a> help you track
11
+ * inventory or provisioning, and prices help you track payment terms. Different
12
+ * physical goods or levels of service should be represented by products, and
13
+ * pricing options should be represented by prices. This approach lets you change
14
+ * prices without having to change your provisioning scheme.
15
+ *
16
+ * For example, you might have a single &quot;gold&quot; product that has prices
17
+ * for $10/month, $100/year, and €9 once.
18
+ *
19
+ * Related guides: <a
20
+ * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
21
+ * a subscription</a>, <a
22
+ * href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>,
23
+ * and more about <a href="https://stripe.com/docs/billing/prices-guide">products
24
+ * and prices</a>.
25
+ *
26
+ * @property string $id Unique identifier for the object.
27
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
28
+ * @property bool $active Whether the price can be used for new purchases.
29
+ * @property string $billing_scheme Describes how to compute the price per period. Either <code>per_unit</code> or <code>tiered</code>. <code>per_unit</code> indicates that the fixed amount (specified in <code>unit_amount</code> or <code>unit_amount_decimal</code>) will be charged per unit in <code>quantity</code> (for prices with <code>usage_type=licensed</code>), or per unit of total usage (for prices with <code>usage_type=metered</code>). <code>tiered</code> indicates that the unit pricing will be computed using a tiering strategy as defined using the <code>tiers</code> and <code>tiers_mode</code> attributes.
30
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
31
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
32
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
33
+ * @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string.
34
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
35
+ * @property null|string $nickname A brief description of the plan, hidden from customers.
36
+ * @property string|\Stripe\Product $product The ID of the product this price is associated with.
37
+ * @property null|\Stripe\StripeObject $recurring The recurring components of a price such as <code>interval</code> and <code>usage_type</code>.
38
+ * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
39
+ * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
40
+ * @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
41
+ * @property string $type One of <code>one_time</code> or <code>recurring</code> depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
42
+ * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>.
43
+ * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>.
44
+ */
45
+ class Price extends ApiResource
46
+ {
47
+ const OBJECT_NAME = 'price';
48
+
49
+ use ApiOperations\All;
50
+ use ApiOperations\Create;
51
+ use ApiOperations\Retrieve;
52
+ use ApiOperations\Update;
53
+
54
+ const BILLING_SCHEME_PER_UNIT = 'per_unit';
55
+ const BILLING_SCHEME_TIERED = 'tiered';
56
+
57
+ const TIERS_MODE_GRADUATED = 'graduated';
58
+ const TIERS_MODE_VOLUME = 'volume';
59
+
60
+ const TYPE_ONE_TIME = 'one_time';
61
+ const TYPE_RECURRING = 'recurring';
62
+ }
app/api/Stripe/Product.php CHANGED
@@ -1,35 +1,46 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Product
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $active
11
- * @property string[] $attributes
12
- * @property string $caption
13
- * @property int $created
14
- * @property string[] $deactivate_on
15
- * @property string $description
16
- * @property string[] $images
17
- * @property bool $livemode
18
- * @property StripeObject $metadata
19
- * @property string $name
20
- * @property mixed $package_dimensions
21
- * @property bool $shippable
22
- * @property string $statement_descriptor
23
- * @property string $type
24
- * @property string $unit_label
25
- * @property int $updated
26
- * @property string $url
27
  *
28
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  */
30
  class Product extends ApiResource
31
  {
32
- const OBJECT_NAME = "product";
33
 
34
  use ApiOperations\All;
35
  use ApiOperations\Create;
@@ -37,10 +48,6 @@ class Product extends ApiResource
37
  use ApiOperations\Retrieve;
38
  use ApiOperations\Update;
39
 
40
- /**
41
- * Possible string representations of the type of product.
42
- * @link https://stripe.com/docs/api/service_products/object#service_product_object-type
43
- */
44
- const TYPE_GOOD = 'good';
45
  const TYPE_SERVICE = 'service';
46
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Products describe the specific goods or services you offer to your customers.
9
+ * For example, you might offer a Standard and Premium version of your goods or
10
+ * service; each version would be a separate Product. They can be used in
11
+ * conjunction with <a href="https://stripe.com/docs/api#prices">Prices</a> to
12
+ * configure pricing in Checkout and Subscriptions.
13
  *
14
+ * Related guides: <a
15
+ * href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
16
+ * a subscription</a> or accept <a
17
+ * href="https://stripe.com/docs/payments/checkout/client#create-products">one-time
18
+ * payments with Checkout</a> and more about <a
19
+ * href="https://stripe.com/docs/billing/prices-guide">Products and Prices</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
+ * @property string $id Unique identifier for the object.
22
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
23
+ * @property bool $active Whether the product is currently available for purchase.
24
+ * @property null|string[] $attributes A list of up to 5 attributes that each SKU can provide values for (e.g., <code>[&quot;color&quot;, &quot;size&quot;]</code>).
25
+ * @property null|string $caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of <code>type=good</code>.
26
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
27
+ * @property string[] $deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of <code>type=good</code>.
28
+ * @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
29
+ * @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
30
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
31
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
32
+ * @property string $name The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
33
+ * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own <code>package_dimensions</code>. Only applicable to products of <code>type=good</code>.
34
+ * @property null|bool $shippable Whether this product is a shipped good. Only applicable to products of <code>type=good</code>.
35
+ * @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
36
+ * @property string $type The type of the product. The product is either of type <code>good</code>, which is eligible for use with Orders and SKUs, or <code>service</code>, which is eligible for use with Subscriptions and Plans.
37
+ * @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions.
38
+ * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
39
+ * @property null|string $url A URL of a publicly-accessible webpage for this product. Only applicable to products of <code>type=good</code>.
40
  */
41
  class Product extends ApiResource
42
  {
43
+ const OBJECT_NAME = 'product';
44
 
45
  use ApiOperations\All;
46
  use ApiOperations\Create;
48
  use ApiOperations\Retrieve;
49
  use ApiOperations\Update;
50
 
51
+ const TYPE_GOOD = 'good';
 
 
 
 
52
  const TYPE_SERVICE = 'service';
53
  }
app/api/Stripe/PromotionCode.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * A Promotion Code represents a customer-redeemable code for a coupon. It can be
9
+ * used to create multiple codes for a single coupon.
10
+ *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property bool $active Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
14
+ * @property string $code The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
15
+ * @property \Stripe\Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#invoices">invoices</a> or <a href="https://stripe.com/docs/api#create_order-coupon">orders</a>. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a>.
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property null|string|\Stripe\Customer $customer The customer that this promotion code can be used by.
18
+ * @property null|int $expires_at Date at which the promotion code can no longer be redeemed.
19
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
20
+ * @property null|int $max_redemptions Maximum number of times this promotion code can be redeemed.
21
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
22
+ * @property \Stripe\StripeObject $restrictions
23
+ * @property int $times_redeemed Number of times this promotion code has been used.
24
+ */
25
+ class PromotionCode extends ApiResource
26
+ {
27
+ const OBJECT_NAME = 'promotion_code';
28
+
29
+ use ApiOperations\All;
30
+ use ApiOperations\Create;
31
+ use ApiOperations\Retrieve;
32
+ use ApiOperations\Update;
33
+ }
app/api/Stripe/Radar/EarlyFraudWarning.php CHANGED
@@ -1,36 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
6
- * Class EarlyFraudWarning
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $actionable
11
- * @property string $charge
12
- * @property int $created
13
- * @property string $fraud_type
14
- * @property bool $livemode
15
  *
16
- * @package Stripe\Radar
 
 
 
 
 
 
17
  */
18
  class EarlyFraudWarning extends \Stripe\ApiResource
19
  {
20
- const OBJECT_NAME = "radar.early_fraud_warning";
21
 
22
  use \Stripe\ApiOperations\All;
23
  use \Stripe\ApiOperations\Retrieve;
24
 
25
- /**
26
- * Possible string representations of an early fraud warning's fraud type.
27
- * @link https://stripe.com/docs/api/early_fraud_warnings/object#early_fraud_warning_object-fraud_type
28
- */
29
- const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received';
30
  const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application';
31
- const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card';
32
- const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card';
33
- const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card';
34
- const FRAUD_TYPE_MISC = 'misc';
35
- const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card';
36
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
8
+ * An early fraud warning indicates that the card issuer has notified us that a
9
+ * charge may be fraudulent.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/disputes/measuring#early-fraud-warnings">Early
13
+ * Fraud Warnings</a>.
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property bool $actionable An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later.
18
+ * @property string|\Stripe\Charge $charge ID of the charge this early fraud warning is for, optionally expanded.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property string $fraud_type The type of fraud labelled by the issuer. One of <code>card_never_received</code>, <code>fraudulent_card_application</code>, <code>made_with_counterfeit_card</code>, <code>made_with_lost_card</code>, <code>made_with_stolen_card</code>, <code>misc</code>, <code>unauthorized_use_of_card</code>.
21
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
22
  */
23
  class EarlyFraudWarning extends \Stripe\ApiResource
24
  {
25
+ const OBJECT_NAME = 'radar.early_fraud_warning';
26
 
27
  use \Stripe\ApiOperations\All;
28
  use \Stripe\ApiOperations\Retrieve;
29
 
30
+ const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received';
 
 
 
 
31
  const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application';
32
+ const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card';
33
+ const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card';
34
+ const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card';
35
+ const FRAUD_TYPE_MISC = 'misc';
36
+ const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card';
37
  }
app/api/Stripe/Radar/ValueList.php CHANGED
@@ -1,28 +1,31 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
6
- * Class ValueList
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $alias
11
- * @property int $created
12
- * @property string $created_by
13
- * @property string $item_type
14
- * @property Collection $list_items
15
- * @property bool $livemode
16
- * @property StripeObject $metadata
17
- * @property mixed $name
18
- * @property int $updated
19
- * @property string $updated_by
20
  *
21
- * @package Stripe\Radar
 
 
 
 
 
 
 
 
 
22
  */
23
  class ValueList extends \Stripe\ApiResource
24
  {
25
- const OBJECT_NAME = "radar.value_list";
26
 
27
  use \Stripe\ApiOperations\All;
28
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
8
+ * Value lists allow you to group values together which can then be referenced in
9
+ * rules.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/radar/lists#managing-list-items">Default Stripe
13
+ * Lists</a>.
 
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property string $alias The name of the value list for use in rules.
18
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
19
+ * @property string $created_by The name or email address of the user who created this value list.
20
+ * @property string $item_type The type of items in the value list. One of <code>card_fingerprint</code>, <code>card_bin</code>, <code>email</code>, <code>ip_address</code>, <code>country</code>, <code>string</code>, or <code>case_sensitive_string</code>.
21
+ * @property \Stripe\Collection $list_items List of items contained within this value list.
22
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
23
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
24
+ * @property string $name The name of the value list.
25
  */
26
  class ValueList extends \Stripe\ApiResource
27
  {
28
+ const OBJECT_NAME = 'radar.value_list';
29
 
30
  use \Stripe\ApiOperations\All;
31
  use \Stripe\ApiOperations\Create;
app/api/Stripe/Radar/ValueListItem.php CHANGED
@@ -1,23 +1,28 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
6
- * Class ValueListItem
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property string $created_by
12
- * @property string $list
13
- * @property bool $livemode
14
- * @property string $value
15
  *
16
- * @package Stripe\Radar
 
 
 
 
 
 
17
  */
18
  class ValueListItem extends \Stripe\ApiResource
19
  {
20
- const OBJECT_NAME = "radar.value_list_item";
21
 
22
  use \Stripe\ApiOperations\All;
23
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
8
+ * Value list items allow you to add specific values to a given Radar value list,
9
+ * which can then be used in rules.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/radar/lists#managing-list-items">Managing List
13
+ * Items</a>.
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18
+ * @property string $created_by The name or email address of the user who added this item to the value list.
19
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
20
+ * @property string $value The value of the item.
21
+ * @property string $value_list The identifier of the value list this item belongs to.
22
  */
23
  class ValueListItem extends \Stripe\ApiResource
24
  {
25
+ const OBJECT_NAME = 'radar.value_list_item';
26
 
27
  use \Stripe\ApiOperations\All;
28
  use \Stripe\ApiOperations\Create;
app/api/Stripe/Recipient.php CHANGED
@@ -1,47 +1,44 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Recipient
 
 
 
7
  *
8
- * @package Stripe
 
 
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property mixed $active_account
13
- * @property Collection $cards
14
- * @property int $created
15
- * @property string $default_card
16
- * @property string $description
17
- * @property string $email
18
- * @property bool $livemode
19
- * @property StripeObject $metadata
20
- * @property string $migrated_to
21
- * @property string $name
22
- * @property string $rolled_back_from
23
- * @property string $type
 
24
  */
25
  class Recipient extends ApiResource
26
  {
27
- const OBJECT_NAME = "recipient";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\Create;
31
  use ApiOperations\Delete;
32
  use ApiOperations\Retrieve;
33
  use ApiOperations\Update;
34
-
35
- /**
36
- * @param array|null $params
37
- *
38
- * @return Collection of the Recipient's Transfers
39
- */
40
- public function transfers($params = null)
41
- {
42
- $params = $params ?: [];
43
- $params['recipient'] = $this->id;
44
- $transfers = Transfer::all($params, $this->_opts);
45
- return $transfers;
46
- }
47
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * With <code>Recipient</code> objects, you can transfer money from your Stripe
9
+ * account to a third-party bank account or debit card. The API allows you to
10
+ * create, delete, and update your recipients. You can retrieve individual
11
+ * recipients as well as a list of all your recipients.
12
  *
13
+ * <strong><code>Recipient</code> objects have been deprecated in favor of <a
14
+ * href="https://stripe.com/docs/connect">Connect</a>, specifically Connect's much
15
+ * more powerful <a href="https://stripe.com/docs/api#account">Account objects</a>.
16
+ * Stripe accounts that don't already use recipients can no longer begin doing so.
17
+ * Please use <code>Account</code> objects instead.</strong>
18
  *
19
+ * @property string $id Unique identifier for the object.
20
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property null|\Stripe\BankAccount $active_account Hash describing the current account on the recipient, if there is one.
22
+ * @property null|\Stripe\Collection $cards
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property null|string|\Stripe\Card $default_card The default card to use for creating transfers to this recipient.
25
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
26
+ * @property null|string $email
27
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
28
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29
+ * @property null|string|\Stripe\Account $migrated_to The ID of the <a href="https://stripe.com/docs/connect/custom-accounts">Custom account</a> this recipient was migrated to. If set, the recipient can no longer be updated, nor can transfers be made to it: use the Custom account instead.
30
+ * @property null|string $name Full, legal name of the recipient.
31
+ * @property string|\Stripe\Account $rolled_back_from
32
+ * @property string $type Type of the recipient, one of <code>individual</code> or <code>corporation</code>.
33
+ * @property bool $verified Whether the recipient has been verified. This field is non-standard, and maybe removed in the future
34
  */
35
  class Recipient extends ApiResource
36
  {
37
+ const OBJECT_NAME = 'recipient';
38
 
39
  use ApiOperations\All;
40
  use ApiOperations\Create;
41
  use ApiOperations\Delete;
42
  use ApiOperations\Retrieve;
43
  use ApiOperations\Update;
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
app/api/Stripe/RecipientTransfer.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class RecipientTransfer
7
  *
8
  * @property string $id
9
  * @property string $object
@@ -20,19 +20,17 @@ namespace Stripe;
20
  * @property string $failure_code
21
  * @property string $failure_message
22
  * @property bool $livemode
23
- * @property StripeObject $metadata
24
  * @property string $method
25
  * @property string $recipient
26
- * @property mixed $reversals
27
  * @property bool $reversed
28
  * @property string $source_type
29
  * @property string $statement_descriptor
30
  * @property string $status
31
  * @property string $type
32
- *
33
- * @package Stripe
34
  */
35
  class RecipientTransfer extends ApiResource
36
  {
37
- const OBJECT_NAME = "recipient_transfer";
38
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class RecipientTransfer.
7
  *
8
  * @property string $id
9
  * @property string $object
20
  * @property string $failure_code
21
  * @property string $failure_message
22
  * @property bool $livemode
23
+ * @property \Stripe\StripeObject $metadata
24
  * @property string $method
25
  * @property string $recipient
26
+ * @property \Stripe\Collection $reversals
27
  * @property bool $reversed
28
  * @property string $source_type
29
  * @property string $statement_descriptor
30
  * @property string $status
31
  * @property string $type
 
 
32
  */
33
  class RecipientTransfer extends ApiResource
34
  {
35
+ const OBJECT_NAME = 'recipient_transfer';
36
  }
app/api/Stripe/Refund.php CHANGED
@@ -1,60 +1,58 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Refund
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $balance_transaction
12
- * @property string $charge
13
- * @property int $created
14
- * @property string $currency
15
- * @property string $description
16
- * @property string $failure_balance_transaction
17
- * @property string $failure_reason
18
- * @property StripeObject $metadata
19
- * @property string $reason
20
- * @property string $receipt_number
21
- * @property string $source_transfer_reversal
22
- * @property string $status
23
- * @property string $transfer_reversal
24
  *
25
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  */
27
  class Refund extends ApiResource
28
  {
29
- const OBJECT_NAME = "refund";
30
 
31
  use ApiOperations\All;
32
  use ApiOperations\Create;
33
  use ApiOperations\Retrieve;
34
  use ApiOperations\Update;
35
 
36
- /**
37
- * Possible string representations of the failure reason.
38
- * @link https://stripe.com/docs/api/refunds/object#refund_object-failure_reason
39
- */
40
- const FAILURE_REASON = 'expired_or_canceled_card';
41
  const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card';
42
- const FAILURE_REASON_UNKNOWN = 'unknown';
43
 
44
- /**
45
- * Possible string representations of the refund reason.
46
- * @link https://stripe.com/docs/api/refunds/object#refund_object-reason
47
- */
48
- const REASON_DUPLICATE = 'duplicate';
49
- const REASON_FRAUDULENT = 'fraudulent';
50
  const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer';
51
 
 
 
 
 
 
52
  /**
53
- * Possible string representations of the refund status.
54
- * @link https://stripe.com/docs/api/refunds/object#refund_object-status
55
  */
56
- const STATUS_CANCELED = 'canceled';
57
- const STATUS_FAILED = 'failed';
58
- const STATUS_PENDING = 'pending';
59
- const STATUS_SUCCEEDED = 'succeeded';
60
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <code>Refund</code> objects allow you to refund a charge that has previously
9
+ * been created but not yet refunded. Funds will be refunded to the credit or debit
10
+ * card that was originally charged.
11
  *
12
+ * Related guide: <a href="https://stripe.com/docs/refunds">Refunds</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property int $amount Amount, in %s.
17
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
18
+ * @property null|string|\Stripe\Charge $charge ID of the charge that was refunded.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
21
+ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
22
+ * @property string|\Stripe\BalanceTransaction $failure_balance_transaction If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.
23
+ * @property string $failure_reason If the refund failed, the reason for refund failure if known. Possible values are <code>lost_or_stolen_card</code>, <code>expired_or_canceled_card</code>, or <code>unknown</code>.
24
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
25
+ * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was refunded.
26
+ * @property null|string $reason Reason for the refund, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, or <code>requested_by_customer</code>) or generated by Stripe internally (<code>expired_uncaptured_charge</code>).
27
+ * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this refund.
28
+ * @property null|string|\Stripe\TransferReversal $source_transfer_reversal The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details.
29
+ * @property null|string $status Status of the refund. For credit card refunds, this can be <code>pending</code>, <code>succeeded</code>, or <code>failed</code>. For other types of refunds, it can be <code>pending</code>, <code>succeeded</code>, <code>failed</code>, or <code>canceled</code>. Refer to our <a href="https://stripe.com/docs/refunds#failed-refunds">refunds</a> documentation for more details.
30
+ * @property null|string|\Stripe\TransferReversal $transfer_reversal If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter.
31
  */
32
  class Refund extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'refund';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
38
  use ApiOperations\Retrieve;
39
  use ApiOperations\Update;
40
 
41
+ const FAILURE_REASON_EXPIRED_OR_CANCELED_CARD = 'expired_or_canceled_card';
 
 
 
 
42
  const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card';
43
+ const FAILURE_REASON_UNKNOWN = 'unknown';
44
 
45
+ const REASON_DUPLICATE = 'duplicate';
46
+ const REASON_FRAUDULENT = 'fraudulent';
 
 
 
 
47
  const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer';
48
 
49
+ const STATUS_CANCELED = 'canceled';
50
+ const STATUS_FAILED = 'failed';
51
+ const STATUS_PENDING = 'pending';
52
+ const STATUS_SUCCEEDED = 'succeeded';
53
+
54
  /**
55
+ * @deprecated use FAILURE_REASON_EXPIRED_OR_CANCELED_CARD instead
 
56
  */
57
+ const FAILURE_REASON = 'expired_or_canceled_card';
 
 
 
58
  }
app/api/Stripe/Reporting/ReportRun.php CHANGED
@@ -1,26 +1,35 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Reporting;
4
 
5
  /**
6
- * Class ReportRun
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property string $error
12
- * @property bool $livemode
13
- * @property mixed $parameters
14
- * @property string $report_type
15
- * @property mixed $result
16
- * @property string $status
17
- * @property int $succeeded_at
18
  *
19
- * @package Stripe\Reporting
 
 
 
 
 
 
 
 
 
20
  */
21
  class ReportRun extends \Stripe\ApiResource
22
  {
23
- const OBJECT_NAME = "reporting.report_run";
24
 
25
  use \Stripe\ApiOperations\All;
26
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Reporting;
6
 
7
  /**
8
+ * The Report Run object represents an instance of a report type generated with
9
+ * specific run parameters. Once the object is created, Stripe begins processing
10
+ * the report. When the report has finished running, it will give you a reference
11
+ * to a file where you can retrieve your results. For an overview, see <a
12
+ * href="https://stripe.com/docs/reporting/statements/api">API Access to
13
+ * Reports</a>.
14
  *
15
+ * Note that reports can only be run based on your live-mode data (not test-mode
16
+ * data), and thus related requests must be made with a <a
17
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.
 
 
 
 
 
 
 
18
  *
19
+ * @property string $id Unique identifier for the object.
20
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
22
+ * @property null|string $error If something should go wrong during the run, a message about the failure (populated when <code>status=failed</code>).
23
+ * @property bool $livemode Always <code>true</code>: reports can only be run on live-mode data.
24
+ * @property \Stripe\StripeObject $parameters
25
+ * @property string $report_type The ID of the <a href="https://stripe.com/docs/reports/report-types">report type</a> to run, such as <code>&quot;balance.summary.1&quot;</code>.
26
+ * @property null|\Stripe\File $result The file object representing the result of the report run (populated when <code>status=succeeded</code>).
27
+ * @property string $status Status of this report run. This will be <code>pending</code> when the run is initially created. When the run finishes, this will be set to <code>succeeded</code> and the <code>result</code> field will be populated. Rarely, we may encounter an error, at which point this will be set to <code>failed</code> and the <code>error</code> field will be populated.
28
+ * @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when <code>status=succeeded</code>). Measured in seconds since the Unix epoch.
29
  */
30
  class ReportRun extends \Stripe\ApiResource
31
  {
32
+ const OBJECT_NAME = 'reporting.report_run';
33
 
34
  use \Stripe\ApiOperations\All;
35
  use \Stripe\ApiOperations\Create;
app/api/Stripe/Reporting/ReportType.php CHANGED
@@ -1,23 +1,33 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Reporting;
4
 
5
  /**
6
- * Class ReportType
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $data_available_end
11
- * @property int $data_available_start
12
- * @property string $name
13
- * @property int $updated
14
- * @property string $version
15
  *
16
- * @package Stripe\Reporting
 
 
 
 
 
 
 
17
  */
18
  class ReportType extends \Stripe\ApiResource
19
  {
20
- const OBJECT_NAME = "reporting.report_type";
21
 
22
  use \Stripe\ApiOperations\All;
23
  use \Stripe\ApiOperations\Retrieve;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Reporting;
6
 
7
  /**
8
+ * The Report Type resource corresponds to a particular type of report, such as the
9
+ * &quot;Activity summary&quot; or &quot;Itemized payouts&quot; reports. These
10
+ * objects are identified by an ID belonging to a set of enumerated values. See <a
11
+ * href="https://stripe.com/docs/reporting/statements/api">API Access to Reports
12
+ * documentation</a> for those Report Type IDs, along with required and optional
13
+ * parameters.
14
  *
15
+ * Note that reports can only be run based on your live-mode data (not test-mode
16
+ * data), and thus related requests must be made with a <a
17
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.
 
 
 
 
18
  *
19
+ * @property string $id The <a href="https://stripe.com/docs/reporting/statements/api#available-report-types">ID of the Report Type</a>, such as <code>balance.summary.1</code>.
20
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch.
22
+ * @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch.
23
+ * @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the <code>columns</code> parameter, this will be null.)
24
+ * @property string $name Human-readable name of the Report Type
25
+ * @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch.
26
+ * @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas.
27
  */
28
  class ReportType extends \Stripe\ApiResource
29
  {
30
+ const OBJECT_NAME = 'reporting.report_type';
31
 
32
  use \Stripe\ApiOperations\All;
33
  use \Stripe\ApiOperations\Retrieve;
app/api/Stripe/RequestTelemetry.php CHANGED
@@ -3,10 +3,9 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class RequestTelemetry
7
  *
8
  * Tracks client request telemetry
9
- * @package Stripe
10
  */
11
  class RequestTelemetry
12
  {
@@ -16,8 +15,8 @@ class RequestTelemetry
16
  /**
17
  * Initialize a new telemetry object.
18
  *
19
- * @param string $requestId The request's request ID.
20
- * @param int $requestDuration The request's duration in milliseconds.
21
  */
22
  public function __construct($requestId, $requestDuration)
23
  {
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class RequestTelemetry.
7
  *
8
  * Tracks client request telemetry
 
9
  */
10
  class RequestTelemetry
11
  {
15
  /**
16
  * Initialize a new telemetry object.
17
  *
18
+ * @param string $requestId the request's request ID
19
+ * @param int $requestDuration the request's duration in milliseconds
20
  */
21
  public function __construct($requestId, $requestDuration)
22
  {
app/api/Stripe/Review.php CHANGED
@@ -1,30 +1,34 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Review
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $billing_zip
11
- * @property string $charge
12
- * @property string $closed_reason
13
- * @property int $created
14
- * @property string $ip_address
15
- * @property mixed $ip_address_location
16
- * @property bool $livemode
17
- * @property bool $open
18
- * @property string $opened_reason
19
- * @property string $payment_intent
20
- * @property string $reason
21
- * @property mixed $session
22
  *
23
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  */
25
  class Review extends ApiResource
26
  {
27
- const OBJECT_NAME = "review";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\Retrieve;
@@ -33,25 +37,30 @@ class Review extends ApiResource
33
  * Possible string representations of the current, the opening or the closure reason of the review.
34
  * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to
35
  * determine where these are apply.
36
- * @link https://stripe.com/docs/api/radar/reviews/object
 
37
  */
38
- const REASON_APPROVED = 'approved';
39
- const REASON_DISPUTED = 'disputed';
40
- const REASON_MANUAL = 'manual';
41
- const REASON_REFUNDED = 'refunded';
42
  const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud';
43
- const REASON_RULE = 'rule';
44
 
45
  /**
46
- * @param array|string|null $options
 
47
  *
48
- * @return Review The approved review.
 
 
49
  */
50
- public function approve($params = null, $options = null)
51
  {
52
  $url = $this->instanceUrl() . '/approve';
53
- list($response, $opts) = $this->_request('post', $url, $params, $options);
54
  $this->refreshFrom($response, $opts);
 
55
  return $this;
56
  }
57
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Reviews can be used to supplement automated fraud detection with human
9
+ * expertise.
10
  *
11
+ * Learn more about <a href="/radar">Radar</a> and reviewing payments <a
12
+ * href="https://stripe.com/docs/radar/reviews">here</a>.
 
 
 
 
 
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property null|string $billing_zip The ZIP or postal code of the card used, if applicable.
17
+ * @property null|string|\Stripe\Charge $charge The charge associated with this review.
18
+ * @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, or <code>disputed</code>.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property null|string $ip_address The IP address where the payment originated.
21
+ * @property null|\Stripe\StripeObject $ip_address_location Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address.
22
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
23
+ * @property bool $open If <code>true</code>, the review needs action.
24
+ * @property string $opened_reason The reason the review was opened. One of <code>rule</code> or <code>manual</code>.
25
+ * @property string|\Stripe\PaymentIntent $payment_intent The PaymentIntent ID associated with this review, if one exists.
26
+ * @property string $reason The reason the review is currently open or closed. One of <code>rule</code>, <code>manual</code>, <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, or <code>disputed</code>.
27
+ * @property null|\Stripe\StripeObject $session Information related to the browsing session of the user who initiated the payment.
28
  */
29
  class Review extends ApiResource
30
  {
31
+ const OBJECT_NAME = 'review';
32
 
33
  use ApiOperations\All;
34
  use ApiOperations\Retrieve;
37
  * Possible string representations of the current, the opening or the closure reason of the review.
38
  * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to
39
  * determine where these are apply.
40
+ *
41
+ * @see https://stripe.com/docs/api/radar/reviews/object
42
  */
43
+ const REASON_APPROVED = 'approved';
44
+ const REASON_DISPUTED = 'disputed';
45
+ const REASON_MANUAL = 'manual';
46
+ const REASON_REFUNDED = 'refunded';
47
  const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud';
48
+ const REASON_RULE = 'rule';
49
 
50
  /**
51
+ * @param null|array $params
52
+ * @param null|array|string $opts
53
  *
54
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
55
+ *
56
+ * @return Review the approved review
57
  */
58
+ public function approve($params = null, $opts = null)
59
  {
60
  $url = $this->instanceUrl() . '/approve';
61
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
62
  $this->refreshFrom($response, $opts);
63
+
64
  return $this;
65
  }
66
  }
app/api/Stripe/SKU.php CHANGED
@@ -1,30 +1,40 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SKU
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $active
11
- * @property mixed $attributes
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $image
15
- * @property mixed $inventory
16
- * @property bool $livemode
17
- * @property StripeObject $metadata
18
- * @property mixed $package_dimensions
19
- * @property int $price
20
- * @property string $product
21
- * @property int $updated
22
  *
23
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  */
25
  class SKU extends ApiResource
26
  {
27
- const OBJECT_NAME = "sku";
28
 
29
  use ApiOperations\All;
30
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Stores representations of <a
9
+ * href="http://en.wikipedia.org/wiki/Stock_keeping_unit">stock keeping units</a>.
10
+ * SKUs describe specific product variations, taking into account any combination
11
+ * of: attributes, currency, and cost. For example, a product may be a T-shirt,
12
+ * whereas a specific SKU represents the <code>size: large</code>, <code>color:
13
+ * red</code> version of that shirt.
14
+ *
15
+ * Can also be used to manage inventory.
16
  *
17
+ * Related guide: <a href="https://stripe.com/docs/orders">Tax, Shipping, and
18
+ * Inventory</a>.
 
 
 
 
 
 
 
 
 
 
 
 
19
  *
20
+ * @property string $id Unique identifier for the object.
21
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
22
+ * @property bool $active Whether the SKU is available for purchase.
23
+ * @property \Stripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are <code>[&quot;size&quot;, &quot;gender&quot;]</code>, a valid SKU has the following dictionary of attributes: <code>{&quot;size&quot;: &quot;Medium&quot;, &quot;gender&quot;: &quot;Unisex&quot;}</code>.
24
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
25
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
26
+ * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer.
27
+ * @property \Stripe\StripeObject $inventory
28
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
29
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
30
+ * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes.
31
+ * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency).
32
+ * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active.
33
+ * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
34
  */
35
  class SKU extends ApiResource
36
  {
37
+ const OBJECT_NAME = 'sku';
38
 
39
  use ApiOperations\All;
40
  use ApiOperations\Create;
app/api/Stripe/Service/AbstractService.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Service;
4
+
5
+ /**
6
+ * Abstract base class for all services.
7
+ */
8
+ abstract class AbstractService
9
+ {
10
+ /**
11
+ * @var \Stripe\StripeClientInterface
12
+ */
13
+ protected $client;
14
+
15
+ /**
16
+ * Initializes a new instance of the {@link AbstractService} class.
17
+ *
18
+ * @param \Stripe\StripeClientInterface $client
19
+ */
20
+ public function __construct($client)
21
+ {
22
+ $this->client = $client;
23
+ }
24
+
25
+ /**
26
+ * Gets the client used by this service to send requests.
27
+ *
28
+ * @return \Stripe\StripeClientInterface
29
+ */
30
+ public function getClient()
31
+ {
32
+ return $this->client;
33
+ }
34
+
35
+ /**
36
+ * Translate null values to empty strings. For service methods,
37
+ * we interpret null as a request to unset the field, which
38
+ * corresponds to sending an empty string for the field to the
39
+ * API.
40
+ *
41
+ * @param null|array $params
42
+ */
43
+ private static function formatParams($params)
44
+ {
45
+ if (null === $params) {
46
+ return null;
47
+ }
48
+ \array_walk_recursive($params, function (&$value, $key) {
49
+ if (null === $value) {
50
+ $value = '';
51
+ }
52
+ });
53
+
54
+ return $params;
55
+ }
56
+
57
+ protected function request($method, $path, $params, $opts)
58
+ {
59
+ return $this->getClient()->request($method, $path, static::formatParams($params), $opts);
60
+ }
61
+
62
+ protected function requestCollection($method, $path, $params, $opts)
63
+ {
64
+ return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts);
65
+ }
66
+
67
+ protected function buildPath($basePath, ...$ids)
68
+ {
69
+ foreach ($ids as $id) {
70
+ if (null === $id || '' === \trim($id)) {
71
+ $msg = 'The resource ID cannot be null or whitespace.';
72
+
73
+ throw new \Stripe\Exception\InvalidArgumentException($msg);
74
+ }
75
+ }
76
+
77
+ return \sprintf($basePath, ...\array_map('\urlencode', $ids));
78
+ }
79
+ }
app/api/Stripe/Service/AbstractServiceFactory.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Service;
4
+
5
+ /**
6
+ * Abstract base class for all service factories used to expose service
7
+ * instances through {@link \Stripe\StripeClient}.
8
+ *
9
+ * Service factories serve two purposes:
10
+ *
11
+ * 1. Expose properties for all services through the `__get()` magic method.
12
+ * 2. Lazily initialize each service instance the first time the property for
13
+ * a given service is used.
14
+ */
15
+ abstract class AbstractServiceFactory
16
+ {
17
+ /** @var \Stripe\StripeClientInterface */
18
+ private $client;
19
+
20
+ /** @var array<string, AbstractService|AbstractServiceFactory> */
21
+ private $services;
22
+
23
+ /**
24
+ * @param \Stripe\StripeClientInterface $client
25
+ */
26
+ public function __construct($client)
27
+ {
28
+ $this->client = $client;
29
+ $this->services = [];
30
+ }
31
+
32
+ /**
33
+ * @param string $name
34
+ *
35
+ * @return null|string
36
+ */
37
+ abstract protected function getServiceClass($name);
38
+
39
+ /**
40
+ * @param string $name
41
+ *
42
+ * @return null|AbstractService|AbstractServiceFactory
43
+ */
44
+ public function __get($name)
45
+ {
46
+ $serviceClass = $this->getServiceClass($name);
47
+ if (null !== $serviceClass) {
48
+ if (!\array_key_exists($name, $this->services)) {
49
+ $this->services[$name] = new $serviceClass($this->client);
50
+ }
51
+
52
+ return $this->services[$name];
53
+ }
54
+
55
+ \trigger_error('Undefined property: ' . static::class . '::$' . $name);
56
+
57
+ return null;
58
+ }
59
+ }
app/api/Stripe/Service/AccountLinkService.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class AccountLinkService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Creates an AccountLink object that includes a single-use Stripe URL that the
11
+ * platform can redirect their user to in order to take them through the Connect
12
+ * Onboarding flow.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\AccountLink
20
+ */
21
+ public function create($params = null, $opts = null)
22
+ {
23
+ return $this->request('post', '/v1/account_links', $params, $opts);
24
+ }
25
+ }
app/api/Stripe/Service/AccountService.php ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class AccountService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of accounts connected to your platform via <a
11
+ * href="/docs/connect">Connect</a>. If you’re not a platform, the list is empty.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/accounts', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Returns a list of capabilities associated with the account. The capabilities are
27
+ * returned sorted by creation date, with the most recent capability appearing
28
+ * first.
29
+ *
30
+ * @param string $parentId
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\Collection
37
+ */
38
+ public function allCapabilities($parentId, $params = null, $opts = null)
39
+ {
40
+ return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts);
41
+ }
42
+
43
+ /**
44
+ * List external accounts for an account.
45
+ *
46
+ * @param string $parentId
47
+ * @param null|array $params
48
+ * @param null|array|\Stripe\Util\RequestOptions $opts
49
+ *
50
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
51
+ *
52
+ * @return \Stripe\Collection
53
+ */
54
+ public function allExternalAccounts($parentId, $params = null, $opts = null)
55
+ {
56
+ return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts);
57
+ }
58
+
59
+ /**
60
+ * Returns a list of people associated with the account’s legal entity. The people
61
+ * are returned sorted by creation date, with the most recent people appearing
62
+ * first.
63
+ *
64
+ * @param string $parentId
65
+ * @param null|array $params
66
+ * @param null|array|\Stripe\Util\RequestOptions $opts
67
+ *
68
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
69
+ *
70
+ * @return \Stripe\Collection
71
+ */
72
+ public function allPersons($parentId, $params = null, $opts = null)
73
+ {
74
+ return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts);
75
+ }
76
+
77
+ /**
78
+ * With <a href="/docs/connect">Connect</a>, you can create Stripe accounts for
79
+ * your users. To do this, you’ll first need to <a
80
+ * href="https://dashboard.stripe.com/account/applications/settings">register your
81
+ * platform</a>.
82
+ *
83
+ * @param null|array $params
84
+ * @param null|array|\Stripe\Util\RequestOptions $opts
85
+ *
86
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
87
+ *
88
+ * @return \Stripe\Account
89
+ */
90
+ public function create($params = null, $opts = null)
91
+ {
92
+ return $this->request('post', '/v1/accounts', $params, $opts);
93
+ }
94
+
95
+ /**
96
+ * Create an external account for a given account.
97
+ *
98
+ * @param string $parentId
99
+ * @param null|array $params
100
+ * @param null|array|\Stripe\Util\RequestOptions $opts
101
+ *
102
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
103
+ *
104
+ * @return \Stripe\BankAccount|\Stripe\Card
105
+ */
106
+ public function createExternalAccount($parentId, $params = null, $opts = null)
107
+ {
108
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts);
109
+ }
110
+
111
+ /**
112
+ * Creates a single-use login link for an Express account to access their Stripe
113
+ * dashboard.
114
+ *
115
+ * <strong>You may only create login links for <a
116
+ * href="/docs/connect/express-accounts">Express accounts</a> connected to your
117
+ * platform</strong>.
118
+ *
119
+ * @param string $parentId
120
+ * @param null|array $params
121
+ * @param null|array|\Stripe\Util\RequestOptions $opts
122
+ *
123
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
124
+ *
125
+ * @return \Stripe\LoginLink
126
+ */
127
+ public function createLoginLink($parentId, $params = null, $opts = null)
128
+ {
129
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/login_links', $parentId), $params, $opts);
130
+ }
131
+
132
+ /**
133
+ * Creates a new person.
134
+ *
135
+ * @param string $parentId
136
+ * @param null|array $params
137
+ * @param null|array|\Stripe\Util\RequestOptions $opts
138
+ *
139
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
140
+ *
141
+ * @return \Stripe\Person
142
+ */
143
+ public function createPerson($parentId, $params = null, $opts = null)
144
+ {
145
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts);
146
+ }
147
+
148
+ /**
149
+ * With <a href="/docs/connect">Connect</a>, you can delete Custom or Express
150
+ * accounts you manage.
151
+ *
152
+ * Accounts created using test-mode keys can be deleted at any time. Accounts
153
+ * created using live-mode keys can only be deleted once all balances are zero.
154
+ *
155
+ * If you want to delete your own account, use the <a
156
+ * href="https://dashboard.stripe.com/account">account information tab in your
157
+ * account settings</a> instead.
158
+ *
159
+ * @param string $id
160
+ * @param null|array $params
161
+ * @param null|array|\Stripe\Util\RequestOptions $opts
162
+ *
163
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
164
+ *
165
+ * @return \Stripe\Account
166
+ */
167
+ public function delete($id, $params = null, $opts = null)
168
+ {
169
+ return $this->request('delete', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
170
+ }
171
+
172
+ /**
173
+ * Delete a specified external account for a given account.
174
+ *
175
+ * @param string $parentId
176
+ * @param string $id
177
+ * @param null|array $params
178
+ * @param null|array|\Stripe\Util\RequestOptions $opts
179
+ *
180
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
181
+ *
182
+ * @return \Stripe\BankAccount|\Stripe\Card
183
+ */
184
+ public function deleteExternalAccount($parentId, $id, $params = null, $opts = null)
185
+ {
186
+ return $this->request('delete', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
187
+ }
188
+
189
+ /**
190
+ * Deletes an existing person’s relationship to the account’s legal entity. Any
191
+ * person with a relationship for an account can be deleted through the API, except
192
+ * if the person is the <code>account_opener</code>. If your integration is using
193
+ * the <code>executive</code> parameter, you cannot delete the only verified
194
+ * <code>executive</code> on file.
195
+ *
196
+ * @param string $parentId
197
+ * @param string $id
198
+ * @param null|array $params
199
+ * @param null|array|\Stripe\Util\RequestOptions $opts
200
+ *
201
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
202
+ *
203
+ * @return \Stripe\Person
204
+ */
205
+ public function deletePerson($parentId, $id, $params = null, $opts = null)
206
+ {
207
+ return $this->request('delete', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
208
+ }
209
+
210
+ /**
211
+ * With <a href="/docs/connect">Connect</a>, you may flag accounts as suspicious.
212
+ *
213
+ * Test-mode Custom and Express accounts can be rejected at any time. Accounts
214
+ * created using live-mode keys may only be rejected once all balances are zero.
215
+ *
216
+ * @param string $id
217
+ * @param null|array $params
218
+ * @param null|array|\Stripe\Util\RequestOptions $opts
219
+ *
220
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
221
+ *
222
+ * @return \Stripe\Account
223
+ */
224
+ public function reject($id, $params = null, $opts = null)
225
+ {
226
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/reject', $id), $params, $opts);
227
+ }
228
+
229
+ /**
230
+ * Retrieves information about the specified Account Capability.
231
+ *
232
+ * @param string $parentId
233
+ * @param string $id
234
+ * @param null|array $params
235
+ * @param null|array|\Stripe\Util\RequestOptions $opts
236
+ *
237
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
238
+ *
239
+ * @return \Stripe\Capability
240
+ */
241
+ public function retrieveCapability($parentId, $id, $params = null, $opts = null)
242
+ {
243
+ return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
244
+ }
245
+
246
+ /**
247
+ * Retrieve a specified external account for a given account.
248
+ *
249
+ * @param string $parentId
250
+ * @param string $id
251
+ * @param null|array $params
252
+ * @param null|array|\Stripe\Util\RequestOptions $opts
253
+ *
254
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
255
+ *
256
+ * @return \Stripe\BankAccount|\Stripe\Card
257
+ */
258
+ public function retrieveExternalAccount($parentId, $id, $params = null, $opts = null)
259
+ {
260
+ return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
261
+ }
262
+
263
+ /**
264
+ * Retrieves an existing person.
265
+ *
266
+ * @param string $parentId
267
+ * @param string $id
268
+ * @param null|array $params
269
+ * @param null|array|\Stripe\Util\RequestOptions $opts
270
+ *
271
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
272
+ *
273
+ * @return \Stripe\Person
274
+ */
275
+ public function retrievePerson($parentId, $id, $params = null, $opts = null)
276
+ {
277
+ return $this->request('get', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
278
+ }
279
+
280
+ /**
281
+ * Updates a connected <a href="/docs/connect/accounts">Express or Custom
282
+ * account</a> by setting the values of the parameters passed. Any parameters not
283
+ * provided are left unchanged. Most parameters can be changed only for Custom
284
+ * accounts. (These are marked <strong>Custom Only</strong> below.) Parameters
285
+ * marked <strong>Custom and Express</strong> are supported by both account types.
286
+ *
287
+ * To update your own account, use the <a
288
+ * href="https://dashboard.stripe.com/account">Dashboard</a>. Refer to our <a
289
+ * href="/docs/connect/updating-accounts">Connect</a> documentation to learn more
290
+ * about updating accounts.
291
+ *
292
+ * @param string $id
293
+ * @param null|array $params
294
+ * @param null|array|\Stripe\Util\RequestOptions $opts
295
+ *
296
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
297
+ *
298
+ * @return \Stripe\Account
299
+ */
300
+ public function update($id, $params = null, $opts = null)
301
+ {
302
+ return $this->request('post', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
303
+ }
304
+
305
+ /**
306
+ * Updates an existing Account Capability.
307
+ *
308
+ * @param string $parentId
309
+ * @param string $id
310
+ * @param null|array $params
311
+ * @param null|array|\Stripe\Util\RequestOptions $opts
312
+ *
313
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
314
+ *
315
+ * @return \Stripe\Capability
316
+ */
317
+ public function updateCapability($parentId, $id, $params = null, $opts = null)
318
+ {
319
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
320
+ }
321
+
322
+ /**
323
+ * Updates the metadata, account holder name, and account holder type of a bank
324
+ * account belonging to a <a href="/docs/connect/custom-accounts">Custom
325
+ * account</a>, and optionally sets it as the default for its currency. Other bank
326
+ * account details are not editable by design.
327
+ *
328
+ * You can re-enable a disabled bank account by performing an update call without
329
+ * providing any arguments or changes.
330
+ *
331
+ * @param string $parentId
332
+ * @param string $id
333
+ * @param null|array $params
334
+ * @param null|array|\Stripe\Util\RequestOptions $opts
335
+ *
336
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
337
+ *
338
+ * @return \Stripe\BankAccount|\Stripe\Card
339
+ */
340
+ public function updateExternalAccount($parentId, $id, $params = null, $opts = null)
341
+ {
342
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
343
+ }
344
+
345
+ /**
346
+ * Updates an existing person.
347
+ *
348
+ * @param string $parentId
349
+ * @param string $id
350
+ * @param null|array $params
351
+ * @param null|array|\Stripe\Util\RequestOptions $opts
352
+ *
353
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
354
+ *
355
+ * @return \Stripe\Person
356
+ */
357
+ public function updatePerson($parentId, $id, $params = null, $opts = null)
358
+ {
359
+ return $this->request('post', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
360
+ }
361
+
362
+ /**
363
+ * Retrieves the details of an account.
364
+ *
365
+ * @param null|string $id
366
+ * @param null|array $params
367
+ * @param null|array|StripeUtilRequestOptions $opts
368
+ *
369
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
370
+ *
371
+ * @return \Stripe\Account
372
+ */
373
+ public function retrieve($id = null, $params = null, $opts = null)
374
+ {
375
+ if (null === $id) {
376
+ return $this->request('get', '/v1/account', $params, $opts);
377
+ }
378
+
379
+ return $this->request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
380
+ }
381
+ }
app/api/Stripe/Service/ApplePayDomainService.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ApplePayDomainService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * List apple pay domains.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/apple_pay/domains', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Create an apple pay domain.
26
+ *
27
+ * @param null|array $params
28
+ * @param null|array|\Stripe\Util\RequestOptions $opts
29
+ *
30
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
31
+ *
32
+ * @return \Stripe\ApplePayDomain
33
+ */
34
+ public function create($params = null, $opts = null)
35
+ {
36
+ return $this->request('post', '/v1/apple_pay/domains', $params, $opts);
37
+ }
38
+
39
+ /**
40
+ * Delete an apple pay domain.
41
+ *
42
+ * @param string $id
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\ApplePayDomain
49
+ */
50
+ public function delete($id, $params = null, $opts = null)
51
+ {
52
+ return $this->request('delete', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Retrieve an apple pay domain.
57
+ *
58
+ * @param string $id
59
+ * @param null|array $params
60
+ * @param null|array|\Stripe\Util\RequestOptions $opts
61
+ *
62
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
63
+ *
64
+ * @return \Stripe\ApplePayDomain
65
+ */
66
+ public function retrieve($id, $params = null, $opts = null)
67
+ {
68
+ return $this->request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts);
69
+ }
70
+ }
app/api/Stripe/Service/ApplicationFeeService.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ApplicationFeeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of application fees you’ve previously collected. The application
11
+ * fees are returned in sorted order, with the most recent fees appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/application_fees', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * You can see a list of the refunds belonging to a specific application fee. Note
27
+ * that the 10 most recent refunds are always available by default on the
28
+ * application fee object. If you need more than those 10, you can use this API
29
+ * method and the <code>limit</code> and <code>starting_after</code> parameters to
30
+ * page through additional refunds.
31
+ *
32
+ * @param string $parentId
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\Collection
39
+ */
40
+ public function allRefunds($parentId, $params = null, $opts = null)
41
+ {
42
+ return $this->requestCollection('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * Refunds an application fee that has previously been collected but not yet
47
+ * refunded. Funds will be refunded to the Stripe account from which the fee was
48
+ * originally collected.
49
+ *
50
+ * You can optionally refund only part of an application fee. You can do so
51
+ * multiple times, until the entire fee has been refunded.
52
+ *
53
+ * Once entirely refunded, an application fee can’t be refunded again. This method
54
+ * will raise an error when called on an already-refunded application fee, or when
55
+ * trying to refund more money than is left on an application fee.
56
+ *
57
+ * @param string $parentId
58
+ * @param null|array $params
59
+ * @param null|array|\Stripe\Util\RequestOptions $opts
60
+ *
61
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
62
+ *
63
+ * @return \Stripe\ApplicationFeeRefund
64
+ */
65
+ public function createRefund($parentId, $params = null, $opts = null)
66
+ {
67
+ return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts);
68
+ }
69
+
70
+ /**
71
+ * Retrieves the details of an application fee that your account has collected. The
72
+ * same information is returned when refunding the application fee.
73
+ *
74
+ * @param string $id
75
+ * @param null|array $params
76
+ * @param null|array|\Stripe\Util\RequestOptions $opts
77
+ *
78
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
79
+ *
80
+ * @return \Stripe\ApplicationFee
81
+ */
82
+ public function retrieve($id, $params = null, $opts = null)
83
+ {
84
+ return $this->request('get', $this->buildPath('/v1/application_fees/%s', $id), $params, $opts);
85
+ }
86
+
87
+ /**
88
+ * By default, you can see the 10 most recent refunds stored directly on the
89
+ * application fee object, but you can also retrieve details about a specific
90
+ * refund stored on the application fee.
91
+ *
92
+ * @param string $parentId
93
+ * @param string $id
94
+ * @param null|array $params
95
+ * @param null|array|\Stripe\Util\RequestOptions $opts
96
+ *
97
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
98
+ *
99
+ * @return \Stripe\ApplicationFeeRefund
100
+ */
101
+ public function retrieveRefund($parentId, $id, $params = null, $opts = null)
102
+ {
103
+ return $this->request('get', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts);
104
+ }
105
+
106
+ /**
107
+ * Updates the specified application fee refund by setting the values of the
108
+ * parameters passed. Any parameters not provided will be left unchanged.
109
+ *
110
+ * This request only accepts metadata as an argument.
111
+ *
112
+ * @param string $parentId
113
+ * @param string $id
114
+ * @param null|array $params
115
+ * @param null|array|\Stripe\Util\RequestOptions $opts
116
+ *
117
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
118
+ *
119
+ * @return \Stripe\ApplicationFeeRefund
120
+ */
121
+ public function updateRefund($parentId, $id, $params = null, $opts = null)
122
+ {
123
+ return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts);
124
+ }
125
+ }
app/api/Stripe/Service/BalanceService.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class BalanceService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Retrieves the current account balance, based on the authentication that was used
11
+ * to make the request. For a sample request, see <a
12
+ * href="/docs/connect/account-balances#accounting-for-negative-balances">Accounting
13
+ * for negative balances</a>.
14
+ *
15
+ * @param null|array $params
16
+ * @param null|array|\Stripe\Util\RequestOptions $opts
17
+ *
18
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
19
+ *
20
+ * @return \Stripe\Balance
21
+ */
22
+ public function retrieve($params = null, $opts = null)
23
+ {
24
+ return $this->request('get', '/v1/balance', $params, $opts);
25
+ }
26
+ }
app/api/Stripe/Service/BalanceTransactionService.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class BalanceTransactionService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of transactions that have contributed to the Stripe account
11
+ * balance (e.g., charges, transfers, and so forth). The transactions are returned
12
+ * in sorted order, with the most recent transactions appearing first.
13
+ *
14
+ * Note that this endpoint was previously called “Balance history” and used the
15
+ * path <code>/v1/balance/history</code>.
16
+ *
17
+ * @param null|array $params
18
+ * @param null|array|\Stripe\Util\RequestOptions $opts
19
+ *
20
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
21
+ *
22
+ * @return \Stripe\Collection
23
+ */
24
+ public function all($params = null, $opts = null)
25
+ {
26
+ return $this->requestCollection('get', '/v1/balance_transactions', $params, $opts);
27
+ }
28
+
29
+ /**
30
+ * Retrieves the balance transaction with the given ID.
31
+ *
32
+ * Note that this endpoint previously used the path
33
+ * <code>/v1/balance/history/:id</code>.
34
+ *
35
+ * @param string $id
36
+ * @param null|array $params
37
+ * @param null|array|\Stripe\Util\RequestOptions $opts
38
+ *
39
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
40
+ *
41
+ * @return \Stripe\BalanceTransaction
42
+ */
43
+ public function retrieve($id, $params = null, $opts = null)
44
+ {
45
+ return $this->request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts);
46
+ }
47
+ }
app/api/Stripe/Service/BillingPortal/BillingPortalServiceFactory.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\BillingPortal;
6
+
7
+ /**
8
+ * Service factory class for API resources in the BillingPortal namespace.
9
+ *
10
+ * @property ConfigurationService $configurations
11
+ * @property SessionService $sessions
12
+ */
13
+ class BillingPortalServiceFactory extends \Stripe\Service\AbstractServiceFactory
14
+ {
15
+ /**
16
+ * @var array<string, string>
17
+ */
18
+ private static $classMap = [
19
+ 'configurations' => ConfigurationService::class,
20
+ 'sessions' => SessionService::class,
21
+ ];
22
+
23
+ protected function getServiceClass($name)
24
+ {
25
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
26
+ }
27
+ }
app/api/Stripe/Service/BillingPortal/ConfigurationService.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\BillingPortal;
6
+
7
+ class ConfigurationService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of configurations that describe the functionality of the customer
11
+ * portal.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/billing_portal/configurations', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a configuration that describes the functionality and behavior of a
27
+ * PortalSession.
28
+ *
29
+ * @param null|array $params
30
+ * @param null|array|\Stripe\Util\RequestOptions $opts
31
+ *
32
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
33
+ *
34
+ * @return \Stripe\BillingPortal\Configuration
35
+ */
36
+ public function create($params = null, $opts = null)
37
+ {
38
+ return $this->request('post', '/v1/billing_portal/configurations', $params, $opts);
39
+ }
40
+
41
+ /**
42
+ * Retrieves a configuration that describes the functionality of the customer
43
+ * portal.
44
+ *
45
+ * @param string $id
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\BillingPortal\Configuration
52
+ */
53
+ public function retrieve($id, $params = null, $opts = null)
54
+ {
55
+ return $this->request('get', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Updates a configuration that describes the functionality of the customer portal.
60
+ *
61
+ * @param string $id
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\BillingPortal\Configuration
68
+ */
69
+ public function update($id, $params = null, $opts = null)
70
+ {
71
+ return $this->request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts);
72
+ }
73
+ }
app/api/Stripe/Service/BillingPortal/SessionService.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\BillingPortal;
6
+
7
+ class SessionService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Creates a session of the customer portal.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\BillingPortal\Session
18
+ */
19
+ public function create($params = null, $opts = null)
20
+ {
21
+ return $this->request('post', '/v1/billing_portal/sessions', $params, $opts);
22
+ }
23
+ }
app/api/Stripe/Service/ChargeService.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ChargeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of charges you’ve previously created. The charges are returned in
11
+ * sorted order, with the most recent charges appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/charges', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Capture the payment of an existing, uncaptured, charge. This is the second half
27
+ * of the two-step payment flow, where first you <a href="#create_charge">created a
28
+ * charge</a> with the capture option set to false.
29
+ *
30
+ * Uncaptured payments expire exactly seven days after they are created. If they
31
+ * are not captured by that point in time, they will be marked as refunded and will
32
+ * no longer be capturable.
33
+ *
34
+ * @param string $id
35
+ * @param null|array $params
36
+ * @param null|array|\Stripe\Util\RequestOptions $opts
37
+ *
38
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
39
+ *
40
+ * @return \Stripe\Charge
41
+ */
42
+ public function capture($id, $params = null, $opts = null)
43
+ {
44
+ return $this->request('post', $this->buildPath('/v1/charges/%s/capture', $id), $params, $opts);
45
+ }
46
+
47
+ /**
48
+ * To charge a credit card or other payment source, you create a
49
+ * <code>Charge</code> object. If your API key is in test mode, the supplied
50
+ * payment source (e.g., card) won’t actually be charged, although everything else
51
+ * will occur as if in live mode. (Stripe assumes that the charge would have
52
+ * completed successfully).
53
+ *
54
+ * @param null|array $params
55
+ * @param null|array|\Stripe\Util\RequestOptions $opts
56
+ *
57
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
58
+ *
59
+ * @return \Stripe\Charge
60
+ */
61
+ public function create($params = null, $opts = null)
62
+ {
63
+ return $this->request('post', '/v1/charges', $params, $opts);
64
+ }
65
+
66
+ /**
67
+ * Retrieves the details of a charge that has previously been created. Supply the
68
+ * unique charge ID that was returned from your previous request, and Stripe will
69
+ * return the corresponding charge information. The same information is returned
70
+ * when creating or refunding the charge.
71
+ *
72
+ * @param string $id
73
+ * @param null|array $params
74
+ * @param null|array|\Stripe\Util\RequestOptions $opts
75
+ *
76
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
77
+ *
78
+ * @return \Stripe\Charge
79
+ */
80
+ public function retrieve($id, $params = null, $opts = null)
81
+ {
82
+ return $this->request('get', $this->buildPath('/v1/charges/%s', $id), $params, $opts);
83
+ }
84
+
85
+ /**
86
+ * Updates the specified charge by setting the values of the parameters passed. Any
87
+ * parameters not provided will be left unchanged.
88
+ *
89
+ * @param string $id
90
+ * @param null|array $params
91
+ * @param null|array|\Stripe\Util\RequestOptions $opts
92
+ *
93
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
94
+ *
95
+ * @return \Stripe\Charge
96
+ */
97
+ public function update($id, $params = null, $opts = null)
98
+ {
99
+ return $this->request('post', $this->buildPath('/v1/charges/%s', $id), $params, $opts);
100
+ }
101
+ }
app/api/Stripe/Service/Checkout/CheckoutServiceFactory.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Checkout;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Checkout namespace.
9
+ *
10
+ * @property SessionService $sessions
11
+ */
12
+ class CheckoutServiceFactory extends \Stripe\Service\AbstractServiceFactory
13
+ {
14
+ /**
15
+ * @var array<string, string>
16
+ */
17
+ private static $classMap = [
18
+ 'sessions' => SessionService::class,
19
+ ];
20
+
21
+ protected function getServiceClass($name)
22
+ {
23
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
24
+ }
25
+ }
app/api/Stripe/Service/Checkout/SessionService.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Checkout;
6
+
7
+ class SessionService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Checkout Sessions.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/checkout/sessions', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * When retrieving a Checkout Session, there is an includable
26
+ * <strong>line_items</strong> property containing the first handful of those
27
+ * items. There is also a URL where you can retrieve the full (paginated) list of
28
+ * line items.
29
+ *
30
+ * @param string $parentId
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\Collection
37
+ */
38
+ public function allLineItems($parentId, $params = null, $opts = null)
39
+ {
40
+ return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts);
41
+ }
42
+
43
+ /**
44
+ * Creates a Session object.
45
+ *
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Checkout\Session
52
+ */
53
+ public function create($params = null, $opts = null)
54
+ {
55
+ return $this->request('post', '/v1/checkout/sessions', $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Retrieves a Session object.
60
+ *
61
+ * @param string $id
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\Checkout\Session
68
+ */
69
+ public function retrieve($id, $params = null, $opts = null)
70
+ {
71
+ return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts);
72
+ }
73
+ }
app/api/Stripe/Service/CoreServiceFactory.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ /**
8
+ * Service factory class for API resources in the root namespace.
9
+ *
10
+ * @property AccountLinkService $accountLinks
11
+ * @property AccountService $accounts
12
+ * @property ApplePayDomainService $applePayDomains
13
+ * @property ApplicationFeeService $applicationFees
14
+ * @property BalanceService $balance
15
+ * @property BalanceTransactionService $balanceTransactions
16
+ * @property BillingPortal\BillingPortalServiceFactory $billingPortal
17
+ * @property ChargeService $charges
18
+ * @property Checkout\CheckoutServiceFactory $checkout
19
+ * @property CountrySpecService $countrySpecs
20
+ * @property CouponService $coupons
21
+ * @property CreditNoteService $creditNotes
22
+ * @property CustomerService $customers
23
+ * @property DisputeService $disputes
24
+ * @property EphemeralKeyService $ephemeralKeys
25
+ * @property EventService $events
26
+ * @property ExchangeRateService $exchangeRates
27
+ * @property FileLinkService $fileLinks
28
+ * @property FileService $files
29
+ * @property InvoiceItemService $invoiceItems
30
+ * @property InvoiceService $invoices
31
+ * @property Issuing\IssuingServiceFactory $issuing
32
+ * @property MandateService $mandates
33
+ * @property OAuthService $oauth
34
+ * @property OrderReturnService $orderReturns
35
+ * @property OrderService $orders
36
+ * @property PaymentIntentService $paymentIntents
37
+ * @property PaymentMethodService $paymentMethods
38
+ * @property PayoutService $payouts
39
+ * @property PlanService $plans
40
+ * @property PriceService $prices
41
+ * @property ProductService $products
42
+ * @property PromotionCodeService $promotionCodes
43
+ * @property Radar\RadarServiceFactory $radar
44
+ * @property RefundService $refunds
45
+ * @property Reporting\ReportingServiceFactory $reporting
46
+ * @property ReviewService $reviews
47
+ * @property SetupAttemptService $setupAttempts
48
+ * @property SetupIntentService $setupIntents
49
+ * @property Sigma\SigmaServiceFactory $sigma
50
+ * @property SkuService $skus
51
+ * @property SourceService $sources
52
+ * @property SubscriptionItemService $subscriptionItems
53
+ * @property SubscriptionService $subscriptions
54
+ * @property SubscriptionScheduleService $subscriptionSchedules
55
+ * @property TaxRateService $taxRates
56
+ * @property Terminal\TerminalServiceFactory $terminal
57
+ * @property TokenService $tokens
58
+ * @property TopupService $topups
59
+ * @property TransferService $transfers
60
+ * @property WebhookEndpointService $webhookEndpoints
61
+ */
62
+ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
63
+ {
64
+ /**
65
+ * @var array<string, string>
66
+ */
67
+ private static $classMap = [
68
+ 'accountLinks' => AccountLinkService::class,
69
+ 'accounts' => AccountService::class,
70
+ 'applePayDomains' => ApplePayDomainService::class,
71
+ 'applicationFees' => ApplicationFeeService::class,
72
+ 'balance' => BalanceService::class,
73
+ 'balanceTransactions' => BalanceTransactionService::class,
74
+ 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class,
75
+ 'charges' => ChargeService::class,
76
+ 'checkout' => Checkout\CheckoutServiceFactory::class,
77
+ 'countrySpecs' => CountrySpecService::class,
78
+ 'coupons' => CouponService::class,
79
+ 'creditNotes' => CreditNoteService::class,
80
+ 'customers' => CustomerService::class,
81
+ 'disputes' => DisputeService::class,
82
+ 'ephemeralKeys' => EphemeralKeyService::class,
83
+ 'events' => EventService::class,
84
+ 'exchangeRates' => ExchangeRateService::class,
85
+ 'fileLinks' => FileLinkService::class,
86
+ 'files' => FileService::class,
87
+ 'invoiceItems' => InvoiceItemService::class,
88
+ 'invoices' => InvoiceService::class,
89
+ 'issuing' => Issuing\IssuingServiceFactory::class,
90
+ 'mandates' => MandateService::class,
91
+ 'oauth' => OAuthService::class,
92
+ 'orderReturns' => OrderReturnService::class,
93
+ 'orders' => OrderService::class,
94
+ 'paymentIntents' => PaymentIntentService::class,
95
+ 'paymentMethods' => PaymentMethodService::class,
96
+ 'payouts' => PayoutService::class,
97
+ 'plans' => PlanService::class,
98
+ 'prices' => PriceService::class,
99
+ 'products' => ProductService::class,
100
+ 'promotionCodes' => PromotionCodeService::class,
101
+ 'radar' => Radar\RadarServiceFactory::class,
102
+ 'refunds' => RefundService::class,
103
+ 'reporting' => Reporting\ReportingServiceFactory::class,
104
+ 'reviews' => ReviewService::class,
105
+ 'setupAttempts' => SetupAttemptService::class,
106
+ 'setupIntents' => SetupIntentService::class,
107
+ 'sigma' => Sigma\SigmaServiceFactory::class,
108
+ 'skus' => SkuService::class,
109
+ 'sources' => SourceService::class,
110
+ 'subscriptionItems' => SubscriptionItemService::class,
111
+ 'subscriptions' => SubscriptionService::class,
112
+ 'subscriptionSchedules' => SubscriptionScheduleService::class,
113
+ 'taxRates' => TaxRateService::class,
114
+ 'terminal' => Terminal\TerminalServiceFactory::class,
115
+ 'tokens' => TokenService::class,
116
+ 'topups' => TopupService::class,
117
+ 'transfers' => TransferService::class,
118
+ 'webhookEndpoints' => WebhookEndpointService::class,
119
+ ];
120
+
121
+ protected function getServiceClass($name)
122
+ {
123
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
124
+ }
125
+ }
app/api/Stripe/Service/CountrySpecService.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class CountrySpecService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Lists all Country Spec objects available in the API.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/country_specs', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Returns a Country Spec for a given Country code.
26
+ *
27
+ * @param string $id
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\CountrySpec
34
+ */
35
+ public function retrieve($id, $params = null, $opts = null)
36
+ {
37
+ return $this->request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts);
38
+ }
39
+ }
app/api/Stripe/Service/CouponService.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class CouponService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your coupons.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/coupons', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * You can create coupons easily via the <a
26
+ * href="https://dashboard.stripe.com/coupons">coupon management</a> page of the
27
+ * Stripe dashboard. Coupon creation is also accessible via the API if you need to
28
+ * create coupons on the fly.
29
+ *
30
+ * A coupon has either a <code>percent_off</code> or an <code>amount_off</code> and
31
+ * <code>currency</code>. If you set an <code>amount_off</code>, that amount will
32
+ * be subtracted from any invoice’s subtotal. For example, an invoice with a
33
+ * subtotal of <currency>100</currency> will have a final total of
34
+ * <currency>0</currency> if a coupon with an <code>amount_off</code> of
35
+ * <amount>200</amount> is applied to it and an invoice with a subtotal of
36
+ * <currency>300</currency> will have a final total of <currency>100</currency> if
37
+ * a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to
38
+ * it.
39
+ *
40
+ * @param null|array $params
41
+ * @param null|array|\Stripe\Util\RequestOptions $opts
42
+ *
43
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
44
+ *
45
+ * @return \Stripe\Coupon
46
+ */
47
+ public function create($params = null, $opts = null)
48
+ {
49
+ return $this->request('post', '/v1/coupons', $params, $opts);
50
+ }
51
+
52
+ /**
53
+ * You can delete coupons via the <a
54
+ * href="https://dashboard.stripe.com/coupons">coupon management</a> page of the
55
+ * Stripe dashboard. However, deleting a coupon does not affect any customers who
56
+ * have already applied the coupon; it means that new customers can’t redeem the
57
+ * coupon. You can also delete coupons via the API.
58
+ *
59
+ * @param string $id
60
+ * @param null|array $params
61
+ * @param null|array|\Stripe\Util\RequestOptions $opts
62
+ *
63
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
64
+ *
65
+ * @return \Stripe\Coupon
66
+ */
67
+ public function delete($id, $params = null, $opts = null)
68
+ {
69
+ return $this->request('delete', $this->buildPath('/v1/coupons/%s', $id), $params, $opts);
70
+ }
71
+
72
+ /**
73
+ * Retrieves the coupon with the given ID.
74
+ *
75
+ * @param string $id
76
+ * @param null|array $params
77
+ * @param null|array|\Stripe\Util\RequestOptions $opts
78
+ *
79
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
80
+ *
81
+ * @return \Stripe\Coupon
82
+ */
83
+ public function retrieve($id, $params = null, $opts = null)
84
+ {
85
+ return $this->request('get', $this->buildPath('/v1/coupons/%s', $id), $params, $opts);
86
+ }
87
+
88
+ /**
89
+ * Updates the metadata of a coupon. Other coupon details (currency, duration,
90
+ * amount_off) are, by design, not editable.
91
+ *
92
+ * @param string $id
93
+ * @param null|array $params
94
+ * @param null|array|\Stripe\Util\RequestOptions $opts
95
+ *
96
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
97
+ *
98
+ * @return \Stripe\Coupon
99
+ */
100
+ public function update($id, $params = null, $opts = null)
101
+ {
102
+ return $this->request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts);
103
+ }
104
+ }
app/api/Stripe/Service/CreditNoteService.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class CreditNoteService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of credit notes.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/credit_notes', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * When retrieving a credit note, you’ll get a <strong>lines</strong> property
26
+ * containing the the first handful of those items. There is also a URL where you
27
+ * can retrieve the full (paginated) list of line items.
28
+ *
29
+ * @param string $parentId
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Collection
36
+ */
37
+ public function allLines($parentId, $params = null, $opts = null)
38
+ {
39
+ return $this->requestCollection('get', $this->buildPath('/v1/credit_notes/%s/lines', $parentId), $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Issue a credit note to adjust the amount of a finalized invoice. For a
44
+ * <code>status=open</code> invoice, a credit note reduces its
45
+ * <code>amount_due</code>. For a <code>status=paid</code> invoice, a credit note
46
+ * does not affect its <code>amount_due</code>. Instead, it can result in any
47
+ * combination of the following:.
48
+ *
49
+ * <ul> <li>Refund: create a new refund (using <code>refund_amount</code>) or link
50
+ * an existing refund (using <code>refund</code>).</li> <li>Customer balance
51
+ * credit: credit the customer’s balance (using <code>credit_amount</code>) which
52
+ * will be automatically applied to their next invoice when it’s finalized.</li>
53
+ * <li>Outside of Stripe credit: record the amount that is or will be credited
54
+ * outside of Stripe (using <code>out_of_band_amount</code>).</li> </ul>
55
+ *
56
+ * For post-payment credit notes the sum of the refund, credit and outside of
57
+ * Stripe amounts must equal the credit note total.
58
+ *
59
+ * You may issue multiple credit notes for an invoice. Each credit note will
60
+ * increment the invoice’s <code>pre_payment_credit_notes_amount</code> or
61
+ * <code>post_payment_credit_notes_amount</code> depending on its
62
+ * <code>status</code> at the time of credit note creation.
63
+ *
64
+ * @param null|array $params
65
+ * @param null|array|\Stripe\Util\RequestOptions $opts
66
+ *
67
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
68
+ *
69
+ * @return \Stripe\CreditNote
70
+ */
71
+ public function create($params = null, $opts = null)
72
+ {
73
+ return $this->request('post', '/v1/credit_notes', $params, $opts);
74
+ }
75
+
76
+ /**
77
+ * Get a preview of a credit note without creating it.
78
+ *
79
+ * @param null|array $params
80
+ * @param null|array|\Stripe\Util\RequestOptions $opts
81
+ *
82
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
83
+ *
84
+ * @return \Stripe\CreditNote
85
+ */
86
+ public function preview($params = null, $opts = null)
87
+ {
88
+ return $this->request('get', '/v1/credit_notes/preview', $params, $opts);
89
+ }
90
+
91
+ /**
92
+ * When retrieving a credit note preview, you’ll get a <strong>lines</strong>
93
+ * property containing the first handful of those items. This URL you can retrieve
94
+ * the full (paginated) list of line items.
95
+ *
96
+ * @param null|array $params
97
+ * @param null|array|\Stripe\Util\RequestOptions $opts
98
+ *
99
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
100
+ *
101
+ * @return \Stripe\CreditNote
102
+ */
103
+ public function previewLines($params = null, $opts = null)
104
+ {
105
+ return $this->request('get', '/v1/credit_notes/preview/lines', $params, $opts);
106
+ }
107
+
108
+ /**
109
+ * Retrieves the credit note object with the given identifier.
110
+ *
111
+ * @param string $id
112
+ * @param null|array $params
113
+ * @param null|array|\Stripe\Util\RequestOptions $opts
114
+ *
115
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
116
+ *
117
+ * @return \Stripe\CreditNote
118
+ */
119
+ public function retrieve($id, $params = null, $opts = null)
120
+ {
121
+ return $this->request('get', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts);
122
+ }
123
+
124
+ /**
125
+ * Updates an existing credit note.
126
+ *
127
+ * @param string $id
128
+ * @param null|array $params
129
+ * @param null|array|\Stripe\Util\RequestOptions $opts
130
+ *
131
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
132
+ *
133
+ * @return \Stripe\CreditNote
134
+ */
135
+ public function update($id, $params = null, $opts = null)
136
+ {
137
+ return $this->request('post', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts);
138
+ }
139
+
140
+ /**
141
+ * Marks a credit note as void. Learn more about <a
142
+ * href="/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
143
+ *
144
+ * @param string $id
145
+ * @param null|array $params
146
+ * @param null|array|\Stripe\Util\RequestOptions $opts
147
+ *
148
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
149
+ *
150
+ * @return \Stripe\CreditNote
151
+ */
152
+ public function voidCreditNote($id, $params = null, $opts = null)
153
+ {
154
+ return $this->request('post', $this->buildPath('/v1/credit_notes/%s/void', $id), $params, $opts);
155
+ }
156
+ }
app/api/Stripe/Service/CustomerService.php ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class CustomerService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your customers. The customers are returned sorted by creation
11
+ * date, with the most recent customers appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/customers', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Returns a list of transactions that updated the customer’s <a
27
+ * href="/docs/billing/customer/balance">balances</a>.
28
+ *
29
+ * @param string $parentId
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Collection
36
+ */
37
+ public function allBalanceTransactions($parentId, $params = null, $opts = null)
38
+ {
39
+ return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * List sources for a specified customer.
44
+ *
45
+ * @param string $parentId
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Collection
52
+ */
53
+ public function allSources($parentId, $params = null, $opts = null)
54
+ {
55
+ return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Returns a list of tax IDs for a customer.
60
+ *
61
+ * @param string $parentId
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\Collection
68
+ */
69
+ public function allTaxIds($parentId, $params = null, $opts = null)
70
+ {
71
+ return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts);
72
+ }
73
+
74
+ /**
75
+ * Creates a new customer object.
76
+ *
77
+ * @param null|array $params
78
+ * @param null|array|\Stripe\Util\RequestOptions $opts
79
+ *
80
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
81
+ *
82
+ * @return \Stripe\Customer
83
+ */
84
+ public function create($params = null, $opts = null)
85
+ {
86
+ return $this->request('post', '/v1/customers', $params, $opts);
87
+ }
88
+
89
+ /**
90
+ * Creates an immutable transaction that updates the customer’s credit <a
91
+ * href="/docs/billing/customer/balance">balance</a>.
92
+ *
93
+ * @param string $parentId
94
+ * @param null|array $params
95
+ * @param null|array|\Stripe\Util\RequestOptions $opts
96
+ *
97
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
98
+ *
99
+ * @return \Stripe\CustomerBalanceTransaction
100
+ */
101
+ public function createBalanceTransaction($parentId, $params = null, $opts = null)
102
+ {
103
+ return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
104
+ }
105
+
106
+ /**
107
+ * When you create a new credit card, you must specify a customer or recipient on
108
+ * which to create it.
109
+ *
110
+ * If the card’s owner has no default card, then the new card will become the
111
+ * default. However, if the owner already has a default, then it will not change.
112
+ * To change the default, you should <a href="/docs/api#update_customer">update the
113
+ * customer</a> to have a new <code>default_source</code>.
114
+ *
115
+ * @param string $parentId
116
+ * @param null|array $params
117
+ * @param null|array|\Stripe\Util\RequestOptions $opts
118
+ *
119
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
120
+ *
121
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
122
+ */
123
+ public function createSource($parentId, $params = null, $opts = null)
124
+ {
125
+ return $this->request('post', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts);
126
+ }
127
+
128
+ /**
129
+ * Creates a new <code>TaxID</code> object for a customer.
130
+ *
131
+ * @param string $parentId
132
+ * @param null|array $params
133
+ * @param null|array|\Stripe\Util\RequestOptions $opts
134
+ *
135
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
136
+ *
137
+ * @return \Stripe\TaxId
138
+ */
139
+ public function createTaxId($parentId, $params = null, $opts = null)
140
+ {
141
+ return $this->request('post', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts);
142
+ }
143
+
144
+ /**
145
+ * Permanently deletes a customer. It cannot be undone. Also immediately cancels
146
+ * any active subscriptions on the customer.
147
+ *
148
+ * @param string $id
149
+ * @param null|array $params
150
+ * @param null|array|\Stripe\Util\RequestOptions $opts
151
+ *
152
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
153
+ *
154
+ * @return \Stripe\Customer
155
+ */
156
+ public function delete($id, $params = null, $opts = null)
157
+ {
158
+ return $this->request('delete', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
159
+ }
160
+
161
+ /**
162
+ * Removes the currently applied discount on a customer.
163
+ *
164
+ * @param string $id
165
+ * @param null|array $params
166
+ * @param null|array|\Stripe\Util\RequestOptions $opts
167
+ *
168
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
169
+ *
170
+ * @return \Stripe\Customer
171
+ */
172
+ public function deleteDiscount($id, $params = null, $opts = null)
173
+ {
174
+ return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts);
175
+ }
176
+
177
+ /**
178
+ * @param string $parentId
179
+ * @param string $id
180
+ * @param null|array $params
181
+ * @param null|array|\Stripe\Util\RequestOptions $opts
182
+ *
183
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
184
+ *
185
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
186
+ */
187
+ public function deleteSource($parentId, $id, $params = null, $opts = null)
188
+ {
189
+ return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
190
+ }
191
+
192
+ /**
193
+ * Deletes an existing <code>TaxID</code> object.
194
+ *
195
+ * @param string $parentId
196
+ * @param string $id
197
+ * @param null|array $params
198
+ * @param null|array|\Stripe\Util\RequestOptions $opts
199
+ *
200
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
201
+ *
202
+ * @return \Stripe\TaxId
203
+ */
204
+ public function deleteTaxId($parentId, $id, $params = null, $opts = null)
205
+ {
206
+ return $this->request('delete', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts);
207
+ }
208
+
209
+ /**
210
+ * Retrieves the details of an existing customer. You need only supply the unique
211
+ * customer identifier that was returned upon customer creation.
212
+ *
213
+ * @param string $id
214
+ * @param null|array $params
215
+ * @param null|array|\Stripe\Util\RequestOptions $opts
216
+ *
217
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
218
+ *
219
+ * @return \Stripe\Customer
220
+ */
221
+ public function retrieve($id, $params = null, $opts = null)
222
+ {
223
+ return $this->request('get', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
224
+ }
225
+
226
+ /**
227
+ * Retrieves a specific customer balance transaction that updated the customer’s <a
228
+ * href="/docs/billing/customer/balance">balances</a>.
229
+ *
230
+ * @param string $parentId
231
+ * @param string $id
232
+ * @param null|array $params
233
+ * @param null|array|\Stripe\Util\RequestOptions $opts
234
+ *
235
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
236
+ *
237
+ * @return \Stripe\CustomerBalanceTransaction
238
+ */
239
+ public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts = null)
240
+ {
241
+ return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
242
+ }
243
+
244
+ /**
245
+ * Retrieve a specified source for a given customer.
246
+ *
247
+ * @param string $parentId
248
+ * @param string $id
249
+ * @param null|array $params
250
+ * @param null|array|\Stripe\Util\RequestOptions $opts
251
+ *
252
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
253
+ *
254
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
255
+ */
256
+ public function retrieveSource($parentId, $id, $params = null, $opts = null)
257
+ {
258
+ return $this->request('get', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
259
+ }
260
+
261
+ /**
262
+ * Retrieves the <code>TaxID</code> object with the given identifier.
263
+ *
264
+ * @param string $parentId
265
+ * @param string $id
266
+ * @param null|array $params
267
+ * @param null|array|\Stripe\Util\RequestOptions $opts
268
+ *
269
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
270
+ *
271
+ * @return \Stripe\TaxId
272
+ */
273
+ public function retrieveTaxId($parentId, $id, $params = null, $opts = null)
274
+ {
275
+ return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts);
276
+ }
277
+
278
+ /**
279
+ * Updates the specified customer by setting the values of the parameters passed.
280
+ * Any parameters not provided will be left unchanged. For example, if you pass the
281
+ * <strong>source</strong> parameter, that becomes the customer’s active source
282
+ * (e.g., a card) to be used for all charges in the future. When you update a
283
+ * customer to a new valid card source by passing the <strong>source</strong>
284
+ * parameter: for each of the customer’s current subscriptions, if the subscription
285
+ * bills automatically and is in the <code>past_due</code> state, then the latest
286
+ * open invoice for the subscription with automatic collection enabled will be
287
+ * retried. This retry will not count as an automatic retry, and will not affect
288
+ * the next regularly scheduled payment for the invoice. Changing the
289
+ * <strong>default_source</strong> for a customer will not trigger this behavior.
290
+ *
291
+ * This request accepts mostly the same arguments as the customer creation call.
292
+ *
293
+ * @param string $id
294
+ * @param null|array $params
295
+ * @param null|array|\Stripe\Util\RequestOptions $opts
296
+ *
297
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
298
+ *
299
+ * @return \Stripe\Customer
300
+ */
301
+ public function update($id, $params = null, $opts = null)
302
+ {
303
+ return $this->request('post', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
304
+ }
305
+
306
+ /**
307
+ * Most credit balance transaction fields are immutable, but you may update its
308
+ * <code>description</code> and <code>metadata</code>.
309
+ *
310
+ * @param string $parentId
311
+ * @param string $id
312
+ * @param null|array $params
313
+ * @param null|array|\Stripe\Util\RequestOptions $opts
314
+ *
315
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
316
+ *
317
+ * @return \Stripe\CustomerBalanceTransaction
318
+ */
319
+ public function updateBalanceTransaction($parentId, $id, $params = null, $opts = null)
320
+ {
321
+ return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
322
+ }
323
+
324
+ /**
325
+ * @param string $parentId
326
+ * @param string $id
327
+ * @param null|array $params
328
+ * @param null|array|\Stripe\Util\RequestOptions $opts
329
+ *
330
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
331
+ *
332
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
333
+ */
334
+ public function updateSource($parentId, $id, $params = null, $opts = null)
335
+ {
336
+ return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
337
+ }
338
+
339
+ /**
340
+ * @param string $parentId
341
+ * @param string $id
342
+ * @param null|array $params
343
+ * @param null|array|\Stripe\Util\RequestOptions $opts
344
+ *
345
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
346
+ *
347
+ * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
348
+ */
349
+ public function verifySource($parentId, $id, $params = null, $opts = null)
350
+ {
351
+ return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s/verify', $parentId, $id), $params, $opts);
352
+ }
353
+ }
app/api/Stripe/Service/DisputeService.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class DisputeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your disputes.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/disputes', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Closing the dispute for a charge indicates that you do not have any evidence to
26
+ * submit and are essentially dismissing the dispute, acknowledging it as lost.
27
+ *
28
+ * The status of the dispute will change from <code>needs_response</code> to
29
+ * <code>lost</code>. <em>Closing a dispute is irreversible</em>.
30
+ *
31
+ * @param string $id
32
+ * @param null|array $params
33
+ * @param null|array|\Stripe\Util\RequestOptions $opts
34
+ *
35
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
36
+ *
37
+ * @return \Stripe\Dispute
38
+ */
39
+ public function close($id, $params = null, $opts = null)
40
+ {
41
+ return $this->request('post', $this->buildPath('/v1/disputes/%s/close', $id), $params, $opts);
42
+ }
43
+
44
+ /**
45
+ * Retrieves the dispute with the given ID.
46
+ *
47
+ * @param string $id
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return \Stripe\Dispute
54
+ */
55
+ public function retrieve($id, $params = null, $opts = null)
56
+ {
57
+ return $this->request('get', $this->buildPath('/v1/disputes/%s', $id), $params, $opts);
58
+ }
59
+
60
+ /**
61
+ * When you get a dispute, contacting your customer is always the best first step.
62
+ * If that doesn’t work, you can submit evidence to help us resolve the dispute in
63
+ * your favor. You can do this in your <a
64
+ * href="https://dashboard.stripe.com/disputes">dashboard</a>, but if you prefer,
65
+ * you can use the API to submit evidence programmatically.
66
+ *
67
+ * Depending on your dispute type, different evidence fields will give you a better
68
+ * chance of winning your dispute. To figure out which evidence fields to provide,
69
+ * see our <a href="/docs/disputes/categories">guide to dispute types</a>.
70
+ *
71
+ * @param string $id
72
+ * @param null|array $params
73
+ * @param null|array|\Stripe\Util\RequestOptions $opts
74
+ *
75
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
76
+ *
77
+ * @return \Stripe\Dispute
78
+ */
79
+ public function update($id, $params = null, $opts = null)
80
+ {
81
+ return $this->request('post', $this->buildPath('/v1/disputes/%s', $id), $params, $opts);
82
+ }
83
+ }
app/api/Stripe/Service/EphemeralKeyService.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class EphemeralKeyService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Invalidates a short-lived API key for a given resource.
11
+ *
12
+ * @param string $id
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\EphemeralKey
19
+ */
20
+ public function delete($id, $params = null, $opts = null)
21
+ {
22
+ return $this->request('delete', $this->buildPath('/v1/ephemeral_keys/%s', $id), $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a short-lived API key for a given resource.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\EphemeralKey
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ if (!$opts || !isset($opts['stripe_version'])) {
38
+ throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
39
+ }
40
+
41
+ return $this->request('post', '/v1/ephemeral_keys', $params, $opts);
42
+ }
43
+ }
app/api/Stripe/Service/EventService.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class EventService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * List events, going back up to 30 days. Each event data is rendered according to
11
+ * Stripe API version at its creation time, specified in <a
12
+ * href="/docs/api/events/object">event object</a> <code>api_version</code>
13
+ * attribute (not according to your current Stripe API version or
14
+ * <code>Stripe-Version</code> header).
15
+ *
16
+ * @param null|array $params
17
+ * @param null|array|\Stripe\Util\RequestOptions $opts
18
+ *
19
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
20
+ *
21
+ * @return \Stripe\Collection
22
+ */
23
+ public function all($params = null, $opts = null)
24
+ {
25
+ return $this->requestCollection('get', '/v1/events', $params, $opts);
26
+ }
27
+
28
+ /**
29
+ * Retrieves the details of an event. Supply the unique identifier of the event,
30
+ * which you might have received in a webhook.
31
+ *
32
+ * @param string $id
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\Event
39
+ */
40
+ public function retrieve($id, $params = null, $opts = null)
41
+ {
42
+ return $this->request('get', $this->buildPath('/v1/events/%s', $id), $params, $opts);
43
+ }
44
+ }
app/api/Stripe/Service/ExchangeRateService.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ExchangeRateService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of objects that contain the rates at which foreign currencies are
11
+ * converted to one another. Only shows the currencies for which Stripe supports.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/exchange_rates', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Retrieves the exchange rates from the given currency to every supported
27
+ * currency.
28
+ *
29
+ * @param string $id
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\ExchangeRate
36
+ */
37
+ public function retrieve($id, $params = null, $opts = null)
38
+ {
39
+ return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts);
40
+ }
41
+ }
app/api/Stripe/Service/FileLinkService.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class FileLinkService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of file links.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/file_links', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Creates a new file link object.
26
+ *
27
+ * @param null|array $params
28
+ * @param null|array|\Stripe\Util\RequestOptions $opts
29
+ *
30
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
31
+ *
32
+ * @return \Stripe\FileLink
33
+ */
34
+ public function create($params = null, $opts = null)
35
+ {
36
+ return $this->request('post', '/v1/file_links', $params, $opts);
37
+ }
38
+
39
+ /**
40
+ * Retrieves the file link with the given ID.
41
+ *
42
+ * @param string $id
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\FileLink
49
+ */
50
+ public function retrieve($id, $params = null, $opts = null)
51
+ {
52
+ return $this->request('get', $this->buildPath('/v1/file_links/%s', $id), $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Updates an existing file link object. Expired links can no longer be updated.
57
+ *
58
+ * @param string $id
59
+ * @param null|array $params
60
+ * @param null|array|\Stripe\Util\RequestOptions $opts
61
+ *
62
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
63
+ *
64
+ * @return \Stripe\FileLink
65
+ */
66
+ public function update($id, $params = null, $opts = null)
67
+ {
68
+ return $this->request('post', $this->buildPath('/v1/file_links/%s', $id), $params, $opts);
69
+ }
70
+ }
app/api/Stripe/Service/FileService.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class FileService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of the files that your account has access to. The files are
11
+ * returned sorted by creation date, with the most recently created files appearing
12
+ * first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/files', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Retrieves the details of an existing file object. Supply the unique file ID from
28
+ * a file, and Stripe will return the corresponding file object. To access file
29
+ * contents, see the <a href="/docs/file-upload#download-file-contents">File Upload
30
+ * Guide</a>.
31
+ *
32
+ * @param string $id
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\File
39
+ */
40
+ public function retrieve($id, $params = null, $opts = null)
41
+ {
42
+ return $this->request('get', $this->buildPath('/v1/files/%s', $id), $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * Create a file.
47
+ *
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @return \Stripe\File
52
+ */
53
+ public function create($params = null, $opts = null)
54
+ {
55
+ $opts = \Stripe\Util\RequestOptions::parse($opts);
56
+ if (!isset($opts->apiBase)) {
57
+ $opts->apiBase = $this->getClient()->getFilesBase();
58
+ }
59
+
60
+ // Manually flatten params, otherwise curl's multipart encoder will
61
+ // choke on nested null|arrays.
62
+ $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
63
+
64
+ return $this->request('post', '/v1/files', $flatParams, $opts);
65
+ }
66
+ }
app/api/Stripe/Service/InvoiceItemService.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class InvoiceItemService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your invoice items. Invoice items are returned sorted by
11
+ * creation date, with the most recently created invoice items appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/invoiceitems', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates an item to be added to a draft invoice (up to 250 items per invoice). If
27
+ * no invoice is specified, the item will be on the next invoice created for the
28
+ * customer specified.
29
+ *
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\InvoiceItem
36
+ */
37
+ public function create($params = null, $opts = null)
38
+ {
39
+ return $this->request('post', '/v1/invoiceitems', $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Deletes an invoice item, removing it from an invoice. Deleting invoice items is
44
+ * only possible when they’re not attached to invoices, or if it’s attached to a
45
+ * draft invoice.
46
+ *
47
+ * @param string $id
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return \Stripe\InvoiceItem
54
+ */
55
+ public function delete($id, $params = null, $opts = null)
56
+ {
57
+ return $this->request('delete', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
58
+ }
59
+
60
+ /**
61
+ * Retrieves the invoice item with the given ID.
62
+ *
63
+ * @param string $id
64
+ * @param null|array $params
65
+ * @param null|array|\Stripe\Util\RequestOptions $opts
66
+ *
67
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
68
+ *
69
+ * @return \Stripe\InvoiceItem
70
+ */
71
+ public function retrieve($id, $params = null, $opts = null)
72
+ {
73
+ return $this->request('get', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
74
+ }
75
+
76
+ /**
77
+ * Updates the amount or description of an invoice item on an upcoming invoice.
78
+ * Updating an invoice item is only possible before the invoice it’s attached to is
79
+ * closed.
80
+ *
81
+ * @param string $id
82
+ * @param null|array $params
83
+ * @param null|array|\Stripe\Util\RequestOptions $opts
84
+ *
85
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
86
+ *
87
+ * @return \Stripe\InvoiceItem
88
+ */
89
+ public function update($id, $params = null, $opts = null)
90
+ {
91
+ return $this->request('post', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
92
+ }
93
+ }
app/api/Stripe/Service/InvoiceService.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class InvoiceService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * You can list all invoices, or list the invoices for a specific customer. The
11
+ * invoices are returned sorted by creation date, with the most recently created
12
+ * invoices appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/invoices', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * When retrieving an invoice, you’ll get a <strong>lines</strong> property
28
+ * containing the total count of line items and the first handful of those items.
29
+ * There is also a URL where you can retrieve the full (paginated) list of line
30
+ * items.
31
+ *
32
+ * @param string $parentId
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\Collection
39
+ */
40
+ public function allLines($parentId, $params = null, $opts = null)
41
+ {
42
+ return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * This endpoint creates a draft invoice for a given customer. The draft invoice
47
+ * created pulls in all pending invoice items on that customer, including
48
+ * prorations. The invoice remains a draft until you <a
49
+ * href="#finalize_invoice">finalize</a> the invoice, which allows you to <a
50
+ * href="#pay_invoice">pay</a> or <a href="#send_invoice">send</a> the invoice to
51
+ * your customers.
52
+ *
53
+ * @param null|array $params
54
+ * @param null|array|\Stripe\Util\RequestOptions $opts
55
+ *
56
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
57
+ *
58
+ * @return \Stripe\Invoice
59
+ */
60
+ public function create($params = null, $opts = null)
61
+ {
62
+ return $this->request('post', '/v1/invoices', $params, $opts);
63
+ }
64
+
65
+ /**
66
+ * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to
67
+ * delete invoices that are no longer in a draft state will fail; once an invoice
68
+ * has been finalized or if an invoice is for a subscription, it must be <a
69
+ * href="#void_invoice">voided</a>.
70
+ *
71
+ * @param string $id
72
+ * @param null|array $params
73
+ * @param null|array|\Stripe\Util\RequestOptions $opts
74
+ *
75
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
76
+ *
77
+ * @return \Stripe\Invoice
78
+ */
79
+ public function delete($id, $params = null, $opts = null)
80
+ {
81
+ return $this->request('delete', $this->buildPath('/v1/invoices/%s', $id), $params, $opts);
82
+ }
83
+
84
+ /**
85
+ * Stripe automatically finalizes drafts before sending and attempting payment on
86
+ * invoices. However, if you’d like to finalize a draft invoice manually, you can
87
+ * do so using this method.
88
+ *
89
+ * @param string $id
90
+ * @param null|array $params
91
+ * @param null|array|\Stripe\Util\RequestOptions $opts
92
+ *
93
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
94
+ *
95
+ * @return \Stripe\Invoice
96
+ */
97
+ public function finalizeInvoice($id, $params = null, $opts = null)
98
+ {
99
+ return $this->request('post', $this->buildPath('/v1/invoices/%s/finalize', $id), $params, $opts);
100
+ }
101
+
102
+ /**
103
+ * Marking an invoice as uncollectible is useful for keeping track of bad debts
104
+ * that can be written off for accounting purposes.
105
+ *
106
+ * @param string $id
107
+ * @param null|array $params
108
+ * @param null|array|\Stripe\Util\RequestOptions $opts
109
+ *
110
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
111
+ *
112
+ * @return \Stripe\Invoice
113
+ */
114
+ public function markUncollectible($id, $params = null, $opts = null)
115
+ {
116
+ return $this->request('post', $this->buildPath('/v1/invoices/%s/mark_uncollectible', $id), $params, $opts);
117
+ }
118
+
119
+ /**
120
+ * Stripe automatically creates and then attempts to collect payment on invoices
121
+ * for customers on subscriptions according to your <a
122
+ * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions
123
+ * settings</a>. However, if you’d like to attempt payment on an invoice out of the
124
+ * normal collection schedule or for some other reason, you can do so.
125
+ *
126
+ * @param string $id
127
+ * @param null|array $params
128
+ * @param null|array|\Stripe\Util\RequestOptions $opts
129
+ *
130
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
131
+ *
132
+ * @return \Stripe\Invoice
133
+ */
134
+ public function pay($id, $params = null, $opts = null)
135
+ {
136
+ return $this->request('post', $this->buildPath('/v1/invoices/%s/pay', $id), $params, $opts);
137
+ }
138
+
139
+ /**
140
+ * Retrieves the invoice with the given ID.
141
+ *
142
+ * @param string $id
143
+ * @param null|array $params
144
+ * @param null|array|\Stripe\Util\RequestOptions $opts
145
+ *
146
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
147
+ *
148
+ * @return \Stripe\Invoice
149
+ */
150
+ public function retrieve($id, $params = null, $opts = null)
151
+ {
152
+ return $this->request('get', $this->buildPath('/v1/invoices/%s', $id), $params, $opts);
153
+ }
154
+
155
+ /**
156
+ * Stripe will automatically send invoices to customers according to your <a
157
+ * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions
158
+ * settings</a>. However, if you’d like to manually send an invoice to your
159
+ * customer out of the normal schedule, you can do so. When sending invoices that
160
+ * have already been paid, there will be no reference to the payment in the email.
161
+ *
162
+ * Requests made in test-mode result in no emails being sent, despite sending an
163
+ * <code>invoice.sent</code> event.
164
+ *
165
+ * @param string $id
166
+ * @param null|array $params
167
+ * @param null|array|\Stripe\Util\RequestOptions $opts
168
+ *
169
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
170
+ *
171
+ * @return \Stripe\Invoice
172
+ */
173
+ public function sendInvoice($id, $params = null, $opts = null)
174
+ {
175
+ return $this->request('post', $this->buildPath('/v1/invoices/%s/send', $id), $params, $opts);
176
+ }
177
+
178
+ /**
179
+ * At any time, you can preview the upcoming invoice for a customer. This will show
180
+ * you all the charges that are pending, including subscription renewal charges,
181
+ * invoice item charges, etc. It will also show you any discounts that are
182
+ * applicable to the invoice.
183
+ *
184
+ * Note that when you are viewing an upcoming invoice, you are simply viewing a
185
+ * preview – the invoice has not yet been created. As such, the upcoming invoice
186
+ * will not show up in invoice listing calls, and you cannot use the API to pay or
187
+ * edit the invoice. If you want to change the amount that your customer will be
188
+ * billed, you can add, remove, or update pending invoice items, or update the
189
+ * customer’s discount.
190
+ *
191
+ * You can preview the effects of updating a subscription, including a preview of
192
+ * what proration will take place. To ensure that the actual proration is
193
+ * calculated exactly the same as the previewed proration, you should pass a
194
+ * <code>proration_date</code> parameter when doing the actual subscription update.
195
+ * The value passed in should be the same as the
196
+ * <code>subscription_proration_date</code> returned on the upcoming invoice
197
+ * resource. The recommended way to get only the prorations being previewed is to
198
+ * consider only proration line items where <code>period[start]</code> is equal to
199
+ * the <code>subscription_proration_date</code> on the upcoming invoice resource.
200
+ *
201
+ * @param null|array $params
202
+ * @param null|array|\Stripe\Util\RequestOptions $opts
203
+ *
204
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
205
+ *
206
+ * @return \Stripe\Invoice
207
+ */
208
+ public function upcoming($params = null, $opts = null)
209
+ {
210
+ return $this->request('get', '/v1/invoices/upcoming', $params, $opts);
211
+ }
212
+
213
+ /**
214
+ * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong>
215
+ * property containing the total count of line items and the first handful of those
216
+ * items. There is also a URL where you can retrieve the full (paginated) list of
217
+ * line items.
218
+ *
219
+ * @param null|array $params
220
+ * @param null|array|\Stripe\Util\RequestOptions $opts
221
+ *
222
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
223
+ *
224
+ * @return \Stripe\Invoice
225
+ */
226
+ public function upcomingLines($params = null, $opts = null)
227
+ {
228
+ return $this->request('get', '/v1/invoices/upcoming/lines', $params, $opts);
229
+ }
230
+
231
+ /**
232
+ * Draft invoices are fully editable. Once an invoice is <a
233
+ * href="/docs/billing/invoices/workflow#finalized">finalized</a>, monetary values,
234
+ * as well as <code>collection_method</code>, become uneditable.
235
+ *
236
+ * If you would like to stop the Stripe Billing engine from automatically
237
+ * finalizing, reattempting payments on, sending reminders for, or <a
238
+ * href="/docs/billing/invoices/reconciliation">automatically reconciling</a>
239
+ * invoices, pass <code>auto_advance=false</code>.
240
+ *
241
+ * @param string $id
242
+ * @param null|array $params
243
+ * @param null|array|\Stripe\Util\RequestOptions $opts
244
+ *
245
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
246
+ *
247
+ * @return \Stripe\Invoice
248
+ */
249
+ public function update($id, $params = null, $opts = null)
250
+ {
251
+ return $this->request('post', $this->buildPath('/v1/invoices/%s', $id), $params, $opts);
252
+ }
253
+
254
+ /**
255
+ * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is
256
+ * similar to <a href="#delete_invoice">deletion</a>, however it only applies to
257
+ * finalized invoices and maintains a papertrail where the invoice can still be
258
+ * found.
259
+ *
260
+ * @param string $id
261
+ * @param null|array $params
262
+ * @param null|array|\Stripe\Util\RequestOptions $opts
263
+ *
264
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
265
+ *
266
+ * @return \Stripe\Invoice
267
+ */
268
+ public function voidInvoice($id, $params = null, $opts = null)
269
+ {
270
+ return $this->request('post', $this->buildPath('/v1/invoices/%s/void', $id), $params, $opts);
271
+ }
272
+ }
app/api/Stripe/Service/Issuing/AuthorizationService.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ class AuthorizationService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Issuing <code>Authorization</code> objects. The objects are
11
+ * sorted in descending order by creation date, with the most recently created
12
+ * object appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/issuing/authorizations', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Approves a pending Issuing <code>Authorization</code> object. This request
28
+ * should be made within the timeout window of the <a
29
+ * href="/docs/issuing/controls/real-time-authorizations">real-time
30
+ * authorization</a> flow.
31
+ *
32
+ * @param string $id
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\Issuing\Authorization
39
+ */
40
+ public function approve($id, $params = null, $opts = null)
41
+ {
42
+ return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/approve', $id), $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * Declines a pending Issuing <code>Authorization</code> object. This request
47
+ * should be made within the timeout window of the <a
48
+ * href="/docs/issuing/controls/real-time-authorizations">real time
49
+ * authorization</a> flow.
50
+ *
51
+ * @param string $id
52
+ * @param null|array $params
53
+ * @param null|array|\Stripe\Util\RequestOptions $opts
54
+ *
55
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
56
+ *
57
+ * @return \Stripe\Issuing\Authorization
58
+ */
59
+ public function decline($id, $params = null, $opts = null)
60
+ {
61
+ return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/decline', $id), $params, $opts);
62
+ }
63
+
64
+ /**
65
+ * Retrieves an Issuing <code>Authorization</code> object.
66
+ *
67
+ * @param string $id
68
+ * @param null|array $params
69
+ * @param null|array|\Stripe\Util\RequestOptions $opts
70
+ *
71
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
72
+ *
73
+ * @return \Stripe\Issuing\Authorization
74
+ */
75
+ public function retrieve($id, $params = null, $opts = null)
76
+ {
77
+ return $this->request('get', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts);
78
+ }
79
+
80
+ /**
81
+ * Updates the specified Issuing <code>Authorization</code> object by setting the
82
+ * values of the parameters passed. Any parameters not provided will be left
83
+ * unchanged.
84
+ *
85
+ * @param string $id
86
+ * @param null|array $params
87
+ * @param null|array|\Stripe\Util\RequestOptions $opts
88
+ *
89
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
90
+ *
91
+ * @return \Stripe\Issuing\Authorization
92
+ */
93
+ public function update($id, $params = null, $opts = null)
94
+ {
95
+ return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts);
96
+ }
97
+ }
app/api/Stripe/Service/Issuing/CardService.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ class CardService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Issuing <code>Card</code> objects. The objects are sorted in
11
+ * descending order by creation date, with the most recently created object
12
+ * appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/issuing/cards', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Creates an Issuing <code>Card</code> object.
28
+ *
29
+ * @param null|array $params
30
+ * @param null|array|\Stripe\Util\RequestOptions $opts
31
+ *
32
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
33
+ *
34
+ * @return \Stripe\Issuing\Card
35
+ */
36
+ public function create($params = null, $opts = null)
37
+ {
38
+ return $this->request('post', '/v1/issuing/cards', $params, $opts);
39
+ }
40
+
41
+ /**
42
+ * Retrieves an Issuing <code>Card</code> object.
43
+ *
44
+ * @param string $id
45
+ * @param null|array $params
46
+ * @param null|array|\Stripe\Util\RequestOptions $opts
47
+ *
48
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
49
+ *
50
+ * @return \Stripe\Issuing\Card
51
+ */
52
+ public function retrieve($id, $params = null, $opts = null)
53
+ {
54
+ return $this->request('get', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts);
55
+ }
56
+
57
+ /**
58
+ * Updates the specified Issuing <code>Card</code> object by setting the values of
59
+ * the parameters passed. Any parameters not provided will be left unchanged.
60
+ *
61
+ * @param string $id
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\Issuing\Card
68
+ */
69
+ public function update($id, $params = null, $opts = null)
70
+ {
71
+ return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts);
72
+ }
73
+ }
app/api/Stripe/Service/Issuing/CardholderService.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ class CardholderService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Issuing <code>Cardholder</code> objects. The objects are
11
+ * sorted in descending order by creation date, with the most recently created
12
+ * object appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/issuing/cardholders', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Creates a new Issuing <code>Cardholder</code> object that can be issued cards.
28
+ *
29
+ * @param null|array $params
30
+ * @param null|array|\Stripe\Util\RequestOptions $opts
31
+ *
32
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
33
+ *
34
+ * @return \Stripe\Issuing\Cardholder
35
+ */
36
+ public function create($params = null, $opts = null)
37
+ {
38
+ return $this->request('post', '/v1/issuing/cardholders', $params, $opts);
39
+ }
40
+
41
+ /**
42
+ * Retrieves an Issuing <code>Cardholder</code> object.
43
+ *
44
+ * @param string $id
45
+ * @param null|array $params
46
+ * @param null|array|\Stripe\Util\RequestOptions $opts
47
+ *
48
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
49
+ *
50
+ * @return \Stripe\Issuing\Cardholder
51
+ */
52
+ public function retrieve($id, $params = null, $opts = null)
53
+ {
54
+ return $this->request('get', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts);
55
+ }
56
+
57
+ /**
58
+ * Updates the specified Issuing <code>Cardholder</code> object by setting the
59
+ * values of the parameters passed. Any parameters not provided will be left
60
+ * unchanged.
61
+ *
62
+ * @param string $id
63
+ * @param null|array $params
64
+ * @param null|array|\Stripe\Util\RequestOptions $opts
65
+ *
66
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
67
+ *
68
+ * @return \Stripe\Issuing\Cardholder
69
+ */
70
+ public function update($id, $params = null, $opts = null)
71
+ {
72
+ return $this->request('post', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts);
73
+ }
74
+ }
app/api/Stripe/Service/Issuing/DisputeService.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ class DisputeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Issuing <code>Dispute</code> objects. The objects are sorted
11
+ * in descending order by creation date, with the most recently created object
12
+ * appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/issuing/disputes', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Creates an Issuing <code>Dispute</code> object. Individual pieces of evidence
28
+ * within the <code>evidence</code> object are optional at this point. Stripe only
29
+ * validates that required evidence is present during submission. Refer to <a
30
+ * href="/docs/issuing/purchases/disputes#dispute-reasons-and-evidence">Dispute
31
+ * reasons and evidence</a> for more details about evidence requirements.
32
+ *
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\Issuing\Dispute
39
+ */
40
+ public function create($params = null, $opts = null)
41
+ {
42
+ return $this->request('post', '/v1/issuing/disputes', $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * Retrieves an Issuing <code>Dispute</code> object.
47
+ *
48
+ * @param string $id
49
+ * @param null|array $params
50
+ * @param null|array|\Stripe\Util\RequestOptions $opts
51
+ *
52
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
53
+ *
54
+ * @return \Stripe\Issuing\Dispute
55
+ */
56
+ public function retrieve($id, $params = null, $opts = null)
57
+ {
58
+ return $this->request('get', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts);
59
+ }
60
+
61
+ /**
62
+ * Submits an Issuing <code>Dispute</code> to the card network. Stripe validates
63
+ * that all evidence fields required for the dispute’s reason are present. For more
64
+ * details, see <a
65
+ * href="/docs/issuing/purchases/disputes#dispute-reasons-and-evidence">Dispute
66
+ * reasons and evidence</a>.
67
+ *
68
+ * @param string $id
69
+ * @param null|array $params
70
+ * @param null|array|\Stripe\Util\RequestOptions $opts
71
+ *
72
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
73
+ *
74
+ * @return \Stripe\Issuing\Dispute
75
+ */
76
+ public function submit($id, $params = null, $opts = null)
77
+ {
78
+ return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s/submit', $id), $params, $opts);
79
+ }
80
+
81
+ /**
82
+ * Updates the specified Issuing <code>Dispute</code> object by setting the values
83
+ * of the parameters passed. Any parameters not provided will be left unchanged.
84
+ * Properties on the <code>evidence</code> object can be unset by passing in an
85
+ * empty string.
86
+ *
87
+ * @param string $id
88
+ * @param null|array $params
89
+ * @param null|array|\Stripe\Util\RequestOptions $opts
90
+ *
91
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
92
+ *
93
+ * @return \Stripe\Issuing\Dispute
94
+ */
95
+ public function update($id, $params = null, $opts = null)
96
+ {
97
+ return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts);
98
+ }
99
+ }
app/api/Stripe/Service/Issuing/IssuingServiceFactory.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Issuing namespace.
9
+ *
10
+ * @property AuthorizationService $authorizations
11
+ * @property CardholderService $cardholders
12
+ * @property CardService $cards
13
+ * @property DisputeService $disputes
14
+ * @property TransactionService $transactions
15
+ */
16
+ class IssuingServiceFactory extends \Stripe\Service\AbstractServiceFactory
17
+ {
18
+ /**
19
+ * @var array<string, string>
20
+ */
21
+ private static $classMap = [
22
+ 'authorizations' => AuthorizationService::class,
23
+ 'cardholders' => CardholderService::class,
24
+ 'cards' => CardService::class,
25
+ 'disputes' => DisputeService::class,
26
+ 'transactions' => TransactionService::class,
27
+ ];
28
+
29
+ protected function getServiceClass($name)
30
+ {
31
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
32
+ }
33
+ }
app/api/Stripe/Service/Issuing/TransactionService.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Issuing;
6
+
7
+ class TransactionService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Issuing <code>Transaction</code> objects. The objects are
11
+ * sorted in descending order by creation date, with the most recently created
12
+ * object appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/issuing/transactions', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Retrieves an Issuing <code>Transaction</code> object.
28
+ *
29
+ * @param string $id
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Issuing\Transaction
36
+ */
37
+ public function retrieve($id, $params = null, $opts = null)
38
+ {
39
+ return $this->request('get', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Updates the specified Issuing <code>Transaction</code> object by setting the
44
+ * values of the parameters passed. Any parameters not provided will be left
45
+ * unchanged.
46
+ *
47
+ * @param string $id
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return \Stripe\Issuing\Transaction
54
+ */
55
+ public function update($id, $params = null, $opts = null)
56
+ {
57
+ return $this->request('post', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts);
58
+ }
59
+ }
app/api/Stripe/Service/MandateService.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class MandateService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Retrieves a Mandate object.
11
+ *
12
+ * @param string $id
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Mandate
19
+ */
20
+ public function retrieve($id, $params = null, $opts = null)
21
+ {
22
+ return $this->request('get', $this->buildPath('/v1/mandates/%s', $id), $params, $opts);
23
+ }
24
+ }
app/api/Stripe/Service/OAuthService.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe\Service;
4
+
5
+ class OAuthService extends \Stripe\Service\AbstractService
6
+ {
7
+ /**
8
+ * Sends a request to Stripe's Connect API.
9
+ *
10
+ * @param string $method the HTTP method
11
+ * @param string $path the path of the request
12
+ * @param array $params the parameters of the request
13
+ * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
14
+ *
15
+ * @return \Stripe\StripeObject the object returned by Stripe's Connect API
16
+ */
17
+ protected function requestConnect($method, $path, $params, $opts)
18
+ {
19
+ $opts = $this->_parseOpts($opts);
20
+ $opts->apiBase = $this->_getBase($opts);
21
+
22
+ return $this->request($method, $path, $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Generates a URL to Stripe's OAuth form.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array $opts
30
+ *
31
+ * @return string the URL to Stripe's OAuth form
32
+ */
33
+ public function authorizeUrl($params = null, $opts = null)
34
+ {
35
+ $params = $params ?: [];
36
+
37
+ $opts = $this->_parseOpts($opts);
38
+ $base = $this->_getBase($opts);
39
+
40
+ $params['client_id'] = $this->_getClientId($params);
41
+ if (!\array_key_exists('response_type', $params)) {
42
+ $params['response_type'] = 'code';
43
+ }
44
+ $query = \Stripe\Util\Util::encodeParameters($params);
45
+
46
+ return $base . '/oauth/authorize?' . $query;
47
+ }
48
+
49
+ /**
50
+ * Use an authoriztion code to connect an account to your platform and
51
+ * fetch the user's credentials.
52
+ *
53
+ * @param null|array $params
54
+ * @param null|array $opts
55
+ *
56
+ * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
57
+ *
58
+ * @return \Stripe\StripeObject object containing the response from the API
59
+ */
60
+ public function token($params = null, $opts = null)
61
+ {
62
+ $params = $params ?: [];
63
+ $params['client_secret'] = $this->_getClientSecret($params);
64
+
65
+ return $this->requestConnect('post', '/oauth/token', $params, $opts);
66
+ }
67
+
68
+ /**
69
+ * Disconnects an account from your platform.
70
+ *
71
+ * @param null|array $params
72
+ * @param null|array $opts
73
+ *
74
+ * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
75
+ *
76
+ * @return \Stripe\StripeObject object containing the response from the API
77
+ */
78
+ public function deauthorize($params = null, $opts = null)
79
+ {
80
+ $params = $params ?: [];
81
+ $params['client_id'] = $this->_getClientId($params);
82
+
83
+ return $this->requestConnect('post', '/oauth/deauthorize', $params, $opts);
84
+ }
85
+
86
+ private function _getClientId($params = null)
87
+ {
88
+ $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null;
89
+
90
+ if (null === $clientId) {
91
+ $clientId = $this->client->getClientId();
92
+ }
93
+ if (null === $clientId) {
94
+ $msg = 'No client_id provided. (HINT: set your client_id using '
95
+ . '`new \Stripe\StripeClient([clientId => <CLIENT-ID>
96
+ ])`)". You can find your client_ids '
97
+ . 'in your Stripe dashboard at '
98
+ . 'https://dashboard.stripe.com/account/applications/settings, '
99
+ . 'after registering your account as a platform. See '
100
+ . 'https://stripe.com/docs/connect/standard-accounts for details, '
101
+ . 'or email support@stripe.com if you have any questions.';
102
+
103
+ throw new \Stripe\Exception\AuthenticationException($msg);
104
+ }
105
+
106
+ return $clientId;
107
+ }
108
+
109
+ private function _getClientSecret($params = null)
110
+ {
111
+ if (\array_key_exists('client_secret', $params)) {
112
+ return $params['client_secret'];
113
+ }
114
+
115
+ return $this->client->getApiKey();
116
+ }
117
+
118
+ /**
119
+ * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
120
+ *
121
+ * @throws \Stripe\Exception\InvalidArgumentException
122
+ *
123
+ * @return \Stripe\Util\RequestOptions
124
+ */
125
+ private function _parseOpts($opts)
126
+ {
127
+ if (\is_array($opts)) {
128
+ if (\array_key_exists('connect_base', $opts)) {
129
+ // Throw an exception for the convenience of anybody migrating to
130
+ // \Stripe\Service\OAuthService from \Stripe\OAuth, where `connect_base`
131
+ // was the name of the parameter that behaves as `api_base` does here.
132
+ throw new \Stripe\Exception\InvalidArgumentException('Use `api_base`, not `connect_base`');
133
+ }
134
+ }
135
+
136
+ return \Stripe\Util\RequestOptions::parse($opts);
137
+ }
138
+
139
+ /**
140
+ * @param \Stripe\Util\RequestOptions $opts
141
+ *
142
+ * @return string
143
+ */
144
+ private function _getBase($opts)
145
+ {
146
+ return isset($opts->apiBase) ?
147
+ $opts->apiBase :
148
+ $this->client->getConnectBase();
149
+ }
150
+ }
app/api/Stripe/Service/OrderReturnService.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class OrderReturnService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your order returns. The returns are returned sorted by
11
+ * creation date, with the most recently created return appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/order_returns', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Retrieves the details of an existing order return. Supply the unique order ID
27
+ * from either an order return creation request or the order return list, and
28
+ * Stripe will return the corresponding order information.
29
+ *
30
+ * @param string $id
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\OrderReturn
37
+ */
38
+ public function retrieve($id, $params = null, $opts = null)
39
+ {
40
+ return $this->request('get', $this->buildPath('/v1/order_returns/%s', $id), $params, $opts);
41
+ }
42
+ }
app/api/Stripe/Service/OrderService.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class OrderService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your orders. The orders are returned sorted by creation date,
11
+ * with the most recently created orders appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/orders', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a new order object.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\Order
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/orders', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Pay an order by providing a <code>source</code> to create a payment.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\Order
50
+ */
51
+ public function pay($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('post', $this->buildPath('/v1/orders/%s/pay', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Retrieves the details of an existing order. Supply the unique order ID from
58
+ * either an order creation request or the order list, and Stripe will return the
59
+ * corresponding order information.
60
+ *
61
+ * @param string $id
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\Order
68
+ */
69
+ public function retrieve($id, $params = null, $opts = null)
70
+ {
71
+ return $this->request('get', $this->buildPath('/v1/orders/%s', $id), $params, $opts);
72
+ }
73
+
74
+ /**
75
+ * Return all or part of an order. The order must have a status of
76
+ * <code>paid</code> or <code>fulfilled</code> before it can be returned. Once all
77
+ * items have been returned, the order will become <code>canceled</code> or
78
+ * <code>returned</code> depending on which status the order started in.
79
+ *
80
+ * @param string $id
81
+ * @param null|array $params
82
+ * @param null|array|\Stripe\Util\RequestOptions $opts
83
+ *
84
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
85
+ *
86
+ * @return \Stripe\Order
87
+ */
88
+ public function returnOrder($id, $params = null, $opts = null)
89
+ {
90
+ return $this->request('post', $this->buildPath('/v1/orders/%s/returns', $id), $params, $opts);
91
+ }
92
+
93
+ /**
94
+ * Updates the specific order by setting the values of the parameters passed. Any
95
+ * parameters not provided will be left unchanged.
96
+ *
97
+ * @param string $id
98
+ * @param null|array $params
99
+ * @param null|array|\Stripe\Util\RequestOptions $opts
100
+ *
101
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
102
+ *
103
+ * @return \Stripe\Order
104
+ */
105
+ public function update($id, $params = null, $opts = null)
106
+ {
107
+ return $this->request('post', $this->buildPath('/v1/orders/%s', $id), $params, $opts);
108
+ }
109
+ }
app/api/Stripe/Service/PaymentIntentService.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PaymentIntentService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of PaymentIntents.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/payment_intents', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * A PaymentIntent object can be canceled when it is in one of these statuses:
26
+ * <code>requires_payment_method</code>, <code>requires_capture</code>,
27
+ * <code>requires_confirmation</code>, or <code>requires_action</code>.
28
+ *
29
+ * Once canceled, no additional charges will be made by the PaymentIntent and any
30
+ * operations on the PaymentIntent will fail with an error. For PaymentIntents with
31
+ * <code>status=’requires_capture’</code>, the remaining
32
+ * <code>amount_capturable</code> will automatically be refunded.
33
+ *
34
+ * @param string $id
35
+ * @param null|array $params
36
+ * @param null|array|\Stripe\Util\RequestOptions $opts
37
+ *
38
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
39
+ *
40
+ * @return \Stripe\PaymentIntent
41
+ */
42
+ public function cancel($id, $params = null, $opts = null)
43
+ {
44
+ return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts);
45
+ }
46
+
47
+ /**
48
+ * Capture the funds of an existing uncaptured PaymentIntent when its status is
49
+ * <code>requires_capture</code>.
50
+ *
51
+ * Uncaptured PaymentIntents will be canceled exactly seven days after they are
52
+ * created.
53
+ *
54
+ * Learn more about <a href="/docs/payments/capture-later">separate authorization
55
+ * and capture</a>.
56
+ *
57
+ * @param string $id
58
+ * @param null|array $params
59
+ * @param null|array|\Stripe\Util\RequestOptions $opts
60
+ *
61
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
62
+ *
63
+ * @return \Stripe\PaymentIntent
64
+ */
65
+ public function capture($id, $params = null, $opts = null)
66
+ {
67
+ return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts);
68
+ }
69
+
70
+ /**
71
+ * Confirm that your customer intends to pay with current or provided payment
72
+ * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
73
+ *
74
+ * If the selected payment method requires additional authentication steps, the
75
+ * PaymentIntent will transition to the <code>requires_action</code> status and
76
+ * suggest additional actions via <code>next_action</code>. If payment fails, the
77
+ * PaymentIntent will transition to the <code>requires_payment_method</code>
78
+ * status. If payment succeeds, the PaymentIntent will transition to the
79
+ * <code>succeeded</code> status (or <code>requires_capture</code>, if
80
+ * <code>capture_method</code> is set to <code>manual</code>).
81
+ *
82
+ * If the <code>confirmation_method</code> is <code>automatic</code>, payment may
83
+ * be attempted using our <a
84
+ * href="/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a> and
85
+ * the PaymentIntent’s <a
86
+ * href="#payment_intent_object-client_secret">client_secret</a>. After
87
+ * <code>next_action</code>s are handled by the client, no additional confirmation
88
+ * is required to complete the payment.
89
+ *
90
+ * If the <code>confirmation_method</code> is <code>manual</code>, all payment
91
+ * attempts must be initiated using a secret key. If any actions are required for
92
+ * the payment, the PaymentIntent will return to the
93
+ * <code>requires_confirmation</code> state after those actions are completed. Your
94
+ * server needs to then explicitly re-confirm the PaymentIntent to initiate the
95
+ * next payment attempt. Read the <a
96
+ * href="/docs/payments/payment-intents/web-manual">expanded documentation</a> to
97
+ * learn more about manual confirmation.
98
+ *
99
+ * @param string $id
100
+ * @param null|array $params
101
+ * @param null|array|\Stripe\Util\RequestOptions $opts
102
+ *
103
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
104
+ *
105
+ * @return \Stripe\PaymentIntent
106
+ */
107
+ public function confirm($id, $params = null, $opts = null)
108
+ {
109
+ return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts);
110
+ }
111
+
112
+ /**
113
+ * Creates a PaymentIntent object.
114
+ *
115
+ * After the PaymentIntent is created, attach a payment method and <a
116
+ * href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment.
117
+ * You can read more about the different payment flows available via the Payment
118
+ * Intents API <a href="/docs/payments/payment-intents">here</a>.
119
+ *
120
+ * When <code>confirm=true</code> is used during creation, it is equivalent to
121
+ * creating and confirming the PaymentIntent in the same call. You may use any
122
+ * parameters available in the <a href="/docs/api/payment_intents/confirm">confirm
123
+ * API</a> when <code>confirm=true</code> is supplied.
124
+ *
125
+ * @param null|array $params
126
+ * @param null|array|\Stripe\Util\RequestOptions $opts
127
+ *
128
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
129
+ *
130
+ * @return \Stripe\PaymentIntent
131
+ */
132
+ public function create($params = null, $opts = null)
133
+ {
134
+ return $this->request('post', '/v1/payment_intents', $params, $opts);
135
+ }
136
+
137
+ /**
138
+ * Retrieves the details of a PaymentIntent that has previously been created.
139
+ *
140
+ * Client-side retrieval using a publishable key is allowed when the
141
+ * <code>client_secret</code> is provided in the query string.
142
+ *
143
+ * When retrieved with a publishable key, only a subset of properties will be
144
+ * returned. Please refer to the <a href="#payment_intent_object">payment
145
+ * intent</a> object reference for more details.
146
+ *
147
+ * @param string $id
148
+ * @param null|array $params
149
+ * @param null|array|\Stripe\Util\RequestOptions $opts
150
+ *
151
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
152
+ *
153
+ * @return \Stripe\PaymentIntent
154
+ */
155
+ public function retrieve($id, $params = null, $opts = null)
156
+ {
157
+ return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
158
+ }
159
+
160
+ /**
161
+ * Updates properties on a PaymentIntent object without confirming.
162
+ *
163
+ * Depending on which properties you update, you may need to confirm the
164
+ * PaymentIntent again. For example, updating the <code>payment_method</code> will
165
+ * always require you to confirm the PaymentIntent again. If you prefer to update
166
+ * and confirm at the same time, we recommend updating properties via the <a
167
+ * href="/docs/api/payment_intents/confirm">confirm API</a> instead.
168
+ *
169
+ * @param string $id
170
+ * @param null|array $params
171
+ * @param null|array|\Stripe\Util\RequestOptions $opts
172
+ *
173
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
174
+ *
175
+ * @return \Stripe\PaymentIntent
176
+ */
177
+ public function update($id, $params = null, $opts = null)
178
+ {
179
+ return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
180
+ }
181
+ }
app/api/Stripe/Service/PaymentMethodService.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PaymentMethodService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of PaymentMethods for a given Customer.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/payment_methods', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Attaches a PaymentMethod object to a Customer.
26
+ *
27
+ * To attach a new PaymentMethod to a customer for future payments, we recommend
28
+ * you use a <a href="/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent
29
+ * with <a
30
+ * href="/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
31
+ * These approaches will perform any necessary steps to ensure that the
32
+ * PaymentMethod can be used in a future payment. Using the
33
+ * <code>/v1/payment_methods/:id/attach</code> endpoint does not ensure that future
34
+ * payments can be made with the attached PaymentMethod. See <a
35
+ * href="/docs/payments/payment-intents#future-usage">Optimizing cards for future
36
+ * payments</a> for more information about setting up future payments.
37
+ *
38
+ * To use this PaymentMethod as the default for invoice or subscription payments,
39
+ * set <a
40
+ * href="/docs/api/customers/update#update_customer-invoice_settings-default_payment_method"><code>invoice_settings.default_payment_method</code></a>,
41
+ * on the Customer to the PaymentMethod’s ID.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\PaymentMethod
50
+ */
51
+ public function attach($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('post', $this->buildPath('/v1/payment_methods/%s/attach', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Creates a PaymentMethod object. Read the <a
58
+ * href="/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js
59
+ * reference</a> to learn how to create PaymentMethods via Stripe.js.
60
+ *
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\PaymentMethod
67
+ */
68
+ public function create($params = null, $opts = null)
69
+ {
70
+ return $this->request('post', '/v1/payment_methods', $params, $opts);
71
+ }
72
+
73
+ /**
74
+ * Detaches a PaymentMethod object from a Customer.
75
+ *
76
+ * @param string $id
77
+ * @param null|array $params
78
+ * @param null|array|\Stripe\Util\RequestOptions $opts
79
+ *
80
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
81
+ *
82
+ * @return \Stripe\PaymentMethod
83
+ */
84
+ public function detach($id, $params = null, $opts = null)
85
+ {
86
+ return $this->request('post', $this->buildPath('/v1/payment_methods/%s/detach', $id), $params, $opts);
87
+ }
88
+
89
+ /**
90
+ * Retrieves a PaymentMethod object.
91
+ *
92
+ * @param string $id
93
+ * @param null|array $params
94
+ * @param null|array|\Stripe\Util\RequestOptions $opts
95
+ *
96
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
97
+ *
98
+ * @return \Stripe\PaymentMethod
99
+ */
100
+ public function retrieve($id, $params = null, $opts = null)
101
+ {
102
+ return $this->request('get', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts);
103
+ }
104
+
105
+ /**
106
+ * Updates a PaymentMethod object. A PaymentMethod must be attached a customer to
107
+ * be updated.
108
+ *
109
+ * @param string $id
110
+ * @param null|array $params
111
+ * @param null|array|\Stripe\Util\RequestOptions $opts
112
+ *
113
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
114
+ *
115
+ * @return \Stripe\PaymentMethod
116
+ */
117
+ public function update($id, $params = null, $opts = null)
118
+ {
119
+ return $this->request('post', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts);
120
+ }
121
+ }
app/api/Stripe/Service/PayoutService.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PayoutService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of existing payouts sent to third-party bank accounts or that
11
+ * Stripe has sent you. The payouts are returned in sorted order, with the most
12
+ * recently created payouts appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/payouts', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * A previously created payout can be canceled if it has not yet been paid out.
28
+ * Funds will be refunded to your available balance. You may not cancel automatic
29
+ * Stripe payouts.
30
+ *
31
+ * @param string $id
32
+ * @param null|array $params
33
+ * @param null|array|\Stripe\Util\RequestOptions $opts
34
+ *
35
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
36
+ *
37
+ * @return \Stripe\Payout
38
+ */
39
+ public function cancel($id, $params = null, $opts = null)
40
+ {
41
+ return $this->request('post', $this->buildPath('/v1/payouts/%s/cancel', $id), $params, $opts);
42
+ }
43
+
44
+ /**
45
+ * To send funds to your own bank account, you create a new payout object. Your <a
46
+ * href="#balance">Stripe balance</a> must be able to cover the payout amount, or
47
+ * you’ll receive an “Insufficient Funds” error.
48
+ *
49
+ * If your API key is in test mode, money won’t actually be sent, though everything
50
+ * else will occur as if in live mode.
51
+ *
52
+ * If you are creating a manual payout on a Stripe account that uses multiple
53
+ * payment source types, you’ll need to specify the source type balance that the
54
+ * payout should draw from. The <a href="#balance_object">balance object</a>
55
+ * details available and pending amounts by source type.
56
+ *
57
+ * @param null|array $params
58
+ * @param null|array|\Stripe\Util\RequestOptions $opts
59
+ *
60
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
61
+ *
62
+ * @return \Stripe\Payout
63
+ */
64
+ public function create($params = null, $opts = null)
65
+ {
66
+ return $this->request('post', '/v1/payouts', $params, $opts);
67
+ }
68
+
69
+ /**
70
+ * Retrieves the details of an existing payout. Supply the unique payout ID from
71
+ * either a payout creation request or the payout list, and Stripe will return the
72
+ * corresponding payout information.
73
+ *
74
+ * @param string $id
75
+ * @param null|array $params
76
+ * @param null|array|\Stripe\Util\RequestOptions $opts
77
+ *
78
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
79
+ *
80
+ * @return \Stripe\Payout
81
+ */
82
+ public function retrieve($id, $params = null, $opts = null)
83
+ {
84
+ return $this->request('get', $this->buildPath('/v1/payouts/%s', $id), $params, $opts);
85
+ }
86
+
87
+ /**
88
+ * Reverses a payout by debiting the destination bank account. Only payouts for
89
+ * connected accounts to US bank accounts may be reversed at this time. If the
90
+ * payout is in the <code>pending</code> status,
91
+ * <code>/v1/payouts/:id/cancel</code> should be used instead.
92
+ *
93
+ * By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm
94
+ * that the authorized signatory of the selected bank account has authorized the
95
+ * debit on the bank account and that no other authorization is required.
96
+ *
97
+ * @param string $id
98
+ * @param null|array $params
99
+ * @param null|array|\Stripe\Util\RequestOptions $opts
100
+ *
101
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
102
+ *
103
+ * @return \Stripe\Payout
104
+ */
105
+ public function reverse($id, $params = null, $opts = null)
106
+ {
107
+ return $this->request('post', $this->buildPath('/v1/payouts/%s/reverse', $id), $params, $opts);
108
+ }
109
+
110
+ /**
111
+ * Updates the specified payout by setting the values of the parameters passed. Any
112
+ * parameters not provided will be left unchanged. This request accepts only the
113
+ * metadata as arguments.
114
+ *
115
+ * @param string $id
116
+ * @param null|array $params
117
+ * @param null|array|\Stripe\Util\RequestOptions $opts
118
+ *
119
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
120
+ *
121
+ * @return \Stripe\Payout
122
+ */
123
+ public function update($id, $params = null, $opts = null)
124
+ {
125
+ return $this->request('post', $this->buildPath('/v1/payouts/%s', $id), $params, $opts);
126
+ }
127
+ }
app/api/Stripe/Service/PlanService.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PlanService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your plans.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/plans', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * You can now model subscriptions more flexibly using the <a href="#prices">Prices
26
+ * API</a>. It replaces the Plans API and is backwards compatible to simplify your
27
+ * migration.
28
+ *
29
+ * @param null|array $params
30
+ * @param null|array|\Stripe\Util\RequestOptions $opts
31
+ *
32
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
33
+ *
34
+ * @return \Stripe\Plan
35
+ */
36
+ public function create($params = null, $opts = null)
37
+ {
38
+ return $this->request('post', '/v1/plans', $params, $opts);
39
+ }
40
+
41
+ /**
42
+ * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t
43
+ * affected.
44
+ *
45
+ * @param string $id
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Plan
52
+ */
53
+ public function delete($id, $params = null, $opts = null)
54
+ {
55
+ return $this->request('delete', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Retrieves the plan with the given ID.
60
+ *
61
+ * @param string $id
62
+ * @param null|array $params
63
+ * @param null|array|\Stripe\Util\RequestOptions $opts
64
+ *
65
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
66
+ *
67
+ * @return \Stripe\Plan
68
+ */
69
+ public function retrieve($id, $params = null, $opts = null)
70
+ {
71
+ return $this->request('get', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
72
+ }
73
+
74
+ /**
75
+ * Updates the specified plan by setting the values of the parameters passed. Any
76
+ * parameters not provided are left unchanged. By design, you cannot change a
77
+ * plan’s ID, amount, currency, or billing cycle.
78
+ *
79
+ * @param string $id
80
+ * @param null|array $params
81
+ * @param null|array|\Stripe\Util\RequestOptions $opts
82
+ *
83
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
84
+ *
85
+ * @return \Stripe\Plan
86
+ */
87
+ public function update($id, $params = null, $opts = null)
88
+ {
89
+ return $this->request('post', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
90
+ }
91
+ }
app/api/Stripe/Service/PriceService.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PriceService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your prices.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/prices', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Creates a new price for an existing product. The price can be recurring or
26
+ * one-time.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\Price
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/prices', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Retrieves the price with the given ID.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\Price
50
+ */
51
+ public function retrieve($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('get', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Updates the specified price by setting the values of the parameters passed. Any
58
+ * parameters not provided are left unchanged.
59
+ *
60
+ * @param string $id
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\Price
67
+ */
68
+ public function update($id, $params = null, $opts = null)
69
+ {
70
+ return $this->request('post', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
71
+ }
72
+ }
app/api/Stripe/Service/ProductService.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ProductService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your products. The products are returned sorted by creation
11
+ * date, with the most recently created products appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/products', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a new product object.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\Product
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/products', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Delete a product. Deleting a product is only possible if it has no prices
42
+ * associated with it. Additionally, deleting a product with <code>type=good</code>
43
+ * is only possible if it has no SKUs associated with it.
44
+ *
45
+ * @param string $id
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Product
52
+ */
53
+ public function delete($id, $params = null, $opts = null)
54
+ {
55
+ return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Retrieves the details of an existing product. Supply the unique product ID from
60
+ * either a product creation request or the product list, and Stripe will return
61
+ * the corresponding product information.
62
+ *
63
+ * @param string $id
64
+ * @param null|array $params
65
+ * @param null|array|\Stripe\Util\RequestOptions $opts
66
+ *
67
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
68
+ *
69
+ * @return \Stripe\Product
70
+ */
71
+ public function retrieve($id, $params = null, $opts = null)
72
+ {
73
+ return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts);
74
+ }
75
+
76
+ /**
77
+ * Updates the specific product by setting the values of the parameters passed. Any
78
+ * parameters not provided will be left unchanged.
79
+ *
80
+ * @param string $id
81
+ * @param null|array $params
82
+ * @param null|array|\Stripe\Util\RequestOptions $opts
83
+ *
84
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
85
+ *
86
+ * @return \Stripe\Product
87
+ */
88
+ public function update($id, $params = null, $opts = null)
89
+ {
90
+ return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts);
91
+ }
92
+ }
app/api/Stripe/Service/PromotionCodeService.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PromotionCodeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your promotion codes.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/promotion_codes', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * A promotion code points to a coupon. You can optionally restrict the code to a
26
+ * specific customer, redemption limit, and expiration date.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\PromotionCode
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/promotion_codes', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Retrieves the promotion code with the given ID.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\PromotionCode
50
+ */
51
+ public function retrieve($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('get', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Updates the specified promotion code by setting the values of the parameters
58
+ * passed. Most fields are, by design, not editable.
59
+ *
60
+ * @param string $id
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\PromotionCode
67
+ */
68
+ public function update($id, $params = null, $opts = null)
69
+ {
70
+ return $this->request('post', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts);
71
+ }
72
+ }
app/api/Stripe/Service/Radar/EarlyFraudWarningService.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Radar;
6
+
7
+ class EarlyFraudWarningService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of early fraud warnings.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/radar/early_fraud_warnings', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Retrieves the details of an early fraud warning that has previously been
26
+ * created.
27
+ *
28
+ * Please refer to the <a href="#early_fraud_warning_object">early fraud
29
+ * warning</a> object reference for more details.
30
+ *
31
+ * @param string $id
32
+ * @param null|array $params
33
+ * @param null|array|\Stripe\Util\RequestOptions $opts
34
+ *
35
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
36
+ *
37
+ * @return \Stripe\Radar\EarlyFraudWarning
38
+ */
39
+ public function retrieve($id, $params = null, $opts = null)
40
+ {
41
+ return $this->request('get', $this->buildPath('/v1/radar/early_fraud_warnings/%s', $id), $params, $opts);
42
+ }
43
+ }
app/api/Stripe/Service/Radar/RadarServiceFactory.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Radar;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Radar namespace.
9
+ *
10
+ * @property EarlyFraudWarningService $earlyFraudWarnings
11
+ * @property ValueListItemService $valueListItems
12
+ * @property ValueListService $valueLists
13
+ */
14
+ class RadarServiceFactory extends \Stripe\Service\AbstractServiceFactory
15
+ {
16
+ /**
17
+ * @var array<string, string>
18
+ */
19
+ private static $classMap = [
20
+ 'earlyFraudWarnings' => EarlyFraudWarningService::class,
21
+ 'valueListItems' => ValueListItemService::class,
22
+ 'valueLists' => ValueListService::class,
23
+ ];
24
+
25
+ protected function getServiceClass($name)
26
+ {
27
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
28
+ }
29
+ }
app/api/Stripe/Service/Radar/ValueListItemService.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Radar;
6
+
7
+ class ValueListItemService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of <code>ValueListItem</code> objects. The objects are sorted in
11
+ * descending order by creation date, with the most recently created object
12
+ * appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/radar/value_list_items', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Creates a new <code>ValueListItem</code> object, which is added to the specified
28
+ * parent value list.
29
+ *
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Radar\ValueListItem
36
+ */
37
+ public function create($params = null, $opts = null)
38
+ {
39
+ return $this->request('post', '/v1/radar/value_list_items', $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Deletes a <code>ValueListItem</code> object, removing it from its parent value
44
+ * list.
45
+ *
46
+ * @param string $id
47
+ * @param null|array $params
48
+ * @param null|array|\Stripe\Util\RequestOptions $opts
49
+ *
50
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
51
+ *
52
+ * @return \Stripe\Radar\ValueListItem
53
+ */
54
+ public function delete($id, $params = null, $opts = null)
55
+ {
56
+ return $this->request('delete', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts);
57
+ }
58
+
59
+ /**
60
+ * Retrieves a <code>ValueListItem</code> object.
61
+ *
62
+ * @param string $id
63
+ * @param null|array $params
64
+ * @param null|array|\Stripe\Util\RequestOptions $opts
65
+ *
66
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
67
+ *
68
+ * @return \Stripe\Radar\ValueListItem
69
+ */
70
+ public function retrieve($id, $params = null, $opts = null)
71
+ {
72
+ return $this->request('get', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts);
73
+ }
74
+ }
app/api/Stripe/Service/Radar/ValueListService.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Radar;
6
+
7
+ class ValueListService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of <code>ValueList</code> objects. The objects are sorted in
11
+ * descending order by creation date, with the most recently created object
12
+ * appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/radar/value_lists', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Creates a new <code>ValueList</code> object, which can then be referenced in
28
+ * rules.
29
+ *
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Radar\ValueList
36
+ */
37
+ public function create($params = null, $opts = null)
38
+ {
39
+ return $this->request('post', '/v1/radar/value_lists', $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Deletes a <code>ValueList</code> object, also deleting any items contained
44
+ * within the value list. To be deleted, a value list must not be referenced in any
45
+ * rules.
46
+ *
47
+ * @param string $id
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return \Stripe\Radar\ValueList
54
+ */
55
+ public function delete($id, $params = null, $opts = null)
56
+ {
57
+ return $this->request('delete', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
58
+ }
59
+
60
+ /**
61
+ * Retrieves a <code>ValueList</code> object.
62
+ *
63
+ * @param string $id
64
+ * @param null|array $params
65
+ * @param null|array|\Stripe\Util\RequestOptions $opts
66
+ *
67
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
68
+ *
69
+ * @return \Stripe\Radar\ValueList
70
+ */
71
+ public function retrieve($id, $params = null, $opts = null)
72
+ {
73
+ return $this->request('get', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
74
+ }
75
+
76
+ /**
77
+ * Updates a <code>ValueList</code> object by setting the values of the parameters
78
+ * passed. Any parameters not provided will be left unchanged. Note that
79
+ * <code>item_type</code> is immutable.
80
+ *
81
+ * @param string $id
82
+ * @param null|array $params
83
+ * @param null|array|\Stripe\Util\RequestOptions $opts
84
+ *
85
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
86
+ *
87
+ * @return \Stripe\Radar\ValueList
88
+ */
89
+ public function update($id, $params = null, $opts = null)
90
+ {
91
+ return $this->request('post', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
92
+ }
93
+ }
app/api/Stripe/Service/RefundService.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class RefundService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of all refunds you’ve previously created. The refunds are
11
+ * returned in sorted order, with the most recent refunds appearing first. For
12
+ * convenience, the 10 most recent refunds are always available by default on the
13
+ * charge object.
14
+ *
15
+ * @param null|array $params
16
+ * @param null|array|\Stripe\Util\RequestOptions $opts
17
+ *
18
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
19
+ *
20
+ * @return \Stripe\Collection
21
+ */
22
+ public function all($params = null, $opts = null)
23
+ {
24
+ return $this->requestCollection('get', '/v1/refunds', $params, $opts);
25
+ }
26
+
27
+ /**
28
+ * Create a refund.
29
+ *
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Refund
36
+ */
37
+ public function create($params = null, $opts = null)
38
+ {
39
+ return $this->request('post', '/v1/refunds', $params, $opts);
40
+ }
41
+
42
+ /**
43
+ * Retrieves the details of an existing refund.
44
+ *
45
+ * @param string $id
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Refund
52
+ */
53
+ public function retrieve($id, $params = null, $opts = null)
54
+ {
55
+ return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
56
+ }
57
+
58
+ /**
59
+ * Updates the specified refund by setting the values of the parameters passed. Any
60
+ * parameters not provided will be left unchanged.
61
+ *
62
+ * This request only accepts <code>metadata</code> as an argument.
63
+ *
64
+ * @param string $id
65
+ * @param null|array $params
66
+ * @param null|array|\Stripe\Util\RequestOptions $opts
67
+ *
68
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
69
+ *
70
+ * @return \Stripe\Refund
71
+ */
72
+ public function update($id, $params = null, $opts = null)
73
+ {
74
+ return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
75
+ }
76
+ }
app/api/Stripe/Service/Reporting/ReportRunService.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Reporting;
6
+
7
+ class ReportRunService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of Report Runs, with the most recent appearing first. (Requires a
11
+ * <a href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.).
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a new object and begin running the report. (Requires a <a
27
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.).
28
+ *
29
+ * @param null|array $params
30
+ * @param null|array|\Stripe\Util\RequestOptions $opts
31
+ *
32
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
33
+ *
34
+ * @return \Stripe\Reporting\ReportRun
35
+ */
36
+ public function create($params = null, $opts = null)
37
+ {
38
+ return $this->request('post', '/v1/reporting/report_runs', $params, $opts);
39
+ }
40
+
41
+ /**
42
+ * Retrieves the details of an existing Report Run. (Requires a <a
43
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.).
44
+ *
45
+ * @param string $id
46
+ * @param null|array $params
47
+ * @param null|array|\Stripe\Util\RequestOptions $opts
48
+ *
49
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
50
+ *
51
+ * @return \Stripe\Reporting\ReportRun
52
+ */
53
+ public function retrieve($id, $params = null, $opts = null)
54
+ {
55
+ return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts);
56
+ }
57
+ }
app/api/Stripe/Service/Reporting/ReportTypeService.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Reporting;
6
+
7
+ class ReportTypeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a full list of Report Types. (Requires a <a
11
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.).
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Retrieves the details of a Report Type. (Requires a <a
27
+ * href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.).
28
+ *
29
+ * @param string $id
30
+ * @param null|array $params
31
+ * @param null|array|\Stripe\Util\RequestOptions $opts
32
+ *
33
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
34
+ *
35
+ * @return \Stripe\Reporting\ReportType
36
+ */
37
+ public function retrieve($id, $params = null, $opts = null)
38
+ {
39
+ return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts);
40
+ }
41
+ }
app/api/Stripe/Service/Reporting/ReportingServiceFactory.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Reporting;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Reporting namespace.
9
+ *
10
+ * @property ReportRunService $reportRuns
11
+ * @property ReportTypeService $reportTypes
12
+ */
13
+ class ReportingServiceFactory extends \Stripe\Service\AbstractServiceFactory
14
+ {
15
+ /**
16
+ * @var array<string, string>
17
+ */
18
+ private static $classMap = [
19
+ 'reportRuns' => ReportRunService::class,
20
+ 'reportTypes' => ReportTypeService::class,
21
+ ];
22
+
23
+ protected function getServiceClass($name)
24
+ {
25
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
26
+ }
27
+ }
app/api/Stripe/Service/ReviewService.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class ReviewService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of <code>Review</code> objects that have <code>open</code> set to
11
+ * <code>true</code>. The objects are sorted in descending order by creation date,
12
+ * with the most recently created object appearing first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/reviews', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * Approves a <code>Review</code> object, closing it and removing it from the list
28
+ * of reviews.
29
+ *
30
+ * @param string $id
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\Review
37
+ */
38
+ public function approve($id, $params = null, $opts = null)
39
+ {
40
+ return $this->request('post', $this->buildPath('/v1/reviews/%s/approve', $id), $params, $opts);
41
+ }
42
+
43
+ /**
44
+ * Retrieves a <code>Review</code> object.
45
+ *
46
+ * @param string $id
47
+ * @param null|array $params
48
+ * @param null|array|\Stripe\Util\RequestOptions $opts
49
+ *
50
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
51
+ *
52
+ * @return \Stripe\Review
53
+ */
54
+ public function retrieve($id, $params = null, $opts = null)
55
+ {
56
+ return $this->request('get', $this->buildPath('/v1/reviews/%s', $id), $params, $opts);
57
+ }
58
+ }
app/api/Stripe/Service/SetupAttemptService.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SetupAttemptService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of SetupAttempts associated with a provided SetupIntent.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/setup_attempts', $params, $opts);
22
+ }
23
+ }
app/api/Stripe/Service/SetupIntentService.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SetupIntentService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of SetupIntents.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/setup_intents', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * A SetupIntent object can be canceled when it is in one of these statuses:
26
+ * <code>requires_payment_method</code>, <code>requires_confirmation</code>, or
27
+ * <code>requires_action</code>.
28
+ *
29
+ * Once canceled, setup is abandoned and any operations on the SetupIntent will
30
+ * fail with an error.
31
+ *
32
+ * @param string $id
33
+ * @param null|array $params
34
+ * @param null|array|\Stripe\Util\RequestOptions $opts
35
+ *
36
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
37
+ *
38
+ * @return \Stripe\SetupIntent
39
+ */
40
+ public function cancel($id, $params = null, $opts = null)
41
+ {
42
+ return $this->request('post', $this->buildPath('/v1/setup_intents/%s/cancel', $id), $params, $opts);
43
+ }
44
+
45
+ /**
46
+ * Confirm that your customer intends to set up the current or provided payment
47
+ * method. For example, you would confirm a SetupIntent when a customer hits the
48
+ * “Save” button on a payment method management page on your website.
49
+ *
50
+ * If the selected payment method does not require any additional steps from the
51
+ * customer, the SetupIntent will transition to the <code>succeeded</code> status.
52
+ *
53
+ * Otherwise, it will transition to the <code>requires_action</code> status and
54
+ * suggest additional actions via <code>next_action</code>. If setup fails, the
55
+ * SetupIntent will transition to the <code>requires_payment_method</code> status.
56
+ *
57
+ * @param string $id
58
+ * @param null|array $params
59
+ * @param null|array|\Stripe\Util\RequestOptions $opts
60
+ *
61
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
62
+ *
63
+ * @return \Stripe\SetupIntent
64
+ */
65
+ public function confirm($id, $params = null, $opts = null)
66
+ {
67
+ return $this->request('post', $this->buildPath('/v1/setup_intents/%s/confirm', $id), $params, $opts);
68
+ }
69
+
70
+ /**
71
+ * Creates a SetupIntent object.
72
+ *
73
+ * After the SetupIntent is created, attach a payment method and <a
74
+ * href="/docs/api/setup_intents/confirm">confirm</a> to collect any required
75
+ * permissions to charge the payment method later.
76
+ *
77
+ * @param null|array $params
78
+ * @param null|array|\Stripe\Util\RequestOptions $opts
79
+ *
80
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
81
+ *
82
+ * @return \Stripe\SetupIntent
83
+ */
84
+ public function create($params = null, $opts = null)
85
+ {
86
+ return $this->request('post', '/v1/setup_intents', $params, $opts);
87
+ }
88
+
89
+ /**
90
+ * Retrieves the details of a SetupIntent that has previously been created.
91
+ *
92
+ * Client-side retrieval using a publishable key is allowed when the
93
+ * <code>client_secret</code> is provided in the query string.
94
+ *
95
+ * When retrieved with a publishable key, only a subset of properties will be
96
+ * returned. Please refer to the <a href="#setup_intent_object">SetupIntent</a>
97
+ * object reference for more details.
98
+ *
99
+ * @param string $id
100
+ * @param null|array $params
101
+ * @param null|array|\Stripe\Util\RequestOptions $opts
102
+ *
103
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
104
+ *
105
+ * @return \Stripe\SetupIntent
106
+ */
107
+ public function retrieve($id, $params = null, $opts = null)
108
+ {
109
+ return $this->request('get', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts);
110
+ }
111
+
112
+ /**
113
+ * Updates a SetupIntent object.
114
+ *
115
+ * @param string $id
116
+ * @param null|array $params
117
+ * @param null|array|\Stripe\Util\RequestOptions $opts
118
+ *
119
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
120
+ *
121
+ * @return \Stripe\SetupIntent
122
+ */
123
+ public function update($id, $params = null, $opts = null)
124
+ {
125
+ return $this->request('post', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts);
126
+ }
127
+ }
app/api/Stripe/Service/Sigma/ScheduledQueryRunService.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Sigma;
6
+
7
+ class ScheduledQueryRunService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of scheduled query runs.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/sigma/scheduled_query_runs', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Retrieves the details of an scheduled query run.
26
+ *
27
+ * @param string $id
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\Sigma\ScheduledQueryRun
34
+ */
35
+ public function retrieve($id, $params = null, $opts = null)
36
+ {
37
+ return $this->request('get', $this->buildPath('/v1/sigma/scheduled_query_runs/%s', $id), $params, $opts);
38
+ }
39
+ }
app/api/Stripe/Service/Sigma/SigmaServiceFactory.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Sigma;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Sigma namespace.
9
+ *
10
+ * @property ScheduledQueryRunService $scheduledQueryRuns
11
+ */
12
+ class SigmaServiceFactory extends \Stripe\Service\AbstractServiceFactory
13
+ {
14
+ /**
15
+ * @var array<string, string>
16
+ */
17
+ private static $classMap = [
18
+ 'scheduledQueryRuns' => ScheduledQueryRunService::class,
19
+ ];
20
+
21
+ protected function getServiceClass($name)
22
+ {
23
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
24
+ }
25
+ }
app/api/Stripe/Service/SkuService.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SkuService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your SKUs. The SKUs are returned sorted by creation date, with
11
+ * the most recently created SKUs appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/skus', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a new SKU associated with a product.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\SKU
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/skus', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Delete a SKU. Deleting a SKU is only possible until it has been used in an
42
+ * order.
43
+ *
44
+ * @param string $id
45
+ * @param null|array $params
46
+ * @param null|array|\Stripe\Util\RequestOptions $opts
47
+ *
48
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
49
+ *
50
+ * @return \Stripe\SKU
51
+ */
52
+ public function delete($id, $params = null, $opts = null)
53
+ {
54
+ return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
55
+ }
56
+
57
+ /**
58
+ * Retrieves the details of an existing SKU. Supply the unique SKU identifier from
59
+ * either a SKU creation request or from the product, and Stripe will return the
60
+ * corresponding SKU information.
61
+ *
62
+ * @param string $id
63
+ * @param null|array $params
64
+ * @param null|array|\Stripe\Util\RequestOptions $opts
65
+ *
66
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
67
+ *
68
+ * @return \Stripe\SKU
69
+ */
70
+ public function retrieve($id, $params = null, $opts = null)
71
+ {
72
+ return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
73
+ }
74
+
75
+ /**
76
+ * Updates the specific SKU by setting the values of the parameters passed. Any
77
+ * parameters not provided will be left unchanged.
78
+ *
79
+ * Note that a SKU’s <code>attributes</code> are not editable. Instead, you would
80
+ * need to deactivate the existing SKU and create a new one with the new attribute
81
+ * values.
82
+ *
83
+ * @param string $id
84
+ * @param null|array $params
85
+ * @param null|array|\Stripe\Util\RequestOptions $opts
86
+ *
87
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
88
+ *
89
+ * @return \Stripe\SKU
90
+ */
91
+ public function update($id, $params = null, $opts = null)
92
+ {
93
+ return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
94
+ }
95
+ }
app/api/Stripe/Service/SourceService.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SourceService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * @param string $id
11
+ * @param null|array $params
12
+ * @param null|array|\Stripe\Util\RequestOptions $opts
13
+ *
14
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
15
+ *
16
+ * @return \Stripe\Source
17
+ */
18
+ public function allTransactions($id, $params = null, $opts = null)
19
+ {
20
+ return $this->request('get', $this->buildPath('/v1/sources/%s/source_transactions', $id), $params, $opts);
21
+ }
22
+
23
+ /**
24
+ * Creates a new source object.
25
+ *
26
+ * @param null|array $params
27
+ * @param null|array|\Stripe\Util\RequestOptions $opts
28
+ *
29
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
30
+ *
31
+ * @return \Stripe\Source
32
+ */
33
+ public function create($params = null, $opts = null)
34
+ {
35
+ return $this->request('post', '/v1/sources', $params, $opts);
36
+ }
37
+
38
+ /**
39
+ * Delete a specified source for a given customer.
40
+ *
41
+ * @param string $parentId
42
+ * @param string $id
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\Source
49
+ */
50
+ public function detach($parentId, $id, $params = null, $opts = null)
51
+ {
52
+ return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Retrieves an existing source object. Supply the unique source ID from a source
57
+ * creation request and Stripe will return the corresponding up-to-date source
58
+ * object information.
59
+ *
60
+ * @param string $id
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\Source
67
+ */
68
+ public function retrieve($id, $params = null, $opts = null)
69
+ {
70
+ return $this->request('get', $this->buildPath('/v1/sources/%s', $id), $params, $opts);
71
+ }
72
+
73
+ /**
74
+ * Updates the specified source by setting the values of the parameters passed. Any
75
+ * parameters not provided will be left unchanged.
76
+ *
77
+ * This request accepts the <code>metadata</code> and <code>owner</code> as
78
+ * arguments. It is also possible to update type specific information for selected
79
+ * payment methods. Please refer to our <a href="/docs/sources">payment method
80
+ * guides</a> for more detail.
81
+ *
82
+ * @param string $id
83
+ * @param null|array $params
84
+ * @param null|array|\Stripe\Util\RequestOptions $opts
85
+ *
86
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
87
+ *
88
+ * @return \Stripe\Source
89
+ */
90
+ public function update($id, $params = null, $opts = null)
91
+ {
92
+ return $this->request('post', $this->buildPath('/v1/sources/%s', $id), $params, $opts);
93
+ }
94
+
95
+ /**
96
+ * Verify a given source.
97
+ *
98
+ * @param string $id
99
+ * @param null|array $params
100
+ * @param null|array|\Stripe\Util\RequestOptions $opts
101
+ *
102
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
103
+ *
104
+ * @return \Stripe\Source
105
+ */
106
+ public function verify($id, $params = null, $opts = null)
107
+ {
108
+ return $this->request('post', $this->buildPath('/v1/sources/%s/verify', $id), $params, $opts);
109
+ }
110
+ }
app/api/Stripe/Service/SubscriptionItemService.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SubscriptionItemService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your subscription items for a given subscription.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/subscription_items', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * For the specified subscription item, returns a list of summary objects. Each
26
+ * object in the list provides usage information that’s been summarized from
27
+ * multiple usage records and over a subscription billing period (e.g., 15 usage
28
+ * records in the month of September).
29
+ *
30
+ * The list is sorted in reverse-chronological order (newest first). The first list
31
+ * item represents the most current usage period that hasn’t ended yet. Since new
32
+ * usage records can still be added, the returned summary information for the
33
+ * subscription item’s ID should be seen as unstable until the subscription billing
34
+ * period ends.
35
+ *
36
+ * @param string $parentId
37
+ * @param null|array $params
38
+ * @param null|array|\Stripe\Util\RequestOptions $opts
39
+ *
40
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
41
+ *
42
+ * @return \Stripe\Collection
43
+ */
44
+ public function allUsageRecordSummaries($parentId, $params = null, $opts = null)
45
+ {
46
+ return $this->requestCollection('get', $this->buildPath('/v1/subscription_items/%s/usage_record_summaries', $parentId), $params, $opts);
47
+ }
48
+
49
+ /**
50
+ * Adds a new item to an existing subscription. No existing items will be changed
51
+ * or replaced.
52
+ *
53
+ * @param null|array $params
54
+ * @param null|array|\Stripe\Util\RequestOptions $opts
55
+ *
56
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
57
+ *
58
+ * @return \Stripe\SubscriptionItem
59
+ */
60
+ public function create($params = null, $opts = null)
61
+ {
62
+ return $this->request('post', '/v1/subscription_items', $params, $opts);
63
+ }
64
+
65
+ /**
66
+ * Creates a usage record for a specified subscription item and date, and fills it
67
+ * with a quantity.
68
+ *
69
+ * Usage records provide <code>quantity</code> information that Stripe uses to
70
+ * track how much a customer is using your service. With usage information and the
71
+ * pricing model set up by the <a
72
+ * href="https://stripe.com/docs/billing/subscriptions/metered-billing">metered
73
+ * billing</a> plan, Stripe helps you send accurate invoices to your customers.
74
+ *
75
+ * The default calculation for usage is to add up all the <code>quantity</code>
76
+ * values of the usage records within a billing period. You can change this default
77
+ * behavior with the billing plan’s <code>aggregate_usage</code> <a
78
+ * href="/docs/api/plans/create#create_plan-aggregate_usage">parameter</a>. When
79
+ * there is more than one usage record with the same timestamp, Stripe adds the
80
+ * <code>quantity</code> values together. In most cases, this is the desired
81
+ * resolution, however, you can change this behavior with the <code>action</code>
82
+ * parameter.
83
+ *
84
+ * The default pricing model for metered billing is <a
85
+ * href="/docs/api/plans/object#plan_object-billing_scheme">per-unit pricing</a>.
86
+ * For finer granularity, you can configure metered billing to have a <a
87
+ * href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing</a>
88
+ * model.
89
+ *
90
+ * @param string $parentId
91
+ * @param null|array $params
92
+ * @param null|array|\Stripe\Util\RequestOptions $opts
93
+ *
94
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
95
+ *
96
+ * @return \Stripe\UsageRecord
97
+ */
98
+ public function createUsageRecord($parentId, $params = null, $opts = null)
99
+ {
100
+ return $this->request('post', $this->buildPath('/v1/subscription_items/%s/usage_records', $parentId), $params, $opts);
101
+ }
102
+
103
+ /**
104
+ * Deletes an item from the subscription. Removing a subscription item from a
105
+ * subscription will not cancel the subscription.
106
+ *
107
+ * @param string $id
108
+ * @param null|array $params
109
+ * @param null|array|\Stripe\Util\RequestOptions $opts
110
+ *
111
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
112
+ *
113
+ * @return \Stripe\SubscriptionItem
114
+ */
115
+ public function delete($id, $params = null, $opts = null)
116
+ {
117
+ return $this->request('delete', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts);
118
+ }
119
+
120
+ /**
121
+ * Retrieves the subscription item with the given ID.
122
+ *
123
+ * @param string $id
124
+ * @param null|array $params
125
+ * @param null|array|\Stripe\Util\RequestOptions $opts
126
+ *
127
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
128
+ *
129
+ * @return \Stripe\SubscriptionItem
130
+ */
131
+ public function retrieve($id, $params = null, $opts = null)
132
+ {
133
+ return $this->request('get', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts);
134
+ }
135
+
136
+ /**
137
+ * Updates the plan or quantity of an item on a current subscription.
138
+ *
139
+ * @param string $id
140
+ * @param null|array $params
141
+ * @param null|array|\Stripe\Util\RequestOptions $opts
142
+ *
143
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
144
+ *
145
+ * @return \Stripe\SubscriptionItem
146
+ */
147
+ public function update($id, $params = null, $opts = null)
148
+ {
149
+ return $this->request('post', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts);
150
+ }
151
+ }
app/api/Stripe/Service/SubscriptionScheduleService.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SubscriptionScheduleService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Retrieves the list of your subscription schedules.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/subscription_schedules', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Cancels a subscription schedule and its associated subscription immediately (if
26
+ * the subscription schedule has an active subscription). A subscription schedule
27
+ * can only be canceled if its status is <code>not_started</code> or
28
+ * <code>active</code>.
29
+ *
30
+ * @param string $id
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\SubscriptionSchedule
37
+ */
38
+ public function cancel($id, $params = null, $opts = null)
39
+ {
40
+ return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/cancel', $id), $params, $opts);
41
+ }
42
+
43
+ /**
44
+ * Creates a new subscription schedule object. Each customer can have up to 500
45
+ * active or scheduled subscriptions.
46
+ *
47
+ * @param null|array $params
48
+ * @param null|array|\Stripe\Util\RequestOptions $opts
49
+ *
50
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
51
+ *
52
+ * @return \Stripe\SubscriptionSchedule
53
+ */
54
+ public function create($params = null, $opts = null)
55
+ {
56
+ return $this->request('post', '/v1/subscription_schedules', $params, $opts);
57
+ }
58
+
59
+ /**
60
+ * Releases the subscription schedule immediately, which will stop scheduling of
61
+ * its phases, but leave any existing subscription in place. A schedule can only be
62
+ * released if its status is <code>not_started</code> or <code>active</code>. If
63
+ * the subscription schedule is currently associated with a subscription, releasing
64
+ * it will remove its <code>subscription</code> property and set the subscription’s
65
+ * ID to the <code>released_subscription</code> property.
66
+ *
67
+ * @param string $id
68
+ * @param null|array $params
69
+ * @param null|array|\Stripe\Util\RequestOptions $opts
70
+ *
71
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
72
+ *
73
+ * @return \Stripe\SubscriptionSchedule
74
+ */
75
+ public function release($id, $params = null, $opts = null)
76
+ {
77
+ return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/release', $id), $params, $opts);
78
+ }
79
+
80
+ /**
81
+ * Retrieves the details of an existing subscription schedule. You only need to
82
+ * supply the unique subscription schedule identifier that was returned upon
83
+ * subscription schedule creation.
84
+ *
85
+ * @param string $id
86
+ * @param null|array $params
87
+ * @param null|array|\Stripe\Util\RequestOptions $opts
88
+ *
89
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
90
+ *
91
+ * @return \Stripe\SubscriptionSchedule
92
+ */
93
+ public function retrieve($id, $params = null, $opts = null)
94
+ {
95
+ return $this->request('get', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts);
96
+ }
97
+
98
+ /**
99
+ * Updates an existing subscription schedule.
100
+ *
101
+ * @param string $id
102
+ * @param null|array $params
103
+ * @param null|array|\Stripe\Util\RequestOptions $opts
104
+ *
105
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
106
+ *
107
+ * @return \Stripe\SubscriptionSchedule
108
+ */
109
+ public function update($id, $params = null, $opts = null)
110
+ {
111
+ return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts);
112
+ }
113
+ }
app/api/Stripe/Service/SubscriptionService.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class SubscriptionService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * By default, returns a list of subscriptions that have not been canceled. In
11
+ * order to list canceled subscriptions, specify <code>status=canceled</code>.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/subscriptions', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Cancels a customer’s subscription immediately. The customer will not be charged
27
+ * again for the subscription.
28
+ *
29
+ * Note, however, that any pending invoice items that you’ve created will still be
30
+ * charged for at the end of the period, unless manually <a
31
+ * href="#delete_invoiceitem">deleted</a>. If you’ve set the subscription to cancel
32
+ * at the end of the period, any pending prorations will also be left in place and
33
+ * collected at the end of the period. But if the subscription is set to cancel
34
+ * immediately, pending prorations will be removed.
35
+ *
36
+ * By default, upon subscription cancellation, Stripe will stop automatic
37
+ * collection of all finalized invoices for the customer. This is intended to
38
+ * prevent unexpected payment attempts after the customer has canceled a
39
+ * subscription. However, you can resume automatic collection of the invoices
40
+ * manually after subscription cancellation to have us proceed. Or, you could check
41
+ * for unpaid invoices before allowing the customer to cancel the subscription at
42
+ * all.
43
+ *
44
+ * @param string $id
45
+ * @param null|array $params
46
+ * @param null|array|\Stripe\Util\RequestOptions $opts
47
+ *
48
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
49
+ *
50
+ * @return \Stripe\Subscription
51
+ */
52
+ public function cancel($id, $params = null, $opts = null)
53
+ {
54
+ return $this->request('delete', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts);
55
+ }
56
+
57
+ /**
58
+ * Creates a new subscription on an existing customer. Each customer can have up to
59
+ * 500 active or scheduled subscriptions.
60
+ *
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\Subscription
67
+ */
68
+ public function create($params = null, $opts = null)
69
+ {
70
+ return $this->request('post', '/v1/subscriptions', $params, $opts);
71
+ }
72
+
73
+ /**
74
+ * Removes the currently applied discount on a subscription.
75
+ *
76
+ * @param string $id
77
+ * @param null|array $params
78
+ * @param null|array|\Stripe\Util\RequestOptions $opts
79
+ *
80
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
81
+ *
82
+ * @return \Stripe\Subscription
83
+ */
84
+ public function deleteDiscount($id, $params = null, $opts = null)
85
+ {
86
+ return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts);
87
+ }
88
+
89
+ /**
90
+ * Retrieves the subscription with the given ID.
91
+ *
92
+ * @param string $id
93
+ * @param null|array $params
94
+ * @param null|array|\Stripe\Util\RequestOptions $opts
95
+ *
96
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
97
+ *
98
+ * @return \Stripe\Subscription
99
+ */
100
+ public function retrieve($id, $params = null, $opts = null)
101
+ {
102
+ return $this->request('get', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts);
103
+ }
104
+
105
+ /**
106
+ * Updates an existing subscription on a customer to match the specified
107
+ * parameters. When changing plans or quantities, we will optionally prorate the
108
+ * price we charge next month to make up for any price changes. To preview how the
109
+ * proration will be calculated, use the <a href="#upcoming_invoice">upcoming
110
+ * invoice</a> endpoint.
111
+ *
112
+ * @param string $id
113
+ * @param null|array $params
114
+ * @param null|array|\Stripe\Util\RequestOptions $opts
115
+ *
116
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
117
+ *
118
+ * @return \Stripe\Subscription
119
+ */
120
+ public function update($id, $params = null, $opts = null)
121
+ {
122
+ return $this->request('post', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts);
123
+ }
124
+ }
app/api/Stripe/Service/TaxRateService.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class TaxRateService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your tax rates. Tax rates are returned sorted by creation
11
+ * date, with the most recently created tax rates appearing first.
12
+ *
13
+ * @param null|array $params
14
+ * @param null|array|\Stripe\Util\RequestOptions $opts
15
+ *
16
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
17
+ *
18
+ * @return \Stripe\Collection
19
+ */
20
+ public function all($params = null, $opts = null)
21
+ {
22
+ return $this->requestCollection('get', '/v1/tax_rates', $params, $opts);
23
+ }
24
+
25
+ /**
26
+ * Creates a new tax rate.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\TaxRate
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/tax_rates', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Retrieves a tax rate with the given ID.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\TaxRate
50
+ */
51
+ public function retrieve($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('get', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Updates an existing tax rate.
58
+ *
59
+ * @param string $id
60
+ * @param null|array $params
61
+ * @param null|array|\Stripe\Util\RequestOptions $opts
62
+ *
63
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
64
+ *
65
+ * @return \Stripe\TaxRate
66
+ */
67
+ public function update($id, $params = null, $opts = null)
68
+ {
69
+ return $this->request('post', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
70
+ }
71
+ }
app/api/Stripe/Service/Terminal/ConnectionTokenService.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Terminal;
6
+
7
+ class ConnectionTokenService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived
11
+ * connection token from Stripe, proxied through your server. On your backend, add
12
+ * an endpoint that creates and returns a connection token.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Terminal\ConnectionToken
20
+ */
21
+ public function create($params = null, $opts = null)
22
+ {
23
+ return $this->request('post', '/v1/terminal/connection_tokens', $params, $opts);
24
+ }
25
+ }
app/api/Stripe/Service/Terminal/LocationService.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Terminal;
6
+
7
+ class LocationService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of <code>Location</code> objects.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Creates a new <code>Location</code> object.
26
+ *
27
+ * @param null|array $params
28
+ * @param null|array|\Stripe\Util\RequestOptions $opts
29
+ *
30
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
31
+ *
32
+ * @return \Stripe\Terminal\Location
33
+ */
34
+ public function create($params = null, $opts = null)
35
+ {
36
+ return $this->request('post', '/v1/terminal/locations', $params, $opts);
37
+ }
38
+
39
+ /**
40
+ * Deletes a <code>Location</code> object.
41
+ *
42
+ * @param string $id
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\Terminal\Location
49
+ */
50
+ public function delete($id, $params = null, $opts = null)
51
+ {
52
+ return $this->request('delete', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Retrieves a <code>Location</code> object.
57
+ *
58
+ * @param string $id
59
+ * @param null|array $params
60
+ * @param null|array|\Stripe\Util\RequestOptions $opts
61
+ *
62
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
63
+ *
64
+ * @return \Stripe\Terminal\Location
65
+ */
66
+ public function retrieve($id, $params = null, $opts = null)
67
+ {
68
+ return $this->request('get', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
69
+ }
70
+
71
+ /**
72
+ * Updates a <code>Location</code> object by setting the values of the parameters
73
+ * passed. Any parameters not provided will be left unchanged.
74
+ *
75
+ * @param string $id
76
+ * @param null|array $params
77
+ * @param null|array|\Stripe\Util\RequestOptions $opts
78
+ *
79
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
80
+ *
81
+ * @return \Stripe\Terminal\Location
82
+ */
83
+ public function update($id, $params = null, $opts = null)
84
+ {
85
+ return $this->request('post', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
86
+ }
87
+ }
app/api/Stripe/Service/Terminal/ReaderService.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Terminal;
6
+
7
+ class ReaderService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of <code>Reader</code> objects.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/terminal/readers', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Creates a new <code>Reader</code> object.
26
+ *
27
+ * @param null|array $params
28
+ * @param null|array|\Stripe\Util\RequestOptions $opts
29
+ *
30
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
31
+ *
32
+ * @return \Stripe\Terminal\Reader
33
+ */
34
+ public function create($params = null, $opts = null)
35
+ {
36
+ return $this->request('post', '/v1/terminal/readers', $params, $opts);
37
+ }
38
+
39
+ /**
40
+ * Deletes a <code>Reader</code> object.
41
+ *
42
+ * @param string $id
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\Terminal\Reader
49
+ */
50
+ public function delete($id, $params = null, $opts = null)
51
+ {
52
+ return $this->request('delete', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Retrieves a <code>Reader</code> object.
57
+ *
58
+ * @param string $id
59
+ * @param null|array $params
60
+ * @param null|array|\Stripe\Util\RequestOptions $opts
61
+ *
62
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
63
+ *
64
+ * @return \Stripe\Terminal\Reader
65
+ */
66
+ public function retrieve($id, $params = null, $opts = null)
67
+ {
68
+ return $this->request('get', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
69
+ }
70
+
71
+ /**
72
+ * Updates a <code>Reader</code> object by setting the values of the parameters
73
+ * passed. Any parameters not provided will be left unchanged.
74
+ *
75
+ * @param string $id
76
+ * @param null|array $params
77
+ * @param null|array|\Stripe\Util\RequestOptions $opts
78
+ *
79
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
80
+ *
81
+ * @return \Stripe\Terminal\Reader
82
+ */
83
+ public function update($id, $params = null, $opts = null)
84
+ {
85
+ return $this->request('post', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
86
+ }
87
+ }
app/api/Stripe/Service/Terminal/TerminalServiceFactory.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service\Terminal;
6
+
7
+ /**
8
+ * Service factory class for API resources in the Terminal namespace.
9
+ *
10
+ * @property ConnectionTokenService $connectionTokens
11
+ * @property LocationService $locations
12
+ * @property ReaderService $readers
13
+ */
14
+ class TerminalServiceFactory extends \Stripe\Service\AbstractServiceFactory
15
+ {
16
+ /**
17
+ * @var array<string, string>
18
+ */
19
+ private static $classMap = [
20
+ 'connectionTokens' => ConnectionTokenService::class,
21
+ 'locations' => LocationService::class,
22
+ 'readers' => ReaderService::class,
23
+ ];
24
+
25
+ protected function getServiceClass($name)
26
+ {
27
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
28
+ }
29
+ }
app/api/Stripe/Service/TokenService.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class TokenService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Creates a single-use token that represents a bank account’s details. This token
11
+ * can be used with any API method in place of a bank account dictionary. This
12
+ * token can be used only once, by attaching it to a <a href="#accounts">Custom
13
+ * account</a>.
14
+ *
15
+ * @param null|array $params
16
+ * @param null|array|\Stripe\Util\RequestOptions $opts
17
+ *
18
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
19
+ *
20
+ * @return \Stripe\Token
21
+ */
22
+ public function create($params = null, $opts = null)
23
+ {
24
+ return $this->request('post', '/v1/tokens', $params, $opts);
25
+ }
26
+
27
+ /**
28
+ * Retrieves the token with the given ID.
29
+ *
30
+ * @param string $id
31
+ * @param null|array $params
32
+ * @param null|array|\Stripe\Util\RequestOptions $opts
33
+ *
34
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
35
+ *
36
+ * @return \Stripe\Token
37
+ */
38
+ public function retrieve($id, $params = null, $opts = null)
39
+ {
40
+ return $this->request('get', $this->buildPath('/v1/tokens/%s', $id), $params, $opts);
41
+ }
42
+ }
app/api/Stripe/Service/TopupService.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class TopupService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of top-ups.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/topups', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * Cancels a top-up. Only pending top-ups can be canceled.
26
+ *
27
+ * @param string $id
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\Topup
34
+ */
35
+ public function cancel($id, $params = null, $opts = null)
36
+ {
37
+ return $this->request('post', $this->buildPath('/v1/topups/%s/cancel', $id), $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Top up the balance of an account.
42
+ *
43
+ * @param null|array $params
44
+ * @param null|array|\Stripe\Util\RequestOptions $opts
45
+ *
46
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
47
+ *
48
+ * @return \Stripe\Topup
49
+ */
50
+ public function create($params = null, $opts = null)
51
+ {
52
+ return $this->request('post', '/v1/topups', $params, $opts);
53
+ }
54
+
55
+ /**
56
+ * Retrieves the details of a top-up that has previously been created. Supply the
57
+ * unique top-up ID that was returned from your previous request, and Stripe will
58
+ * return the corresponding top-up information.
59
+ *
60
+ * @param string $id
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\Topup
67
+ */
68
+ public function retrieve($id, $params = null, $opts = null)
69
+ {
70
+ return $this->request('get', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
71
+ }
72
+
73
+ /**
74
+ * Updates the metadata of a top-up. Other top-up details are not editable by
75
+ * design.
76
+ *
77
+ * @param string $id
78
+ * @param null|array $params
79
+ * @param null|array|\Stripe\Util\RequestOptions $opts
80
+ *
81
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
82
+ *
83
+ * @return \Stripe\Topup
84
+ */
85
+ public function update($id, $params = null, $opts = null)
86
+ {
87
+ return $this->request('post', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
88
+ }
89
+ }
app/api/Stripe/Service/TransferService.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class TransferService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of existing transfers sent to connected accounts. The transfers
11
+ * are returned in sorted order, with the most recently created transfers appearing
12
+ * first.
13
+ *
14
+ * @param null|array $params
15
+ * @param null|array|\Stripe\Util\RequestOptions $opts
16
+ *
17
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
18
+ *
19
+ * @return \Stripe\Collection
20
+ */
21
+ public function all($params = null, $opts = null)
22
+ {
23
+ return $this->requestCollection('get', '/v1/transfers', $params, $opts);
24
+ }
25
+
26
+ /**
27
+ * You can see a list of the reversals belonging to a specific transfer. Note that
28
+ * the 10 most recent reversals are always available by default on the transfer
29
+ * object. If you need more than those 10, you can use this API method and the
30
+ * <code>limit</code> and <code>starting_after</code> parameters to page through
31
+ * additional reversals.
32
+ *
33
+ * @param string $parentId
34
+ * @param null|array $params
35
+ * @param null|array|\Stripe\Util\RequestOptions $opts
36
+ *
37
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
38
+ *
39
+ * @return \Stripe\Collection
40
+ */
41
+ public function allReversals($parentId, $params = null, $opts = null)
42
+ {
43
+ return $this->requestCollection('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts);
44
+ }
45
+
46
+ /**
47
+ * @param string $id
48
+ * @param null|array $params
49
+ * @param null|array|\Stripe\Util\RequestOptions $opts
50
+ *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return \Stripe\Transfer
54
+ */
55
+ public function cancel($id, $params = null, $opts = null)
56
+ {
57
+ return $this->request('post', $this->buildPath('/v1/transfers/%s/cancel', $id), $params, $opts);
58
+ }
59
+
60
+ /**
61
+ * To send funds from your Stripe account to a connected account, you create a new
62
+ * transfer object. Your <a href="#balance">Stripe balance</a> must be able to
63
+ * cover the transfer amount, or you’ll receive an “Insufficient Funds” error.
64
+ *
65
+ * @param null|array $params
66
+ * @param null|array|\Stripe\Util\RequestOptions $opts
67
+ *
68
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
69
+ *
70
+ * @return \Stripe\Transfer
71
+ */
72
+ public function create($params = null, $opts = null)
73
+ {
74
+ return $this->request('post', '/v1/transfers', $params, $opts);
75
+ }
76
+
77
+ /**
78
+ * When you create a new reversal, you must specify a transfer to create it on.
79
+ *
80
+ * When reversing transfers, you can optionally reverse part of the transfer. You
81
+ * can do so as many times as you wish until the entire transfer has been reversed.
82
+ *
83
+ * Once entirely reversed, a transfer can’t be reversed again. This method will
84
+ * return an error when called on an already-reversed transfer, or when trying to
85
+ * reverse more money than is left on a transfer.
86
+ *
87
+ * @param string $parentId
88
+ * @param null|array $params
89
+ * @param null|array|\Stripe\Util\RequestOptions $opts
90
+ *
91
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
92
+ *
93
+ * @return \Stripe\TransferReversal
94
+ */
95
+ public function createReversal($parentId, $params = null, $opts = null)
96
+ {
97
+ return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts);
98
+ }
99
+
100
+ /**
101
+ * Retrieves the details of an existing transfer. Supply the unique transfer ID
102
+ * from either a transfer creation request or the transfer list, and Stripe will
103
+ * return the corresponding transfer information.
104
+ *
105
+ * @param string $id
106
+ * @param null|array $params
107
+ * @param null|array|\Stripe\Util\RequestOptions $opts
108
+ *
109
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
110
+ *
111
+ * @return \Stripe\Transfer
112
+ */
113
+ public function retrieve($id, $params = null, $opts = null)
114
+ {
115
+ return $this->request('get', $this->buildPath('/v1/transfers/%s', $id), $params, $opts);
116
+ }
117
+
118
+ /**
119
+ * By default, you can see the 10 most recent reversals stored directly on the
120
+ * transfer object, but you can also retrieve details about a specific reversal
121
+ * stored on the transfer.
122
+ *
123
+ * @param string $parentId
124
+ * @param string $id
125
+ * @param null|array $params
126
+ * @param null|array|\Stripe\Util\RequestOptions $opts
127
+ *
128
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
129
+ *
130
+ * @return \Stripe\TransferReversal
131
+ */
132
+ public function retrieveReversal($parentId, $id, $params = null, $opts = null)
133
+ {
134
+ return $this->request('get', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts);
135
+ }
136
+
137
+ /**
138
+ * Updates the specified transfer by setting the values of the parameters passed.
139
+ * Any parameters not provided will be left unchanged.
140
+ *
141
+ * This request accepts only metadata as an argument.
142
+ *
143
+ * @param string $id
144
+ * @param null|array $params
145
+ * @param null|array|\Stripe\Util\RequestOptions $opts
146
+ *
147
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
148
+ *
149
+ * @return \Stripe\Transfer
150
+ */
151
+ public function update($id, $params = null, $opts = null)
152
+ {
153
+ return $this->request('post', $this->buildPath('/v1/transfers/%s', $id), $params, $opts);
154
+ }
155
+
156
+ /**
157
+ * Updates the specified reversal by setting the values of the parameters passed.
158
+ * Any parameters not provided will be left unchanged.
159
+ *
160
+ * This request only accepts metadata and description as arguments.
161
+ *
162
+ * @param string $parentId
163
+ * @param string $id
164
+ * @param null|array $params
165
+ * @param null|array|\Stripe\Util\RequestOptions $opts
166
+ *
167
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
168
+ *
169
+ * @return \Stripe\TransferReversal
170
+ */
171
+ public function updateReversal($parentId, $id, $params = null, $opts = null)
172
+ {
173
+ return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts);
174
+ }
175
+ }
app/api/Stripe/Service/WebhookEndpointService.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class WebhookEndpointService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your webhook endpoints.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/webhook_endpoints', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * A webhook endpoint must have a <code>url</code> and a list of
26
+ * <code>enabled_events</code>. You may optionally specify the Boolean
27
+ * <code>connect</code> parameter. If set to true, then a Connect webhook endpoint
28
+ * that notifies the specified <code>url</code> about events from all connected
29
+ * accounts is created; otherwise an account webhook endpoint that notifies the
30
+ * specified <code>url</code> only about events from your account is created. You
31
+ * can also create webhook endpoints in the <a
32
+ * href="https://dashboard.stripe.com/account/webhooks">webhooks settings</a>
33
+ * section of the Dashboard.
34
+ *
35
+ * @param null|array $params
36
+ * @param null|array|\Stripe\Util\RequestOptions $opts
37
+ *
38
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
39
+ *
40
+ * @return \Stripe\WebhookEndpoint
41
+ */
42
+ public function create($params = null, $opts = null)
43
+ {
44
+ return $this->request('post', '/v1/webhook_endpoints', $params, $opts);
45
+ }
46
+
47
+ /**
48
+ * You can also delete webhook endpoints via the <a
49
+ * href="https://dashboard.stripe.com/account/webhooks">webhook endpoint
50
+ * management</a> page of the Stripe dashboard.
51
+ *
52
+ * @param string $id
53
+ * @param null|array $params
54
+ * @param null|array|\Stripe\Util\RequestOptions $opts
55
+ *
56
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
57
+ *
58
+ * @return \Stripe\WebhookEndpoint
59
+ */
60
+ public function delete($id, $params = null, $opts = null)
61
+ {
62
+ return $this->request('delete', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
63
+ }
64
+
65
+ /**
66
+ * Retrieves the webhook endpoint with the given ID.
67
+ *
68
+ * @param string $id
69
+ * @param null|array $params
70
+ * @param null|array|\Stripe\Util\RequestOptions $opts
71
+ *
72
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
73
+ *
74
+ * @return \Stripe\WebhookEndpoint
75
+ */
76
+ public function retrieve($id, $params = null, $opts = null)
77
+ {
78
+ return $this->request('get', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
79
+ }
80
+
81
+ /**
82
+ * Updates the webhook endpoint. You may edit the <code>url</code>, the list of
83
+ * <code>enabled_events</code>, and the status of your endpoint.
84
+ *
85
+ * @param string $id
86
+ * @param null|array $params
87
+ * @param null|array|\Stripe\Util\RequestOptions $opts
88
+ *
89
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
90
+ *
91
+ * @return \Stripe\WebhookEndpoint
92
+ */
93
+ public function update($id, $params = null, $opts = null)
94
+ {
95
+ return $this->request('post', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
96
+ }
97
+ }
app/api/Stripe/SetupAttempt.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * A SetupAttempt describes one attempted confirmation of a SetupIntent, whether
9
+ * that confirmation was successful or unsuccessful. You can use SetupAttempts to
10
+ * inspect details of a specific attempt at setting up a payment method using a
11
+ * SetupIntent.
12
+ *
13
+ * @property string $id Unique identifier for the object.
14
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
15
+ * @property null|string|\Stripe\StripeObject $application The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application">application</a> on the SetupIntent at the time of this confirmation.
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property null|string|\Stripe\Customer $customer The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer">customer</a> on the SetupIntent at the time of this confirmation.
18
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
19
+ * @property null|string|\Stripe\Account $on_behalf_of The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of">on_behalf_of</a> on the SetupIntent at the time of this confirmation.
20
+ * @property string|\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupAttempt.
21
+ * @property \Stripe\StripeObject $payment_method_details
22
+ * @property null|\Stripe\ErrorObject $setup_error The error encountered during this attempt to confirm the SetupIntent, if any.
23
+ * @property string|\Stripe\SetupIntent $setup_intent ID of the SetupIntent that this attempt belongs to.
24
+ * @property string $status Status of this SetupAttempt, one of <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>succeeded</code>, <code>failed</code>, or <code>abandoned</code>.
25
+ * @property string $usage The value of <a href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage">usage</a> on the SetupIntent at the time of this confirmation, one of <code>off_session</code> or <code>on_session</code>.
26
+ */
27
+ class SetupAttempt extends ApiResource
28
+ {
29
+ const OBJECT_NAME = 'setup_attempt';
30
+
31
+ use ApiOperations\All;
32
+ }
app/api/Stripe/SetupIntent.php CHANGED
@@ -1,74 +1,114 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SetupIntent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $application
11
- * @property string $client_secret
12
- * @property int $created
13
- * @property string $customer
14
- * @property string $description
15
- * @property mixed $last_setup_error
16
- * @property bool $livemode
17
- * @property StripeObject $metadata
18
- * @property mixed $next_action
19
- * @property string $on_behalf_of
20
- * @property string $payment_method
21
- * @property string[] $payment_method_types
22
- * @property string $status
23
  *
24
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  */
26
  class SetupIntent extends ApiResource
27
  {
28
- const OBJECT_NAME = "setup_intent";
29
 
30
  use ApiOperations\All;
31
  use ApiOperations\Create;
32
  use ApiOperations\Retrieve;
33
  use ApiOperations\Update;
34
 
35
- /**
36
- * These constants are possible representations of the status field.
37
- *
38
- * @link https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
39
- */
40
- const STATUS_CANCELED = 'canceled';
41
- const STATUS_PROCESSING = 'processing';
42
- const STATUS_REQUIRES_ACTION = 'requires_action';
43
- const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
44
  const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
45
- const STATUS_SUCCEEDED = 'succeeded';
46
 
47
  /**
48
- * @param array|null $params
49
- * @param array|string|null $options
 
 
50
  *
51
- * @return SetupIntent The canceled setup intent.
52
  */
53
- public function cancel($params = null, $options = null)
54
  {
55
  $url = $this->instanceUrl() . '/cancel';
56
- list($response, $opts) = $this->_request('post', $url, $params, $options);
57
  $this->refreshFrom($response, $opts);
 
58
  return $this;
59
  }
60
 
61
  /**
62
- * @param array|null $params
63
- * @param array|string|null $options
64
  *
65
- * @return SetupIntent The confirmed setup intent.
 
 
66
  */
67
- public function confirm($params = null, $options = null)
68
  {
69
  $url = $this->instanceUrl() . '/confirm';
70
- list($response, $opts) = $this->_request('post', $url, $params, $options);
71
  $this->refreshFrom($response, $opts);
 
72
  return $this;
73
  }
74
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A SetupIntent guides you through the process of setting up and saving a
9
+ * customer's payment credentials for future payments. For example, you could use a
10
+ * SetupIntent to set up and save your customer's card without immediately
11
+ * collecting a payment. Later, you can use <a
12
+ * href="https://stripe.com/docs/api#payment_intents">PaymentIntents</a> to drive
13
+ * the payment flow.
14
+ *
15
+ * Create a SetupIntent as soon as you're ready to collect your customer's payment
16
+ * credentials. Do not maintain long-lived, unconfirmed SetupIntents as they may no
17
+ * longer be valid. The SetupIntent then transitions through multiple <a
18
+ * href="https://stripe.com/docs/payments/intents#intent-statuses">statuses</a> as
19
+ * it guides you through the setup process.
20
+ *
21
+ * Successful SetupIntents result in payment credentials that are optimized for
22
+ * future payments. For example, cardholders in <a
23
+ * href="/guides/strong-customer-authentication">certain regions</a> may need to be
24
+ * run through <a
25
+ * href="https://stripe.com/docs/strong-customer-authentication">Strong Customer
26
+ * Authentication</a> at the time of payment method collection in order to
27
+ * streamline later <a
28
+ * href="https://stripe.com/docs/payments/setup-intents">off-session payments</a>.
29
+ * If the SetupIntent is used with a <a
30
+ * href="https://stripe.com/docs/api#setup_intent_object-customer">Customer</a>,
31
+ * upon success, it will automatically attach the resulting payment method to that
32
+ * Customer. We recommend using SetupIntents or <a
33
+ * href="https://stripe.com/docs/api#payment_intent_object-setup_future_usage">setup_future_usage</a>
34
+ * on PaymentIntents to save payment methods in order to prevent saving invalid or
35
+ * unoptimized payment methods.
36
  *
37
+ * By using SetupIntents, you ensure that your customers experience the minimum set
38
+ * of required friction, even as regulations change over time.
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  *
40
+ * Related guide: <a href="https://stripe.com/docs/payments/setup-intents">Setup
41
+ * Intents API</a>.
42
+ *
43
+ * @property string $id Unique identifier for the object.
44
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
45
+ * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the SetupIntent.
46
+ * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of <code>abandoned</code>, <code>requested_by_customer</code>, or <code>duplicate</code>.
47
+ * @property null|string $client_secret <p>The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p>
48
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
49
+ * @property null|string|\Stripe\Customer $customer <p>ID of the Customer this SetupIntent belongs to, if one exists.</p><p>If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.</p>
50
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
51
+ * @property null|\Stripe\ErrorObject $last_setup_error The error encountered in the previous SetupIntent confirmation.
52
+ * @property null|string|\Stripe\SetupAttempt $latest_attempt The most recent SetupAttempt for this SetupIntent.
53
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
54
+ * @property null|string|\Stripe\Mandate $mandate ID of the multi use Mandate generated by the SetupIntent.
55
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
56
+ * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to continue payment setup.
57
+ * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the setup is intended.
58
+ * @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupIntent.
59
+ * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for this SetupIntent.
60
+ * @property string[] $payment_method_types The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.
61
+ * @property null|string|\Stripe\Mandate $single_use_mandate ID of the single_use Mandate generated by the SetupIntent.
62
+ * @property string $status <a href="https://stripe.com/docs/payments/intents#intent-statuses">Status</a> of this SetupIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>canceled</code>, or <code>succeeded</code>.
63
+ * @property string $usage <p>Indicates how the payment method is intended to be used in the future.</p><p>Use <code>on_session</code> if you intend to only reuse the payment method when the customer is in your checkout flow. Use <code>off_session</code> if your customer may or may not be in your checkout flow. If not provided, this value defaults to <code>off_session</code>.</p>
64
  */
65
  class SetupIntent extends ApiResource
66
  {
67
+ const OBJECT_NAME = 'setup_intent';
68
 
69
  use ApiOperations\All;
70
  use ApiOperations\Create;
71
  use ApiOperations\Retrieve;
72
  use ApiOperations\Update;
73
 
74
+ const STATUS_CANCELED = 'canceled';
75
+ const STATUS_PROCESSING = 'processing';
76
+ const STATUS_REQUIRES_ACTION = 'requires_action';
77
+ const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
 
 
 
 
 
78
  const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
79
+ const STATUS_SUCCEEDED = 'succeeded';
80
 
81
  /**
82
+ * @param null|array $params
83
+ * @param null|array|string $opts
84
+ *
85
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
86
  *
87
+ * @return SetupIntent the canceled setup intent
88
  */
89
+ public function cancel($params = null, $opts = null)
90
  {
91
  $url = $this->instanceUrl() . '/cancel';
92
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
93
  $this->refreshFrom($response, $opts);
94
+
95
  return $this;
96
  }
97
 
98
  /**
99
+ * @param null|array $params
100
+ * @param null|array|string $opts
101
  *
102
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
103
+ *
104
+ * @return SetupIntent the confirmed setup intent
105
  */
106
+ public function confirm($params = null, $opts = null)
107
  {
108
  $url = $this->instanceUrl() . '/confirm';
109
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
110
  $this->refreshFrom($response, $opts);
111
+
112
  return $this;
113
  }
114
  }
app/api/Stripe/Sigma/ScheduledQueryRun.php CHANGED
@@ -1,33 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Sigma;
4
 
5
  /**
6
- * Class Authorization
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property int $data_load_time
12
- * @property string $error
13
- * @property \Stripe\FileUpload $file
14
- * @property bool $livemode
15
- * @property int $result_available_until
16
- * @property string $sql
17
- * @property string $status
18
- * @property string $title
19
  *
20
- * @package Stripe\Sigma
 
 
 
 
 
 
 
 
 
 
21
  */
22
  class ScheduledQueryRun extends \Stripe\ApiResource
23
  {
24
- const OBJECT_NAME = "scheduled_query_run";
25
 
26
  use \Stripe\ApiOperations\All;
27
  use \Stripe\ApiOperations\Retrieve;
28
 
29
  public static function classUrl()
30
  {
31
- return "/v1/sigma/scheduled_query_runs";
32
  }
33
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Sigma;
6
 
7
  /**
8
+ * If you have <a href="https://stripe.com/docs/sigma/scheduled-queries">scheduled
9
+ * a Sigma query</a>, you'll receive a
10
+ * <code>sigma.scheduled_query_run.created</code> webhook each time the query runs.
11
+ * The webhook contains a <code>ScheduledQueryRun</code> object, which you can use
12
+ * to retrieve the query results.
 
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property int $data_load_time When the query was run, Sigma contained a snapshot of your Stripe data at this time.
18
+ * @property \Stripe\StripeObject $error
19
+ * @property null|\Stripe\File $file The file object representing the results of the query.
20
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
21
+ * @property int $result_available_until Time at which the result expires and is no longer available for download.
22
+ * @property string $sql SQL for the query.
23
+ * @property string $status The query's execution status, which will be <code>completed</code> for successful runs, and <code>canceled</code>, <code>failed</code>, or <code>timed_out</code> otherwise.
24
+ * @property string $title Title of the query.
25
  */
26
  class ScheduledQueryRun extends \Stripe\ApiResource
27
  {
28
+ const OBJECT_NAME = 'scheduled_query_run';
29
 
30
  use \Stripe\ApiOperations\All;
31
  use \Stripe\ApiOperations\Retrieve;
32
 
33
  public static function classUrl()
34
  {
35
+ return '/v1/sigma/scheduled_query_runs';
36
  }
37
  }
app/api/Stripe/SingletonApiResource.php CHANGED
@@ -3,9 +3,7 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SingletonApiResource
7
- *
8
- * @package Stripe
9
  */
10
  abstract class SingletonApiResource extends ApiResource
11
  {
@@ -14,22 +12,24 @@ abstract class SingletonApiResource extends ApiResource
14
  $opts = Util\RequestOptions::parse($options);
15
  $instance = new static(null, $opts);
16
  $instance->refresh();
 
17
  return $instance;
18
  }
19
 
20
  /**
21
- * @return string The endpoint associated with this singleton class.
22
  */
23
  public static function classUrl()
24
  {
25
  // Replace dots with slashes for namespaced resources, e.g. if the object's name is
26
  // "foo.bar", then its URL will be "/v1/foo/bar".
27
- $base = str_replace('.', '/', static::OBJECT_NAME);
28
- return "/v1/${base}";
 
29
  }
30
 
31
  /**
32
- * @return string The endpoint associated with this singleton API resource.
33
  */
34
  public function instanceUrl()
35
  {
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class SingletonApiResource.
 
 
7
  */
8
  abstract class SingletonApiResource extends ApiResource
9
  {
12
  $opts = Util\RequestOptions::parse($options);
13
  $instance = new static(null, $opts);
14
  $instance->refresh();
15
+
16
  return $instance;
17
  }
18
 
19
  /**
20
+ * @return string the endpoint associated with this singleton class
21
  */
22
  public static function classUrl()
23
  {
24
  // Replace dots with slashes for namespaced resources, e.g. if the object's name is
25
  // "foo.bar", then its URL will be "/v1/foo/bar".
26
+ $base = \str_replace('.', '/', static::OBJECT_NAME);
27
+
28
+ return "/v1/{$base}";
29
  }
30
 
31
  /**
32
+ * @return string the endpoint associated with this singleton API resource
33
  */
34
  public function instanceUrl()
35
  {
app/api/Stripe/Source.php CHANGED
@@ -1,153 +1,168 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Source
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $ach_credit_transfer
11
- * @property mixed $ach_debit
12
- * @property mixed $alipay
13
- * @property int $amount
14
- * @property mixed $bancontact
15
- * @property mixed $card
16
- * @property mixed $card_present
17
- * @property string $client_secret
18
- * @property mixed $code_verification
19
- * @property int $created
20
- * @property string $currency
21
- * @property string $customer
22
- * @property mixed $eps
23
- * @property string $flow
24
- * @property mixed $giropay
25
- * @property mixed $ideal
26
- * @property bool $livemode
27
- * @property StripeObject $metadata
28
- * @property mixed $multibanco
29
- * @property mixed $owner
30
- * @property mixed $p24
31
- * @property mixed $receiver
32
- * @property mixed $redirect
33
- * @property mixed $sepa_debit
34
- * @property mixed $sofort
35
- * @property string $statement_descriptor
36
- * @property string $status
37
- * @property mixed $three_d_secure
38
- * @property string $type
39
- * @property string $usage
40
- * @property mixed $wechat
41
-
42
- * @package Stripe
 
 
 
43
  */
44
  class Source extends ApiResource
45
  {
46
- const OBJECT_NAME = "source";
47
 
48
  use ApiOperations\Create;
49
  use ApiOperations\Retrieve;
50
  use ApiOperations\Update;
51
 
52
- /**
53
- * Possible string representations of source flows.
54
- * @link https://stripe.com/docs/api#source_object-flow
55
- */
56
- const FLOW_REDIRECT = 'redirect';
57
- const FLOW_RECEIVER = 'receiver';
58
  const FLOW_CODE_VERIFICATION = 'code_verification';
59
- const FLOW_NONE = 'none';
 
 
60
 
61
- /**
62
- * Possible string representations of source statuses.
63
- * @link https://stripe.com/docs/api#source_object-status
64
- */
65
- const STATUS_CANCELED = 'canceled';
66
  const STATUS_CHARGEABLE = 'chargeable';
67
- const STATUS_CONSUMED = 'consumed';
68
- const STATUS_FAILED = 'failed';
69
- const STATUS_PENDING = 'pending';
70
 
71
- /**
72
- * Possible string representations of source usage.
73
- * @link https://stripe.com/docs/api#source_object-usage
74
- */
75
- const USAGE_REUSABLE = 'reusable';
76
  const USAGE_SINGLE_USE = 'single_use';
77
 
 
 
78
  /**
79
- * @param array|null $params
80
- * @param array|string|null $options
81
  *
82
- * @return Source The detached source.
 
 
 
83
  */
84
- public function detach($params = null, $options = null)
85
  {
86
  self::_validateParams($params);
87
 
88
  $id = $this['id'];
89
  if (!$id) {
90
- $class = get_class($this);
91
- $msg = "Could not determine which URL to request: $class instance "
92
- . "has invalid ID: $id";
93
- throw new Error\InvalidRequest($msg, null);
 
94
  }
95
 
96
  if ($this['customer']) {
97
  $base = Customer::classUrl();
98
- $parentExtn = urlencode(Util\Util::utf8($this['customer']));
99
- $extn = urlencode(Util\Util::utf8($id));
100
- $url = "$base/$parentExtn/sources/$extn";
101
 
102
- list($response, $opts) = $this->_request('delete', $url, $params, $options);
103
  $this->refreshFrom($response, $opts);
 
104
  return $this;
105
- } else {
106
- $message = "This source object does not appear to be currently attached "
107
- . "to a customer object.";
108
- throw new Error\Api($message);
109
  }
 
 
 
 
110
  }
111
 
112
  /**
113
- * @param array|null $params
114
- * @param array|string|null $options
 
 
115
  *
116
- * @return Source The detached source.
117
  *
118
- * @deprecated Use the `detach` method instead.
119
  */
120
- public function delete($params = null, $options = null)
121
  {
122
- $this->detach($params, $options);
 
 
 
 
 
123
  }
124
 
125
  /**
126
- * @param array|null $params
127
- * @param array|string|null $options
 
128
  *
129
- * @return Collection The list of source transactions.
 
 
130
  */
131
- public function sourceTransactions($params = null, $options = null)
132
  {
133
- $url = $this->instanceUrl() . '/source_transactions';
134
- list($response, $opts) = $this->_request('get', $url, $params, $options);
135
- $obj = Util\Util::convertToStripeObject($response, $opts);
136
- $obj->setLastResponse($response);
137
- return $obj;
138
  }
139
 
140
  /**
141
- * @param array|null $params
142
- * @param array|string|null $options
 
 
143
  *
144
- * @return Source The verified source.
145
  */
146
- public function verify($params = null, $options = null)
147
  {
148
  $url = $this->instanceUrl() . '/verify';
149
- list($response, $opts) = $this->_request('post', $url, $params, $options);
150
  $this->refreshFrom($response, $opts);
 
151
  return $this;
152
  }
153
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <code>Source</code> objects allow you to accept a variety of payment methods.
9
+ * They represent a customer's payment instrument, and can be used with the Stripe
10
+ * API just like a <code>Card</code> object: once chargeable, they can be charged,
11
+ * or can be attached to customers.
12
+ *
13
+ * Related guides: <a href="https://stripe.com/docs/sources">Sources API</a> and <a
14
+ * href="https://stripe.com/docs/sources/customers">Sources &amp; Customers</a>.
15
  *
16
+ * @property string $id Unique identifier for the object.
17
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property \Stripe\StripeObject $ach_credit_transfer
19
+ * @property \Stripe\StripeObject $ach_debit
20
+ * @property \Stripe\StripeObject $acss_debit
21
+ * @property \Stripe\StripeObject $alipay
22
+ * @property null|int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for <code>single_use</code> sources.
23
+ * @property \Stripe\StripeObject $au_becs_debit
24
+ * @property \Stripe\StripeObject $bancontact
25
+ * @property \Stripe\StripeObject $card
26
+ * @property \Stripe\StripeObject $card_present
27
+ * @property string $client_secret The client secret of the source. Used for client-side retrieval using a publishable key.
28
+ * @property \Stripe\StripeObject $code_verification
29
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
30
+ * @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> associated with the source. This is the currency for which the source will be chargeable once ready. Required for <code>single_use</code> sources.
31
+ * @property string $customer The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer.
32
+ * @property \Stripe\StripeObject $eps
33
+ * @property string $flow The authentication <code>flow</code> of the source. <code>flow</code> is one of <code>redirect</code>, <code>receiver</code>, <code>code_verification</code>, <code>none</code>.
34
+ * @property \Stripe\StripeObject $giropay
35
+ * @property \Stripe\StripeObject $ideal
36
+ * @property \Stripe\StripeObject $klarna
37
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
38
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
39
+ * @property \Stripe\StripeObject $multibanco
40
+ * @property null|\Stripe\StripeObject $owner Information about the owner of the payment instrument that may be used or required by particular source types.
41
+ * @property \Stripe\StripeObject $p24
42
+ * @property \Stripe\StripeObject $receiver
43
+ * @property \Stripe\StripeObject $redirect
44
+ * @property \Stripe\StripeObject $sepa_credit_transfer
45
+ * @property \Stripe\StripeObject $sepa_debit
46
+ * @property \Stripe\StripeObject $sofort
47
+ * @property \Stripe\StripeObject $source_order
48
+ * @property null|string $statement_descriptor Extra information about a source. This will appear on your customer's statement every time you charge the source.
49
+ * @property string $status The status of the source, one of <code>canceled</code>, <code>chargeable</code>, <code>consumed</code>, <code>failed</code>, or <code>pending</code>. Only <code>chargeable</code> sources can be used to create a charge.
50
+ * @property \Stripe\StripeObject $three_d_secure
51
+ * @property string $type The <code>type</code> of the source. The <code>type</code> is a payment method, one of <code>ach_credit_transfer</code>, <code>ach_debit</code>, <code>alipay</code>, <code>bancontact</code>, <code>card</code>, <code>card_present</code>, <code>eps</code>, <code>giropay</code>, <code>ideal</code>, <code>multibanco</code>, <code>klarna</code>, <code>p24</code>, <code>sepa_debit</code>, <code>sofort</code>, <code>three_d_secure</code>, or <code>wechat</code>. An additional hash is included on the source with a name matching this value. It contains additional information specific to the <a href="https://stripe.com/docs/sources">payment method</a> used.
52
+ * @property null|string $usage Either <code>reusable</code> or <code>single_use</code>. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
53
+ * @property \Stripe\StripeObject $wechat
54
  */
55
  class Source extends ApiResource
56
  {
57
+ const OBJECT_NAME = 'source';
58
 
59
  use ApiOperations\Create;
60
  use ApiOperations\Retrieve;
61
  use ApiOperations\Update;
62
 
 
 
 
 
 
 
63
  const FLOW_CODE_VERIFICATION = 'code_verification';
64
+ const FLOW_NONE = 'none';
65
+ const FLOW_RECEIVER = 'receiver';
66
+ const FLOW_REDIRECT = 'redirect';
67
 
68
+ const STATUS_CANCELED = 'canceled';
 
 
 
 
69
  const STATUS_CHARGEABLE = 'chargeable';
70
+ const STATUS_CONSUMED = 'consumed';
71
+ const STATUS_FAILED = 'failed';
72
+ const STATUS_PENDING = 'pending';
73
 
74
+ const USAGE_REUSABLE = 'reusable';
 
 
 
 
75
  const USAGE_SINGLE_USE = 'single_use';
76
 
77
+ use ApiOperations\NestedResource;
78
+
79
  /**
80
+ * @param null|array $params
81
+ * @param null|array|string $opts
82
  *
83
+ * @throws \Stripe\Exception\UnexpectedValueException if the source is not attached to a customer
84
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
85
+ *
86
+ * @return \Stripe\Source the detached source
87
  */
88
+ public function detach($params = null, $opts = null)
89
  {
90
  self::_validateParams($params);
91
 
92
  $id = $this['id'];
93
  if (!$id) {
94
+ $class = static::class;
95
+ $msg = "Could not determine which URL to request: {$class} instance "
96
+ . "has invalid ID: {$id}";
97
+
98
+ throw new Exception\UnexpectedValueException($msg, null);
99
  }
100
 
101
  if ($this['customer']) {
102
  $base = Customer::classUrl();
103
+ $parentExtn = \urlencode(Util\Util::utf8($this['customer']));
104
+ $extn = \urlencode(Util\Util::utf8($id));
105
+ $url = "{$base}/{$parentExtn}/sources/{$extn}";
106
 
107
+ list($response, $opts) = $this->_request('delete', $url, $params, $opts);
108
  $this->refreshFrom($response, $opts);
109
+
110
  return $this;
 
 
 
 
111
  }
112
+ $message = 'This source object does not appear to be currently attached '
113
+ . 'to a customer object.';
114
+
115
+ throw new Exception\UnexpectedValueException($message);
116
  }
117
 
118
  /**
119
+ * @deprecated sourceTransactions is deprecated. Please use Source::allSourceTransactions instead.
120
+ *
121
+ * @param null|array $params
122
+ * @param null|array|string $opts
123
  *
124
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
125
  *
126
+ * @return \Stripe\Collection the list of source transactions
127
  */
128
+ public function sourceTransactions($params = null, $opts = null)
129
  {
130
+ $url = $this->instanceUrl() . '/source_transactions';
131
+ list($response, $opts) = $this->_request('get', $url, $params, $opts);
132
+ $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
133
+ $obj->setLastResponse($response);
134
+
135
+ return $obj;
136
  }
137
 
138
  /**
139
+ * @param string $id
140
+ * @param null|array $params
141
+ * @param null|array|string $opts
142
  *
143
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
144
+ *
145
+ * @return \Stripe\Collection the list of source transactions
146
  */
147
+ public static function allSourceTransactions($id, $params = null, $opts = null)
148
  {
149
+ return self::_allNestedResources($id, '/source_transactions', $params, $opts);
 
 
 
 
150
  }
151
 
152
  /**
153
+ * @param null|array $params
154
+ * @param null|array|string $opts
155
+ *
156
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
157
  *
158
+ * @return Source the verified source
159
  */
160
+ public function verify($params = null, $opts = null)
161
  {
162
  $url = $this->instanceUrl() . '/verify';
163
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
164
  $this->refreshFrom($response, $opts);
165
+
166
  return $this;
167
  }
168
  }
app/api/Stripe/SourceTransaction.php CHANGED
@@ -3,20 +3,18 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SourceTransaction
7
  *
8
  * @property string $id
9
  * @property string $object
 
10
  * @property int $amount
11
  * @property int $created
12
  * @property string $customer_data
13
  * @property string $currency
14
  * @property string $type
15
- * @property mixed $ach_credit_transfer
16
- *
17
- * @package Stripe
18
  */
19
  class SourceTransaction extends ApiResource
20
  {
21
- const OBJECT_NAME = "source_transaction";
22
  }
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class SourceTransaction.
7
  *
8
  * @property string $id
9
  * @property string $object
10
+ * @property \Stripe\StripeObject $ach_credit_transfer
11
  * @property int $amount
12
  * @property int $created
13
  * @property string $customer_data
14
  * @property string $currency
15
  * @property string $type
 
 
 
16
  */
17
  class SourceTransaction extends ApiResource
18
  {
19
+ const OBJECT_NAME = 'source_transaction';
20
  }
app/api/Stripe/Stripe.php CHANGED
@@ -3,62 +3,65 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Stripe
7
- *
8
- * @package Stripe
9
  */
10
  class Stripe
11
  {
12
- // @var string The Stripe API key to be used for requests.
13
  public static $apiKey;
14
 
15
- // @var string The Stripe client_id to be used for Connect requests.
16
  public static $clientId;
17
 
18
- // @var string The base URL for the Stripe API.
19
  public static $apiBase = 'https://api.stripe.com';
20
 
21
- // @var string The base URL for the OAuth API.
22
  public static $connectBase = 'https://connect.stripe.com';
23
 
24
- // @var string The base URL for the Stripe API uploads endpoint.
25
  public static $apiUploadBase = 'https://files.stripe.com';
26
 
27
- // @var string|null The version of the Stripe API to use for requests.
28
  public static $apiVersion = null;
29
 
30
- // @var string|null The account ID for connected accounts requests.
31
  public static $accountId = null;
32
 
33
- // @var string Path to the CA bundle used to verify SSL certificates
34
  public static $caBundlePath = null;
35
 
36
- // @var boolean Defaults to true.
37
  public static $verifySslCerts = true;
38
 
39
- // @var array The application's information (name, version, URL)
40
  public static $appInfo = null;
41
 
42
- // @var Util\LoggerInterface|null The logger to which the library will
43
- // produce messages.
 
 
44
  public static $logger = null;
45
 
46
- // @var int Maximum number of request retries
47
  public static $maxNetworkRetries = 0;
48
 
49
- // @var boolean Whether client telemetry is enabled. Defaults to false.
50
  public static $enableTelemetry = true;
51
 
52
- // @var float Maximum delay between retries, in seconds
53
  private static $maxNetworkRetryDelay = 2.0;
54
 
55
- // @var float Initial delay between retries, in seconds
 
 
 
56
  private static $initialNetworkRetryDelay = 0.5;
57
 
58
- const VERSION = '6.43.0';
59
 
60
  /**
61
- * @return string The API key used for requests.
62
  */
63
  public static function getApiKey()
64
  {
@@ -66,7 +69,7 @@ class Stripe
66
  }
67
 
68
  /**
69
- * @return string The client_id used for Connect requests.
70
  */
71
  public static function getClientId()
72
  {
@@ -74,20 +77,21 @@ class Stripe
74
  }
75
 
76
  /**
77
- * @return Util\LoggerInterface The logger to which the library will
78
- * produce messages.
79
  */
80
  public static function getLogger()
81
  {
82
- if (self::$logger == null) {
83
  return new Util\DefaultLogger();
84
  }
 
85
  return self::$logger;
86
  }
87
 
88
  /**
89
- * @param Util\LoggerInterface $logger The logger to which the library
90
- * will produce messages.
91
  */
92
  public static function setLogger($logger)
93
  {
@@ -124,7 +128,7 @@ class Stripe
124
  }
125
 
126
  /**
127
- * @param string $apiVersion The API version to use for requests.
128
  */
129
  public static function setApiVersion($apiVersion)
130
  {
@@ -156,7 +160,7 @@ class Stripe
156
  }
157
 
158
  /**
159
- * @return boolean
160
  */
161
  public static function getVerifySslCerts()
162
  {
@@ -164,7 +168,7 @@ class Stripe
164
  }
165
 
166
  /**
167
- * @param boolean $verify
168
  */
169
  public static function setVerifySslCerts($verify)
170
  {
@@ -173,7 +177,7 @@ class Stripe
173
 
174
  /**
175
  * @return string | null The Stripe account ID for connected account
176
- * requests.
177
  */
178
  public static function getAccountId()
179
  {
@@ -181,8 +185,8 @@ class Stripe
181
  }
182
 
183
  /**
184
- * @param string $accountId The Stripe account ID to set for connected
185
- * account requests.
186
  */
187
  public static function setAccountId($accountId)
188
  {
@@ -199,8 +203,9 @@ class Stripe
199
 
200
  /**
201
  * @param string $appName The application's name
202
- * @param string $appVersion The application's version
203
- * @param string $appUrl The application's URL
 
204
  */
205
  public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null)
206
  {
@@ -235,6 +240,14 @@ class Stripe
235
  return self::$maxNetworkRetryDelay;
236
  }
237
 
 
 
 
 
 
 
 
 
238
  /**
239
  * @return float Initial delay between retries, in seconds
240
  */
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class Stripe.
 
 
7
  */
8
  class Stripe
9
  {
10
+ /** @var string The Stripe API key to be used for requests. */
11
  public static $apiKey;
12
 
13
+ /** @var string The Stripe client_id to be used for Connect requests. */
14
  public static $clientId;
15
 
16
+ /** @var string The base URL for the Stripe API. */
17
  public static $apiBase = 'https://api.stripe.com';
18
 
19
+ /** @var string The base URL for the OAuth API. */
20
  public static $connectBase = 'https://connect.stripe.com';
21
 
22
+ /** @var string The base URL for the Stripe API uploads endpoint. */
23
  public static $apiUploadBase = 'https://files.stripe.com';
24
 
25
+ /** @var null|string The version of the Stripe API to use for requests. */
26
  public static $apiVersion = null;
27
 
28
+ /** @var null|string The account ID for connected accounts requests. */
29
  public static $accountId = null;
30
 
31
+ /** @var string Path to the CA bundle used to verify SSL certificates */
32
  public static $caBundlePath = null;
33
 
34
+ /** @var bool Defaults to true. */
35
  public static $verifySslCerts = true;
36
 
37
+ /** @var array The application's information (name, version, URL) */
38
  public static $appInfo = null;
39
 
40
+ /**
41
+ * @var null|Util\LoggerInterface the logger to which the library will
42
+ * produce messages
43
+ */
44
  public static $logger = null;
45
 
46
+ /** @var int Maximum number of request retries */
47
  public static $maxNetworkRetries = 0;
48
 
49
+ /** @var bool Whether client telemetry is enabled. Defaults to true. */
50
  public static $enableTelemetry = true;
51
 
52
+ /** @var float Maximum delay between retries, in seconds */
53
  private static $maxNetworkRetryDelay = 2.0;
54
 
55
+ /** @var float Maximum delay between retries, in seconds, that will be respected from the Stripe API */
56
+ private static $maxRetryAfter = 60.0;
57
+
58
+ /** @var float Initial delay between retries, in seconds */
59
  private static $initialNetworkRetryDelay = 0.5;
60
 
61
+ const VERSION = '7.75.0';
62
 
63
  /**
64
+ * @return string the API key used for requests
65
  */
66
  public static function getApiKey()
67
  {
69
  }
70
 
71
  /**
72
+ * @return string the client_id used for Connect requests
73
  */
74
  public static function getClientId()
75
  {
77
  }
78
 
79
  /**
80
+ * @return Util\LoggerInterface the logger to which the library will
81
+ * produce messages
82
  */
83
  public static function getLogger()
84
  {
85
+ if (null === self::$logger) {
86
  return new Util\DefaultLogger();
87
  }
88
+
89
  return self::$logger;
90
  }
91
 
92
  /**
93
+ * @param Util\LoggerInterface $logger the logger to which the library
94
+ * will produce messages
95
  */
96
  public static function setLogger($logger)
97
  {
128
  }
129
 
130
  /**
131
+ * @param string $apiVersion the API version to use for requests
132
  */
133
  public static function setApiVersion($apiVersion)
134
  {
160
  }
161
 
162
  /**
163
+ * @return bool
164
  */
165
  public static function getVerifySslCerts()
166
  {
168
  }
169
 
170
  /**
171
+ * @param bool $verify
172
  */
173
  public static function setVerifySslCerts($verify)
174
  {
177
 
178
  /**
179
  * @return string | null The Stripe account ID for connected account
180
+ * requests
181
  */
182
  public static function getAccountId()
183
  {
185
  }
186
 
187
  /**
188
+ * @param string $accountId the Stripe account ID to set for connected
189
+ * account requests
190
  */
191
  public static function setAccountId($accountId)
192
  {
203
 
204
  /**
205
  * @param string $appName The application's name
206
+ * @param null|string $appVersion The application's version
207
+ * @param null|string $appUrl The application's URL
208
+ * @param null|string $appPartnerId The application's partner ID
209
  */
210
  public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null)
211
  {
240
  return self::$maxNetworkRetryDelay;
241
  }
242
 
243
+ /**
244
+ * @return float Maximum delay between retries, in seconds, that will be respected from the Stripe API
245
+ */
246
+ public static function getMaxRetryAfter()
247
+ {
248
+ return self::$maxRetryAfter;
249
+ }
250
+
251
  /**
252
  * @return float Initial delay between retries, in seconds
253
  */
app/api/Stripe/StripeClient.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * Client used to send requests to Stripe's API.
9
+ *
10
+ * @property \Stripe\Service\AccountLinkService $accountLinks
11
+ * @property \Stripe\Service\AccountService $accounts
12
+ * @property \Stripe\Service\ApplePayDomainService $applePayDomains
13
+ * @property \Stripe\Service\ApplicationFeeService $applicationFees
14
+ * @property \Stripe\Service\BalanceService $balance
15
+ * @property \Stripe\Service\BalanceTransactionService $balanceTransactions
16
+ * @property \Stripe\Service\BillingPortal\BillingPortalServiceFactory $billingPortal
17
+ * @property \Stripe\Service\ChargeService $charges
18
+ * @property \Stripe\Service\Checkout\CheckoutServiceFactory $checkout
19
+ * @property \Stripe\Service\CountrySpecService $countrySpecs
20
+ * @property \Stripe\Service\CouponService $coupons
21
+ * @property \Stripe\Service\CreditNoteService $creditNotes
22
+ * @property \Stripe\Service\CustomerService $customers
23
+ * @property \Stripe\Service\DisputeService $disputes
24
+ * @property \Stripe\Service\EphemeralKeyService $ephemeralKeys
25
+ * @property \Stripe\Service\EventService $events
26
+ * @property \Stripe\Service\ExchangeRateService $exchangeRates
27
+ * @property \Stripe\Service\FileLinkService $fileLinks
28
+ * @property \Stripe\Service\FileService $files
29
+ * @property \Stripe\Service\InvoiceItemService $invoiceItems
30
+ * @property \Stripe\Service\InvoiceService $invoices
31
+ * @property \Stripe\Service\Issuing\IssuingServiceFactory $issuing
32
+ * @property \Stripe\Service\MandateService $mandates
33
+ * @property \Stripe\Service\OAuthService $oauth
34
+ * @property \Stripe\Service\OrderReturnService $orderReturns
35
+ * @property \Stripe\Service\OrderService $orders
36
+ * @property \Stripe\Service\PaymentIntentService $paymentIntents
37
+ * @property \Stripe\Service\PaymentMethodService $paymentMethods
38
+ * @property \Stripe\Service\PayoutService $payouts
39
+ * @property \Stripe\Service\PlanService $plans
40
+ * @property \Stripe\Service\PriceService $prices
41
+ * @property \Stripe\Service\ProductService $products
42
+ * @property \Stripe\Service\PromotionCodeService $promotionCodes
43
+ * @property \Stripe\Service\Radar\RadarServiceFactory $radar
44
+ * @property \Stripe\Service\RefundService $refunds
45
+ * @property \Stripe\Service\Reporting\ReportingServiceFactory $reporting
46
+ * @property \Stripe\Service\ReviewService $reviews
47
+ * @property \Stripe\Service\SetupAttemptService $setupAttempts
48
+ * @property \Stripe\Service\SetupIntentService $setupIntents
49
+ * @property \Stripe\Service\Sigma\SigmaServiceFactory $sigma
50
+ * @property \Stripe\Service\SkuService $skus
51
+ * @property \Stripe\Service\SourceService $sources
52
+ * @property \Stripe\Service\SubscriptionItemService $subscriptionItems
53
+ * @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules
54
+ * @property \Stripe\Service\SubscriptionService $subscriptions
55
+ * @property \Stripe\Service\TaxRateService $taxRates
56
+ * @property \Stripe\Service\Terminal\TerminalServiceFactory $terminal
57
+ * @property \Stripe\Service\TokenService $tokens
58
+ * @property \Stripe\Service\TopupService $topups
59
+ * @property \Stripe\Service\TransferService $transfers
60
+ * @property \Stripe\Service\WebhookEndpointService $webhookEndpoints
61
+ */
62
+ class StripeClient extends BaseStripeClient
63
+ {
64
+ /**
65
+ * @var \Stripe\Service\CoreServiceFactory
66
+ */
67
+ private $coreServiceFactory;
68
+
69
+ public function __get($name)
70
+ {
71
+ if (null === $this->coreServiceFactory) {
72
+ $this->coreServiceFactory = new \Stripe\Service\CoreServiceFactory($this);
73
+ }
74
+
75
+ return $this->coreServiceFactory->__get($name);
76
+ }
77
+ }
app/api/Stripe/StripeClientInterface.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Stripe;
4
+
5
+ /**
6
+ * Interface for a Stripe client.
7
+ */
8
+ interface StripeClientInterface
9
+ {
10
+ /**
11
+ * Gets the API key used by the client to send requests.
12
+ *
13
+ * @return null|string the API key used by the client to send requests
14
+ */
15
+ public function getApiKey();
16
+
17
+ /**
18
+ * Gets the client ID used by the client in OAuth requests.
19
+ *
20
+ * @return null|string the client ID used by the client in OAuth requests
21
+ */
22
+ public function getClientId();
23
+
24
+ /**
25
+ * Gets the base URL for Stripe's API.
26
+ *
27
+ * @return string the base URL for Stripe's API
28
+ */
29
+ public function getApiBase();
30
+
31
+ /**
32
+ * Gets the base URL for Stripe's OAuth API.
33
+ *
34
+ * @return string the base URL for Stripe's OAuth API
35
+ */
36
+ public function getConnectBase();
37
+
38
+ /**
39
+ * Gets the base URL for Stripe's Files API.
40
+ *
41
+ * @return string the base URL for Stripe's Files API
42
+ */
43
+ public function getFilesBase();
44
+
45
+ /**
46
+ * Sends a request to Stripe's API.
47
+ *
48
+ * @param string $method the HTTP method
49
+ * @param string $path the path of the request
50
+ * @param array $params the parameters of the request
51
+ * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
52
+ *
53
+ * @return \Stripe\StripeObject the object returned by Stripe's API
54
+ */
55
+ public function request($method, $path, $params, $opts);
56
+ }
app/api/Stripe/StripeObject.php CHANGED
@@ -3,18 +3,29 @@
3
  namespace Stripe;
4
 
5
  /**
6
- * Class StripeObject
7
- *
8
- * @package Stripe
9
  */
10
  class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
11
  {
 
12
  protected $_opts;
 
 
13
  protected $_originalValues;
 
 
14
  protected $_values;
 
 
15
  protected $_unsavedValues;
 
 
16
  protected $_transientValues;
 
 
17
  protected $_retrieveOptions;
 
 
18
  protected $_lastResponse;
19
 
20
  /**
@@ -24,17 +35,19 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
24
  public static function getPermanentAttributes()
25
  {
26
  static $permanentAttributes = null;
27
- if ($permanentAttributes === null) {
28
  $permanentAttributes = new Util\Set([
29
  'id',
30
  ]);
31
  }
 
32
  return $permanentAttributes;
33
  }
34
 
35
  /**
36
  * Additive objects are subobjects in the API that don't have the same
37
  * semantics as most subobjects, which are fully replaced when they're set.
 
38
  * This is best illustrated by example. The `source` parameter sent when
39
  * updating a subscription is *not* additive; if we set it:
40
  *
@@ -85,7 +98,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
85
  public static function getAdditiveParams()
86
  {
87
  static $additiveParams = null;
88
- if ($additiveParams === null) {
89
  // Set `metadata` as additive so that when it's set directly we remember
90
  // to clear keys that may have been previously set by sending empty
91
  // values for them.
@@ -96,6 +109,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
96
  'metadata',
97
  ]);
98
  }
 
99
  return $additiveParams;
100
  }
101
 
@@ -107,7 +121,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
107
  $this->_values = [];
108
  $this->_unsavedValues = new Util\Set();
109
  $this->_transientValues = new Util\Set();
110
- if ($id !== null) {
111
  $this->_values['id'] = $id;
112
  }
113
  }
@@ -116,17 +130,17 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
116
  public function __set($k, $v)
117
  {
118
  if (static::getPermanentAttributes()->includes($k)) {
119
- throw new \InvalidArgumentException(
120
- "Cannot set $k on this object. HINT: you can't set: " .
121
- join(', ', static::getPermanentAttributes()->toArray())
122
  );
123
  }
124
 
125
- if ($v === "") {
126
- throw new \InvalidArgumentException(
127
- 'You cannot set \''.$k.'\'to an empty string. '
128
- .'We interpret empty strings as NULL in requests. '
129
- .'You may set obj->'.$k.' = NULL to delete the property'
130
  );
131
  }
132
 
@@ -151,24 +165,26 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
151
  {
152
  // function should return a reference, using $nullval to return a reference to null
153
  $nullval = null;
154
- if (!empty($this->_values) && array_key_exists($k, $this->_values)) {
155
  return $this->_values[$k];
156
- } elseif (!empty($this->_transientValues) && $this->_transientValues->includes($k)) {
157
- $class = get_class($this);
158
- $attrs = join(', ', array_keys($this->_values));
159
- $message = "Stripe Notice: Undefined property of $class instance: $k. "
160
- . "HINT: The $k attribute was set in the past, however. "
161
- . "It was then wiped when refreshing the object "
 
162
  . "with the result returned by Stripe's API, "
163
- . "probably as a result of a save(). The attributes currently "
164
- . "available on this object are: $attrs";
165
  Stripe::getLogger()->error($message);
166
- return $nullval;
167
- } else {
168
- $class = get_class($this);
169
- Stripe::getLogger()->error("Stripe Notice: Undefined property of $class instance: $k");
170
  return $nullval;
171
  }
 
 
 
 
172
  }
173
 
174
  // Magic method for var_dump output. Only works with PHP >= 5.6
@@ -180,52 +196,53 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
180
  // ArrayAccess methods
181
  public function offsetSet($k, $v)
182
  {
183
- $this->$k = $v;
184
  }
185
 
186
  public function offsetExists($k)
187
  {
188
- return array_key_exists($k, $this->_values);
189
  }
190
 
191
  public function offsetUnset($k)
192
  {
193
- unset($this->$k);
194
  }
195
 
196
  public function offsetGet($k)
197
  {
198
- return array_key_exists($k, $this->_values) ? $this->_values[$k] : null;
199
  }
200
 
201
  // Countable method
202
  public function count()
203
  {
204
- return count($this->_values);
205
  }
206
 
207
  public function keys()
208
  {
209
- return array_keys($this->_values);
210
  }
211
 
212
  public function values()
213
  {
214
- return array_values($this->_values);
215
  }
216
 
217
  /**
218
- * This unfortunately needs to be public to be used in Util\Util
219
  *
220
  * @param array $values
221
- * @param null|string|array|Util\RequestOptions $opts
222
  *
223
- * @return static The object constructed from the given values.
224
  */
225
  public static function constructFrom($values, $opts = null)
226
  {
227
  $obj = new static(isset($values['id']) ? $values['id'] : null);
228
  $obj->refreshFrom($values, $opts);
 
229
  return $obj;
230
  }
231
 
@@ -233,8 +250,8 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
233
  * Refreshes this object using the provided values.
234
  *
235
  * @param array $values
236
- * @param null|string|array|Util\RequestOptions $opts
237
- * @param boolean $partial Defaults to false.
238
  */
239
  public function refreshFrom($values, $opts, $partial = false)
240
  {
@@ -243,7 +260,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
243
  $this->_originalValues = self::deepCopy($values);
244
 
245
  if ($values instanceof StripeObject) {
246
- $values = $values->__toArray(true);
247
  }
248
 
249
  // Wipe old state before setting new. This is useful for e.g. updating a
@@ -252,11 +269,11 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
252
  if ($partial) {
253
  $removed = new Util\Set();
254
  } else {
255
- $removed = new Util\Set(array_diff(array_keys($this->_values), array_keys($values)));
256
  }
257
 
258
  foreach ($removed->toArray() as $k) {
259
- unset($this->$k);
260
  }
261
 
262
  $this->updateAttributes($values, $opts, false);
@@ -270,8 +287,8 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
270
  * Mass assigns attributes on the model.
271
  *
272
  * @param array $values
273
- * @param null|string|array|Util\RequestOptions $opts
274
- * @param boolean $dirty Defaults to true.
275
  */
276
  public function updateAttributes($values, $opts = null, $dirty = true)
277
  {
@@ -280,7 +297,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
280
  // This is necessary in case metadata is empty, as PHP arrays do
281
  // not differentiate between lists and hashes, and we consider
282
  // empty arrays to be lists.
283
- if (($k === "metadata") && (is_array($v))) {
284
  $this->_values[$k] = StripeObject::constructFrom($v, $opts);
285
  } else {
286
  $this->_values[$k] = Util\Util::convertToStripeObject($v, $opts);
@@ -293,8 +310,10 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
293
  }
294
 
295
  /**
296
- * @return array A recursive mapping of attributes to values for this object,
297
- * including the proper value for deleted attributes.
 
 
298
  */
299
  public function serializeParameters($force = false)
300
  {
@@ -309,7 +328,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
309
  // 3. Its value is a StripeObject. A StripeObject may contain modified
310
  // values within in that its parent StripeObject doesn't know about.
311
  //
312
- $original = array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null;
313
  $unsaved = $this->_unsavedValues->includes($k);
314
  if ($force || $unsaved || $v instanceof StripeObject) {
315
  $updateParams[$k] = $this->serializeParamsValue(
@@ -324,17 +343,14 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
324
 
325
  // a `null` that makes it out of `serializeParamsValue` signals an empty
326
  // value that we shouldn't appear in the serialized form of the object
327
- $updateParams = array_filter(
328
  $updateParams,
329
  function ($v) {
330
- return $v !== null;
331
  }
332
  );
333
-
334
- return $updateParams;
335
  }
336
 
337
-
338
  public function serializeParamsValue($value, $original, $unsaved, $force, $key = null)
339
  {
340
  // The logic here is that essentially any object embedded in another
@@ -359,26 +375,29 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
359
  // We throw an error if a property was set explicitly but we can't do
360
  // anything with it because the integration is probably not working as the
361
  // user intended it to.
362
- if ($value === null) {
363
- return "";
364
- } elseif (($value instanceof APIResource) && (!$value->saveWithParent)) {
 
365
  if (!$unsaved) {
366
  return null;
367
- } elseif (isset($value->id)) {
 
368
  return $value;
369
- } else {
370
- throw new \InvalidArgumentException(
371
- "Cannot save property `$key` containing an API resource of type " .
372
- get_class($value) . ". It doesn't appear to be persisted and is " .
373
- "not marked as `saveWithParent`."
374
- );
375
  }
376
- } elseif (is_array($value)) {
 
 
 
 
 
 
 
377
  if (Util\Util::isList($value)) {
378
  // Sequential array, i.e. a list
379
  $update = [];
380
  foreach ($value as $v) {
381
- array_push($update, $this->serializeParamsValue($v, null, true, $force));
382
  }
383
  // This prevents an array that's unchanged from being resent.
384
  if ($update !== $this->serializeParamsValue($original, null, true, $force, $key)) {
@@ -391,8 +410,9 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
391
  } elseif ($value instanceof StripeObject) {
392
  $update = $value->serializeParameters($force);
393
  if ($original && $unsaved && $key && static::getAdditiveParams()->includes($key)) {
394
- $update = array_merge(self::emptyValues($original), $update);
395
  }
 
396
  return $update;
397
  } else {
398
  return $value;
@@ -401,27 +421,55 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
401
 
402
  public function jsonSerialize()
403
  {
404
- return $this->__toArray(true);
405
  }
406
 
407
- public function __toJSON()
 
 
 
 
 
 
408
  {
409
- return json_encode($this->__toArray(true), JSON_PRETTY_PRINT);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  }
411
 
412
- public function __toString()
 
 
 
 
 
413
  {
414
- $class = get_class($this);
415
- return $class . ' JSON: ' . $this->__toJSON();
416
  }
417
 
418
- public function __toArray($recursive = false)
419
  {
420
- if ($recursive) {
421
- return Util\Util::convertStripeObjectToArray($this->_values);
422
- } else {
423
- return $this->_values;
424
- }
425
  }
426
 
427
  /**
@@ -432,7 +480,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
432
  */
433
  public function dirty()
434
  {
435
- $this->_unsavedValues = new Util\Set(array_keys($this->_values));
436
  foreach ($this->_values as $k => $v) {
437
  $this->dirtyValue($v);
438
  }
@@ -440,7 +488,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
440
 
441
  protected function dirtyValue($value)
442
  {
443
- if (is_array($value)) {
444
  foreach ($value as $v) {
445
  $this->dirtyValue($v);
446
  }
@@ -452,46 +500,52 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
452
  /**
453
  * Produces a deep copy of the given object including support for arrays
454
  * and StripeObjects.
 
 
455
  */
456
  protected static function deepCopy($obj)
457
  {
458
- if (is_array($obj)) {
459
  $copy = [];
460
  foreach ($obj as $k => $v) {
461
  $copy[$k] = self::deepCopy($v);
462
  }
 
463
  return $copy;
464
- } elseif ($obj instanceof StripeObject) {
 
465
  return $obj::constructFrom(
466
  self::deepCopy($obj->_values),
467
  clone $obj->_opts
468
  );
469
- } else {
470
- return $obj;
471
  }
 
 
472
  }
473
 
474
  /**
475
  * Returns a hash of empty values for all the values that are in the given
476
  * StripeObject.
 
 
477
  */
478
  public static function emptyValues($obj)
479
  {
480
- if (is_array($obj)) {
481
  $values = $obj;
482
  } elseif ($obj instanceof StripeObject) {
483
  $values = $obj->_values;
484
  } else {
485
- throw new \InvalidArgumentException(
486
- "empty_values got got unexpected object type: " . get_class($obj)
487
  );
488
  }
489
- $update = array_fill_keys(array_keys($values), "");
490
- return $update;
491
  }
492
 
493
  /**
494
- * @return object The last response from the Stripe API
495
  */
496
  public function getLastResponse()
497
  {
@@ -499,10 +553,9 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
499
  }
500
 
501
  /**
502
- * Sets the last response from the Stripe API
503
  *
504
  * @param ApiResponse $resp
505
- * @return void
506
  */
507
  public function setLastResponse($resp)
508
  {
@@ -514,7 +567,7 @@ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
514
  * Note that some, but not all, resources can indicate whether they have
515
  * been deleted.
516
  *
517
- * @return bool Whether the resource is deleted.
518
  */
519
  public function isDeleted()
520
  {
3
  namespace Stripe;
4
 
5
  /**
6
+ * Class StripeObject.
 
 
7
  */
8
  class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
9
  {
10
+ /** @var Util\RequestOptions */
11
  protected $_opts;
12
+
13
+ /** @var array */
14
  protected $_originalValues;
15
+
16
+ /** @var array */
17
  protected $_values;
18
+
19
+ /** @var Util\Set */
20
  protected $_unsavedValues;
21
+
22
+ /** @var Util\Set */
23
  protected $_transientValues;
24
+
25
+ /** @var null|array */
26
  protected $_retrieveOptions;
27
+
28
+ /** @var null|ApiResponse */
29
  protected $_lastResponse;
30
 
31
  /**
35
  public static function getPermanentAttributes()
36
  {
37
  static $permanentAttributes = null;
38
+ if (null === $permanentAttributes) {
39
  $permanentAttributes = new Util\Set([
40
  'id',
41
  ]);
42
  }
43
+
44
  return $permanentAttributes;
45
  }
46
 
47
  /**
48
  * Additive objects are subobjects in the API that don't have the same
49
  * semantics as most subobjects, which are fully replaced when they're set.
50
+ *
51
  * This is best illustrated by example. The `source` parameter sent when
52
  * updating a subscription is *not* additive; if we set it:
53
  *
98
  public static function getAdditiveParams()
99
  {
100
  static $additiveParams = null;
101
+ if (null === $additiveParams) {
102
  // Set `metadata` as additive so that when it's set directly we remember
103
  // to clear keys that may have been previously set by sending empty
104
  // values for them.
109
  'metadata',
110
  ]);
111
  }
112
+
113
  return $additiveParams;
114
  }
115
 
121
  $this->_values = [];
122
  $this->_unsavedValues = new Util\Set();
123
  $this->_transientValues = new Util\Set();
124
+ if (null !== $id) {
125
  $this->_values['id'] = $id;
126
  }
127
  }
130
  public function __set($k, $v)
131
  {
132
  if (static::getPermanentAttributes()->includes($k)) {
133
+ throw new Exception\InvalidArgumentException(
134
+ "Cannot set {$k} on this object. HINT: you can't set: " .
135
+ \implode(', ', static::getPermanentAttributes()->toArray())
136
  );
137
  }
138
 
139
+ if ('' === $v) {
140
+ throw new Exception\InvalidArgumentException(
141
+ 'You cannot set \'' . $k . '\'to an empty string. '
142
+ . 'We interpret empty strings as NULL in requests. '
143
+ . 'You may set obj->' . $k . ' = NULL to delete the property'
144
  );
145
  }
146
 
165
  {
166
  // function should return a reference, using $nullval to return a reference to null
167
  $nullval = null;
168
+ if (!empty($this->_values) && \array_key_exists($k, $this->_values)) {
169
  return $this->_values[$k];
170
+ }
171
+ if (!empty($this->_transientValues) && $this->_transientValues->includes($k)) {
172
+ $class = static::class;
173
+ $attrs = \implode(', ', \array_keys($this->_values));
174
+ $message = "Stripe Notice: Undefined property of {$class} instance: {$k}. "
175
+ . "HINT: The {$k} attribute was set in the past, however. "
176
+ . 'It was then wiped when refreshing the object '
177
  . "with the result returned by Stripe's API, "
178
+ . 'probably as a result of a save(). The attributes currently '
179
+ . "available on this object are: {$attrs}";
180
  Stripe::getLogger()->error($message);
181
+
 
 
 
182
  return $nullval;
183
  }
184
+ $class = static::class;
185
+ Stripe::getLogger()->error("Stripe Notice: Undefined property of {$class} instance: {$k}");
186
+
187
+ return $nullval;
188
  }
189
 
190
  // Magic method for var_dump output. Only works with PHP >= 5.6
196
  // ArrayAccess methods
197
  public function offsetSet($k, $v)
198
  {
199
+ $this->{$k} = $v;
200
  }
201
 
202
  public function offsetExists($k)
203
  {
204
+ return \array_key_exists($k, $this->_values);
205
  }
206
 
207
  public function offsetUnset($k)
208
  {
209
+ unset($this->{$k});
210
  }
211
 
212
  public function offsetGet($k)
213
  {
214
+ return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null;
215
  }
216
 
217
  // Countable method
218
  public function count()
219
  {
220
+ return \count($this->_values);
221
  }
222
 
223
  public function keys()
224
  {
225
+ return \array_keys($this->_values);
226
  }
227
 
228
  public function values()
229
  {
230
+ return \array_values($this->_values);
231
  }
232
 
233
  /**
234
+ * This unfortunately needs to be public to be used in Util\Util.
235
  *
236
  * @param array $values
237
+ * @param null|array|string|Util\RequestOptions $opts
238
  *
239
+ * @return static the object constructed from the given values
240
  */
241
  public static function constructFrom($values, $opts = null)
242
  {
243
  $obj = new static(isset($values['id']) ? $values['id'] : null);
244
  $obj->refreshFrom($values, $opts);
245
+
246
  return $obj;
247
  }
248
 
250
  * Refreshes this object using the provided values.
251
  *
252
  * @param array $values
253
+ * @param null|array|string|Util\RequestOptions $opts
254
+ * @param bool $partial defaults to false
255
  */
256
  public function refreshFrom($values, $opts, $partial = false)
257
  {
260
  $this->_originalValues = self::deepCopy($values);
261
 
262
  if ($values instanceof StripeObject) {
263
+ $values = $values->toArray();
264
  }
265
 
266
  // Wipe old state before setting new. This is useful for e.g. updating a
269
  if ($partial) {
270
  $removed = new Util\Set();
271
  } else {
272
+ $removed = new Util\Set(\array_diff(\array_keys($this->_values), \array_keys($values)));
273
  }
274
 
275
  foreach ($removed->toArray() as $k) {
276
+ unset($this->{$k});
277
  }
278
 
279
  $this->updateAttributes($values, $opts, false);
287
  * Mass assigns attributes on the model.
288
  *
289
  * @param array $values
290
+ * @param null|array|string|Util\RequestOptions $opts
291
+ * @param bool $dirty defaults to true
292
  */
293
  public function updateAttributes($values, $opts = null, $dirty = true)
294
  {
297
  // This is necessary in case metadata is empty, as PHP arrays do
298
  // not differentiate between lists and hashes, and we consider
299
  // empty arrays to be lists.
300
+ if (('metadata' === $k) && (\is_array($v))) {
301
  $this->_values[$k] = StripeObject::constructFrom($v, $opts);
302
  } else {
303
  $this->_values[$k] = Util\Util::convertToStripeObject($v, $opts);
310
  }
311
 
312
  /**
313
+ * @param bool $force defaults to false
314
+ *
315
+ * @return array a recursive mapping of attributes to values for this object,
316
+ * including the proper value for deleted attributes
317
  */
318
  public function serializeParameters($force = false)
319
  {
328
  // 3. Its value is a StripeObject. A StripeObject may contain modified
329
  // values within in that its parent StripeObject doesn't know about.
330
  //
331
+ $original = \array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null;
332
  $unsaved = $this->_unsavedValues->includes($k);
333
  if ($force || $unsaved || $v instanceof StripeObject) {
334
  $updateParams[$k] = $this->serializeParamsValue(
343
 
344
  // a `null` that makes it out of `serializeParamsValue` signals an empty
345
  // value that we shouldn't appear in the serialized form of the object
346
+ return \array_filter(
347
  $updateParams,
348
  function ($v) {
349
+ return null !== $v;
350
  }
351
  );
 
 
352
  }
353
 
 
354
  public function serializeParamsValue($value, $original, $unsaved, $force, $key = null)
355
  {
356
  // The logic here is that essentially any object embedded in another
375
  // We throw an error if a property was set explicitly but we can't do
376
  // anything with it because the integration is probably not working as the
377
  // user intended it to.
378
+ if (null === $value) {
379
+ return '';
380
+ }
381
+ if (($value instanceof ApiResource) && (!$value->saveWithParent)) {
382
  if (!$unsaved) {
383
  return null;
384
+ }
385
+ if (isset($value->id)) {
386
  return $value;
 
 
 
 
 
 
387
  }
388
+
389
+ throw new Exception\InvalidArgumentException(
390
+ "Cannot save property `{$key}` containing an API resource of type " .
391
+ \get_class($value) . ". It doesn't appear to be persisted and is " .
392
+ 'not marked as `saveWithParent`.'
393
+ );
394
+ }
395
+ if (\is_array($value)) {
396
  if (Util\Util::isList($value)) {
397
  // Sequential array, i.e. a list
398
  $update = [];
399
  foreach ($value as $v) {
400
+ $update[] = $this->serializeParamsValue($v, null, true, $force);
401
  }
402
  // This prevents an array that's unchanged from being resent.
403
  if ($update !== $this->serializeParamsValue($original, null, true, $force, $key)) {
410
  } elseif ($value instanceof StripeObject) {
411
  $update = $value->serializeParameters($force);
412
  if ($original && $unsaved && $key && static::getAdditiveParams()->includes($key)) {
413
+ $update = \array_merge(self::emptyValues($original), $update);
414
  }
415
+
416
  return $update;
417
  } else {
418
  return $value;
421
 
422
  public function jsonSerialize()
423
  {
424
+ return $this->toArray();
425
  }
426
 
427
+ /**
428
+ * Returns an associative array with the key and values composing the
429
+ * Stripe object.
430
+ *
431
+ * @return array the associative array
432
+ */
433
+ public function toArray()
434
  {
435
+ $maybeToArray = function ($value) {
436
+ if (null === $value) {
437
+ return null;
438
+ }
439
+
440
+ return \is_object($value) && \method_exists($value, 'toArray') ? $value->toArray() : $value;
441
+ };
442
+
443
+ return \array_reduce(\array_keys($this->_values), function ($acc, $k) use ($maybeToArray) {
444
+ if ('_' === \substr((string) $k, 0, 1)) {
445
+ return $acc;
446
+ }
447
+ $v = $this->_values[$k];
448
+ if (Util\Util::isList($v)) {
449
+ $acc[$k] = \array_map($maybeToArray, $v);
450
+ } else {
451
+ $acc[$k] = $maybeToArray($v);
452
+ }
453
+
454
+ return $acc;
455
+ }, []);
456
  }
457
 
458
+ /**
459
+ * Returns a pretty JSON representation of the Stripe object.
460
+ *
461
+ * @return string the JSON representation of the Stripe object
462
+ */
463
+ public function toJSON()
464
  {
465
+ return \json_encode($this->toArray(), \JSON_PRETTY_PRINT);
 
466
  }
467
 
468
+ public function __toString()
469
  {
470
+ $class = static::class;
471
+
472
+ return $class . ' JSON: ' . $this->toJSON();
 
 
473
  }
474
 
475
  /**
480
  */
481
  public function dirty()
482
  {
483
+ $this->_unsavedValues = new Util\Set(\array_keys($this->_values));
484
  foreach ($this->_values as $k => $v) {
485
  $this->dirtyValue($v);
486
  }
488
 
489
  protected function dirtyValue($value)
490
  {
491
+ if (\is_array($value)) {
492
  foreach ($value as $v) {
493
  $this->dirtyValue($v);
494
  }
500
  /**
501
  * Produces a deep copy of the given object including support for arrays
502
  * and StripeObjects.
503
+ *
504
+ * @param mixed $obj
505
  */
506
  protected static function deepCopy($obj)
507
  {
508
+ if (\is_array($obj)) {
509
  $copy = [];
510
  foreach ($obj as $k => $v) {
511
  $copy[$k] = self::deepCopy($v);
512
  }
513
+
514
  return $copy;
515
+ }
516
+ if ($obj instanceof StripeObject) {
517
  return $obj::constructFrom(
518
  self::deepCopy($obj->_values),
519
  clone $obj->_opts
520
  );
 
 
521
  }
522
+
523
+ return $obj;
524
  }
525
 
526
  /**
527
  * Returns a hash of empty values for all the values that are in the given
528
  * StripeObject.
529
+ *
530
+ * @param mixed $obj
531
  */
532
  public static function emptyValues($obj)
533
  {
534
+ if (\is_array($obj)) {
535
  $values = $obj;
536
  } elseif ($obj instanceof StripeObject) {
537
  $values = $obj->_values;
538
  } else {
539
+ throw new Exception\InvalidArgumentException(
540
+ 'empty_values got unexpected object type: ' . \get_class($obj)
541
  );
542
  }
543
+
544
+ return \array_fill_keys(\array_keys($values), '');
545
  }
546
 
547
  /**
548
+ * @return null|ApiResponse The last response from the Stripe API
549
  */
550
  public function getLastResponse()
551
  {
553
  }
554
 
555
  /**
556
+ * Sets the last response from the Stripe API.
557
  *
558
  * @param ApiResponse $resp
 
559
  */
560
  public function setLastResponse($resp)
561
  {
567
  * Note that some, but not all, resources can indicate whether they have
568
  * been deleted.
569
  *
570
+ * @return bool whether the resource is deleted
571
  */
572
  public function isDeleted()
573
  {
app/api/Stripe/Subscription.php CHANGED
@@ -1,85 +1,98 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Subscription
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property float $application_fee_percent
11
- * @property string $billing
12
- * @property int $billing_cycle_anchor
13
- * @property mixed $billing_thresholds
14
- * @property bool $cancel_at_period_end
15
- * @property int $canceled_at
16
- * @property string $collection_method
17
- * @property int $created
18
- * @property int $current_period_end
19
- * @property int $current_period_start
20
- * @property string $customer
21
- * @property int $days_until_due
22
- * @property string $default_payment_method
23
- * @property string $default_source
24
- * @property array $default_tax_rates
25
- * @property Discount $discount
26
- * @property int $ended_at
27
- * @property Collection $items
28
- * @property string $latest_invoice
29
- * @property boolean $livemode
30
- * @property StripeObject $metadata
31
- * @property Plan $plan
32
- * @property int $quantity
33
- * @property SubscriptionSchedule $schedule
34
- * @property int $start
35
- * @property int $start_date
36
- * @property string $status
37
- * @property float $tax_percent
38
- * @property int $trial_end
39
- * @property int $trial_start
40
  *
41
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  */
43
  class Subscription extends ApiResource
44
  {
45
- const OBJECT_NAME = "subscription";
46
 
47
  use ApiOperations\All;
48
  use ApiOperations\Create;
49
- use ApiOperations\Delete {
50
- delete as protected _delete;
51
- }
52
  use ApiOperations\Retrieve;
53
  use ApiOperations\Update;
54
 
55
- /**
56
- * These constants are possible representations of the status field.
57
- *
58
- * @link https://stripe.com/docs/api#subscription_object-status
59
- */
60
- const STATUS_ACTIVE = 'active';
61
- const STATUS_CANCELED = 'canceled';
62
- const STATUS_PAST_DUE = 'past_due';
63
- const STATUS_TRIALING = 'trialing';
64
- const STATUS_UNPAID = 'unpaid';
65
- const STATUS_INCOMPLETE = 'incomplete';
66
  const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired';
 
 
 
 
 
 
 
67
 
68
  public static function getSavedNestedResources()
69
  {
70
  static $savedNestedResources = null;
71
- if ($savedNestedResources === null) {
72
  $savedNestedResources = new Util\Set([
73
  'source',
74
  ]);
75
  }
 
76
  return $savedNestedResources;
77
  }
78
 
79
  /**
80
- * @param array|null $params
 
 
 
81
  *
82
- * @return Subscription The deleted subscription.
83
  */
84
  public function cancel($params = null, $opts = null)
85
  {
@@ -87,12 +100,17 @@ class Subscription extends ApiResource
87
  }
88
 
89
  /**
90
- * @return Subscription The updated subscription.
 
 
 
 
 
91
  */
92
- public function deleteDiscount()
93
  {
94
  $url = $this->instanceUrl() . '/discount';
95
- list($response, $opts) = $this->_request('delete', $url);
96
  $this->refreshFrom(['discount' => null], $opts, true);
97
  }
98
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Subscriptions allow you to charge a customer on a recurring basis.
9
  *
10
+ * Related guide: <a
11
+ * href="https://stripe.com/docs/billing/subscriptions/creating">Creating
12
+ * Subscriptions</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.
17
+ * @property int $billing_cycle_anchor Determines the date of the first full invoice, and, for plans with <code>month</code> or <code>year</code> intervals, the day of the month for subsequent invoices.
18
+ * @property null|\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
19
+ * @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled
20
+ * @property bool $cancel_at_period_end If the subscription has been canceled with the <code>at_period_end</code> flag set to <code>true</code>, <code>cancel_at_period_end</code> on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.
21
+ * @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with <code>cancel_at_period_end</code>, <code>canceled_at</code> will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.
22
+ * @property null|string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions.
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property int $current_period_end End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.
25
+ * @property int $current_period_start Start of the current period that the subscription has been invoiced for.
26
+ * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription.
27
+ * @property null|int $days_until_due Number of days a customer has to pay invoices generated by this subscription. This value will be <code>null</code> for subscriptions where <code>collection_method=charge_automatically</code>.
28
+ * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over <code>default_source</code>. If neither are set, invoices will use the customer's <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> or <a href="https://stripe.com/docs/api/customers/object#customer_object-default_source">default_source</a>.
29
+ * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If <code>default_payment_method</code> is also set, <code>default_payment_method</code> will take precedence. If neither are set, invoices will use the customer's <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> or <a href="https://stripe.com/docs/api/customers/object#customer_object-default_source">default_source</a>.
30
+ * @property null|\Stripe\TaxRate[] $default_tax_rates The tax rates that will apply to any subscription item that does not have <code>tax_rates</code> set. Invoices created will have their <code>default_tax_rates</code> populated from the subscription.
31
+ * @property null|\Stripe\Discount $discount Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.
32
+ * @property null|int $ended_at If the subscription has ended, the date the subscription ended.
33
+ * @property \Stripe\Collection $items List of subscription items, each with an attached price.
34
+ * @property null|string|\Stripe\Invoice $latest_invoice The most recent invoice this subscription has generated.
35
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
36
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
37
+ * @property null|int $next_pending_invoice_item_invoice Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at <code>pending_invoice_item_interval</code>.
38
+ * @property null|\Stripe\StripeObject $pause_collection If specified, payment collection for this subscription will be paused.
39
+ * @property null|\Stripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling <a href="https://stripe.com/docs/api#create_invoice">Create an invoice</a> for the given subscription at the specified interval.
40
+ * @property null|string|\Stripe\SetupIntent $pending_setup_intent You can use this <a href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the <a href="https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2">SCA Migration Guide</a>.
41
+ * @property null|\Stripe\StripeObject $pending_update If specified, <a href="https://stripe.com/docs/billing/subscriptions/pending-updates">pending updates</a> that will be applied to the subscription once the <code>latest_invoice</code> has been paid.
42
+ * @property null|string|\Stripe\SubscriptionSchedule $schedule The schedule attached to the subscription
43
+ * @property int $start_date Date when the subscription was first created. The date might differ from the <code>created</code> date due to backdating.
44
+ * @property string $status <p>Possible values are <code>incomplete</code>, <code>incomplete_expired</code>, <code>trialing</code>, <code>active</code>, <code>past_due</code>, <code>canceled</code>, or <code>unpaid</code>.</p><p>For <code>collection_method=charge_automatically</code> a subscription moves into <code>incomplete</code> if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an <code>active</code> state. If the first invoice is not paid within 23 hours, the subscription transitions to <code>incomplete_expired</code>. This is a terminal state, the open invoice will be voided and no further invoices will be generated.</p><p>A subscription that is currently in a trial period is <code>trialing</code> and moves to <code>active</code> when the trial period is over.</p><p>If subscription <code>collection_method=charge_automatically</code> it becomes <code>past_due</code> when payment to renew it fails and <code>canceled</code> or <code>unpaid</code> (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.</p><p>If subscription <code>collection_method=send_invoice</code> it becomes <code>past_due</code> when its invoice is not paid by the due date, and <code>canceled</code> or <code>unpaid</code> if it is still not paid by an additional deadline after that. Note that when a subscription has a status of <code>unpaid</code>, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.</p>
45
+ * @property null|int $trial_end If the subscription has a trial, the end of that trial.
46
+ * @property null|int $trial_start If the subscription has a trial, the beginning of that trial.
47
  */
48
  class Subscription extends ApiResource
49
  {
50
+ const OBJECT_NAME = 'subscription';
51
 
52
  use ApiOperations\All;
53
  use ApiOperations\Create;
 
 
 
54
  use ApiOperations\Retrieve;
55
  use ApiOperations\Update;
56
 
57
+ const PAYMENT_BEHAVIOR_ALLOW_INCOMPLETE = 'allow_incomplete';
58
+ const PAYMENT_BEHAVIOR_ERROR_IF_INCOMPLETE = 'error_if_incomplete';
59
+ const PAYMENT_BEHAVIOR_PENDING_IF_INCOMPLETE = 'pending_if_incomplete';
60
+
61
+ const PRORATION_BEHAVIOR_ALWAYS_INVOICE = 'always_invoice';
62
+ const PRORATION_BEHAVIOR_CREATE_PRORATIONS = 'create_prorations';
63
+ const PRORATION_BEHAVIOR_NONE = 'none';
64
+
65
+ const STATUS_ACTIVE = 'active';
66
+ const STATUS_CANCELED = 'canceled';
67
+ const STATUS_INCOMPLETE = 'incomplete';
68
  const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired';
69
+ const STATUS_PAST_DUE = 'past_due';
70
+ const STATUS_TRIALING = 'trialing';
71
+ const STATUS_UNPAID = 'unpaid';
72
+
73
+ use ApiOperations\Delete {
74
+ delete as protected _delete;
75
+ }
76
 
77
  public static function getSavedNestedResources()
78
  {
79
  static $savedNestedResources = null;
80
+ if (null === $savedNestedResources) {
81
  $savedNestedResources = new Util\Set([
82
  'source',
83
  ]);
84
  }
85
+
86
  return $savedNestedResources;
87
  }
88
 
89
  /**
90
+ * @param null|array $params
91
+ * @param null|array|string $opts
92
+ *
93
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
94
  *
95
+ * @return \Stripe\Subscription the deleted subscription
96
  */
97
  public function cancel($params = null, $opts = null)
98
  {
100
  }
101
 
102
  /**
103
+ * @param null|array $params
104
+ * @param null|array|string $opts
105
+ *
106
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
107
+ *
108
+ * @return \Stripe\Subscription the updated subscription
109
  */
110
+ public function deleteDiscount($params = null, $opts = null)
111
  {
112
  $url = $this->instanceUrl() . '/discount';
113
+ list($response, $opts) = $this->_request('delete', $url, $params, $opts);
114
  $this->refreshFrom(['discount' => null], $opts, true);
115
  }
116
  }
app/api/Stripe/SubscriptionItem.php CHANGED
@@ -1,27 +1,27 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SubscriptionItem
7
- *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $billing_thresholds
11
- * @property int $created
12
- * @property StripeObject $metadata
13
- * @property Plan $plan
14
- * @property int $quantity
15
- * @property string $subscription
16
- * @property array $tax_rates
17
  *
18
- * @package Stripe
 
 
 
 
 
 
 
 
 
19
  */
20
  class SubscriptionItem extends ApiResource
21
  {
22
- const OBJECT_NAME = "subscription_item";
23
-
24
- const PATH_USAGE_RECORDS = '/usage_records';
25
 
26
  use ApiOperations\All;
27
  use ApiOperations\Create;
@@ -30,12 +30,16 @@ class SubscriptionItem extends ApiResource
30
  use ApiOperations\Retrieve;
31
  use ApiOperations\Update;
32
 
 
 
33
  /**
34
- * @param string|null $id The ID of the subscription item on which to create the usage record.
35
- * @param array|null $params
36
- * @param array|string|null $opts
 
 
37
  *
38
- * @return ApiResource
39
  */
40
  public static function createUsageRecord($id, $params = null, $opts = null)
41
  {
@@ -43,17 +47,38 @@ class SubscriptionItem extends ApiResource
43
  }
44
 
45
  /**
46
- * @param array|null $params
47
- * @param array|string|null $options
 
 
 
 
48
  *
49
- * @return Collection The list of usage record summaries.
50
  */
51
- public function usageRecordSummaries($params = null, $options = null)
52
  {
53
  $url = $this->instanceUrl() . '/usage_record_summaries';
54
- list($response, $opts) = $this->_request('get', $url, $params, $options);
55
- $obj = Util\Util::convertToStripeObject($response, $opts);
56
  $obj->setLastResponse($response);
 
57
  return $obj;
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Subscription items allow you to create customer subscriptions with more than one
9
+ * plan, making it easy to represent complex billing relationships.
 
 
 
 
 
 
 
 
 
10
  *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property null|\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
14
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
16
+ * @property \Stripe\Plan $plan <p>You can now model subscriptions more flexibly using the <a href="https://stripe.com/docs/api#prices">Prices API</a>. It replaces the Plans API and is backwards compatible to simplify your migration.</p><p>Plans define the base price, currency, and billing cycle for recurring purchases of products. <a href="https://stripe.com/docs/api#products">Products</a> help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.</p><p>For example, you might have a single &quot;gold&quot; product that has plans for $10/month, $100/year, €9/month, and €90/year.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a> and more about <a href="https://stripe.com/docs/billing/prices-guide">products and prices</a>.</p>
17
+ * @property \Stripe\Price $price <p>Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. <a href="https://stripe.com/docs/api#products">Products</a> help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.</p><p>For example, you might have a single &quot;gold&quot; product that has prices for $10/month, $100/year, and €9 once.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a>, <a href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>, and more about <a href="https://stripe.com/docs/billing/prices-guide">products and prices</a>.</p>
18
+ * @property int $quantity The <a href="https://stripe.com/docs/subscriptions/quantities">quantity</a> of the plan to which the customer should be subscribed.
19
+ * @property string $subscription The <code>subscription</code> this <code>subscription_item</code> belongs to.
20
+ * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to this <code>subscription_item</code>. When set, the <code>default_tax_rates</code> on the subscription do not apply to this <code>subscription_item</code>.
21
  */
22
  class SubscriptionItem extends ApiResource
23
  {
24
+ const OBJECT_NAME = 'subscription_item';
 
 
25
 
26
  use ApiOperations\All;
27
  use ApiOperations\Create;
30
  use ApiOperations\Retrieve;
31
  use ApiOperations\Update;
32
 
33
+ const PATH_USAGE_RECORDS = '/usage_records';
34
+
35
  /**
36
+ * @param null|string $id the ID of the subscription item on which to create the usage record
37
+ * @param null|array $params
38
+ * @param null|array|string $opts
39
+ *
40
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
41
  *
42
+ * @return \Stripe\UsageRecord
43
  */
44
  public static function createUsageRecord($id, $params = null, $opts = null)
45
  {
47
  }
48
 
49
  /**
50
+ * @deprecated usageRecordSummaries is deprecated. Please use SubscriptionItem::allUsageRecordSummaries instead.
51
+ *
52
+ * @param null|array $params
53
+ * @param null|array|string $opts
54
+ *
55
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
56
  *
57
+ * @return \Stripe\Collection the list of usage record summaries
58
  */
59
+ public function usageRecordSummaries($params = null, $opts = null)
60
  {
61
  $url = $this->instanceUrl() . '/usage_record_summaries';
62
+ list($response, $opts) = $this->_request('get', $url, $params, $opts);
63
+ $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
64
  $obj->setLastResponse($response);
65
+
66
  return $obj;
67
  }
68
+
69
+ const PATH_USAGE_RECORD_SUMMARIES = '/usage_record_summaries';
70
+
71
+ /**
72
+ * @param string $id the ID of the subscription item on which to retrieve the usage record summaries
73
+ * @param null|array $params
74
+ * @param null|array|string $opts
75
+ *
76
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
77
+ *
78
+ * @return \Stripe\Collection the list of usage record summaries
79
+ */
80
+ public static function allUsageRecordSummaries($id, $params = null, $opts = null)
81
+ {
82
+ return self::_allNestedResources($id, static::PATH_USAGE_RECORD_SUMMARIES, $params, $opts);
83
+ }
84
  }
app/api/Stripe/SubscriptionSchedule.php CHANGED
@@ -1,68 +1,74 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class SubscriptionSchedule
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property string $billing
11
- * @property mixed $billing_thresholds
12
- * @property int $canceled_at
13
- * @property int $completed_at
14
- * @property int $created
15
- * @property mixed $current_phase
16
- * @property string $customer
17
- * @property mixed $invoice_settings
18
- * @property boolean $livemode
19
- * @property StripeObject $metadata
20
- * @property mixed $phases
21
- * @property int $released_at
22
- * @property string $released_subscription
23
- * @property string $renewal_behavior
24
- * @property mixed $renewal_interval
25
- * @property string $revision
26
- * @property string $status
27
- * @property string $subscription
28
  *
29
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  */
31
  class SubscriptionSchedule extends ApiResource
32
  {
33
- const OBJECT_NAME = "subscription_schedule";
34
 
35
  use ApiOperations\All;
36
  use ApiOperations\Create;
37
  use ApiOperations\Retrieve;
38
  use ApiOperations\Update;
39
- use ApiOperations\NestedResource;
40
 
41
  /**
42
- * @param array|null $params
43
- * @param array|string|null $opts
 
 
44
  *
45
- * @return SubscriptionSchedule The canceled subscription schedule.
46
  */
47
  public function cancel($params = null, $opts = null)
48
  {
49
  $url = $this->instanceUrl() . '/cancel';
50
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
51
  $this->refreshFrom($response, $opts);
 
52
  return $this;
53
  }
54
 
55
  /**
56
- * @param array|null $params
57
- * @param array|string|null $opts
58
  *
59
- * @return SubscriptionSchedule The released subscription schedule.
 
 
60
  */
61
  public function release($params = null, $opts = null)
62
  {
63
  $url = $this->instanceUrl() . '/release';
64
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
65
  $this->refreshFrom($response, $opts);
 
66
  return $this;
67
  }
68
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A subscription schedule allows you to create and manage the lifecycle of a
9
+ * subscription by predefining expected changes.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">Subscription
13
+ * Schedules</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
18
+ * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property null|\Stripe\StripeObject $current_phase Object representing the start and end dates for the current phase of the subscription schedule, if it is <code>active</code>.
21
+ * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription schedule.
22
+ * @property \Stripe\StripeObject $default_settings
23
+ * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are <code>release</code> and <code>cancel</code>.
24
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
25
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
26
+ * @property \Stripe\StripeObject[] $phases Configuration for the subscription schedule's phases.
27
+ * @property null|int $released_at Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
28
+ * @property null|string $released_subscription ID of the subscription once managed by the subscription schedule (if it is released).
29
+ * @property string $status The present status of the subscription schedule. Possible values are <code>not_started</code>, <code>active</code>, <code>completed</code>, <code>released</code>, and <code>canceled</code>. You can read more about the different states in our <a href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">behavior guide</a>.
30
+ * @property null|string|\Stripe\Subscription $subscription ID of the subscription managed by the subscription schedule.
31
  */
32
  class SubscriptionSchedule extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'subscription_schedule';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
38
  use ApiOperations\Retrieve;
39
  use ApiOperations\Update;
 
40
 
41
  /**
42
+ * @param null|array $params
43
+ * @param null|array|string $opts
44
+ *
45
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
46
  *
47
+ * @return SubscriptionSchedule the canceled subscription schedule
48
  */
49
  public function cancel($params = null, $opts = null)
50
  {
51
  $url = $this->instanceUrl() . '/cancel';
52
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
53
  $this->refreshFrom($response, $opts);
54
+
55
  return $this;
56
  }
57
 
58
  /**
59
+ * @param null|array $params
60
+ * @param null|array|string $opts
61
  *
62
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
63
+ *
64
+ * @return SubscriptionSchedule the released subscription schedule
65
  */
66
  public function release($params = null, $opts = null)
67
  {
68
  $url = $this->instanceUrl() . '/release';
69
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
70
  $this->refreshFrom($response, $opts);
71
+
72
  return $this;
73
  }
74
  }
app/api/Stripe/TaxId.php CHANGED
@@ -1,80 +1,107 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class TaxId
 
 
7
  *
8
- * @package Stripe
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property string $country
13
- * @property int $created
14
- * @property string $customer
15
- * @property bool $livemode
16
- * @property string $type
17
- * @property string $value
18
- * @property mixed $verification
19
  */
20
  class TaxId extends ApiResource
21
  {
22
- const OBJECT_NAME = "tax_id";
23
 
24
  use ApiOperations\Delete;
25
 
26
- /**
27
- * Possible string representations of a tax id's type.
28
- * @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type
29
- */
30
- const TYPE_AU_ABN = 'au_abn';
31
- const TYPE_EU_VAT = 'eu_vat';
32
- const TYPE_IN_GST = 'in_gst';
33
- const TYPE_NO_VAT = 'no_vat';
34
- const TYPE_NZ_GST = 'nz_gst';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  const TYPE_UNKNOWN = 'unknown';
 
 
36
 
37
- /**
38
- * Possible string representations of the verification status.
39
- * @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-verification
40
- */
41
- const VERIFICATION_STATUS_PENDING = 'pending';
42
  const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable';
43
- const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
44
- const VERIFICATION_STATUS_VERIFIED = 'verified';
45
 
46
  /**
47
- * @return string The API URL for this tax id.
48
  */
49
  public function instanceUrl()
50
  {
51
  $id = $this['id'];
52
  $customer = $this['customer'];
53
  if (!$id) {
54
- throw new Error\InvalidRequest(
55
- "Could not determine which URL to request: class instance has invalid ID: $id",
56
- null
57
  );
58
  }
59
  $id = Util\Util::utf8($id);
60
  $customer = Util\Util::utf8($customer);
61
 
62
  $base = Customer::classUrl();
63
- $customerExtn = urlencode($customer);
64
- $extn = urlencode($id);
65
- return "$base/$customerExtn/tax_ids/$extn";
 
66
  }
67
 
68
  /**
69
  * @param array|string $_id
70
- * @param array|string|null $_opts
71
  *
72
- * @throws \Stripe\Error\InvalidRequest
73
  */
74
  public static function retrieve($_id, $_opts = null)
75
  {
76
- $msg = "Tax Ids cannot be accessed without a customer ID. " .
77
- "Retrieve a Tax Id using Customer::retrieveTaxId('tax_id') instead.";
78
- throw new Error\InvalidRequest($msg, null);
 
 
79
  }
80
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * You can add one or multiple tax IDs to a <a
9
+ * href="https://stripe.com/docs/api/customers">customer</a>. A customer's tax IDs
10
+ * are displayed on invoices and credit notes issued for the customer.
11
  *
12
+ * Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-ids">Customer
13
+ * Tax Identification Numbers</a>.
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property null|string $country Two-letter ISO code representing the country of the tax ID.
18
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
19
+ * @property null|string|\Stripe\Customer $customer ID of the customer.
20
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
21
+ * @property string $type Type of the tax ID, one of <code>ae_trn</code>, <code>au_abn</code>, <code>br_cnpj</code>, <code>br_cpf</code>, <code>ca_bn</code>, <code>ca_qst</code>, <code>ch_vat</code>, <code>cl_tin</code>, <code>es_cif</code>, <code>eu_vat</code>, <code>gb_vat</code>, <code>hk_br</code>, <code>id_npwp</code>, <code>in_gst</code>, <code>jp_cn</code>, <code>jp_rn</code>, <code>kr_brn</code>, <code>li_uid</code>, <code>mx_rfc</code>, <code>my_frp</code>, <code>my_itn</code>, <code>my_sst</code>, <code>no_vat</code>, <code>nz_gst</code>, <code>ru_inn</code>, <code>ru_kpp</code>, <code>sa_vat</code>, <code>sg_gst</code>, <code>sg_uen</code>, <code>th_vat</code>, <code>tw_vat</code>, <code>us_ein</code>, or <code>za_vat</code>. Note that some legacy tax IDs have type <code>unknown</code>
22
+ * @property string $value Value of the tax ID.
23
+ * @property null|\Stripe\StripeObject $verification Tax ID verification information.
24
  */
25
  class TaxId extends ApiResource
26
  {
27
+ const OBJECT_NAME = 'tax_id';
28
 
29
  use ApiOperations\Delete;
30
 
31
+ const TYPE_AE_TRN = 'ae_trn';
32
+ const TYPE_AU_ABN = 'au_abn';
33
+ const TYPE_BR_CNPJ = 'br_cnpj';
34
+ const TYPE_BR_CPF = 'br_cpf';
35
+ const TYPE_CA_BN = 'ca_bn';
36
+ const TYPE_CA_QST = 'ca_qst';
37
+ const TYPE_CH_VAT = 'ch_vat';
38
+ const TYPE_CL_TIN = 'cl_tin';
39
+ const TYPE_ES_CIF = 'es_cif';
40
+ const TYPE_EU_VAT = 'eu_vat';
41
+ const TYPE_GB_VAT = 'gb_vat';
42
+ const TYPE_HK_BR = 'hk_br';
43
+ const TYPE_ID_NPWP = 'id_npwp';
44
+ const TYPE_IN_GST = 'in_gst';
45
+ const TYPE_JP_CN = 'jp_cn';
46
+ const TYPE_JP_RN = 'jp_rn';
47
+ const TYPE_KR_BRN = 'kr_brn';
48
+ const TYPE_LI_UID = 'li_uid';
49
+ const TYPE_MX_RFC = 'mx_rfc';
50
+ const TYPE_MY_FRP = 'my_frp';
51
+ const TYPE_MY_ITN = 'my_itn';
52
+ const TYPE_MY_SST = 'my_sst';
53
+ const TYPE_NO_VAT = 'no_vat';
54
+ const TYPE_NZ_GST = 'nz_gst';
55
+ const TYPE_RU_INN = 'ru_inn';
56
+ const TYPE_RU_KPP = 'ru_kpp';
57
+ const TYPE_SA_VAT = 'sa_vat';
58
+ const TYPE_SG_GST = 'sg_gst';
59
+ const TYPE_SG_UEN = 'sg_uen';
60
+ const TYPE_TH_VAT = 'th_vat';
61
+ const TYPE_TW_VAT = 'tw_vat';
62
  const TYPE_UNKNOWN = 'unknown';
63
+ const TYPE_US_EIN = 'us_ein';
64
+ const TYPE_ZA_VAT = 'za_vat';
65
 
66
+ const VERIFICATION_STATUS_PENDING = 'pending';
 
 
 
 
67
  const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable';
68
+ const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
69
+ const VERIFICATION_STATUS_VERIFIED = 'verified';
70
 
71
  /**
72
+ * @return string the API URL for this tax id
73
  */
74
  public function instanceUrl()
75
  {
76
  $id = $this['id'];
77
  $customer = $this['customer'];
78
  if (!$id) {
79
+ throw new Exception\UnexpectedValueException(
80
+ "Could not determine which URL to request: class instance has invalid ID: {$id}"
 
81
  );
82
  }
83
  $id = Util\Util::utf8($id);
84
  $customer = Util\Util::utf8($customer);
85
 
86
  $base = Customer::classUrl();
87
+ $customerExtn = \urlencode($customer);
88
+ $extn = \urlencode($id);
89
+
90
+ return "{$base}/{$customerExtn}/tax_ids/{$extn}";
91
  }
92
 
93
  /**
94
  * @param array|string $_id
95
+ * @param null|array|string $_opts
96
  *
97
+ * @throws \Stripe\Exception\BadMethodCallException
98
  */
99
  public static function retrieve($_id, $_opts = null)
100
  {
101
+ $msg = 'Tax IDs cannot be retrieved without a customer ID. Retrieve ' .
102
+ "a tax ID using `Customer::retrieveTaxId('customer_id', " .
103
+ "'tax_id_id')`.";
104
+
105
+ throw new Exception\BadMethodCallException($msg);
106
  }
107
  }
app/api/Stripe/TaxRate.php CHANGED
@@ -1,27 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class TaxRate
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $active
11
- * @property int $created
12
- * @property string $description
13
- * @property string $display_name
14
- * @property bool $inclusive
15
- * @property string $jurisdiction
16
- * @property bool $livemode
17
- * @property StripeObject $metadata
18
- * @property float $percentage
19
  *
20
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
  class TaxRate extends ApiResource
23
  {
24
- const OBJECT_NAME = "tax_rate";
25
 
26
  use ApiOperations\All;
27
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Tax rates can be applied to <a
9
+ * href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a
10
+ * href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and
11
+ * <a
12
+ * href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout
13
+ * Sessions</a> to collect tax.
14
  *
15
+ * Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax
16
+ * Rates</a>.
 
 
 
 
 
 
 
 
 
17
  *
18
+ * @property string $id Unique identifier for the object.
19
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
20
+ * @property bool $active Defaults to <code>true</code>. When set to <code>false</code>, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.
21
+ * @property null|string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
22
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
23
+ * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
24
+ * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
25
+ * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive.
26
+ * @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.
27
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
28
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29
+ * @property float $percentage This represents the tax rate percent out of 100.
30
+ * @property null|string $state <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US">ISO 3166-2 subdivision code</a>, without country prefix. For example, &quot;NY&quot; for New York, United States.
31
  */
32
  class TaxRate extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'tax_rate';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
app/api/Stripe/Terminal/ConnectionToken.php CHANGED
@@ -1,17 +1,23 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
6
- * Class ConnectionToken
7
  *
8
- * @property string $secret
 
 
9
  *
10
- * @package Stripe\Terminal
 
 
11
  */
12
  class ConnectionToken extends \Stripe\ApiResource
13
  {
14
- const OBJECT_NAME = "terminal.connection_token";
15
 
16
  use \Stripe\ApiOperations\Create;
17
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
8
+ * A Connection Token is used by the Stripe Terminal SDK to connect to a reader.
9
  *
10
+ * Related guide: <a
11
+ * href="https://stripe.com/docs/terminal/readers/fleet-management#create">Fleet
12
+ * Management</a>.
13
  *
14
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
15
+ * @property string $location The id of the location that this connection token is scoped to.
16
+ * @property string $secret Your application should pass this token to the Stripe Terminal SDK.
17
  */
18
  class ConnectionToken extends \Stripe\ApiResource
19
  {
20
+ const OBJECT_NAME = 'terminal.connection_token';
21
 
22
  use \Stripe\ApiOperations\Create;
23
  }
app/api/Stripe/Terminal/Location.php CHANGED
@@ -1,21 +1,26 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
6
- * Class Location
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property mixed $address
11
- * @property bool $deleted
12
- * @property string $display_name
13
  *
14
- * @package Stripe\Terminal
 
 
 
 
 
15
  */
16
  class Location extends \Stripe\ApiResource
17
  {
18
- const OBJECT_NAME = "terminal.location";
19
 
20
  use \Stripe\ApiOperations\All;
21
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
8
+ * A Location represents a grouping of readers.
9
  *
10
+ * Related guide: <a
11
+ * href="https://stripe.com/docs/terminal/readers/fleet-management#create">Fleet
12
+ * Management</a>.
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property \Stripe\StripeObject $address
17
+ * @property string $display_name The display name of the location.
18
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
19
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
20
  */
21
  class Location extends \Stripe\ApiResource
22
  {
23
+ const OBJECT_NAME = 'terminal.location';
24
 
25
  use \Stripe\ApiOperations\All;
26
  use \Stripe\ApiOperations\Create;
app/api/Stripe/Terminal/Reader.php CHANGED
@@ -1,26 +1,31 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
6
- * Class Reader
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property bool $deleted
11
- * @property string $device_sw_version
12
- * @property string $device_type
13
- * @property string $ip_address
14
- * @property string $label
15
- * @property string $location
16
- * @property string $serial_number
17
- * @property string $status
18
  *
19
- * @package Stripe\Terminal
 
 
 
 
 
 
 
 
 
 
20
  */
21
  class Reader extends \Stripe\ApiResource
22
  {
23
- const OBJECT_NAME = "terminal.reader";
24
 
25
  use \Stripe\ApiOperations\All;
26
  use \Stripe\ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
8
+ * A Reader represents a physical device for accepting payment details.
9
  *
10
+ * Related guide: <a
11
+ * href="https://stripe.com/docs/terminal/readers/connecting">Connecting to a
12
+ * Reader</a>.
 
 
 
 
 
 
 
13
  *
14
+ * @property string $id Unique identifier for the object.
15
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
16
+ * @property null|string $device_sw_version The current software version of the reader.
17
+ * @property string $device_type Type of reader, one of <code>bbpos_chipper2x</code> or <code>verifone_P400</code>.
18
+ * @property null|string $ip_address The local IP address of the reader.
19
+ * @property string $label Custom label given to the reader for easier identification.
20
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
21
+ * @property null|string $location The location identifier of the reader.
22
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
23
+ * @property string $serial_number Serial number of the reader.
24
+ * @property null|string $status The networking status of the reader.
25
  */
26
  class Reader extends \Stripe\ApiResource
27
  {
28
+ const OBJECT_NAME = 'terminal.reader';
29
 
30
  use \Stripe\ApiOperations\All;
31
  use \Stripe\ApiOperations\Create;
app/api/Stripe/ThreeDSecure.php CHANGED
@@ -1,19 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  class ThreeDSecure extends ApiResource
6
  {
7
- const OBJECT_NAME = "three_d_secure";
8
 
9
  use ApiOperations\Create;
10
  use ApiOperations\Retrieve;
11
 
12
  /**
13
- * @return string The endpoint URL for the given class.
14
  */
15
  public static function classUrl()
16
  {
17
- return "/v1/3d_secure";
18
  }
19
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
+ /**
8
+ * Cardholder authentication via 3D Secure is initiated by creating a <code>3D
9
+ * Secure</code> object. Once the object has been created, you can use it to
10
+ * authenticate the cardholder and create a charge.
11
+ *
12
+ * @property string $id Unique identifier for the object.
13
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
14
+ * @property int $amount Amount of the charge that you will create when authentication completes.
15
+ * @property bool $authenticated True if the cardholder went through the authentication flow and their bank indicated that authentication succeeded.
16
+ * @property \Stripe\Card $card <p>You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.</p><p>Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments with Sources</a>.</p>
17
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
19
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
20
+ * @property null|string $redirect_url If present, this is the URL that you should send the cardholder to for authentication. If you are going to use Stripe.js to display the authentication page in an iframe, you should use the value &quot;_callback&quot;.
21
+ * @property string $status Possible values are <code>redirect_pending</code>, <code>succeeded</code>, or <code>failed</code>. When the cardholder can be authenticated, the object starts with status <code>redirect_pending</code>. When liability will be shifted to the cardholder's bank (either because the cardholder was successfully authenticated, or because the bank has not implemented 3D Secure, the object wlil be in status <code>succeeded</code>. <code>failed</code> indicates that authentication was attempted unsuccessfully.
22
+ */
23
  class ThreeDSecure extends ApiResource
24
  {
25
+ const OBJECT_NAME = 'three_d_secure';
26
 
27
  use ApiOperations\Create;
28
  use ApiOperations\Retrieve;
29
 
30
  /**
31
+ * @return string the endpoint URL for the given class
32
  */
33
  public static function classUrl()
34
  {
35
+ return '/v1/3d_secure';
36
  }
37
  }
app/api/Stripe/Token.php CHANGED
@@ -1,35 +1,57 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Token
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property BankAccount $bank_account
11
- * @property Card $card
12
- * @property string $client_ip
13
- * @property int $created
14
- * @property bool $livemode
15
- * @property string $type
16
- * @property bool $used
17
  *
18
- * @package Stripe
 
 
 
 
 
 
 
 
19
  */
20
  class Token extends ApiResource
21
  {
22
- const OBJECT_NAME = "token";
23
 
24
  use ApiOperations\Create;
25
  use ApiOperations\Retrieve;
26
 
27
- /**
28
- * Possible string representations of the token type.
29
- * @link https://stripe.com/docs/api/tokens/object#token_object-type
30
- */
31
- const TYPE_ACCOUNT = 'account';
32
  const TYPE_BANK_ACCOUNT = 'bank_account';
33
- const TYPE_CARD = 'card';
34
- const TYPE_PII = 'pii';
35
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Tokenization is the process Stripe uses to collect sensitive card or bank
9
+ * account details, or personally identifiable information (PII), directly from
10
+ * your customers in a secure manner. A token representing this information is
11
+ * returned to your server to use. You should use our <a
12
+ * href="https://stripe.com/docs/payments">recommended payments integrations</a> to
13
+ * perform this process client-side. This ensures that no sensitive card data
14
+ * touches your server, and allows your integration to operate in a PCI-compliant
15
+ * way.
16
+ *
17
+ * If you cannot use client-side tokenization, you can also create tokens using the
18
+ * API with either your publishable or secret API key. Keep in mind that if your
19
+ * integration uses this method, you are responsible for any PCI compliance that
20
+ * may be required, and you must keep your secret API key safe. Unlike with
21
+ * client-side tokenization, your customer's information is not sent directly to
22
+ * Stripe, so we cannot determine how it is handled or stored.
23
+ *
24
+ * Tokens cannot be stored or used more than once. To store card or bank account
25
+ * information for later use, you can create <a
26
+ * href="https://stripe.com/docs/api#customers">Customer</a> objects or <a
27
+ * href="https://stripe.com/docs/api#external_accounts">Custom accounts</a>. Note
28
+ * that <a href="https://stripe.com/docs/radar">Radar</a>, our integrated solution
29
+ * for automatic fraud protection, supports only integrations that use client-side
30
+ * tokenization.
31
  *
32
+ * Related guide: <a
33
+ * href="https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token">Accept
34
+ * a payment</a>
 
 
 
 
 
 
35
  *
36
+ * @property string $id Unique identifier for the object.
37
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
38
+ * @property \Stripe\BankAccount $bank_account <p>These bank accounts are payment methods on <code>Customer</code> objects.</p><p>On the other hand <a href="https://stripe.com/docs/api#external_accounts">External Accounts</a> are transfer destinations on <code>Account</code> objects for <a href="https://stripe.com/docs/connect/custom-accounts">Custom accounts</a>. They can be bank accounts or debit cards as well, and are documented in the links above.</p><p>Related guide: <a href="https://stripe.com/docs/payments/bank-debits-transfers">Bank Debits and Transfers</a>.</p>
39
+ * @property \Stripe\Card $card <p>You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.</p><p>Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments with Sources</a>.</p>
40
+ * @property null|string $client_ip IP address of the client that generated the token.
41
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
42
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
43
+ * @property string $type Type of the token: <code>account</code>, <code>bank_account</code>, <code>card</code>, or <code>pii</code>.
44
+ * @property bool $used Whether this token has already been used (tokens can be used only once).
45
  */
46
  class Token extends ApiResource
47
  {
48
+ const OBJECT_NAME = 'token';
49
 
50
  use ApiOperations\Create;
51
  use ApiOperations\Retrieve;
52
 
53
+ const TYPE_ACCOUNT = 'account';
 
 
 
 
54
  const TYPE_BANK_ACCOUNT = 'bank_account';
55
+ const TYPE_CARD = 'card';
56
+ const TYPE_PII = 'pii';
57
  }
app/api/Stripe/Topup.php CHANGED
@@ -1,59 +1,63 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Topup
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $balance_transaction
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $description
15
- * @property int $expected_availability_date
16
- * @property string $failure_code
17
- * @property string $failure_message
18
- * @property bool $livemode
19
- * @property StripeObject $metadata
20
- * @property mixed $source
21
- * @property string $statement_descriptor
22
- * @property string $status
23
- * @property string $transfer_group
24
  *
25
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  */
27
  class Topup extends ApiResource
28
  {
29
- const OBJECT_NAME = "topup";
30
 
31
  use ApiOperations\All;
32
  use ApiOperations\Create;
33
  use ApiOperations\Retrieve;
34
  use ApiOperations\Update;
35
 
36
- /**
37
- * Possible string representations of the status of the top-up.
38
- * @link https://stripe.com/docs/api/topups/object#topup_object-status
39
- */
40
- const STATUS_CANCELED = 'canceled';
41
- const STATUS_FAILED = 'failed';
42
- const STATUS_PENDING = 'pending';
43
- const STATUS_REVERSED = 'reversed';
44
  const STATUS_SUCCEEDED = 'succeeded';
45
 
46
  /**
47
- * @param array|null $params
48
- * @param array|string|null $options
49
  *
50
- * @return Topup The canceled topup.
 
 
51
  */
52
- public function cancel($params = null, $options = null)
53
  {
54
  $url = $this->instanceUrl() . '/cancel';
55
- list($response, $opts) = $this->_request('post', $url, $params, $options);
56
  $this->refreshFrom($response, $opts);
 
57
  return $this;
58
  }
59
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * To top up your Stripe balance, you create a top-up object. You can retrieve
9
+ * individual top-ups, as well as list all top-ups. Top-ups are identified by a
10
+ * unique, random ID.
11
  *
12
+ * Related guide: <a href="https://stripe.com/docs/connect/top-ups">Topping Up your
13
+ * Platform Account</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property int $amount Amount transferred.
18
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
19
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
21
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
22
+ * @property null|int $expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up.
23
+ * @property null|string $failure_code Error code explaining reason for top-up failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes).
24
+ * @property null|string $failure_message Message to user further explaining reason for top-up failure if available.
25
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
26
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
27
+ * @property \Stripe\Source $source <p><code>Source</code> objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Stripe API just like a <code>Card</code> object: once chargeable, they can be charged, or can be attached to customers.</p><p>Related guides: <a href="https://stripe.com/docs/sources">Sources API</a> and <a href="https://stripe.com/docs/sources/customers">Sources &amp; Customers</a>.</p>
28
+ * @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
29
+ * @property string $status The status of the top-up is either <code>canceled</code>, <code>failed</code>, <code>pending</code>, <code>reversed</code>, or <code>succeeded</code>.
30
+ * @property null|string $transfer_group A string that identifies this top-up as part of a group.
31
  */
32
  class Topup extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'topup';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
38
  use ApiOperations\Retrieve;
39
  use ApiOperations\Update;
40
 
41
+ const STATUS_CANCELED = 'canceled';
42
+ const STATUS_FAILED = 'failed';
43
+ const STATUS_PENDING = 'pending';
44
+ const STATUS_REVERSED = 'reversed';
 
 
 
 
45
  const STATUS_SUCCEEDED = 'succeeded';
46
 
47
  /**
48
+ * @param null|array $params
49
+ * @param null|array|string $opts
50
  *
51
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
52
+ *
53
+ * @return Topup the canceled topup
54
  */
55
+ public function cancel($params = null, $opts = null)
56
  {
57
  $url = $this->instanceUrl() . '/cancel';
58
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
59
  $this->refreshFrom($response, $opts);
60
+
61
  return $this;
62
  }
63
  }
app/api/Stripe/Transfer.php CHANGED
@@ -1,33 +1,44 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class Transfer
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property int $amount_reversed
12
- * @property string $balance_transaction
13
- * @property int $created
14
- * @property string $currency
15
- * @property string $description
16
- * @property string $destination
17
- * @property string $destination_payment
18
- * @property bool $livemode
19
- * @property StripeObject $metadata
20
- * @property Collection $reversals
21
- * @property bool $reversed
22
- * @property string $source_transaction
23
- * @property string $source_type
24
- * @property string $transfer_group
25
  *
26
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  */
28
  class Transfer extends ApiResource
29
  {
30
- const OBJECT_NAME = "transfer";
31
 
32
  use ApiOperations\All;
33
  use ApiOperations\Create;
@@ -35,45 +46,52 @@ class Transfer extends ApiResource
35
  use ApiOperations\Retrieve;
36
  use ApiOperations\Update;
37
 
38
- const PATH_REVERSALS = '/reversals';
39
-
40
- /**
41
- * Possible string representations of the source type of the transfer.
42
- * @link https://stripe.com/docs/api/transfers/object#transfer_object-source_type
43
- */
44
  const SOURCE_TYPE_ALIPAY_ACCOUNT = 'alipay_account';
45
- const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account';
46
- const SOURCE_TYPE_CARD = 'card';
47
- const SOURCE_TYPE_FINANCING = 'financing';
48
 
49
  /**
50
- * @return TransferReversal The created transfer reversal.
 
 
 
 
 
51
  */
52
- public function reverse($params = null, $opts = null)
53
  {
54
- $url = $this->instanceUrl() . '/reversals';
55
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
56
  $this->refreshFrom($response, $opts);
 
57
  return $this;
58
  }
59
 
 
 
60
  /**
61
- * @return Transfer The canceled transfer.
 
 
 
 
 
 
62
  */
63
- public function cancel()
64
  {
65
- $url = $this->instanceUrl() . '/cancel';
66
- list($response, $opts) = $this->_request('post', $url);
67
- $this->refreshFrom($response, $opts);
68
- return $this;
69
  }
70
 
71
  /**
72
- * @param string|null $id The ID of the transfer on which to create the reversal.
73
- * @param array|null $params
74
- * @param array|string|null $opts
75
  *
76
- * @return TransferReversal
 
 
77
  */
78
  public static function createReversal($id, $params = null, $opts = null)
79
  {
@@ -81,12 +99,14 @@ class Transfer extends ApiResource
81
  }
82
 
83
  /**
84
- * @param string|null $id The ID of the transfer to which the reversal belongs.
85
- * @param array|null $reversalId The ID of the reversal to retrieve.
86
- * @param array|null $params
87
- * @param array|string|null $opts
 
 
88
  *
89
- * @return TransferReversal
90
  */
91
  public static function retrieveReversal($id, $reversalId, $params = null, $opts = null)
92
  {
@@ -94,27 +114,17 @@ class Transfer extends ApiResource
94
  }
95
 
96
  /**
97
- * @param string|null $id The ID of the transfer to which the reversal belongs.
98
- * @param array|null $reversalId The ID of the reversal to update.
99
- * @param array|null $params
100
- * @param array|string|null $opts
101
  *
102
- * @return TransferReversal
 
 
103
  */
104
  public static function updateReversal($id, $reversalId, $params = null, $opts = null)
105
  {
106
  return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts);
107
  }
108
-
109
- /**
110
- * @param string|null $id The ID of the transfer on which to retrieve the reversals.
111
- * @param array|null $params
112
- * @param array|string|null $opts
113
- *
114
- * @return Collection The list of reversals.
115
- */
116
- public static function allReversals($id, $params = null, $opts = null)
117
- {
118
- return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts);
119
- }
120
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * A <code>Transfer</code> object is created when you move funds between Stripe
9
+ * accounts as part of Connect.
10
+ *
11
+ * Before April 6, 2017, transfers also represented movement of funds from a Stripe
12
+ * account to a card or bank account. This behavior has since been split out into a
13
+ * <a href="https://stripe.com/docs/api#payout_object">Payout</a> object, with
14
+ * corresponding payout endpoints. For more information, read about the <a
15
+ * href="https://stripe.com/docs/transfer-payout-split">transfer/payout split</a>.
16
  *
17
+ * Related guide: <a
18
+ * href="https://stripe.com/docs/connect/charges-transfers">Creating Separate
19
+ * Charges and Transfers</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
+ * @property string $id Unique identifier for the object.
22
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
23
+ * @property int $amount Amount in %s to be transferred.
24
+ * @property int $amount_reversed Amount in %s reversed (can be less than the amount attribute on the transfer if a partial reversal was issued).
25
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this transfer on your account balance.
26
+ * @property int $created Time that this record of the transfer was first created.
27
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
28
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
29
+ * @property null|string|\Stripe\Account $destination ID of the Stripe account the transfer was sent to.
30
+ * @property string|\Stripe\Charge $destination_payment If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer.
31
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
32
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
33
+ * @property \Stripe\Collection $reversals A list of reversals that have been applied to the transfer.
34
+ * @property bool $reversed Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false.
35
+ * @property null|string|\Stripe\Charge $source_transaction ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance.
36
+ * @property null|string $source_type The source balance this transfer came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>.
37
+ * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the <a href="https://stripe.com/docs/connect/charges-transfers#transfer-options">Connect documentation</a> for details.
38
  */
39
  class Transfer extends ApiResource
40
  {
41
+ const OBJECT_NAME = 'transfer';
42
 
43
  use ApiOperations\All;
44
  use ApiOperations\Create;
46
  use ApiOperations\Retrieve;
47
  use ApiOperations\Update;
48
 
 
 
 
 
 
 
49
  const SOURCE_TYPE_ALIPAY_ACCOUNT = 'alipay_account';
50
+ const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account';
51
+ const SOURCE_TYPE_CARD = 'card';
52
+ const SOURCE_TYPE_FINANCING = 'financing';
53
 
54
  /**
55
+ * @param null|array $params
56
+ * @param null|array|string $opts
57
+ *
58
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
59
+ *
60
+ * @return Transfer the canceled transfer
61
  */
62
+ public function cancel($params = null, $opts = null)
63
  {
64
+ $url = $this->instanceUrl() . '/cancel';
65
  list($response, $opts) = $this->_request('post', $url, $params, $opts);
66
  $this->refreshFrom($response, $opts);
67
+
68
  return $this;
69
  }
70
 
71
+ const PATH_REVERSALS = '/reversals';
72
+
73
  /**
74
+ * @param string $id the ID of the transfer on which to retrieve the transfer reversals
75
+ * @param null|array $params
76
+ * @param null|array|string $opts
77
+ *
78
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
79
+ *
80
+ * @return \Stripe\Collection the list of transfer reversals
81
  */
82
+ public static function allReversals($id, $params = null, $opts = null)
83
  {
84
+ return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts);
 
 
 
85
  }
86
 
87
  /**
88
+ * @param string $id the ID of the transfer on which to create the transfer reversal
89
+ * @param null|array $params
90
+ * @param null|array|string $opts
91
  *
92
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
93
+ *
94
+ * @return \Stripe\TransferReversal
95
  */
96
  public static function createReversal($id, $params = null, $opts = null)
97
  {
99
  }
100
 
101
  /**
102
+ * @param string $id the ID of the transfer to which the transfer reversal belongs
103
+ * @param string $reversalId the ID of the transfer reversal to retrieve
104
+ * @param null|array $params
105
+ * @param null|array|string $opts
106
+ *
107
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
108
  *
109
+ * @return \Stripe\TransferReversal
110
  */
111
  public static function retrieveReversal($id, $reversalId, $params = null, $opts = null)
112
  {
114
  }
115
 
116
  /**
117
+ * @param string $id the ID of the transfer to which the transfer reversal belongs
118
+ * @param string $reversalId the ID of the transfer reversal to update
119
+ * @param null|array $params
120
+ * @param null|array|string $opts
121
  *
122
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
123
+ *
124
+ * @return \Stripe\TransferReversal
125
  */
126
  public static function updateReversal($id, $reversalId, $params = null, $opts = null)
127
  {
128
  return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts);
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
app/api/Stripe/TransferReversal.php CHANGED
@@ -1,42 +1,57 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class TransferReversal
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $amount
11
- * @property string $balance_transaction
12
- * @property int $created
13
- * @property string $currency
14
- * @property string $destination_payment_refund
15
- * @property StripeObject $metadata
16
- * @property string $source_refund
17
- * @property string $transfer
18
  *
19
- * @package Stripe
 
 
 
 
 
 
 
 
 
20
  */
21
  class TransferReversal extends ApiResource
22
  {
23
- const OBJECT_NAME = "transfer_reversal";
24
 
25
  use ApiOperations\Update {
26
  save as protected _save;
27
  }
28
 
29
  /**
30
- * @return string The API URL for this Stripe transfer reversal.
31
  */
32
  public function instanceUrl()
33
  {
34
  $id = $this['id'];
35
  $transfer = $this['transfer'];
36
  if (!$id) {
37
- throw new Error\InvalidRequest(
38
- "Could not determine which URL to request: " .
39
- "class instance has invalid ID: $id",
40
  null
41
  );
42
  }
@@ -44,15 +59,18 @@ class TransferReversal extends ApiResource
44
  $transfer = Util\Util::utf8($transfer);
45
 
46
  $base = Transfer::classUrl();
47
- $transferExtn = urlencode($transfer);
48
- $extn = urlencode($id);
49
- return "$base/$transferExtn/reversals/$extn";
 
50
  }
51
 
52
  /**
53
- * @param array|string|null $opts
 
 
54
  *
55
- * @return TransferReversal The saved reversal.
56
  */
57
  public function save($opts = null)
58
  {
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * <a href="https://stripe.com/docs/connect">Stripe Connect</a> platforms can
9
+ * reverse transfers made to a connected account, either entirely or partially, and
10
+ * can also specify whether to refund any related application fees. Transfer
11
+ * reversals add to the platform's balance and subtract from the destination
12
+ * account's balance.
13
+ *
14
+ * Reversing a transfer that was made for a <a
15
+ * href="/docs/connect/destination-charges">destination charge</a> is allowed only
16
+ * up to the amount of the charge. It is possible to reverse a <a
17
+ * href="https://stripe.com/docs/connect/charges-transfers#transfer-options">transfer_group</a>
18
+ * transfer only if the destination account has enough balance to cover the
19
+ * reversal.
20
  *
21
+ * Related guide: <a
22
+ * href="https://stripe.com/docs/connect/charges-transfers#reversing-transfers">Reversing
23
+ * Transfers</a>.
 
 
 
 
 
 
 
24
  *
25
+ * @property string $id Unique identifier for the object.
26
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
27
+ * @property int $amount Amount, in %s.
28
+ * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
29
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
30
+ * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
31
+ * @property null|string|\Stripe\Refund $destination_payment_refund Linked payment refund for the transfer reversal.
32
+ * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
33
+ * @property null|string|\Stripe\Refund $source_refund ID of the refund responsible for the transfer reversal.
34
+ * @property string|\Stripe\Transfer $transfer ID of the transfer that was reversed.
35
  */
36
  class TransferReversal extends ApiResource
37
  {
38
+ const OBJECT_NAME = 'transfer_reversal';
39
 
40
  use ApiOperations\Update {
41
  save as protected _save;
42
  }
43
 
44
  /**
45
+ * @return string the API URL for this Stripe transfer reversal
46
  */
47
  public function instanceUrl()
48
  {
49
  $id = $this['id'];
50
  $transfer = $this['transfer'];
51
  if (!$id) {
52
+ throw new Exception\UnexpectedValueException(
53
+ 'Could not determine which URL to request: ' .
54
+ "class instance has invalid ID: {$id}",
55
  null
56
  );
57
  }
59
  $transfer = Util\Util::utf8($transfer);
60
 
61
  $base = Transfer::classUrl();
62
+ $transferExtn = \urlencode($transfer);
63
+ $extn = \urlencode($id);
64
+
65
+ return "{$base}/{$transferExtn}/reversals/{$extn}";
66
  }
67
 
68
  /**
69
+ * @param null|array|string $opts
70
+ *
71
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
72
  *
73
+ * @return TransferReversal the saved reversal
74
  */
75
  public function save($opts = null)
76
  {
app/api/Stripe/UsageRecord.php CHANGED
@@ -1,43 +1,25 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class UsageRecord
 
7
  *
8
- * @package Stripe
 
 
9
  *
10
- * @property string $id
11
- * @property string $object
12
- * @property bool $livemode
13
- * @property int $quantity
14
- * @property string $subscription_item
15
- * @property int $timestamp
16
  */
17
  class UsageRecord extends ApiResource
18
  {
19
- const OBJECT_NAME = "usage_record";
20
-
21
- /**
22
- * @param array|null $params
23
- * @param array|string|null $options
24
- *
25
- * @return \Stripe\ApiResource The created resource.
26
- */
27
- public static function create($params = null, $options = null)
28
- {
29
- self::_validateParams($params);
30
- if (!array_key_exists('subscription_item', $params)) {
31
- throw new Error\InvalidRequest("Missing subscription_item param in request", null);
32
- }
33
- $subscription_item = $params['subscription_item'];
34
- $url = "/v1/subscription_items/$subscription_item/usage_records";
35
- $request_params = $params;
36
- unset($request_params['subscription_item']);
37
-
38
- list($response, $opts) = static::_staticRequest('post', $url, $request_params, $options);
39
- $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
40
- $obj->setLastResponse($response);
41
- return $obj;
42
- }
43
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * Usage records allow you to report customer usage and metrics to Stripe for
9
+ * metered billing of subscription prices.
10
  *
11
+ * Related guide: <a
12
+ * href="https://stripe.com/docs/billing/subscriptions/metered-billing">Metered
13
+ * Billing</a>.
14
  *
15
+ * @property string $id Unique identifier for the object.
16
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
17
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
18
+ * @property int $quantity The usage quantity for the specified date.
19
+ * @property string $subscription_item The ID of the subscription item this usage record contains data for.
20
+ * @property int $timestamp The timestamp when this usage occurred.
21
  */
22
  class UsageRecord extends ApiResource
23
  {
24
+ const OBJECT_NAME = 'usage_record';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
app/api/Stripe/UsageRecordSummary.php CHANGED
@@ -1,21 +1,19 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class UsageRecord
7
- *
8
- * @package Stripe
9
- *
10
- * @property string $id
11
- * @property string $object
12
- * @property string $invoice
13
- * @property bool $livemode
14
- * @property mixed $period
15
- * @property string $subscription_item
16
- * @property int $total_usage
17
  */
18
  class UsageRecordSummary extends ApiResource
19
  {
20
- const OBJECT_NAME = "usage_record_summary";
21
  }
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * @property string $id Unique identifier for the object.
9
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
10
+ * @property null|string $invoice The invoice in which this usage period has been billed for.
11
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
12
+ * @property \Stripe\StripeObject $period
13
+ * @property string $subscription_item The ID of the subscription item this summary is describing.
14
+ * @property int $total_usage The total usage within this usage period.
 
 
 
 
15
  */
16
  class UsageRecordSummary extends ApiResource
17
  {
18
+ const OBJECT_NAME = 'usage_record_summary';
19
  }
app/api/Stripe/Util/AutoPagingIterator.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- namespace Stripe\Util;
4
-
5
- class AutoPagingIterator implements \Iterator
6
- {
7
- private $lastId = null;
8
- private $page = null;
9
- private $pageOffset = 0;
10
- private $params = [];
11
-
12
- public function __construct($collection, $params)
13
- {
14
- $this->page = $collection;
15
- $this->params = $params;
16
- }
17
-
18
- public function rewind()
19
- {
20
- // Actually rewinding would require making a copy of the original page.
21
- }
22
-
23
- public function current()
24
- {
25
- $item = current($this->page->data);
26
- $this->lastId = $item !== false ? $item['id'] : null;
27
-
28
- return $item;
29
- }
30
-
31
- public function key()
32
- {
33
- return key($this->page->data) + $this->pageOffset;
34
- }
35
-
36
- public function next()
37
- {
38
- $item = next($this->page->data);
39
- if ($item === false) {
40
- // If we've run out of data on the current page, try to fetch another one
41
- // and increase the offset the new page would start at
42
- $this->pageOffset += count($this->page->data);
43
- if ($this->page['has_more']) {
44
- $this->params = array_merge(
45
- $this->params ?: [],
46
- ['starting_after' => $this->lastId]
47
- );
48
- $this->page = $this->page->all($this->params);
49
- } else {
50
- return false;
51
- }
52
- }
53
- }
54
-
55
- public function valid()
56
- {
57
- $key = key($this->page->data);
58
- $valid = ($key !== null && $key !== false);
59
- return $valid;
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/api/Stripe/Util/CaseInsensitiveArray.php CHANGED
@@ -2,8 +2,6 @@
2
 
3
  namespace Stripe\Util;
4
 
5
- use ArrayAccess;
6
-
7
  /**
8
  * CaseInsensitiveArray is an array-like class that ignores case for keys.
9
  *
@@ -14,19 +12,29 @@ use ArrayAccess;
14
  * In the context of stripe-php, this is useful because the API will return headers with different
15
  * case depending on whether HTTP/2 is used or not (with HTTP/2, headers are always in lowercase).
16
  */
17
- class CaseInsensitiveArray implements ArrayAccess
18
  {
19
- private $container = array();
 
 
 
 
 
20
 
21
- public function __construct($initial_array = array())
22
  {
23
- $this->container = array_map("strtolower", $initial_array);
 
 
 
 
 
24
  }
25
 
26
  public function offsetSet($offset, $value)
27
  {
28
  $offset = static::maybeLowercase($offset);
29
- if (is_null($offset)) {
30
  $this->container[] = $value;
31
  } else {
32
  $this->container[$offset] = $value;
@@ -36,6 +44,7 @@ class CaseInsensitiveArray implements ArrayAccess
36
  public function offsetExists($offset)
37
  {
38
  $offset = static::maybeLowercase($offset);
 
39
  return isset($this->container[$offset]);
40
  }
41
 
@@ -48,15 +57,16 @@ class CaseInsensitiveArray implements ArrayAccess
48
  public function offsetGet($offset)
49
  {
50
  $offset = static::maybeLowercase($offset);
 
51
  return isset($this->container[$offset]) ? $this->container[$offset] : null;
52
  }
53
 
54
  private static function maybeLowercase($v)
55
  {
56
- if (is_string($v)) {
57
- return strtolower($v);
58
- } else {
59
- return $v;
60
  }
 
 
61
  }
62
  }
2
 
3
  namespace Stripe\Util;
4
 
 
 
5
  /**
6
  * CaseInsensitiveArray is an array-like class that ignores case for keys.
7
  *
12
  * In the context of stripe-php, this is useful because the API will return headers with different
13
  * case depending on whether HTTP/2 is used or not (with HTTP/2, headers are always in lowercase).
14
  */
15
+ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \IteratorAggregate
16
  {
17
+ private $container = [];
18
+
19
+ public function __construct($initial_array = [])
20
+ {
21
+ $this->container = \array_change_key_case($initial_array, \CASE_LOWER);
22
+ }
23
 
24
+ public function count()
25
  {
26
+ return \count($this->container);
27
+ }
28
+
29
+ public function getIterator()
30
+ {
31
+ return new \ArrayIterator($this->container);
32
  }
33
 
34
  public function offsetSet($offset, $value)
35
  {
36
  $offset = static::maybeLowercase($offset);
37
+ if (null === $offset) {
38
  $this->container[] = $value;
39
  } else {
40
  $this->container[$offset] = $value;
44
  public function offsetExists($offset)
45
  {
46
  $offset = static::maybeLowercase($offset);
47
+
48
  return isset($this->container[$offset]);
49
  }
50
 
57
  public function offsetGet($offset)
58
  {
59
  $offset = static::maybeLowercase($offset);
60
+
61
  return isset($this->container[$offset]) ? $this->container[$offset] : null;
62
  }
63
 
64
  private static function maybeLowercase($v)
65
  {
66
+ if (\is_string($v)) {
67
+ return \strtolower($v);
 
 
68
  }
69
+
70
+ return $v;
71
  }
72
  }
app/api/Stripe/Util/DefaultLogger.php CHANGED
@@ -8,11 +8,22 @@ namespace Stripe\Util;
8
  */
9
  class DefaultLogger implements LoggerInterface
10
  {
 
 
 
 
 
 
11
  public function error($message, array $context = [])
12
  {
13
- if (count($context) > 0) {
14
- throw new \Exception('DefaultLogger does not currently implement context. Please implement if you need it.');
 
 
 
 
 
 
15
  }
16
- error_log($message);
17
  }
18
  }
8
  */
9
  class DefaultLogger implements LoggerInterface
10
  {
11
+ /** @var int */
12
+ public $messageType = 0;
13
+
14
+ /** @var null|string */
15
+ public $destination;
16
+
17
  public function error($message, array $context = [])
18
  {
19
+ if (\count($context) > 0) {
20
+ throw new \Stripe\Exception\BadMethodCallException('DefaultLogger does not currently implement context. Please implement if you need it.');
21
+ }
22
+
23
+ if (null === $this->destination) {
24
+ \error_log($message, $this->messageType);
25
+ } else {
26
+ \error_log($message, $this->messageType, $this->destination);
27
  }
 
28
  }
29
  }
app/api/Stripe/Util/LoggerInterface.php CHANGED
@@ -29,8 +29,6 @@ interface LoggerInterface
29
  * be logged and monitored.
30
  *
31
  * @param string $message
32
- * @param array $context
33
- * @return null
34
  */
35
  public function error($message, array $context = []);
36
  }
29
  * be logged and monitored.
30
  *
31
  * @param string $message
 
 
32
  */
33
  public function error($message, array $context = []);
34
  }
app/api/Stripe/Util/ObjectTypes.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Util;
6
+
7
+ class ObjectTypes
8
+ {
9
+ /**
10
+ * @var array Mapping from object types to resource classes
11
+ */
12
+ const mapping = [
13
+ \Stripe\Account::OBJECT_NAME => \Stripe\Account::class,
14
+ \Stripe\AccountLink::OBJECT_NAME => \Stripe\AccountLink::class,
15
+ \Stripe\AlipayAccount::OBJECT_NAME => \Stripe\AlipayAccount::class,
16
+ \Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class,
17
+ \Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class,
18
+ \Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class,
19
+ \Stripe\Balance::OBJECT_NAME => \Stripe\Balance::class,
20
+ \Stripe\BalanceTransaction::OBJECT_NAME => \Stripe\BalanceTransaction::class,
21
+ \Stripe\BankAccount::OBJECT_NAME => \Stripe\BankAccount::class,
22
+ \Stripe\BillingPortal\Configuration::OBJECT_NAME => \Stripe\BillingPortal\Configuration::class,
23
+ \Stripe\BillingPortal\Session::OBJECT_NAME => \Stripe\BillingPortal\Session::class,
24
+ \Stripe\BitcoinReceiver::OBJECT_NAME => \Stripe\BitcoinReceiver::class,
25
+ \Stripe\BitcoinTransaction::OBJECT_NAME => \Stripe\BitcoinTransaction::class,
26
+ \Stripe\Capability::OBJECT_NAME => \Stripe\Capability::class,
27
+ \Stripe\Card::OBJECT_NAME => \Stripe\Card::class,
28
+ \Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class,
29
+ \Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class,
30
+ \Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class,
31
+ \Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class,
32
+ \Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class,
33
+ \Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class,
34
+ \Stripe\CreditNoteLineItem::OBJECT_NAME => \Stripe\CreditNoteLineItem::class,
35
+ \Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class,
36
+ \Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class,
37
+ \Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class,
38
+ \Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class,
39
+ \Stripe\EphemeralKey::OBJECT_NAME => \Stripe\EphemeralKey::class,
40
+ \Stripe\Event::OBJECT_NAME => \Stripe\Event::class,
41
+ \Stripe\ExchangeRate::OBJECT_NAME => \Stripe\ExchangeRate::class,
42
+ \Stripe\File::OBJECT_NAME => \Stripe\File::class,
43
+ \Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class,
44
+ \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class,
45
+ \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class,
46
+ \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class,
47
+ \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class,
48
+ \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class,
49
+ \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class,
50
+ \Stripe\Issuing\CardDetails::OBJECT_NAME => \Stripe\Issuing\CardDetails::class,
51
+ \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class,
52
+ \Stripe\Issuing\Dispute::OBJECT_NAME => \Stripe\Issuing\Dispute::class,
53
+ \Stripe\Issuing\Transaction::OBJECT_NAME => \Stripe\Issuing\Transaction::class,
54
+ \Stripe\LineItem::OBJECT_NAME => \Stripe\LineItem::class,
55
+ \Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class,
56
+ \Stripe\Mandate::OBJECT_NAME => \Stripe\Mandate::class,
57
+ \Stripe\Order::OBJECT_NAME => \Stripe\Order::class,
58
+ \Stripe\OrderItem::OBJECT_NAME => \Stripe\OrderItem::class,
59
+ \Stripe\OrderReturn::OBJECT_NAME => \Stripe\OrderReturn::class,
60
+ \Stripe\PaymentIntent::OBJECT_NAME => \Stripe\PaymentIntent::class,
61
+ \Stripe\PaymentMethod::OBJECT_NAME => \Stripe\PaymentMethod::class,
62
+ \Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class,
63
+ \Stripe\Person::OBJECT_NAME => \Stripe\Person::class,
64
+ \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class,
65
+ \Stripe\Price::OBJECT_NAME => \Stripe\Price::class,
66
+ \Stripe\Product::OBJECT_NAME => \Stripe\Product::class,
67
+ \Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class,
68
+ \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class,
69
+ \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class,
70
+ \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class,
71
+ \Stripe\Recipient::OBJECT_NAME => \Stripe\Recipient::class,
72
+ \Stripe\RecipientTransfer::OBJECT_NAME => \Stripe\RecipientTransfer::class,
73
+ \Stripe\Refund::OBJECT_NAME => \Stripe\Refund::class,
74
+ \Stripe\Reporting\ReportRun::OBJECT_NAME => \Stripe\Reporting\ReportRun::class,
75
+ \Stripe\Reporting\ReportType::OBJECT_NAME => \Stripe\Reporting\ReportType::class,
76
+ \Stripe\Review::OBJECT_NAME => \Stripe\Review::class,
77
+ \Stripe\SetupAttempt::OBJECT_NAME => \Stripe\SetupAttempt::class,
78
+ \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class,
79
+ \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class,
80
+ \Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class,
81
+ \Stripe\Source::OBJECT_NAME => \Stripe\Source::class,
82
+ \Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class,
83
+ \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class,
84
+ \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class,
85
+ \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class,
86
+ \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class,
87
+ \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class,
88
+ \Stripe\Terminal\ConnectionToken::OBJECT_NAME => \Stripe\Terminal\ConnectionToken::class,
89
+ \Stripe\Terminal\Location::OBJECT_NAME => \Stripe\Terminal\Location::class,
90
+ \Stripe\Terminal\Reader::OBJECT_NAME => \Stripe\Terminal\Reader::class,
91
+ \Stripe\ThreeDSecure::OBJECT_NAME => \Stripe\ThreeDSecure::class,
92
+ \Stripe\Token::OBJECT_NAME => \Stripe\Token::class,
93
+ \Stripe\Topup::OBJECT_NAME => \Stripe\Topup::class,
94
+ \Stripe\Transfer::OBJECT_NAME => \Stripe\Transfer::class,
95
+ \Stripe\TransferReversal::OBJECT_NAME => \Stripe\TransferReversal::class,
96
+ \Stripe\UsageRecord::OBJECT_NAME => \Stripe\UsageRecord::class,
97
+ \Stripe\UsageRecordSummary::OBJECT_NAME => \Stripe\UsageRecordSummary::class,
98
+ \Stripe\WebhookEndpoint::OBJECT_NAME => \Stripe\WebhookEndpoint::class,
99
+ ];
100
+ }
app/api/Stripe/Util/RandomGenerator.php CHANGED
@@ -12,11 +12,12 @@ class RandomGenerator
12
  * Returns a random value between 0 and $max.
13
  *
14
  * @param float $max (optional)
 
15
  * @return float
16
  */
17
  public function randFloat($max = 1.0)
18
  {
19
- return mt_rand() / mt_getrandmax() * $max;
20
  }
21
 
22
  /**
@@ -26,9 +27,10 @@ class RandomGenerator
26
  */
27
  public function uuid()
28
  {
29
- $arr = array_values(unpack('N1a/n4b/N1c', openssl_random_pseudo_bytes(16)));
30
  $arr[2] = ($arr[2] & 0x0fff) | 0x4000;
31
  $arr[3] = ($arr[3] & 0x3fff) | 0x8000;
32
- return vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr);
 
33
  }
34
  }
12
  * Returns a random value between 0 and $max.
13
  *
14
  * @param float $max (optional)
15
+ *
16
  * @return float
17
  */
18
  public function randFloat($max = 1.0)
19
  {
20
+ return \mt_rand() / \mt_getrandmax() * $max;
21
  }
22
 
23
  /**
27
  */
28
  public function uuid()
29
  {
30
+ $arr = \array_values(\unpack('N1a/n4b/N1c', \openssl_random_pseudo_bytes(16)));
31
  $arr[2] = ($arr[2] & 0x0fff) | 0x4000;
32
  $arr[3] = ($arr[3] & 0x3fff) | 0x8000;
33
+
34
+ return \vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr);
35
  }
36
  }
app/api/Stripe/Util/RequestOptions.php CHANGED
@@ -2,22 +2,30 @@
2
 
3
  namespace Stripe\Util;
4
 
5
- use Stripe\Error;
6
-
7
  class RequestOptions
8
  {
9
  /**
10
- * @var array A list of headers that should be persisted across requests.
11
  */
12
  public static $HEADERS_TO_PERSIST = [
13
  'Stripe-Account',
14
  'Stripe-Version',
15
  ];
16
 
 
17
  public $headers;
 
 
18
  public $apiKey;
 
 
19
  public $apiBase;
20
 
 
 
 
 
 
21
  public function __construct($key = null, $headers = [], $base = null)
22
  {
23
  $this->apiKey = $key;
@@ -25,23 +33,38 @@ class RequestOptions
25
  $this->apiBase = $base;
26
  }
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Unpacks an options array and merges it into the existing RequestOptions
30
  * object.
31
- * @param array|string|null $options a key => value array
 
 
32
  *
33
  * @return RequestOptions
34
  */
35
- public function merge($options)
36
  {
37
- $other_options = self::parse($options);
38
- if ($other_options->apiKey === null) {
39
  $other_options->apiKey = $this->apiKey;
40
  }
41
- if ($other_options->apiBase === null) {
42
  $other_options->apiBase = $this->apiBase;
43
  }
44
- $other_options->headers = array_merge($this->headers, $other_options->headers);
 
45
  return $other_options;
46
  }
47
 
@@ -51,51 +74,75 @@ class RequestOptions
51
  public function discardNonPersistentHeaders()
52
  {
53
  foreach ($this->headers as $k => $v) {
54
- if (!in_array($k, self::$HEADERS_TO_PERSIST)) {
55
  unset($this->headers[$k]);
56
  }
57
  }
58
  }
59
 
60
  /**
61
- * Unpacks an options array into an RequestOptions object
62
- * @param array|string|null $options a key => value array
 
 
 
 
63
  *
64
  * @return RequestOptions
65
  */
66
- public static function parse($options)
67
  {
68
  if ($options instanceof self) {
69
  return $options;
70
  }
71
 
72
- if (is_null($options)) {
73
  return new RequestOptions(null, [], null);
74
  }
75
 
76
- if (is_string($options)) {
 
 
 
 
 
 
 
77
  return new RequestOptions($options, [], null);
78
  }
79
 
80
- if (is_array($options)) {
81
  $headers = [];
82
  $key = null;
83
  $base = null;
84
- if (array_key_exists('api_key', $options)) {
 
85
  $key = $options['api_key'];
 
86
  }
87
- if (array_key_exists('idempotency_key', $options)) {
88
  $headers['Idempotency-Key'] = $options['idempotency_key'];
 
89
  }
90
- if (array_key_exists('stripe_account', $options)) {
91
  $headers['Stripe-Account'] = $options['stripe_account'];
 
92
  }
93
- if (array_key_exists('stripe_version', $options)) {
94
  $headers['Stripe-Version'] = $options['stripe_version'];
 
95
  }
96
- if (array_key_exists('api_base', $options)) {
97
  $base = $options['api_base'];
 
 
 
 
 
 
 
98
  }
 
99
  return new RequestOptions($key, $headers, $base);
100
  }
101
 
@@ -103,6 +150,19 @@ class RequestOptions
103
  . 'optional per-request apiKey, which must be a string, or '
104
  . 'per-request options, which must be an array. (HINT: you can set '
105
  . 'a global apiKey by "Stripe::setApiKey(<apiKey>)")';
106
- throw new Error\Api($message);
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  }
2
 
3
  namespace Stripe\Util;
4
 
 
 
5
  class RequestOptions
6
  {
7
  /**
8
+ * @var array<string> a list of headers that should be persisted across requests
9
  */
10
  public static $HEADERS_TO_PERSIST = [
11
  'Stripe-Account',
12
  'Stripe-Version',
13
  ];
14
 
15
+ /** @var array<string, string> */
16
  public $headers;
17
+
18
+ /** @var null|string */
19
  public $apiKey;
20
+
21
+ /** @var null|string */
22
  public $apiBase;
23
 
24
+ /**
25
+ * @param null|string $key
26
+ * @param array<string, string> $headers
27
+ * @param null|string $base
28
+ */
29
  public function __construct($key = null, $headers = [], $base = null)
30
  {
31
  $this->apiKey = $key;
33
  $this->apiBase = $base;
34
  }
35
 
36
+ /**
37
+ * @return array<string, string>
38
+ */
39
+ public function __debugInfo()
40
+ {
41
+ return [
42
+ 'apiKey' => $this->redactedApiKey(),
43
+ 'headers' => $this->headers,
44
+ 'apiBase' => $this->apiBase,
45
+ ];
46
+ }
47
+
48
  /**
49
  * Unpacks an options array and merges it into the existing RequestOptions
50
  * object.
51
+ *
52
+ * @param null|array|RequestOptions|string $options a key => value array
53
+ * @param bool $strict when true, forbid string form and arbitrary keys in array form
54
  *
55
  * @return RequestOptions
56
  */
57
+ public function merge($options, $strict = false)
58
  {
59
+ $other_options = self::parse($options, $strict);
60
+ if (null === $other_options->apiKey) {
61
  $other_options->apiKey = $this->apiKey;
62
  }
63
+ if (null === $other_options->apiBase) {
64
  $other_options->apiBase = $this->apiBase;
65
  }
66
+ $other_options->headers = \array_merge($this->headers, $other_options->headers);
67
+
68
  return $other_options;
69
  }
70
 
74
  public function discardNonPersistentHeaders()
75
  {
76
  foreach ($this->headers as $k => $v) {
77
+ if (!\in_array($k, self::$HEADERS_TO_PERSIST, true)) {
78
  unset($this->headers[$k]);
79
  }
80
  }
81
  }
82
 
83
  /**
84
+ * Unpacks an options array into an RequestOptions object.
85
+ *
86
+ * @param null|array|RequestOptions|string $options a key => value array
87
+ * @param bool $strict when true, forbid string form and arbitrary keys in array form
88
+ *
89
+ * @throws \Stripe\Exception\InvalidArgumentException
90
  *
91
  * @return RequestOptions
92
  */
93
+ public static function parse($options, $strict = false)
94
  {
95
  if ($options instanceof self) {
96
  return $options;
97
  }
98
 
99
+ if (null === $options) {
100
  return new RequestOptions(null, [], null);
101
  }
102
 
103
+ if (\is_string($options)) {
104
+ if ($strict) {
105
+ $message = 'Do not pass a string for request options. If you want to set the '
106
+ . 'API key, pass an array like ["api_key" => <apiKey>] instead.';
107
+
108
+ throw new \Stripe\Exception\InvalidArgumentException($message);
109
+ }
110
+
111
  return new RequestOptions($options, [], null);
112
  }
113
 
114
+ if (\is_array($options)) {
115
  $headers = [];
116
  $key = null;
117
  $base = null;
118
+
119
+ if (\array_key_exists('api_key', $options)) {
120
  $key = $options['api_key'];
121
+ unset($options['api_key']);
122
  }
123
+ if (\array_key_exists('idempotency_key', $options)) {
124
  $headers['Idempotency-Key'] = $options['idempotency_key'];
125
+ unset($options['idempotency_key']);
126
  }
127
+ if (\array_key_exists('stripe_account', $options)) {
128
  $headers['Stripe-Account'] = $options['stripe_account'];
129
+ unset($options['stripe_account']);
130
  }
131
+ if (\array_key_exists('stripe_version', $options)) {
132
  $headers['Stripe-Version'] = $options['stripe_version'];
133
+ unset($options['stripe_version']);
134
  }
135
+ if (\array_key_exists('api_base', $options)) {
136
  $base = $options['api_base'];
137
+ unset($options['api_base']);
138
+ }
139
+
140
+ if ($strict && !empty($options)) {
141
+ $message = 'Got unexpected keys in options array: ' . \implode(', ', \array_keys($options));
142
+
143
+ throw new \Stripe\Exception\InvalidArgumentException($message);
144
  }
145
+
146
  return new RequestOptions($key, $headers, $base);
147
  }
148
 
150
  . 'optional per-request apiKey, which must be a string, or '
151
  . 'per-request options, which must be an array. (HINT: you can set '
152
  . 'a global apiKey by "Stripe::setApiKey(<apiKey>)")';
153
+
154
+ throw new \Stripe\Exception\InvalidArgumentException($message);
155
+ }
156
+
157
+ private function redactedApiKey()
158
+ {
159
+ $pieces = \explode('_', $this->apiKey, 3);
160
+ $last = \array_pop($pieces);
161
+ $redactedLast = \strlen($last) > 4
162
+ ? (\str_repeat('*', \strlen($last) - 4) . \substr($last, -4))
163
+ : $last;
164
+ $pieces[] = $redactedLast;
165
+
166
+ return \implode('_', $pieces);
167
  }
168
  }
app/api/Stripe/Util/Set.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  namespace Stripe\Util;
4
 
5
- use IteratorAggregate;
6
  use ArrayIterator;
 
7
 
8
  class Set implements IteratorAggregate
9
  {
@@ -34,7 +34,7 @@ class Set implements IteratorAggregate
34
 
35
  public function toArray()
36
  {
37
- return array_keys($this->_elts);
38
  }
39
 
40
  public function getIterator()
2
 
3
  namespace Stripe\Util;
4
 
 
5
  use ArrayIterator;
6
+ use IteratorAggregate;
7
 
8
  class Set implements IteratorAggregate
9
  {
34
 
35
  public function toArray()
36
  {
37
+ return \array_keys($this->_elts);
38
  }
39
 
40
  public function getIterator()
app/api/Stripe/Util/Util.php CHANGED
@@ -15,211 +15,110 @@ abstract class Util
15
  * integers starting at 0. Empty arrays are considered to be lists.
16
  *
17
  * @param array|mixed $array
18
- * @return boolean true if the given object is a list.
 
19
  */
20
  public static function isList($array)
21
  {
22
- if (!is_array($array)) {
23
  return false;
24
  }
25
- if ($array === []) {
26
  return true;
27
  }
28
- if (array_keys($array) !== range(0, count($array) - 1)) {
29
  return false;
30
  }
31
- return true;
32
- }
33
 
34
- /**
35
- * Recursively converts the PHP Stripe object to an array.
36
- *
37
- * @param array $values The PHP Stripe object to convert.
38
- * @return array
39
- */
40
- public static function convertStripeObjectToArray($values)
41
- {
42
- $results = [];
43
- foreach ($values as $k => $v) {
44
- // FIXME: this is an encapsulation violation
45
- if ($k[0] == '_') {
46
- continue;
47
- }
48
- if ($v instanceof StripeObject) {
49
- $results[$k] = $v->__toArray(true);
50
- } elseif (is_array($v)) {
51
- $results[$k] = self::convertStripeObjectToArray($v);
52
- } else {
53
- $results[$k] = $v;
54
- }
55
- }
56
- return $results;
57
  }
58
 
59
  /**
60
  * Converts a response from the Stripe API to the corresponding PHP object.
61
  *
62
- * @param array $resp The response from the Stripe API.
63
  * @param array $opts
64
- * @return StripeObject|array
 
65
  */
66
  public static function convertToStripeObject($resp, $opts)
67
  {
68
- $types = [
69
- // data structures
70
- \Stripe\Collection::OBJECT_NAME => 'Stripe\\Collection',
71
-
72
- // business objects
73
- \Stripe\Account::OBJECT_NAME => 'Stripe\\Account',
74
- \Stripe\AccountLink::OBJECT_NAME => 'Stripe\\AccountLink',
75
- \Stripe\AlipayAccount::OBJECT_NAME => 'Stripe\\AlipayAccount',
76
- \Stripe\ApplePayDomain::OBJECT_NAME => 'Stripe\\ApplePayDomain',
77
- \Stripe\ApplicationFee::OBJECT_NAME => 'Stripe\\ApplicationFee',
78
- \Stripe\Balance::OBJECT_NAME => 'Stripe\\Balance',
79
- \Stripe\BalanceTransaction::OBJECT_NAME => 'Stripe\\BalanceTransaction',
80
- \Stripe\BankAccount::OBJECT_NAME => 'Stripe\\BankAccount',
81
- \Stripe\BitcoinReceiver::OBJECT_NAME => 'Stripe\\BitcoinReceiver',
82
- \Stripe\BitcoinTransaction::OBJECT_NAME => 'Stripe\\BitcoinTransaction',
83
- \Stripe\Capability::OBJECT_NAME => 'Stripe\\Capability',
84
- \Stripe\Card::OBJECT_NAME => 'Stripe\\Card',
85
- \Stripe\Charge::OBJECT_NAME => 'Stripe\\Charge',
86
- \Stripe\Checkout\Session::OBJECT_NAME => 'Stripe\\Checkout\\Session',
87
- \Stripe\CountrySpec::OBJECT_NAME => 'Stripe\\CountrySpec',
88
- \Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon',
89
- \Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote',
90
- \Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer',
91
- \Stripe\CustomerBalanceTransaction::OBJECT_NAME => 'Stripe\\CustomerBalanceTransaction',
92
- \Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount',
93
- \Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute',
94
- \Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey',
95
- \Stripe\Event::OBJECT_NAME => 'Stripe\\Event',
96
- \Stripe\ExchangeRate::OBJECT_NAME => 'Stripe\\ExchangeRate',
97
- \Stripe\ApplicationFeeRefund::OBJECT_NAME => 'Stripe\\ApplicationFeeRefund',
98
- \Stripe\File::OBJECT_NAME => 'Stripe\\File',
99
- \Stripe\File::OBJECT_NAME_ALT => 'Stripe\\File',
100
- \Stripe\FileLink::OBJECT_NAME => 'Stripe\\FileLink',
101
- \Stripe\Invoice::OBJECT_NAME => 'Stripe\\Invoice',
102
- \Stripe\InvoiceItem::OBJECT_NAME => 'Stripe\\InvoiceItem',
103
- \Stripe\InvoiceLineItem::OBJECT_NAME => 'Stripe\\InvoiceLineItem',
104
- \Stripe\IssuerFraudRecord::OBJECT_NAME => 'Stripe\\IssuerFraudRecord',
105
- \Stripe\Issuing\Authorization::OBJECT_NAME => 'Stripe\\Issuing\\Authorization',
106
- \Stripe\Issuing\Card::OBJECT_NAME => 'Stripe\\Issuing\\Card',
107
- \Stripe\Issuing\CardDetails::OBJECT_NAME => 'Stripe\\Issuing\\CardDetails',
108
- \Stripe\Issuing\Cardholder::OBJECT_NAME => 'Stripe\\Issuing\\Cardholder',
109
- \Stripe\Issuing\Dispute::OBJECT_NAME => 'Stripe\\Issuing\\Dispute',
110
- \Stripe\Issuing\Transaction::OBJECT_NAME => 'Stripe\\Issuing\\Transaction',
111
- \Stripe\LoginLink::OBJECT_NAME => 'Stripe\\LoginLink',
112
- \Stripe\Order::OBJECT_NAME => 'Stripe\\Order',
113
- \Stripe\OrderItem::OBJECT_NAME => 'Stripe\\OrderItem',
114
- \Stripe\OrderReturn::OBJECT_NAME => 'Stripe\\OrderReturn',
115
- \Stripe\PaymentIntent::OBJECT_NAME => 'Stripe\\PaymentIntent',
116
- \Stripe\PaymentMethod::OBJECT_NAME => 'Stripe\\PaymentMethod',
117
- \Stripe\Payout::OBJECT_NAME => 'Stripe\\Payout',
118
- \Stripe\Person::OBJECT_NAME => 'Stripe\\Person',
119
- \Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan',
120
- \Stripe\Product::OBJECT_NAME => 'Stripe\\Product',
121
- \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => 'Stripe\\Radar\\EarlyFraudWarning',
122
- \Stripe\Radar\ValueList::OBJECT_NAME => 'Stripe\\Radar\\ValueList',
123
- \Stripe\Radar\ValueListItem::OBJECT_NAME => 'Stripe\\Radar\\ValueListItem',
124
- \Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient',
125
- \Stripe\RecipientTransfer::OBJECT_NAME => 'Stripe\\RecipientTransfer',
126
- \Stripe\Refund::OBJECT_NAME => 'Stripe\\Refund',
127
- \Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun',
128
- \Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType',
129
- \Stripe\Review::OBJECT_NAME => 'Stripe\\Review',
130
- \Stripe\SetupIntent::OBJECT_NAME => 'Stripe\\SetupIntent',
131
- \Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU',
132
- \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun',
133
- \Stripe\Source::OBJECT_NAME => 'Stripe\\Source',
134
- \Stripe\SourceTransaction::OBJECT_NAME => 'Stripe\\SourceTransaction',
135
- \Stripe\Subscription::OBJECT_NAME => 'Stripe\\Subscription',
136
- \Stripe\SubscriptionItem::OBJECT_NAME => 'Stripe\\SubscriptionItem',
137
- \Stripe\SubscriptionSchedule::OBJECT_NAME => 'Stripe\\SubscriptionSchedule',
138
- \Stripe\TaxId::OBJECT_NAME => 'Stripe\\TaxId',
139
- \Stripe\TaxRate::OBJECT_NAME => 'Stripe\\TaxRate',
140
- \Stripe\ThreeDSecure::OBJECT_NAME => 'Stripe\\ThreeDSecure',
141
- \Stripe\Terminal\ConnectionToken::OBJECT_NAME => 'Stripe\\Terminal\\ConnectionToken',
142
- \Stripe\Terminal\Location::OBJECT_NAME => 'Stripe\\Terminal\\Location',
143
- \Stripe\Terminal\Reader::OBJECT_NAME => 'Stripe\\Terminal\\Reader',
144
- \Stripe\Token::OBJECT_NAME => 'Stripe\\Token',
145
- \Stripe\Topup::OBJECT_NAME => 'Stripe\\Topup',
146
- \Stripe\Transfer::OBJECT_NAME => 'Stripe\\Transfer',
147
- \Stripe\TransferReversal::OBJECT_NAME => 'Stripe\\TransferReversal',
148
- \Stripe\UsageRecord::OBJECT_NAME => 'Stripe\\UsageRecord',
149
- \Stripe\UsageRecordSummary::OBJECT_NAME => 'Stripe\\UsageRecordSummary',
150
- \Stripe\WebhookEndpoint::OBJECT_NAME => 'Stripe\\WebhookEndpoint',
151
- ];
152
  if (self::isList($resp)) {
153
  $mapped = [];
154
  foreach ($resp as $i) {
155
- array_push($mapped, self::convertToStripeObject($i, $opts));
156
  }
 
157
  return $mapped;
158
- } elseif (is_array($resp)) {
159
- if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) {
 
160
  $class = $types[$resp['object']];
161
  } else {
162
- $class = 'Stripe\\StripeObject';
163
  }
 
164
  return $class::constructFrom($resp, $opts);
165
- } else {
166
- return $resp;
167
  }
 
 
168
  }
169
 
170
  /**
171
- * @param string|mixed $value A string to UTF8-encode.
172
  *
173
- * @return string|mixed The UTF8-encoded string, or the object passed in if
174
- * it wasn't a string.
175
  */
176
  public static function utf8($value)
177
  {
178
- if (self::$isMbstringAvailable === null) {
179
- self::$isMbstringAvailable = function_exists('mb_detect_encoding');
180
 
181
  if (!self::$isMbstringAvailable) {
182
- trigger_error("It looks like the mbstring extension is not enabled. " .
183
- "UTF-8 strings will not properly be encoded. Ask your system " .
184
- "administrator to enable the mbstring extension, or write to " .
185
- "support@stripe.com if you have any questions.", E_USER_WARNING);
186
  }
187
  }
188
 
189
- if (is_string($value) && self::$isMbstringAvailable && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") {
190
- return utf8_encode($value);
191
- } else {
192
- return $value;
193
  }
 
 
194
  }
195
 
196
  /**
197
  * Compares two strings for equality. The time taken is independent of the
198
  * number of characters that match.
199
  *
200
- * @param string $a one of the strings to compare.
201
- * @param string $b the other string to compare.
202
- * @return bool true if the strings are equal, false otherwise.
 
203
  */
204
  public static function secureCompare($a, $b)
205
  {
206
- if (self::$isHashEqualsAvailable === null) {
207
- self::$isHashEqualsAvailable = function_exists('hash_equals');
208
  }
209
 
210
  if (self::$isHashEqualsAvailable) {
211
- return hash_equals($a, $b);
212
- } else {
213
- if (strlen($a) != strlen($b)) {
214
- return false;
215
- }
216
 
217
- $result = 0;
218
- for ($i = 0; $i < strlen($a); $i++) {
219
- $result |= ord($a[$i]) ^ ord($b[$i]);
220
- }
221
- return ($result == 0);
222
  }
 
 
223
  }
224
 
225
  /**
@@ -228,30 +127,35 @@ abstract class Util
228
  * Also clears out null values.
229
  *
230
  * @param mixed $h
 
231
  * @return mixed
232
  */
233
  public static function objectsToIds($h)
234
  {
235
  if ($h instanceof \Stripe\ApiResource) {
236
  return $h->id;
237
- } elseif (static::isList($h)) {
 
238
  $results = [];
239
  foreach ($h as $v) {
240
- array_push($results, static::objectsToIds($v));
241
  }
 
242
  return $results;
243
- } elseif (is_array($h)) {
 
244
  $results = [];
245
  foreach ($h as $k => $v) {
246
- if (is_null($v)) {
247
  continue;
248
  }
249
  $results[$k] = static::objectsToIds($v);
250
  }
 
251
  return $results;
252
- } else {
253
- return $h;
254
  }
 
 
255
  }
256
 
257
  /**
@@ -265,14 +169,15 @@ abstract class Util
265
  $pieces = [];
266
  foreach ($flattenedParams as $param) {
267
  list($k, $v) = $param;
268
- array_push($pieces, self::urlEncode($k) . '=' . self::urlEncode($v));
269
  }
270
- return implode('&', $pieces);
 
271
  }
272
 
273
  /**
274
  * @param array $params
275
- * @param string|null $parentKey
276
  *
277
  * @return array
278
  */
@@ -284,11 +189,11 @@ abstract class Util
284
  $calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key;
285
 
286
  if (self::isList($value)) {
287
- $result = array_merge($result, self::flattenParamsList($value, $calculatedKey));
288
- } elseif (is_array($value)) {
289
- $result = array_merge($result, self::flattenParams($value, $calculatedKey));
290
  } else {
291
- array_push($result, [$calculatedKey, $value]);
292
  }
293
  }
294
 
@@ -307,11 +212,11 @@ abstract class Util
307
 
308
  foreach ($value as $i => $elem) {
309
  if (self::isList($elem)) {
310
- $result = array_merge($result, self::flattenParamsList($elem, $calculatedKey));
311
- } elseif (is_array($elem)) {
312
- $result = array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]"));
313
  } else {
314
- array_push($result, ["{$calculatedKey}[{$i}]", $elem]);
315
  }
316
  }
317
 
@@ -319,42 +224,42 @@ abstract class Util
319
  }
320
 
321
  /**
322
- * @param string $key A string to URL-encode.
323
  *
324
- * @return string The URL-encoded string.
325
  */
326
  public static function urlEncode($key)
327
  {
328
- $s = urlencode($key);
329
 
330
  // Don't use strict form encoding by changing the square bracket control
331
  // characters back to their literals. This is fine by the server, and
332
  // makes these parameter strings easier to read.
333
- $s = str_replace('%5B', '[', $s);
334
- $s = str_replace('%5D', ']', $s);
335
 
336
- return $s;
337
  }
338
 
339
  public static function normalizeId($id)
340
  {
341
- if (is_array($id)) {
342
  $params = $id;
343
  $id = $params['id'];
344
  unset($params['id']);
345
  } else {
346
  $params = [];
347
  }
 
348
  return [$id, $params];
349
  }
350
 
351
  /**
352
- * Returns UNIX timestamp in milliseconds
353
  *
354
- * @return integer current time in millis
355
  */
356
  public static function currentTimeMillis()
357
  {
358
- return (int) round(microtime(true) * 1000);
359
  }
360
  }
15
  * integers starting at 0. Empty arrays are considered to be lists.
16
  *
17
  * @param array|mixed $array
18
+ *
19
+ * @return bool true if the given object is a list
20
  */
21
  public static function isList($array)
22
  {
23
+ if (!\is_array($array)) {
24
  return false;
25
  }
26
+ if ([] === $array) {
27
  return true;
28
  }
29
+ if (\array_keys($array) !== \range(0, \count($array) - 1)) {
30
  return false;
31
  }
 
 
32
 
33
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
 
36
  /**
37
  * Converts a response from the Stripe API to the corresponding PHP object.
38
  *
39
+ * @param array $resp the response from the Stripe API
40
  * @param array $opts
41
+ *
42
+ * @return array|StripeObject
43
  */
44
  public static function convertToStripeObject($resp, $opts)
45
  {
46
+ $types = \Stripe\Util\ObjectTypes::mapping;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  if (self::isList($resp)) {
48
  $mapped = [];
49
  foreach ($resp as $i) {
50
+ $mapped[] = self::convertToStripeObject($i, $opts);
51
  }
52
+
53
  return $mapped;
54
+ }
55
+ if (\is_array($resp)) {
56
+ if (isset($resp['object']) && \is_string($resp['object']) && isset($types[$resp['object']])) {
57
  $class = $types[$resp['object']];
58
  } else {
59
+ $class = \Stripe\StripeObject::class;
60
  }
61
+
62
  return $class::constructFrom($resp, $opts);
 
 
63
  }
64
+
65
+ return $resp;
66
  }
67
 
68
  /**
69
+ * @param mixed|string $value a string to UTF8-encode
70
  *
71
+ * @return mixed|string the UTF8-encoded string, or the object passed in if
72
+ * it wasn't a string
73
  */
74
  public static function utf8($value)
75
  {
76
+ if (null === self::$isMbstringAvailable) {
77
+ self::$isMbstringAvailable = \function_exists('mb_detect_encoding');
78
 
79
  if (!self::$isMbstringAvailable) {
80
+ \trigger_error('It looks like the mbstring extension is not enabled. ' .
81
+ 'UTF-8 strings will not properly be encoded. Ask your system ' .
82
+ 'administrator to enable the mbstring extension, or write to ' .
83
+ 'support@stripe.com if you have any questions.', \E_USER_WARNING);
84
  }
85
  }
86
 
87
+ if (\is_string($value) && self::$isMbstringAvailable && 'UTF-8' !== \mb_detect_encoding($value, 'UTF-8', true)) {
88
+ return \utf8_encode($value);
 
 
89
  }
90
+
91
+ return $value;
92
  }
93
 
94
  /**
95
  * Compares two strings for equality. The time taken is independent of the
96
  * number of characters that match.
97
  *
98
+ * @param string $a one of the strings to compare
99
+ * @param string $b the other string to compare
100
+ *
101
+ * @return bool true if the strings are equal, false otherwise
102
  */
103
  public static function secureCompare($a, $b)
104
  {
105
+ if (null === self::$isHashEqualsAvailable) {
106
+ self::$isHashEqualsAvailable = \function_exists('hash_equals');
107
  }
108
 
109
  if (self::$isHashEqualsAvailable) {
110
+ return \hash_equals($a, $b);
111
+ }
112
+ if (\strlen($a) !== \strlen($b)) {
113
+ return false;
114
+ }
115
 
116
+ $result = 0;
117
+ for ($i = 0; $i < \strlen($a); ++$i) {
118
+ $result |= \ord($a[$i]) ^ \ord($b[$i]);
 
 
119
  }
120
+
121
+ return 0 === $result;
122
  }
123
 
124
  /**
127
  * Also clears out null values.
128
  *
129
  * @param mixed $h
130
+ *
131
  * @return mixed
132
  */
133
  public static function objectsToIds($h)
134
  {
135
  if ($h instanceof \Stripe\ApiResource) {
136
  return $h->id;
137
+ }
138
+ if (static::isList($h)) {
139
  $results = [];
140
  foreach ($h as $v) {
141
+ $results[] = static::objectsToIds($v);
142
  }
143
+
144
  return $results;
145
+ }
146
+ if (\is_array($h)) {
147
  $results = [];
148
  foreach ($h as $k => $v) {
149
+ if (null === $v) {
150
  continue;
151
  }
152
  $results[$k] = static::objectsToIds($v);
153
  }
154
+
155
  return $results;
 
 
156
  }
157
+
158
+ return $h;
159
  }
160
 
161
  /**
169
  $pieces = [];
170
  foreach ($flattenedParams as $param) {
171
  list($k, $v) = $param;
172
+ $pieces[] = self::urlEncode($k) . '=' . self::urlEncode($v);
173
  }
174
+
175
+ return \implode('&', $pieces);
176
  }
177
 
178
  /**
179
  * @param array $params
180
+ * @param null|string $parentKey
181
  *
182
  * @return array
183
  */
189
  $calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key;
190
 
191
  if (self::isList($value)) {
192
+ $result = \array_merge($result, self::flattenParamsList($value, $calculatedKey));
193
+ } elseif (\is_array($value)) {
194
+ $result = \array_merge($result, self::flattenParams($value, $calculatedKey));
195
  } else {
196
+ \array_push($result, [$calculatedKey, $value]);
197
  }
198
  }
199
 
212
 
213
  foreach ($value as $i => $elem) {
214
  if (self::isList($elem)) {
215
+ $result = \array_merge($result, self::flattenParamsList($elem, $calculatedKey));
216
+ } elseif (\is_array($elem)) {
217
+ $result = \array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]"));
218
  } else {
219
+ \array_push($result, ["{$calculatedKey}[{$i}]", $elem]);
220
  }
221
  }
222
 
224
  }
225
 
226
  /**
227
+ * @param string $key a string to URL-encode
228
  *
229
+ * @return string the URL-encoded string
230
  */
231
  public static function urlEncode($key)
232
  {
233
+ $s = \urlencode((string) $key);
234
 
235
  // Don't use strict form encoding by changing the square bracket control
236
  // characters back to their literals. This is fine by the server, and
237
  // makes these parameter strings easier to read.
238
+ $s = \str_replace('%5B', '[', $s);
 
239
 
240
+ return \str_replace('%5D', ']', $s);
241
  }
242
 
243
  public static function normalizeId($id)
244
  {
245
+ if (\is_array($id)) {
246
  $params = $id;
247
  $id = $params['id'];
248
  unset($params['id']);
249
  } else {
250
  $params = [];
251
  }
252
+
253
  return [$id, $params];
254
  }
255
 
256
  /**
257
+ * Returns UNIX timestamp in milliseconds.
258
  *
259
+ * @return int current time in millis
260
  */
261
  public static function currentTimeMillis()
262
  {
263
+ return (int) \round(\microtime(true) * 1000);
264
  }
265
  }
app/api/Stripe/Webhook.php CHANGED
@@ -7,34 +7,36 @@ abstract class Webhook
7
  const DEFAULT_TOLERANCE = 300;
8
 
9
  /**
10
- * Returns an Event instance using the provided JSON payload. Throws a
11
- * \UnexpectedValueException if the payload is not valid JSON, and a
12
- * \Stripe\SignatureVerificationException if the signature verification
13
- * fails for any reason.
14
  *
15
- * @param string $payload the payload sent by Stripe.
16
  * @param string $sigHeader the contents of the signature header sent by
17
- * Stripe.
18
- * @param string $secret secret used to generate the signature.
19
  * @param int $tolerance maximum difference allowed between the header's
20
  * timestamp and the current time
21
- * @return \Stripe\Event the Event instance
22
- * @throws \UnexpectedValueException if the payload is not valid JSON,
23
- * @throws \Stripe\Error\SignatureVerification if the verification fails.
 
 
24
  */
25
  public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE)
26
  {
27
  WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
28
 
29
- $data = json_decode($payload, true);
30
- $jsonError = json_last_error();
31
- if ($data === null && $jsonError !== JSON_ERROR_NONE) {
32
- $msg = "Invalid payload: $payload "
33
- . "(json_last_error() was $jsonError)";
34
- throw new \UnexpectedValueException($msg);
 
35
  }
36
- $event = Event::constructFrom($data);
37
 
38
- return $event;
39
  }
40
  }
7
  const DEFAULT_TOLERANCE = 300;
8
 
9
  /**
10
+ * Returns an Event instance using the provided JSON payload. Throws an
11
+ * Exception\UnexpectedValueException if the payload is not valid JSON, and
12
+ * an Exception\SignatureVerificationException if the signature
13
+ * verification fails for any reason.
14
  *
15
+ * @param string $payload the payload sent by Stripe
16
  * @param string $sigHeader the contents of the signature header sent by
17
+ * Stripe
18
+ * @param string $secret secret used to generate the signature
19
  * @param int $tolerance maximum difference allowed between the header's
20
  * timestamp and the current time
21
+ *
22
+ * @throws Exception\UnexpectedValueException if the payload is not valid JSON,
23
+ * @throws Exception\SignatureVerificationException if the verification fails
24
+ *
25
+ * @return Event the Event instance
26
  */
27
  public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE)
28
  {
29
  WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
30
 
31
+ $data = \json_decode($payload, true);
32
+ $jsonError = \json_last_error();
33
+ if (null === $data && \JSON_ERROR_NONE !== $jsonError) {
34
+ $msg = "Invalid payload: {$payload} "
35
+ . "(json_last_error() was {$jsonError})";
36
+
37
+ throw new Exception\UnexpectedValueException($msg);
38
  }
 
39
 
40
+ return Event::constructFrom($data);
41
  }
42
  }
app/api/Stripe/WebhookEndpoint.php CHANGED
@@ -1,24 +1,37 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
6
- * Class WebhookEndpoint
 
 
 
 
 
 
7
  *
8
- * @property string $id
9
- * @property string $object
10
- * @property int $created
11
- * @property string[] $enabled_events
12
- * @property bool $livemode
13
- * @property string $secret
14
- * @property string $status
15
- * @property string $url
16
  *
17
- * @package Stripe
 
 
 
 
 
 
 
 
 
 
 
18
  */
19
  class WebhookEndpoint extends ApiResource
20
  {
21
- const OBJECT_NAME = "webhook_endpoint";
22
 
23
  use ApiOperations\All;
24
  use ApiOperations\Create;
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
8
+ * You can configure <a href="https://stripe.com/docs/webhooks/">webhook
9
+ * endpoints</a> via the API to be notified about events that happen in your Stripe
10
+ * account or connected accounts.
11
+ *
12
+ * Most users configure webhooks from <a
13
+ * href="https://dashboard.stripe.com/webhooks">the dashboard</a>, which provides a
14
+ * user interface for registering and testing your webhook endpoints.
15
  *
16
+ * Related guide: <a href="https://stripe.com/docs/webhooks/configure">Setting up
17
+ * Webhooks</a>.
 
 
 
 
 
 
18
  *
19
+ * @property string $id Unique identifier for the object.
20
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property null|string $api_version The API version events are rendered as for this webhook endpoint.
22
+ * @property null|string $application The ID of the associated Connect application.
23
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
24
+ * @property null|string $description An optional description of what the webhook is used for.
25
+ * @property string[] $enabled_events The list of events to enable for this endpoint. <code>['*']</code> indicates that all events are enabled, except those that require explicit selection.
26
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
27
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
28
+ * @property string $secret The endpoint's secret, used to generate <a href="https://stripe.com/docs/webhooks/signatures">webhook signatures</a>. Only returned at creation.
29
+ * @property string $status The status of the webhook. It can be <code>enabled</code> or <code>disabled</code>.
30
+ * @property string $url The URL of the webhook endpoint.
31
  */
32
  class WebhookEndpoint extends ApiResource
33
  {
34
+ const OBJECT_NAME = 'webhook_endpoint';
35
 
36
  use ApiOperations\All;
37
  use ApiOperations\Create;
app/api/Stripe/WebhookSignature.php CHANGED
@@ -4,20 +4,22 @@ namespace Stripe;
4
 
5
  abstract class WebhookSignature
6
  {
7
- const EXPECTED_SCHEME = "v1";
8
 
9
  /**
10
- * Verifies the signature header sent by Stripe. Throws a
11
- * SignatureVerification exception if the verification fails for any
12
- * reason.
13
  *
14
- * @param string $payload the payload sent by Stripe.
15
  * @param string $header the contents of the signature header sent by
16
- * Stripe.
17
- * @param string $secret secret used to generate the signature.
18
  * @param int $tolerance maximum difference allowed between the header's
19
  * timestamp and the current time
20
- * @throws \Stripe\Error\SignatureVerification if the verification fails.
 
 
21
  * @return bool
22
  */
23
  public static function verifyHeader($payload, $header, $secret, $tolerance = null)
@@ -25,46 +27,47 @@ abstract class WebhookSignature
25
  // Extract timestamp and signatures from header
26
  $timestamp = self::getTimestamp($header);
27
  $signatures = self::getSignatures($header, self::EXPECTED_SCHEME);
28
- if ($timestamp == -1) {
29
- throw new Error\SignatureVerification(
30
- "Unable to extract timestamp and signatures from header",
31
- $header,
32
- $payload
33
  );
34
  }
35
  if (empty($signatures)) {
36
- throw new Error\SignatureVerification(
37
- "No signatures found with expected scheme",
38
- $header,
39
- $payload
40
  );
41
  }
42
 
43
  // Check if expected signature is found in list of signatures from
44
  // header
45
- $signedPayload = "$timestamp.$payload";
46
  $expectedSignature = self::computeSignature($signedPayload, $secret);
47
  $signatureFound = false;
48
  foreach ($signatures as $signature) {
49
  if (Util\Util::secureCompare($expectedSignature, $signature)) {
50
  $signatureFound = true;
 
51
  break;
52
  }
53
  }
54
  if (!$signatureFound) {
55
- throw new Error\SignatureVerification(
56
- "No signatures found matching the expected signature for payload",
57
- $header,
58
- $payload
59
  );
60
  }
61
 
62
  // Check if timestamp is within tolerance
63
- if (($tolerance > 0) && (abs(time() - $timestamp) > $tolerance)) {
64
- throw new Error\SignatureVerification(
65
- "Timestamp outside the tolerance zone",
66
- $header,
67
- $payload
68
  );
69
  }
70
 
@@ -75,20 +78,22 @@ abstract class WebhookSignature
75
  * Extracts the timestamp in a signature header.
76
  *
77
  * @param string $header the signature header
 
78
  * @return int the timestamp contained in the header, or -1 if no valid
79
  * timestamp is found
80
  */
81
  private static function getTimestamp($header)
82
  {
83
- $items = explode(",", $header);
84
 
85
  foreach ($items as $item) {
86
- $itemParts = explode("=", $item, 2);
87
- if ($itemParts[0] == "t") {
88
- if (!is_numeric($itemParts[1])) {
89
  return -1;
90
  }
91
- return intval($itemParts[1]);
 
92
  }
93
  }
94
 
@@ -99,18 +104,19 @@ abstract class WebhookSignature
99
  * Extracts the signatures matching a given scheme in a signature header.
100
  *
101
  * @param string $header the signature header
102
- * @param string $scheme the signature scheme to look for.
103
- * @return array the list of signatures matching the provided scheme.
 
104
  */
105
  private static function getSignatures($header, $scheme)
106
  {
107
  $signatures = [];
108
- $items = explode(",", $header);
109
 
110
  foreach ($items as $item) {
111
- $itemParts = explode("=", $item, 2);
112
- if ($itemParts[0] == $scheme) {
113
- array_push($signatures, $itemParts[1]);
114
  }
115
  }
116
 
@@ -122,12 +128,13 @@ abstract class WebhookSignature
122
  *
123
  * The current scheme used by Stripe ("v1") is HMAC/SHA-256.
124
  *
125
- * @param string $payload the payload to sign.
126
- * @param string $secret the secret used to generate the signature.
127
- * @return string the signature as a string.
 
128
  */
129
  private static function computeSignature($payload, $secret)
130
  {
131
- return hash_hmac("sha256", $payload, $secret);
132
  }
133
  }
4
 
5
  abstract class WebhookSignature
6
  {
7
+ const EXPECTED_SCHEME = 'v1';
8
 
9
  /**
10
+ * Verifies the signature header sent by Stripe. Throws an
11
+ * Exception\SignatureVerificationException exception if the verification fails for
12
+ * any reason.
13
  *
14
+ * @param string $payload the payload sent by Stripe
15
  * @param string $header the contents of the signature header sent by
16
+ * Stripe
17
+ * @param string $secret secret used to generate the signature
18
  * @param int $tolerance maximum difference allowed between the header's
19
  * timestamp and the current time
20
+ *
21
+ * @throws Exception\SignatureVerificationException if the verification fails
22
+ *
23
  * @return bool
24
  */
25
  public static function verifyHeader($payload, $header, $secret, $tolerance = null)
27
  // Extract timestamp and signatures from header
28
  $timestamp = self::getTimestamp($header);
29
  $signatures = self::getSignatures($header, self::EXPECTED_SCHEME);
30
+ if (-1 === $timestamp) {
31
+ throw Exception\SignatureVerificationException::factory(
32
+ 'Unable to extract timestamp and signatures from header',
33
+ $payload,
34
+ $header
35
  );
36
  }
37
  if (empty($signatures)) {
38
+ throw Exception\SignatureVerificationException::factory(
39
+ 'No signatures found with expected scheme',
40
+ $payload,
41
+ $header
42
  );
43
  }
44
 
45
  // Check if expected signature is found in list of signatures from
46
  // header
47
+ $signedPayload = "{$timestamp}.{$payload}";
48
  $expectedSignature = self::computeSignature($signedPayload, $secret);
49
  $signatureFound = false;
50
  foreach ($signatures as $signature) {
51
  if (Util\Util::secureCompare($expectedSignature, $signature)) {
52
  $signatureFound = true;
53
+
54
  break;
55
  }
56
  }
57
  if (!$signatureFound) {
58
+ throw Exception\SignatureVerificationException::factory(
59
+ 'No signatures found matching the expected signature for payload',
60
+ $payload,
61
+ $header
62
  );
63
  }
64
 
65
  // Check if timestamp is within tolerance
66
+ if (($tolerance > 0) && (\abs(\time() - $timestamp) > $tolerance)) {
67
+ throw Exception\SignatureVerificationException::factory(
68
+ 'Timestamp outside the tolerance zone',
69
+ $payload,
70
+ $header
71
  );
72
  }
73
 
78
  * Extracts the timestamp in a signature header.
79
  *
80
  * @param string $header the signature header
81
+ *
82
  * @return int the timestamp contained in the header, or -1 if no valid
83
  * timestamp is found
84
  */
85
  private static function getTimestamp($header)
86
  {
87
+ $items = \explode(',', $header);
88
 
89
  foreach ($items as $item) {
90
+ $itemParts = \explode('=', $item, 2);
91
+ if ('t' === $itemParts[0]) {
92
+ if (!\is_numeric($itemParts[1])) {
93
  return -1;
94
  }
95
+
96
+ return (int) ($itemParts[1]);
97
  }
98
  }
99
 
104
  * Extracts the signatures matching a given scheme in a signature header.
105
  *
106
  * @param string $header the signature header
107
+ * @param string $scheme the signature scheme to look for
108
+ *
109
+ * @return array the list of signatures matching the provided scheme
110
  */
111
  private static function getSignatures($header, $scheme)
112
  {
113
  $signatures = [];
114
+ $items = \explode(',', $header);
115
 
116
  foreach ($items as $item) {
117
+ $itemParts = \explode('=', $item, 2);
118
+ if (\trim($itemParts[0]) === $scheme) {
119
+ $signatures[] = $itemParts[1];
120
  }
121
  }
122
 
128
  *
129
  * The current scheme used by Stripe ("v1") is HMAC/SHA-256.
130
  *
131
+ * @param string $payload the payload to sign
132
+ * @param string $secret the secret used to generate the signature
133
+ *
134
+ * @return string the signature as a string
135
  */
136
  private static function computeSignature($payload, $secret)
137
  {
138
+ return \hash_hmac('sha256', $payload, $secret);
139
  }
140
  }
app/features/events.php CHANGED
@@ -1301,7 +1301,7 @@ class MEC_feature_events extends MEC_base
1301
  <?php /** Checkbox **/ elseif($event_field['type'] == 'checkbox'): ?>
1302
  <?php if(isset($event_field['options']) and is_array($event_field['options'])): foreach($event_field['options'] as $event_field_option): ?>
1303
  <label for="mec_event_fields_<?php echo $j.'_'.strtolower(str_replace(' ', '_', $event_field_option['label'])); ?>">
1304
- <input type="checkbox" id="mec_event_fields_<?php echo $j.'_'.strtolower(str_replace(' ', '_', $event_field_option['label'])); ?>" <?php echo ((is_array($value) and in_array($event_field_option['label'], $value)) ? 'checked="checked"' : ''); ?> name="mec[fields][<?php echo $j; ?>][]" value="<?php _e($event_field_option['label'], 'modern-events-calendar-lite'); ?>" />
1305
  <?php _e(stripslashes($event_field_option['label']), 'modern-events-calendar-lite'); ?>
1306
  </label>
1307
  <?php endforeach; endif; ?>
@@ -2848,6 +2848,14 @@ class MEC_feature_events extends MEC_base
2848
  $repeat_status = isset($repeat['status']) ? 1 : 0;
2849
  $repeat_type = ($repeat_status and isset($repeat['type'])) ? $repeat['type'] : '';
2850
 
 
 
 
 
 
 
 
 
2851
  $repeat_interval = ($repeat_status and isset($repeat['interval']) and trim($repeat['interval'])) ? $repeat['interval'] : 1;
2852
 
2853
  // Advanced Repeat
1301
  <?php /** Checkbox **/ elseif($event_field['type'] == 'checkbox'): ?>
1302
  <?php if(isset($event_field['options']) and is_array($event_field['options'])): foreach($event_field['options'] as $event_field_option): ?>
1303
  <label for="mec_event_fields_<?php echo $j.'_'.strtolower(str_replace(' ', '_', $event_field_option['label'])); ?>">
1304
+ <input type="checkbox" id="mec_event_fields_<?php echo $j.'_'.strtolower(str_replace(' ', '_', $event_field_option['label'])); ?>" <?php echo ((is_array($value) and in_array($event_field_option['label'], $value)) ? 'checked="checked"' : ''); ?> name="mec[fields][<?php echo $j; ?>][]" value="<?php _e($event_field_option['label'], 'modern-events-calendar-lite'); ?>" <?php if(isset($event_field['mandatory']) and $event_field['mandatory'] and count($event_field['options']) == 1) echo 'required'; ?> />
1305
  <?php _e(stripslashes($event_field_option['label']), 'modern-events-calendar-lite'); ?>
1306
  </label>
1307
  <?php endforeach; endif; ?>
2848
  $repeat_status = isset($repeat['status']) ? 1 : 0;
2849
  $repeat_type = ($repeat_status and isset($repeat['type'])) ? $repeat['type'] : '';
2850
 
2851
+ // Unset Repeat if no days are selected
2852
+ if($repeat_type == 'certain_weekdays' and (!is_array($certain_weekdays) or (is_array($certain_weekdays) and !count($certain_weekdays))))
2853
+ {
2854
+ $repeat_status = 0;
2855
+ $repeat['status'] = 0;
2856
+ $repeat['type'] = '';
2857
+ }
2858
+
2859
  $repeat_interval = ($repeat_status and isset($repeat['interval']) and trim($repeat['interval'])) ? $repeat['interval'] : 1;
2860
 
2861
  // Advanced Repeat
app/features/feed/rss2.php CHANGED
@@ -24,13 +24,13 @@ do_action('rss_tag_pre', 'rss2');
24
  <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
25
  <link><?php bloginfo_rss('url'); ?></link>
26
  <description><?php bloginfo_rss("description"); ?></description>
27
- <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
28
  <language><?php bloginfo_rss('language'); ?></language>
29
  <sy:updatePeriod><?php echo apply_filters('rss_update_period', 'hourly'); ?></sy:updatePeriod>
30
  <sy:updateFrequency><?php echo apply_filters('rss_update_frequency', 1); ?></sy:updateFrequency>
31
  <?php do_action('rss2_head'); ?>
32
 
33
- <?php foreach($this->events as $date=>$events): foreach($events as $event): ?>
34
  <item>
35
  <title><?php echo $this->feed->title($event->ID); ?></title>
36
  <link><?php echo $this->main->get_event_date_permalink($event, $event->date['start']['date']); ?></link>
@@ -39,7 +39,7 @@ do_action('rss_tag_pre', 'rss2');
39
  <comments><?php $this->feed->comments_link_feed($event->ID); ?></comments>
40
  <?php endif; ?>
41
 
42
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $event->date['start']['date'].' '.$event->data->time['start'], false); ?></pubDate>
43
  <dc:creator><![CDATA[<?php $this->feed->author($event->data->post->post_author); ?>]]></dc:creator>
44
 
45
  <guid isPermaLink="false"><?php the_guid($event->ID); ?></guid>
24
  <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
25
  <link><?php bloginfo_rss('url'); ?></link>
26
  <description><?php bloginfo_rss("description"); ?></description>
27
+ <lastBuildDate><?php echo wp_date('D, d M Y H:i:s O', strtotime(get_lastpostmodified('GMT'))); ?></lastBuildDate>
28
  <language><?php bloginfo_rss('language'); ?></language>
29
  <sy:updatePeriod><?php echo apply_filters('rss_update_period', 'hourly'); ?></sy:updatePeriod>
30
  <sy:updateFrequency><?php echo apply_filters('rss_update_frequency', 1); ?></sy:updateFrequency>
31
  <?php do_action('rss2_head'); ?>
32
 
33
+ <?php foreach($this->events as $date=>$events): foreach($events as $event): $timezone = $this->main->get_timezone($event); $tz = ($timezone ? new DateTimeZone($timezone) : NULL); ?>
34
  <item>
35
  <title><?php echo $this->feed->title($event->ID); ?></title>
36
  <link><?php echo $this->main->get_event_date_permalink($event, $event->date['start']['date']); ?></link>
39
  <comments><?php $this->feed->comments_link_feed($event->ID); ?></comments>
40
  <?php endif; ?>
41
 
42
+ <pubDate><?php echo wp_date('D, d M Y H:i:s O', strtotime($event->date['start']['date'].' '.$event->data->time['start']), $tz); ?></pubDate>
43
  <dc:creator><![CDATA[<?php $this->feed->author($event->data->post->post_author); ?>]]></dc:creator>
44
 
45
  <guid isPermaLink="false"><?php the_guid($event->ID); ?></guid>
app/features/ix.php CHANGED
@@ -565,6 +565,30 @@ class MEC_feature_ix extends MEC_base
565
  }
566
  }
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  // Start
569
  $start_date = (string) $meta->mec_date->start->date;
570
  $start_hour = (int) $meta->mec_date->start->hour;
@@ -798,6 +822,9 @@ class MEC_feature_ix extends MEC_base
798
  // Set labels to the post
799
  if(count($label_ids)) foreach($label_ids as $label_id) wp_set_object_terms($post_id, (int) $label_id, 'mec_label', true);
800
 
 
 
 
801
  // Featured Image
802
  $featured_image = isset($event->featured_image) ? (string) $event->featured_image->full : '';
803
  if(!has_post_thumbnail($post_id) and trim($featured_image))
565
  }
566
  }
567
 
568
+ // Event Speakers
569
+ $speaker_ids = array();
570
+ if(isset($event->speakers))
571
+ {
572
+ foreach($event->speakers->children() as $speaker)
573
+ {
574
+ $speaker_id = $main->save_speaker(array
575
+ (
576
+ 'name'=>trim((string) $speaker->name),
577
+ 'job_title'=>(string) (isset($speaker->job_title) ? $speaker->job_title : ''),
578
+ 'tel'=>(string) (isset($speaker->tel) ? $speaker->tel : ''),
579
+ 'email'=>(string) (isset($speaker->email) ? $speaker->email : ''),
580
+ 'facebook'=>(string) (isset($speaker->facebook) ? $speaker->facebook : ''),
581
+ 'twitter'=>(string) (isset($speaker->twitter) ? $speaker->twitter : ''),
582
+ 'instagram'=>(string) (isset($speaker->instagram) ? $speaker->instagram : ''),
583
+ 'linkedin'=>(string) (isset($speaker->linkedin) ? $speaker->linkedin : ''),
584
+ 'website'=>(string) (isset($speaker->website) ? $speaker->website : ''),
585
+ 'thumbnail'=>(string) (isset($speaker->thumbnail) ? $speaker->thumbnail : ''),
586
+ ));
587
+
588
+ if($speaker_id) $speaker_ids[] = $speaker_id;
589
+ }
590
+ }
591
+
592
  // Start
593
  $start_date = (string) $meta->mec_date->start->date;
594
  $start_hour = (int) $meta->mec_date->start->hour;
822
  // Set labels to the post
823
  if(count($label_ids)) foreach($label_ids as $label_id) wp_set_object_terms($post_id, (int) $label_id, 'mec_label', true);
824
 
825
+ // Set speakers to the post
826
+ if(count($speaker_ids)) foreach($speaker_ids as $speaker_id) wp_set_object_terms($post_id, (int) $speaker_id, 'mec_speaker', true);
827
+
828
  // Featured Image
829
  $featured_image = isset($event->featured_image) ? (string) $event->featured_image->full : '';
830
  if(!has_post_thumbnail($post_id) and trim($featured_image))
app/features/locations.php CHANGED
@@ -223,8 +223,8 @@ class MEC_feature_locations extends MEC_base
223
  public function save_metadata($term_id)
224
  {
225
  $address = isset($_POST['address']) ? sanitize_text_field($_POST['address']) : '';
226
- $latitude = isset($_POST['latitude']) ? sanitize_text_field($_POST['latitude']) : '0';
227
- $longitude = isset($_POST['longitude']) ? sanitize_text_field($_POST['longitude']) : '0';
228
  $url = (isset($_POST['url']) and trim($_POST['url'])) ? esc_url($_POST['url']) : '';
229
  $thumbnail = isset($_POST['thumbnail']) ? sanitize_text_field($_POST['thumbnail']) : '';
230
 
223
  public function save_metadata($term_id)
224
  {
225
  $address = isset($_POST['address']) ? sanitize_text_field($_POST['address']) : '';
226
+ $latitude = isset($_POST['latitude']) ? floatval(sanitize_text_field($_POST['latitude'])) : '0';
227
+ $longitude = isset($_POST['longitude']) ? floatval(sanitize_text_field($_POST['longitude'])) : '0';
228
  $url = (isset($_POST['url']) and trim($_POST['url'])) ? esc_url($_POST['url']) : '';
229
  $thumbnail = isset($_POST['thumbnail']) ? sanitize_text_field($_POST['thumbnail']) : '';
230
 
app/features/mec/booking.php CHANGED
@@ -852,6 +852,7 @@ $gateways_options = $this->main->get_gateways_options();
852
  <li><?php esc_html_e('Coupons', 'modern-events-calendar-lite'); ?></li>
853
  <li><?php esc_html_e('Ticket variations', 'modern-events-calendar-lite'); ?></li>
854
  <li><?php esc_html_e('Taxes / Fees', 'modern-events-calendar-lite'); ?></li>
 
855
  </ul>
856
 
857
  <div class="mec-form-row" style="margin-top: 40px;">
852
  <li><?php esc_html_e('Coupons', 'modern-events-calendar-lite'); ?></li>
853
  <li><?php esc_html_e('Ticket variations', 'modern-events-calendar-lite'); ?></li>
854
  <li><?php esc_html_e('Taxes / Fees', 'modern-events-calendar-lite'); ?></li>
855
+ <li><?php esc_html_e('Discount Per Roles', 'modern-events-calendar-lite'); ?></li>
856
  </ul>
857
 
858
  <div class="mec-form-row" style="margin-top: 40px;">
app/features/mec/meta_boxes/display_options.php CHANGED
@@ -1095,6 +1095,16 @@ $events = $this->main->get_events();
1095
  </div>
1096
  </div>
1097
  <!-- End Display Reason for Cancellation -->
 
 
 
 
 
 
 
 
 
 
1098
  <!-- <div class="mec-form-row mec-switcher">
1099
  <div class="mec-col-4">
1100
  <label><?php _e('Uppercase Text', 'modern-events-calendar-lite'); ?></label>
1095
  </div>
1096
  </div>
1097
  <!-- End Display Reason for Cancellation -->
1098
+ <div class="mec-form-row mec-switcher mec-not-monthly_view-fluent">
1099
+ <div class="mec-col-4">
1100
+ <label for="mec_skin_monthly_view_activate_first_date"><?php _e('Activate First upcoming Date with Event', 'modern-events-calendar-lite'); ?></label>
1101
+ </div>
1102
+ <div class="mec-col-4">
1103
+ <input type="hidden" name="mec[sk-options][monthly_view][activate_first_date]" value="0" />
1104
+ <input type="checkbox" name="mec[sk-options][monthly_view][activate_first_date]" id="mec_skin_monthly_view_activate_first_date" value="1" <?php if(isset($sk_options_monthly_view['activate_first_date']) and trim($sk_options_monthly_view['activate_first_date'])) echo 'checked="checked"'; ?> />
1105
+ <label for="mec_skin_monthly_view_activate_first_date"></label>
1106
+ </div>
1107
+ </div>
1108
  <!-- <div class="mec-form-row mec-switcher">
1109
  <div class="mec-col-4">
1110
  <label><?php _e('Uppercase Text', 'modern-events-calendar-lite'); ?></label>
app/features/mec/meta_boxes/search_form.php CHANGED
@@ -18,6 +18,17 @@ $sf_options = get_post_meta($post->ID, 'sf-options', true);
18
  <label for="mec_sf_status"></label>
19
  </div>
20
  </div>
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  <!-- Search Form OPTIONS -->
23
  <div class="mec-meta-box-fields" id="mec_meta_box_calendar_search_form_options">
18
  <label for="mec_sf_status"></label>
19
  </div>
20
  </div>
21
+ <div class="mec-form-row mec-switcher">
22
+ <?php $sf_display_label = get_post_meta($post->ID, 'sf_display_label', true); ?>
23
+ <div class="mec-col-8">
24
+ <label><?php _e('Show Labels', 'modern-events-calendar-lite'); ?></label>
25
+ </div>
26
+ <div class="mec-col-4">
27
+ <input type="hidden" name="mec[sf_display_label]" value="0" />
28
+ <input type="checkbox" name="mec[sf_display_label]" id="mec_sf_display_label" value="1" <?php if($sf_display_label == 1) echo 'checked="checked"'; ?> />
29
+ <label for="mec_sf_display_label"></label>
30
+ </div>
31
+ </div>
32
 
33
  <!-- Search Form OPTIONS -->
34
  <div class="mec-meta-box-fields" id="mec_meta_box_calendar_search_form_options">
app/features/organizers.php CHANGED
@@ -281,11 +281,11 @@ class MEC_feature_organizers extends MEC_base
281
  <p class="description"><?php _e('eg. John Smith', 'modern-events-calendar-lite'); ?></p>
282
  </div>
283
  <div class="mec-form-row">
284
- <input type="text" name="mec[organizer][tel]" id="mec_organizer_contact" value="" placeholder="<?php esc_attr_e('Phone number.', 'modern-events-calendar-lite'); ?>" />
285
  <p class="description"><?php _e('eg. +1 (234) 5678', 'modern-events-calendar-lite'); ?></p>
286
  </div>
287
  <div class="mec-form-row">
288
- <input type="text" name="mec[organizer][email]" id="mec_organizer_contact" value="" placeholder="<?php esc_attr_e('Email address.', 'modern-events-calendar-lite'); ?>" />
289
  <p class="description"><?php _e('eg. john@smith.com', 'modern-events-calendar-lite'); ?></p>
290
  </div>
291
  <div class="mec-form-row">
281
  <p class="description"><?php _e('eg. John Smith', 'modern-events-calendar-lite'); ?></p>
282
  </div>
283
  <div class="mec-form-row">
284
+ <input type="text" name="mec[organizer][tel]" id="mec_organizer_tel" value="" placeholder="<?php esc_attr_e('Phone number.', 'modern-events-calendar-lite'); ?>" />
285
  <p class="description"><?php _e('eg. +1 (234) 5678', 'modern-events-calendar-lite'); ?></p>
286
  </div>
287
  <div class="mec-form-row">
288
+ <input type="text" name="mec[organizer][email]" id="mec_organizer_email" value="" placeholder="<?php esc_attr_e('Email address.', 'modern-events-calendar-lite'); ?>" />
289
  <p class="description"><?php _e('eg. john@smith.com', 'modern-events-calendar-lite'); ?></p>
290
  </div>
291
  <div class="mec-form-row">
app/features/popup.php CHANGED
@@ -223,6 +223,7 @@ class MEC_feature_popup extends MEC_base
223
 
224
  $sf = array();
225
  $sf_status = 0;
 
226
 
227
  if($skin == 'full_calendar')
228
  {
@@ -244,6 +245,7 @@ class MEC_feature_popup extends MEC_base
244
  ),
245
  'sf-options' => array($skin => $sf),
246
  'sf_status' => $sf_status,
 
247
  'show_past_events' => $show_past_events,
248
  'show_only_past_events' => $show_only_past_events,
249
  'show_only_ongoing_events' => $show_only_ongoing_events,
223
 
224
  $sf = array();
225
  $sf_status = 0;
226
+ $sf_display_label = '';
227
 
228
  if($skin == 'full_calendar')
229
  {
245
  ),
246
  'sf-options' => array($skin => $sf),
247
  'sf_status' => $sf_status,
248
+ 'sf_display_label' => $sf_display_label,
249
  'show_past_events' => $show_past_events,
250
  'show_only_past_events' => $show_only_past_events,
251
  'show_only_ongoing_events' => $show_only_ongoing_events,
app/features/popup/event.php CHANGED
@@ -183,12 +183,12 @@ $datepicker_format = (isset($settings['datepicker_format']) and trim($settings['
183
  <p class="description"><?php _e('eg. John Smith', 'modern-events-calendar-lite'); ?></p>
184
  </div>
185
  <div class="mec-col-6">
186
- <input type="text" name="mec[organizer][tel]" id="mec_organizer_contact" value="" placeholder="<?php esc_attr_e('Phone number.', 'modern-events-calendar-lite'); ?>" />
187
  <p class="description"><?php _e('eg. +1 (234) 5678', 'modern-events-calendar-lite'); ?></p>
188
  </div>
189
  </div>
190
  <div class="mec-form-row">
191
- <input type="text" name="mec[organizer][email]" id="mec_organizer_contact" value="" placeholder="<?php esc_attr_e('Email address.', 'modern-events-calendar-lite'); ?>" />
192
  <p class="description"><?php _e('eg. john@smith.com', 'modern-events-calendar-lite'); ?></p>
193
  </div>
194
  <div class="mec-form-row">
183
  <p class="description"><?php _e('eg. John Smith', 'modern-events-calendar-lite'); ?></p>
184
  </div>
185
  <div class="mec-col-6">
186
+ <input type="text" name="mec[organizer][tel]" id="mec_organizer_tel" value="" placeholder="<?php esc_attr_e('Phone number.', 'modern-events-calendar-lite'); ?>" />
187
  <p class="description"><?php _e('eg. +1 (234) 5678', 'modern-events-calendar-lite'); ?></p>
188
  </div>
189
  </div>
190
  <div class="mec-form-row">
191
+ <input type="text" name="mec[organizer][email]" id="mec_organizer_email" value="" placeholder="<?php esc_attr_e('Email address.', 'modern-events-calendar-lite'); ?>" />
192
  <p class="description"><?php _e('eg. john@smith.com', 'modern-events-calendar-lite'); ?></p>
193
  </div>
194
  <div class="mec-form-row">
app/features/speakers.php CHANGED
@@ -262,7 +262,6 @@ class MEC_feature_speakers extends MEC_base
262
  update_term_meta($term_id, 'linkedin', $linkedin);
263
  update_term_meta($term_id, 'thumbnail', $thumbnail);
264
 
265
-
266
  do_action('mec_save_speaker_extra_fields', $term_id);
267
  }
268
 
262
  update_term_meta($term_id, 'linkedin', $linkedin);
263
  update_term_meta($term_id, 'thumbnail', $thumbnail);
264
 
 
265
  do_action('mec_save_speaker_extra_fields', $term_id);
266
  }
267
 
app/features/updateTable.php CHANGED
@@ -76,6 +76,8 @@ class MEC_feature_updateTable extends MEC_base
76
 
77
  foreach($attendeesMeta as $attendeeMetaKey => $attendeeMeta)
78
  {
 
 
79
  $tickets[$attendeeMetaKey]['price'] = isset($eventTickets[$attendeeMeta['id']]['price']) ? (float)$eventTickets[$attendeeMeta['id']]['price'] : 0;
80
  if(isset($attendeeMeta['variations']) and is_array($attendeeMeta['variations']) and count($attendeeMeta['variations']))
81
  {
76
 
77
  foreach($attendeesMeta as $attendeeMetaKey => $attendeeMeta)
78
  {
79
+ if(!isset($attendeeMeta['id'])) continue;
80
+
81
  $tickets[$attendeeMetaKey]['price'] = isset($eventTickets[$attendeeMeta['id']]['price']) ? (float)$eventTickets[$attendeeMeta['id']]['price'] : 0;
82
  if(isset($attendeeMeta['variations']) and is_array($attendeeMeta['variations']) and count($attendeeMeta['variations']))
83
  {
app/libraries/factory.php CHANGED
@@ -279,9 +279,6 @@ class MEC_factory extends MEC_base
279
  // Include MEC backend script file
280
  wp_enqueue_script('mec-backend-script', $this->main->asset('js/backend.js'), $dependencies, $this->main->get_version());
281
 
282
- // Block Editor
283
- // wp_enqueue_script('mec-external-script', $this->main->asset('js/mec-external.js'), $dependencies, $this->main->get_version());
284
-
285
  // Settings
286
  $settings = $this->main->get_settings();
287
 
279
  // Include MEC backend script file
280
  wp_enqueue_script('mec-backend-script', $this->main->asset('js/backend.js'), $dependencies, $this->main->get_version());
281
 
 
 
 
282
  // Settings
283
  $settings = $this->main->get_settings();
284
 
app/libraries/main.php CHANGED
@@ -2915,6 +2915,7 @@ class MEC_main extends MEC_base
2915
  $atts['sk-options']['agenda']['style'] = 'clean';
2916
  $atts['sk-options']['agenda']['limit'] = 1000;
2917
  $atts['sf_status'] = false;
 
2918
 
2919
  // Create Skin Object Class
2920
  $SKO = new MEC_skin_agenda();
@@ -3353,9 +3354,9 @@ class MEC_main extends MEC_base
3353
  <span class="mec_'.$prefix.'_field_type">'.__('Text', 'modern-events-calendar-lite').'</span>
3354
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3355
  <p class="mec_'.$prefix.'_field_options">
3356
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3357
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3358
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3359
  '.__('Required Field', 'modern-events-calendar-lite').'
3360
  </label>
3361
  </p>
@@ -3383,9 +3384,9 @@ class MEC_main extends MEC_base
3383
  <span class="mec_'.$prefix.'_field_type">'.__('MEC Name', 'modern-events-calendar-lite').'</span>
3384
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3385
  <p class="mec_'.$prefix.'_field_options" style="display:none">
3386
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3387
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" />
3388
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" checked="checked" disabled />
3389
  '.__('Required Field', 'modern-events-calendar-lite').'
3390
  </label>
3391
  </p>
@@ -3412,9 +3413,9 @@ class MEC_main extends MEC_base
3412
  <span class="mec_'.$prefix.'_field_type">'.__('MEC Email', 'modern-events-calendar-lite').'</span>
3413
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3414
  <p class="mec_'.$prefix.'_field_options" style="display:none">
3415
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3416
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" />
3417
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" checked="checked" disabled />
3418
  '.__('Required Field', 'modern-events-calendar-lite').'
3419
  </label>
3420
  </p>
@@ -3441,9 +3442,9 @@ class MEC_main extends MEC_base
3441
  <span class="mec_'.$prefix.'_field_type">'.__('Email', 'modern-events-calendar-lite').'</span>
3442
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3443
  <p class="mec_'.$prefix.'_field_options">
3444
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3445
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3446
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3447
  '.__('Required Field', 'modern-events-calendar-lite').'
3448
  </label>
3449
  </p>
@@ -3471,9 +3472,9 @@ class MEC_main extends MEC_base
3471
  <span class="mec_'.$prefix.'_field_type">'.__('URL', 'modern-events-calendar-lite').'</span>
3472
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3473
  <p class="mec_'.$prefix.'_field_options">
3474
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3475
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3476
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3477
  '.__('Required Field', 'modern-events-calendar-lite').'
3478
  </label>
3479
  </p>
@@ -3501,9 +3502,9 @@ class MEC_main extends MEC_base
3501
  <span class="mec_'.$prefix.'_field_type">'.__('File', 'modern-events-calendar-lite').'</span>
3502
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3503
  <p class="mec_'.$prefix.'_field_options">
3504
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3505
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3506
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3507
  '.__('Required Field', 'modern-events-calendar-lite').'
3508
  </label>
3509
  </p>
@@ -3530,9 +3531,9 @@ class MEC_main extends MEC_base
3530
  <span class="mec_'.$prefix.'_field_type">'.__('Date', 'modern-events-calendar-lite').'</span>
3531
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3532
  <p class="mec_'.$prefix.'_field_options">
3533
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3534
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3535
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3536
  '.__('Required Field', 'modern-events-calendar-lite').'
3537
  </label>
3538
  </p>
@@ -3560,9 +3561,9 @@ class MEC_main extends MEC_base
3560
  <span class="mec_'.$prefix.'_field_type">'.__('Tel', 'modern-events-calendar-lite').'</span>
3561
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3562
  <p class="mec_'.$prefix.'_field_options">
3563
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3564
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3565
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3566
  '.__('Required Field', 'modern-events-calendar-lite').'
3567
  </label>
3568
  </p>
@@ -3590,9 +3591,9 @@ class MEC_main extends MEC_base
3590
  <span class="mec_'.$prefix.'_field_type">'.__('Textarea', 'modern-events-calendar-lite').'</span>
3591
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3592
  <p class="mec_'.$prefix.'_field_options">
3593
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3594
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3595
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3596
  '.__('Required Field', 'modern-events-calendar-lite').'
3597
  </label>
3598
  </p>
@@ -3643,9 +3644,9 @@ class MEC_main extends MEC_base
3643
  <span class="mec_'.$prefix.'_field_type">'.__('Checkboxes', 'modern-events-calendar-lite').'</span>
3644
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3645
  <p class="mec_'.$prefix.'_field_options">
3646
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3647
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3648
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3649
  '.__('Required Field', 'modern-events-calendar-lite').'
3650
  </label>
3651
  </p>
@@ -3690,9 +3691,9 @@ class MEC_main extends MEC_base
3690
  <span class="mec_'.$prefix.'_field_type">'.__('Radio Buttons', 'modern-events-calendar-lite').'</span>
3691
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3692
  <p class="mec_'.$prefix.'_field_options">
3693
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3694
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3695
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3696
  '.__('Required Field', 'modern-events-calendar-lite').'
3697
  </label>
3698
  </p>
@@ -3737,9 +3738,9 @@ class MEC_main extends MEC_base
3737
  <span class="mec_'.$prefix.'_field_type">'.__('Dropdown', 'modern-events-calendar-lite').'</span>
3738
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3739
  <p class="mec_'.$prefix.'_field_options">
3740
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3741
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3742
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3743
  '.__('Required Field', 'modern-events-calendar-lite').'
3744
  </label>
3745
  </p>
@@ -3787,9 +3788,9 @@ class MEC_main extends MEC_base
3787
  <span class="mec_'.$prefix.'_field_type">'.__('Agreement', 'modern-events-calendar-lite').'</span>
3788
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3789
  <p class="mec_'.$prefix.'_field_options">
3790
- <label for="mec_'.$prefix.'_fields_'.$key.'_mandatory">
3791
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3792
- <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" id="mec_'.$prefix.'_fields_'.$key.'_mandatory" '.((!isset($values['mandatory']) or (isset($values['mandatory']) and $values['mandatory'])) ? 'checked="checked"' : '').' />
3793
  '.__('Required Field', 'modern-events-calendar-lite').'
3794
  </label>
3795
  </p>
@@ -4478,15 +4479,7 @@ class MEC_main extends MEC_base
4478
  */
4479
  public function add_mce_external_plugins($plugins)
4480
  {
4481
- if(!function_exists('is_plugin_active')) include_once(ABSPATH . 'wp-admin/includes/plugin.php');
4482
-
4483
- // MEC Settings
4484
- $settings = $this->get_settings();
4485
-
4486
- if(is_plugin_active('js_composer/js_composer.php')) $plugins['mec_mce_buttons'] = $this->asset('js/mec-external.js');
4487
- elseif((!isset($settings['gutenberg']) or (isset($settings['gutenberg']) and $settings['gutenberg']))) $plugins['mec_mce_buttons'] = $this->asset('js/mec-external.js');
4488
- else $plugins['mec_mce_buttons'] = $this->asset('js/backend.js');
4489
-
4490
  return $plugins;
4491
  }
4492
 
@@ -5099,9 +5092,10 @@ class MEC_main extends MEC_base
5099
  * Return a web page
5100
  * @author Webnus <info@webnus.biz>
5101
  * @param string $url
 
5102
  * @return string
5103
  */
5104
- public function get_web_page($url)
5105
  {
5106
  $result = false;
5107
 
@@ -5110,13 +5104,13 @@ class MEC_main extends MEC_base
5110
  {
5111
  $result = wp_remote_retrieve_body(wp_remote_get($url, array(
5112
  'body' => null,
5113
- 'timeout' => '120',
5114
- 'redirection' => '10',
5115
  )));
5116
  }
5117
 
5118
  // Doing FGC
5119
- if($result == false)
5120
  {
5121
  $http = array();
5122
  $result = @file_get_contents($url, false, stream_context_create(array('http'=>$http)));
@@ -5350,12 +5344,14 @@ class MEC_main extends MEC_base
5350
  $organizer_id = $term['term_id'];
5351
  if(!$organizer_id) return false;
5352
 
5353
- if ( isset($organizer['tel']) && strpos($organizer['tel'], '@') !== false )
5354
  {
5355
  // Just for EventON
5356
  $tel = '';
5357
  $email = (isset($organizer['tel']) and trim($organizer['tel'])) ? $organizer['tel'] : '';
5358
- } else {
 
 
5359
  $tel = (isset($organizer['tel']) and trim($organizer['tel'])) ? $organizer['tel'] : '';
5360
  $email = (isset($organizer['email']) and trim($organizer['email'])) ? $organizer['email'] : '';
5361
  }
@@ -5411,6 +5407,47 @@ class MEC_main extends MEC_base
5411
 
5412
  return $location_id;
5413
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5414
 
5415
  /**
5416
  * Returns data export array for one event
@@ -6391,13 +6428,13 @@ class MEC_main extends MEC_base
6391
  if($cache->has($cache_key)) return $cache->get($cache_key);
6392
 
6393
  // First Provider
6394
- $JSON = $this->get_web_page('http://ip-api.com/json/'.$ip);
6395
  $data = json_decode($JSON, true);
6396
 
6397
  // Second Provider
6398
  if(!trim($JSON) or (is_array($data) and !isset($data['timezone'])))
6399
  {
6400
- $JSON = $this->get_web_page('https://ipapi.co/'.$ip.'/json/');
6401
  $data = json_decode($JSON, true);
6402
  }
6403
 
@@ -7295,6 +7332,9 @@ class MEC_main extends MEC_base
7295
  // Booking on single page is disabled
7296
  if(!isset($settings['booking_status']) or (isset($settings['booking_status']) and !$settings['booking_status'])) return false;
7297
 
 
 
 
7298
  // No Tickets
7299
  $tickets = get_post_meta($event_id, 'mec_tickets', true);
7300
  if(!is_array($tickets) or (is_array($tickets) and !count($tickets))) return false;
@@ -7790,14 +7830,14 @@ class MEC_main extends MEC_base
7790
  $start_date = (isset($date['start']) and isset($date['start']['date'])) ? $date['start']['date'] : NULL;
7791
  if(!$start_date) return false;
7792
 
7793
- $s_hour = $date['start']['hour'];
7794
- if(strtoupper($date['start']['ampm']) == 'AM' and $s_hour == '0') $s_hour = 12;
7795
 
7796
  $start_time = sprintf("%02d", $s_hour).':';
7797
- $start_time .= sprintf("%02d", $date['start']['minutes']);
7798
- $start_time .= ' '.trim($date['start']['ampm']);
7799
 
7800
- $allday = isset($date['allday']) ? $date['allday'] : 0;
7801
  if($allday) $start_time = '12:01 AM';
7802
 
7803
  // The event is started
2915
  $atts['sk-options']['agenda']['style'] = 'clean';
2916
  $atts['sk-options']['agenda']['limit'] = 1000;
2917
  $atts['sf_status'] = false;
2918
+ $atts['sf_display_label'] = false;
2919
 
2920
  // Create Skin Object Class
2921
  $SKO = new MEC_skin_agenda();
3354
  <span class="mec_'.$prefix.'_field_type">'.__('Text', 'modern-events-calendar-lite').'</span>
3355
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3356
  <p class="mec_'.$prefix.'_field_options">
3357
+ <label>
3358
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3359
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3360
  '.__('Required Field', 'modern-events-calendar-lite').'
3361
  </label>
3362
  </p>
3384
  <span class="mec_'.$prefix.'_field_type">'.__('MEC Name', 'modern-events-calendar-lite').'</span>
3385
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3386
  <p class="mec_'.$prefix.'_field_options" style="display:none">
3387
+ <label>
3388
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" />
3389
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" checked="checked" disabled />
3390
  '.__('Required Field', 'modern-events-calendar-lite').'
3391
  </label>
3392
  </p>
3413
  <span class="mec_'.$prefix.'_field_type">'.__('MEC Email', 'modern-events-calendar-lite').'</span>
3414
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3415
  <p class="mec_'.$prefix.'_field_options" style="display:none">
3416
+ <label>
3417
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" />
3418
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" checked="checked" disabled />
3419
  '.__('Required Field', 'modern-events-calendar-lite').'
3420
  </label>
3421
  </p>
3442
  <span class="mec_'.$prefix.'_field_type">'.__('Email', 'modern-events-calendar-lite').'</span>
3443
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3444
  <p class="mec_'.$prefix.'_field_options">
3445
+ <label>
3446
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3447
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3448
  '.__('Required Field', 'modern-events-calendar-lite').'
3449
  </label>
3450
  </p>
3472
  <span class="mec_'.$prefix.'_field_type">'.__('URL', 'modern-events-calendar-lite').'</span>
3473
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3474
  <p class="mec_'.$prefix.'_field_options">
3475
+ <label>
3476
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3477
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3478
  '.__('Required Field', 'modern-events-calendar-lite').'
3479
  </label>
3480
  </p>
3502
  <span class="mec_'.$prefix.'_field_type">'.__('File', 'modern-events-calendar-lite').'</span>
3503
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3504
  <p class="mec_'.$prefix.'_field_options">
3505
+ <label>
3506
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3507
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3508
  '.__('Required Field', 'modern-events-calendar-lite').'
3509
  </label>
3510
  </p>
3531
  <span class="mec_'.$prefix.'_field_type">'.__('Date', 'modern-events-calendar-lite').'</span>
3532
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3533
  <p class="mec_'.$prefix.'_field_options">
3534
+ <label>
3535
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3536
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3537
  '.__('Required Field', 'modern-events-calendar-lite').'
3538
  </label>
3539
  </p>
3561
  <span class="mec_'.$prefix.'_field_type">'.__('Tel', 'modern-events-calendar-lite').'</span>
3562
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3563
  <p class="mec_'.$prefix.'_field_options">
3564
+ <label>
3565
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3566
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3567
  '.__('Required Field', 'modern-events-calendar-lite').'
3568
  </label>
3569
  </p>
3591
  <span class="mec_'.$prefix.'_field_type">'.__('Textarea', 'modern-events-calendar-lite').'</span>
3592
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3593
  <p class="mec_'.$prefix.'_field_options">
3594
+ <label>
3595
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3596
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3597
  '.__('Required Field', 'modern-events-calendar-lite').'
3598
  </label>
3599
  </p>
3644
  <span class="mec_'.$prefix.'_field_type">'.__('Checkboxes', 'modern-events-calendar-lite').'</span>
3645
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3646
  <p class="mec_'.$prefix.'_field_options">
3647
+ <label>
3648
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3649
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3650
  '.__('Required Field', 'modern-events-calendar-lite').'
3651
  </label>
3652
  </p>
3691
  <span class="mec_'.$prefix.'_field_type">'.__('Radio Buttons', 'modern-events-calendar-lite').'</span>
3692
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3693
  <p class="mec_'.$prefix.'_field_options">
3694
+ <label>
3695
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3696
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3697
  '.__('Required Field', 'modern-events-calendar-lite').'
3698
  </label>
3699
  </p>
3738
  <span class="mec_'.$prefix.'_field_type">'.__('Dropdown', 'modern-events-calendar-lite').'</span>
3739
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3740
  <p class="mec_'.$prefix.'_field_options">
3741
+ <label>
3742
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3743
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((isset($values['mandatory']) and $values['mandatory']) ? 'checked="checked"' : '').' />
3744
  '.__('Required Field', 'modern-events-calendar-lite').'
3745
  </label>
3746
  </p>
3788
  <span class="mec_'.$prefix.'_field_type">'.__('Agreement', 'modern-events-calendar-lite').'</span>
3789
  '.($prefix == 'event' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%event_field_'.$key.'%%</span>' : ($prefix == 'bfixed' ? '<span class="mec_'.$prefix.'_notification_placeholder">%%booking_field_'.$key.'%%</span>' : '')).'
3790
  <p class="mec_'.$prefix.'_field_options">
3791
+ <label>
3792
  <input type="hidden" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="0" />
3793
+ <input type="checkbox" name="mec['.$prefix.'_fields]['.$key.'][mandatory]" value="1" '.((!isset($values['mandatory']) or (isset($values['mandatory']) and $values['mandatory'])) ? 'checked="checked"' : '').' />
3794
  '.__('Required Field', 'modern-events-calendar-lite').'
3795
  </label>
3796
  </p>
4479
  */
4480
  public function add_mce_external_plugins($plugins)
4481
  {
4482
+ $plugins['mec_mce_buttons'] = $this->asset('js/mec-external.js');
 
 
 
 
 
 
 
 
4483
  return $plugins;
4484
  }
4485
 
5092
  * Return a web page
5093
  * @author Webnus <info@webnus.biz>
5094
  * @param string $url
5095
+ * @param int $timeout
5096
  * @return string
5097
  */
5098
+ public function get_web_page($url, $timeout = 20)
5099
  {
5100
  $result = false;
5101
 
5104
  {
5105
  $result = wp_remote_retrieve_body(wp_remote_get($url, array(
5106
  'body' => null,
5107
+ 'timeout' => $timeout,
5108
+ 'redirection' => 5,
5109
  )));
5110
  }
5111
 
5112
  // Doing FGC
5113
+ if($result === false)
5114
  {
5115
  $http = array();
5116
  $result = @file_get_contents($url, false, stream_context_create(array('http'=>$http)));
5344
  $organizer_id = $term['term_id'];
5345
  if(!$organizer_id) return false;
5346
 
5347
+ if(isset($organizer['tel']) && strpos($organizer['tel'], '@') !== false)
5348
  {
5349
  // Just for EventON
5350
  $tel = '';
5351
  $email = (isset($organizer['tel']) and trim($organizer['tel'])) ? $organizer['tel'] : '';
5352
+ }
5353
+ else
5354
+ {
5355
  $tel = (isset($organizer['tel']) and trim($organizer['tel'])) ? $organizer['tel'] : '';
5356
  $email = (isset($organizer['email']) and trim($organizer['email'])) ? $organizer['email'] : '';
5357
  }
5407
 
5408
  return $location_id;
5409
  }
5410
+
5411
+ public function save_speaker($speaker = array())
5412
+ {
5413
+ $name = isset($speaker['name']) ? $speaker['name'] : '';
5414
+ if(!trim($name)) return false;
5415
+
5416
+ $term = get_term_by('name', $name, 'mec_speaker');
5417
+
5418
+ // Term already exists
5419
+ if(is_object($term) and isset($term->term_id)) return $term->term_id;
5420
+
5421
+ $term = wp_insert_term($name, 'mec_speaker');
5422
+
5423
+ // An error ocurred
5424
+ if(is_wp_error($term)) return false;
5425
+
5426
+ $speaker_id = $term['term_id'];
5427
+ if(!$speaker_id) return false;
5428
+
5429
+ $job_title = (isset($speaker['job_title']) and trim($speaker['job_title'])) ? $speaker['job_title'] : '';
5430
+ $tel = (isset($speaker['tel']) and trim($speaker['tel'])) ? $speaker['tel'] : '';
5431
+ $email = (isset($speaker['email']) and trim($speaker['email'])) ? $speaker['email'] : '';
5432
+ $facebook = (isset($speaker['facebook']) and trim($speaker['facebook'])) ? esc_url($speaker['facebook']) : '';
5433
+ $twitter = (isset($speaker['twitter']) and trim($speaker['twitter'])) ? esc_url($speaker['twitter']) : '';
5434
+ $instagram = (isset($speaker['instagram']) and trim($speaker['instagram'])) ? esc_url($speaker['instagram']) : '';
5435
+ $linkedin = (isset($speaker['linkedin']) and trim($speaker['linkedin'])) ? esc_url($speaker['linkedin']) : '';
5436
+ $website = (isset($speaker['website']) and trim($speaker['website'])) ? esc_url($speaker['website']) : '';
5437
+ $thumbnail = isset($speaker['thumbnail']) ? $speaker['thumbnail'] : '';
5438
+
5439
+ update_term_meta($speaker_id, 'job_title', $job_title);
5440
+ update_term_meta($speaker_id, 'tel', $tel);
5441
+ update_term_meta($speaker_id, 'email', $email);
5442
+ update_term_meta($speaker_id, 'facebook', $facebook);
5443
+ update_term_meta($speaker_id, 'twitter', $twitter);
5444
+ update_term_meta($speaker_id, 'instagram', $instagram);
5445
+ update_term_meta($speaker_id, 'linkedin', $linkedin);
5446
+ update_term_meta($speaker_id, 'website', $website);
5447
+ if(trim($thumbnail)) update_term_meta($speaker_id, 'thumbnail', $thumbnail);
5448
+
5449
+ return $speaker_id;
5450
+ }
5451
 
5452
  /**
5453
  * Returns data export array for one event
6428
  if($cache->has($cache_key)) return $cache->get($cache_key);
6429
 
6430
  // First Provider
6431
+ $JSON = $this->get_web_page('http://ip-api.com/json/'.$ip, 3);
6432
  $data = json_decode($JSON, true);
6433
 
6434
  // Second Provider
6435
  if(!trim($JSON) or (is_array($data) and !isset($data['timezone'])))
6436
  {
6437
+ $JSON = $this->get_web_page('https://ipapi.co/'.$ip.'/json/', 3);
6438
  $data = json_decode($JSON, true);
6439
  }
6440
 
7332
  // Booking on single page is disabled
7333
  if(!isset($settings['booking_status']) or (isset($settings['booking_status']) and !$settings['booking_status'])) return false;
7334
 
7335
+ // Original Event ID for Multilingual Websites
7336
+ $event_id = $this->get_original_event($event_id);
7337
+
7338
  // No Tickets
7339
  $tickets = get_post_meta($event_id, 'mec_tickets', true);
7340
  if(!is_array($tickets) or (is_array($tickets) and !count($tickets))) return false;
7830
  $start_date = (isset($date['start']) and isset($date['start']['date'])) ? $date['start']['date'] : NULL;
7831
  if(!$start_date) return false;
7832
 
7833
+ $s_hour = (isset($date['start']['hour']) ? $date['start']['hour'] : NULL);
7834
+ if(isset($date['start']['ampm']) and strtoupper($date['start']['ampm']) == 'AM' and $s_hour == '0') $s_hour = 12;
7835
 
7836
  $start_time = sprintf("%02d", $s_hour).':';
7837
+ $start_time .= sprintf("%02d", (isset($date['start']['minutes']) ? $date['start']['minutes'] : NULL));
7838
+ $start_time .= ' '.(isset($date['start']['ampm']) ? trim($date['start']['ampm']) : NULL);
7839
 
7840
+ $allday = (isset($date['allday']) ? $date['allday'] : 0);
7841
  if($allday) $start_time = '12:01 AM';
7842
 
7843
  // The event is started
app/libraries/render.php CHANGED
@@ -1239,7 +1239,7 @@ class MEC_render extends MEC_base
1239
  $advanced_days = get_post_meta($event_id, 'mec_advanced_days', true);
1240
 
1241
  // Generate dates for event
1242
- $event_info = array('start' => $start_date, 'end' => $end_date, 'allday' => $allday, 'hide_time' => $hide_time, 'finish_date' => $finish_date['date'], 'exceptional_days' => $exceptional_days, 'mec_repeat_end' => $event->meta['mec_repeat']['end'], 'occurrences' => $event->meta['mec_repeat']['end_at_occurrences']);
1243
 
1244
  $dates = $this->generate_advanced_days($advanced_days, $event_info, $maximum, $today);
1245
  }
@@ -1422,7 +1422,10 @@ class MEC_render extends MEC_base
1422
 
1423
  // No latitude/Longitude
1424
  if(trim($latitude) == '' or trim($longitude) == '') continue;
1425
-
 
 
 
1426
  $key = $latitude.','.$longitude;
1427
  if(!isset($markers[$key]))
1428
  {
1239
  $advanced_days = get_post_meta($event_id, 'mec_advanced_days', true);
1240
 
1241
  // Generate dates for event
1242
+ $event_info = array('start' => $start_date, 'end' => $end_date, 'allday' => $allday, 'hide_time' => $hide_time, 'finish_date' => $finish_date['date'], 'exceptional_days' => $exceptional_days, 'mec_repeat_end' => ((isset($event->meta['mec_repeat']) and isset($event->meta['mec_repeat']['end'])) ? $event->meta['mec_repeat']['end'] : ''), 'occurrences' => ((isset($event->meta['mec_repeat']) and isset($event->meta['mec_repeat']['end_at_occurrences'])) ? $event->meta['mec_repeat']['end_at_occurrences'] : ''));
1243
 
1244
  $dates = $this->generate_advanced_days($advanced_days, $event_info, $maximum, $today);
1245
  }
1422
 
1423
  // No latitude/Longitude
1424
  if(trim($latitude) == '' or trim($longitude) == '') continue;
1425
+
1426
+ $latitude = floatval($latitude);
1427
+ $longitude = floatval($longitude);
1428
+
1429
  $key = $latitude.','.$longitude;
1430
  if(!isset($markers[$key]))
1431
  {
app/libraries/skins.php CHANGED
@@ -76,6 +76,7 @@ class MEC_skins extends MEC_base
76
  public $html_class;
77
  public $sf;
78
  public $sf_status;
 
79
  public $sf_options;
80
  public $id;
81
  public $events;
@@ -540,7 +541,9 @@ class MEC_skins extends MEC_base
540
  elseif($this->hide_time_method == 'end') $column = 'tend';
541
 
542
  $order = "`tstart` DESC";
 
543
  $where_OR = "`".$column."`<'".$seconds_start."'";
 
544
  }
545
  elseif($this->show_ongoing_events)
546
  {
@@ -978,13 +981,13 @@ class MEC_skins extends MEC_base
978
  $fields .= '</div>';
979
  }
980
 
981
- $fields .= $this->sf_search_field($field, $options);
982
  }
983
 
984
  $fields = apply_filters('mec_filter_fields_search_form', $fields, $this);
985
 
986
  $form = '';
987
- if(trim($fields) && (in_array('dropdown', $display_form) || in_array('text_input', $display_form) || in_array('address_input', $display_form) || in_array('minmax', $display_form) || in_array('local-time-picker', $display_form))) $form .= '<div id="mec_search_form_'.$this->id.'" class="mec-search-form mec-totalcal-box">'.$fields.'</div>';
988
 
989
  return $form;
990
  }
@@ -996,7 +999,7 @@ class MEC_skins extends MEC_base
996
  * @param array $options
997
  * @return string
998
  */
999
- public function sf_search_field($field, $options)
1000
  {
1001
  $type = isset($options['type']) ? $options['type'] : '';
1002
 
@@ -1013,10 +1016,14 @@ class MEC_skins extends MEC_base
1013
  $output = '';
1014
  if($field == 'category')
1015
  {
 
 
1016
  if($type == 'dropdown')
1017
  {
1018
- $output .= '<div class="mec-dropdown-search">
1019
- <i class="mec-sl-folder"></i>';
 
 
1020
 
1021
  $output .= wp_dropdown_categories(array
1022
  (
@@ -1026,7 +1033,7 @@ class MEC_skins extends MEC_base
1026
  'include'=>((isset($this->atts['category']) and trim($this->atts['category'])) ? $this->atts['category'] : ''),
1027
  'id'=>'mec_sf_category_'.$this->id,
1028
  'hierarchical'=>true,
1029
- 'show_option_none'=>$this->main->m('taxonomy_category', __('Category', 'modern-events-calendar-lite')),
1030
  'option_none_value'=>'',
1031
  'selected'=>(isset($this->atts['category']) ? $this->atts['category'] : ''),
1032
  'orderby'=>'name',
@@ -1038,8 +1045,9 @@ class MEC_skins extends MEC_base
1038
  }
1039
  elseif($type == 'checkboxes' and wp_count_terms(array('taxonomy' => 'mec_category')))
1040
  {
1041
- $output .= '<div class="mec-checkboxes-search">
1042
- <i class="mec-sl-folder"></i>';
 
1043
 
1044
  $selected = ((isset($this->atts['category']) and trim($this->atts['category'])) ? explode(',', trim($this->atts['category'], ', ')) : array());
1045
 
@@ -1064,10 +1072,14 @@ class MEC_skins extends MEC_base
1064
  }
1065
  elseif($field == 'location')
1066
  {
 
 
1067
  if($type == 'dropdown')
1068
  {
1069
- $output .= '<div class="mec-dropdown-search">
1070
- <i class="mec-sl-location-pin"></i>';
 
 
1071
 
1072
  $output .= wp_dropdown_categories(array
1073
  (
@@ -1077,7 +1089,7 @@ class MEC_skins extends MEC_base
1077
  'include'=>((isset($this->atts['location']) and trim($this->atts['location'])) ? $this->atts['location'] : ''),
1078
  'id'=>'mec_sf_location_'.$this->id,
1079
  'hierarchical'=>true,
1080
- 'show_option_none'=>$this->main->m('taxonomy_location', __('Location', 'modern-events-calendar-lite')),
1081
  'option_none_value'=>'',
1082
  'selected'=>(isset($this->atts['location']) ? $this->atts['location'] : ''),
1083
  'orderby'=>'name',
@@ -1090,10 +1102,13 @@ class MEC_skins extends MEC_base
1090
  }
1091
  elseif($field == 'organizer')
1092
  {
 
 
1093
  if($type == 'dropdown')
1094
  {
1095
- $output .= '<div class="mec-dropdown-search">
1096
- <i class="mec-sl-user"></i>';
 
1097
 
1098
  $output .= wp_dropdown_categories(array
1099
  (
@@ -1103,7 +1118,7 @@ class MEC_skins extends MEC_base
1103
  'include'=>((isset($this->atts['organizer']) and trim($this->atts['organizer'])) ? $this->atts['organizer'] : ''),
1104
  'id'=>'mec_sf_organizer_'.$this->id,
1105
  'hierarchical'=>true,
1106
- 'show_option_none'=>$this->main->m('taxonomy_organizer', __('Organizer', 'modern-events-calendar-lite')),
1107
  'option_none_value'=>'',
1108
  'selected'=>(isset($this->atts['organizer']) ? $this->atts['organizer'] : ''),
1109
  'orderby'=>'name',
@@ -1116,10 +1131,13 @@ class MEC_skins extends MEC_base
1116
  }
1117
  elseif($field == 'speaker' and $speakers_status)
1118
  {
 
 
1119
  if($type == 'dropdown')
1120
  {
1121
- $output .= '<div class="mec-dropdown-search">
1122
- <i class="mec-sl-microphone"></i>';
 
1123
 
1124
  $output .= wp_dropdown_categories(array
1125
  (
@@ -1129,7 +1147,7 @@ class MEC_skins extends MEC_base
1129
  'include'=>((isset($this->atts['speaker']) and trim($this->atts['speaker'])) ? $this->atts['speaker'] : ''),
1130
  'id'=>'mec_sf_speaker_'.$this->id,
1131
  'hierarchical'=>true,
1132
- 'show_option_none'=>$this->main->m('taxonomy_speaker', __('Speaker', 'modern-events-calendar-lite')),
1133
  'option_none_value'=>'',
1134
  'selected'=>(isset($this->atts['speaker']) ? $this->atts['speaker'] : ''),
1135
  'orderby'=>'name',
@@ -1142,10 +1160,13 @@ class MEC_skins extends MEC_base
1142
  }
1143
  elseif($field == 'tag')
1144
  {
 
 
1145
  if($type == 'dropdown')
1146
  {
1147
- $output .= '<div class="mec-dropdown-search">
1148
- <i class="mec-sl-tag"></i>';
 
1149
 
1150
  $output .= wp_dropdown_categories(array
1151
  (
@@ -1155,7 +1176,7 @@ class MEC_skins extends MEC_base
1155
  'include'=>((isset($this->atts['tag']) and trim($this->atts['tag'])) ? $this->atts['tag'] : ''),
1156
  'id'=>'mec_sf_tag_'.$this->id,
1157
  'hierarchical'=>true,
1158
- 'show_option_none'=>$this->main->m('taxonomy_tag', __('Tag', 'modern-events-calendar-lite')),
1159
  'option_none_value'=>'',
1160
  'selected'=>(isset($this->atts['tag']) ? $this->atts['tag'] : ''),
1161
  'orderby'=>'name',
@@ -1168,10 +1189,13 @@ class MEC_skins extends MEC_base
1168
  }
1169
  elseif($field == 'label')
1170
  {
 
 
1171
  if($type == 'dropdown')
1172
  {
1173
- $output .= '<div class="mec-dropdown-search">
1174
- <i class="mec-sl-pin"></i>';
 
1175
 
1176
  $output .= wp_dropdown_categories(array
1177
  (
@@ -1181,7 +1205,7 @@ class MEC_skins extends MEC_base
1181
  'include'=>((isset($this->atts['label']) and trim($this->atts['label'])) ? $this->atts['label'] : ''),
1182
  'id'=>'mec_sf_label_'.$this->id,
1183
  'hierarchical'=>true,
1184
- 'show_option_none'=>$this->main->m('taxonomy_label', __('Label', 'modern-events-calendar-lite')),
1185
  'option_none_value'=>'',
1186
  'selected'=>(isset($this->atts['label']) ? $this->atts['label'] : ''),
1187
  'orderby'=>'name',
@@ -1194,6 +1218,7 @@ class MEC_skins extends MEC_base
1194
  }
1195
  elseif($field == 'month_filter')
1196
  {
 
1197
  if($type == 'dropdown')
1198
  {
1199
  $time = isset($this->start_date) ? strtotime($this->start_date) : '';
@@ -1205,8 +1230,9 @@ class MEC_skins extends MEC_base
1205
  $item = __('Select', 'modern-events-calendar-lite');
1206
  $option = in_array($this->skin, $skins) ? '<option class="mec-none-item" value="none" selected="selected">'.$item.'</option>' : '';
1207
 
1208
- $output .= '<div class="mec-date-search"><input type="hidden" id="mec-filter-none" value="'.$item.'">
1209
- <i class="mec-sl-calendar"></i>
 
1210
  <select id="mec_sf_month_'.$this->id.'">';
1211
 
1212
  $output .= $option;
@@ -1251,8 +1277,9 @@ class MEC_skins extends MEC_base
1251
  {
1252
  $min_date = (isset($this->start_date) ? $this->start_date : NULL);
1253
 
1254
- $output .= '<div class="mec-date-search">
1255
- <i class="mec-sl-calendar"></i>
 
1256
  <input class="mec-col-3 mec_date_picker_dynamic_format_start" data-min="'.$min_date.'" type="text"
1257
  id="mec_sf_date_start_'.$this->id.'"
1258
  placeholder="'.esc_attr__('Start', 'modern-events-calendar-lite').'" autocomplete="off">
@@ -1264,12 +1291,14 @@ class MEC_skins extends MEC_base
1264
  }
1265
  elseif($field == 'time_filter')
1266
  {
 
1267
  if($type == 'local-time-picker')
1268
  {
1269
  $this->main->load_time_picker_assets();
1270
 
1271
- $output .= '<div class="mec-time-picker-search">
1272
- <i class="mec-sl-clock"></i>
 
1273
  <input type="text" class="mec-timepicker-start" id="mec_sf_timepicker_start_'.$this->id.'" placeholder="'.__('Start Time', 'modern-events-calendar-lite').'" data-format="'.$this->main->get_hour_format().'" />
1274
  <input type="text" class="mec-timepicker-end" id="mec_sf_timepicker_end_'.$this->id.'" placeholder="'.__('End Time', 'modern-events-calendar-lite').'" data-format="'.$this->main->get_hour_format().'" />
1275
  </div>';
@@ -1277,30 +1306,36 @@ class MEC_skins extends MEC_base
1277
  }
1278
  elseif($field == 'text_search')
1279
  {
 
1280
  if($type == 'text_input')
1281
  {
1282
- $output .= '<div class="mec-text-input-search">
1283
- <i class="mec-sl-magnifier"></i>
 
1284
  <input type="search" value="'.(isset($this->atts['s']) ? $this->atts['s'] : '').'" id="mec_sf_s_'.$this->id.'" />
1285
  </div>';
1286
  }
1287
  }
1288
  elseif($field == 'address_search')
1289
  {
 
1290
  if($type == 'address_input')
1291
  {
1292
- $output .= '<div class="mec-text-address-search">
1293
- <i class="mec-sl-map"></i>
 
1294
  <input type="search" value="'.(isset($this->atts['address']) ? $this->atts['address'] : '').'" id="mec_sf_address_s_'.$this->id.'" />
1295
  </div>';
1296
  }
1297
  }
1298
  elseif($field == 'event_cost')
1299
  {
 
1300
  if($type == 'minmax')
1301
  {
1302
- $output .= '<div class="mec-minmax-event-cost">
1303
- <i class="mec-sl-credit-card"></i>
 
1304
  <input type="number" min="0" step="0.01" value="'.(isset($this->atts['event-cost-min']) ? $this->atts['event-cost-min'] : '').'" id="mec_sf_event_cost_min_'.$this->id.'" class="mec-minmax-price" placeholder="'.esc_attr__('Min Price', 'modern-events-calendar-lite').'" />
1305
  <input type="number" min="0" step="0.01" value="'.(isset($this->atts['event-cost-max']) ? $this->atts['event-cost-max'] : '').'" id="mec_sf_event_cost_max_'.$this->id.'" class="mec-minmax-price" placeholder="'.esc_attr__('Max Price', 'modern-events-calendar-lite').'" />
1306
  </div>';
76
  public $html_class;
77
  public $sf;
78
  public $sf_status;
79
+ public $sf_display_label;
80
  public $sf_options;
81
  public $id;
82
  public $events;
541
  elseif($this->hide_time_method == 'end') $column = 'tend';
542
 
543
  $order = "`tstart` DESC";
544
+
545
  $where_OR = "`".$column."`<'".$seconds_start."'";
546
+ if($column != 'tend') $where_OR .= " AND `tend`<'".$seconds_start."'";
547
  }
548
  elseif($this->show_ongoing_events)
549
  {
981
  $fields .= '</div>';
982
  }
983
 
984
+ $fields .= $this->sf_search_field($field, $options, $this->sf_display_label);
985
  }
986
 
987
  $fields = apply_filters('mec_filter_fields_search_form', $fields, $this);
988
 
989
  $form = '';
990
+ if(trim($fields) && (in_array('dropdown', $display_form) || in_array('checkboxes', $display_form) || in_array('text_input', $display_form) || in_array('address_input', $display_form) || in_array('minmax', $display_form) || in_array('local-time-picker', $display_form))) $form .= '<div id="mec_search_form_'.$this->id.'" class="mec-search-form mec-totalcal-box">'.$fields.'</div>';
991
 
992
  return $form;
993
  }
999
  * @param array $options
1000
  * @return string
1001
  */
1002
+ public function sf_search_field($field, $options , $display_label = null)
1003
  {
1004
  $type = isset($options['type']) ? $options['type'] : '';
1005
 
1016
  $output = '';
1017
  if($field == 'category')
1018
  {
1019
+ $label = $this->main->m('taxonomy_category', __('Category', 'modern-events-calendar-lite'));
1020
+
1021
  if($type == 'dropdown')
1022
  {
1023
+ $output .='<div class="mec-dropdown-search">';
1024
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1025
+
1026
+ $output .='<i class="mec-sl-folder"></i>';
1027
 
1028
  $output .= wp_dropdown_categories(array
1029
  (
1033
  'include'=>((isset($this->atts['category']) and trim($this->atts['category'])) ? $this->atts['category'] : ''),
1034
  'id'=>'mec_sf_category_'.$this->id,
1035
  'hierarchical'=>true,
1036
+ 'show_option_none'=>$label,
1037
  'option_none_value'=>'',
1038
  'selected'=>(isset($this->atts['category']) ? $this->atts['category'] : ''),
1039
  'orderby'=>'name',
1045
  }
1046
  elseif($type == 'checkboxes' and wp_count_terms(array('taxonomy' => 'mec_category')))
1047
  {
1048
+ $output .= '<div class="mec-checkboxes-search">';
1049
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1050
+ $output .='<i class="mec-sl-folder"></i>';
1051
 
1052
  $selected = ((isset($this->atts['category']) and trim($this->atts['category'])) ? explode(',', trim($this->atts['category'], ', ')) : array());
1053
 
1072
  }
1073
  elseif($field == 'location')
1074
  {
1075
+ $label = $this->main->m('taxonomy_location', __('Location', 'modern-events-calendar-lite'));
1076
+
1077
  if($type == 'dropdown')
1078
  {
1079
+ $output .= '<div class="mec-dropdown-search">';
1080
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1081
+
1082
+ $output .= '<i class="mec-sl-location-pin"></i>';
1083
 
1084
  $output .= wp_dropdown_categories(array
1085
  (
1089
  'include'=>((isset($this->atts['location']) and trim($this->atts['location'])) ? $this->atts['location'] : ''),
1090
  'id'=>'mec_sf_location_'.$this->id,
1091
  'hierarchical'=>true,
1092
+ 'show_option_none'=>$label,
1093
  'option_none_value'=>'',
1094
  'selected'=>(isset($this->atts['location']) ? $this->atts['location'] : ''),
1095
  'orderby'=>'name',
1102
  }
1103
  elseif($field == 'organizer')
1104
  {
1105
+ $label = $this->main->m('taxonomy_organizer', __('Organizer', 'modern-events-calendar-lite'));
1106
+
1107
  if($type == 'dropdown')
1108
  {
1109
+ $output .= '<div class="mec-dropdown-search">';
1110
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1111
+ $output .= '<i class="mec-sl-user"></i>';
1112
 
1113
  $output .= wp_dropdown_categories(array
1114
  (
1118
  'include'=>((isset($this->atts['organizer']) and trim($this->atts['organizer'])) ? $this->atts['organizer'] : ''),
1119
  'id'=>'mec_sf_organizer_'.$this->id,
1120
  'hierarchical'=>true,
1121
+ 'show_option_none'=>$label,
1122
  'option_none_value'=>'',
1123
  'selected'=>(isset($this->atts['organizer']) ? $this->atts['organizer'] : ''),
1124
  'orderby'=>'name',
1131
  }
1132
  elseif($field == 'speaker' and $speakers_status)
1133
  {
1134
+ $label = $this->main->m('taxonomy_speaker', __('Speaker', 'modern-events-calendar-lite'));
1135
+
1136
  if($type == 'dropdown')
1137
  {
1138
+ $output .= '<div class="mec-dropdown-search">';
1139
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1140
+ $output .= '<i class="mec-sl-microphone"></i>';
1141
 
1142
  $output .= wp_dropdown_categories(array
1143
  (
1147
  'include'=>((isset($this->atts['speaker']) and trim($this->atts['speaker'])) ? $this->atts['speaker'] : ''),
1148
  'id'=>'mec_sf_speaker_'.$this->id,
1149
  'hierarchical'=>true,
1150
+ 'show_option_none'=>$label,
1151
  'option_none_value'=>'',
1152
  'selected'=>(isset($this->atts['speaker']) ? $this->atts['speaker'] : ''),
1153
  'orderby'=>'name',
1160
  }
1161
  elseif($field == 'tag')
1162
  {
1163
+ $label = $this->main->m('taxonomy_tag', __('Tag', 'modern-events-calendar-lite'));
1164
+
1165
  if($type == 'dropdown')
1166
  {
1167
+ $output .= '<div class="mec-dropdown-search">';
1168
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1169
+ $output .= '<i class="mec-sl-tag"></i>';
1170
 
1171
  $output .= wp_dropdown_categories(array
1172
  (
1176
  'include'=>((isset($this->atts['tag']) and trim($this->atts['tag'])) ? $this->atts['tag'] : ''),
1177
  'id'=>'mec_sf_tag_'.$this->id,
1178
  'hierarchical'=>true,
1179
+ 'show_option_none'=>$label,
1180
  'option_none_value'=>'',
1181
  'selected'=>(isset($this->atts['tag']) ? $this->atts['tag'] : ''),
1182
  'orderby'=>'name',
1189
  }
1190
  elseif($field == 'label')
1191
  {
1192
+ $label = $this->main->m('taxonomy_label', __('Label', 'modern-events-calendar-lite'));
1193
+
1194
  if($type == 'dropdown')
1195
  {
1196
+ $output .= '<div class="mec-dropdown-search">';
1197
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1198
+ $output .= '<i class="mec-sl-pin"></i>';
1199
 
1200
  $output .= wp_dropdown_categories(array
1201
  (
1205
  'include'=>((isset($this->atts['label']) and trim($this->atts['label'])) ? $this->atts['label'] : ''),
1206
  'id'=>'mec_sf_label_'.$this->id,
1207
  'hierarchical'=>true,
1208
+ 'show_option_none'=>$label,
1209
  'option_none_value'=>'',
1210
  'selected'=>(isset($this->atts['label']) ? $this->atts['label'] : ''),
1211
  'orderby'=>'name',
1218
  }
1219
  elseif($field == 'month_filter')
1220
  {
1221
+ $label = __('Date', 'modern-events-calendar-lite');
1222
  if($type == 'dropdown')
1223
  {
1224
  $time = isset($this->start_date) ? strtotime($this->start_date) : '';
1230
  $item = __('Select', 'modern-events-calendar-lite');
1231
  $option = in_array($this->skin, $skins) ? '<option class="mec-none-item" value="none" selected="selected">'.$item.'</option>' : '';
1232
 
1233
+ $output .= '<div class="mec-date-search"><input type="hidden" id="mec-filter-none" value="'.$item.'">';
1234
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1235
+ $output .= '<i class="mec-sl-calendar"></i>
1236
  <select id="mec_sf_month_'.$this->id.'">';
1237
 
1238
  $output .= $option;
1277
  {
1278
  $min_date = (isset($this->start_date) ? $this->start_date : NULL);
1279
 
1280
+ $output .= '<div class="mec-date-search">';
1281
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1282
+ $output .= '<i class="mec-sl-calendar"></i>
1283
  <input class="mec-col-3 mec_date_picker_dynamic_format_start" data-min="'.$min_date.'" type="text"
1284
  id="mec_sf_date_start_'.$this->id.'"
1285
  placeholder="'.esc_attr__('Start', 'modern-events-calendar-lite').'" autocomplete="off">
1291
  }
1292
  elseif($field == 'time_filter')
1293
  {
1294
+ $label = __('Time', 'modern-events-calendar-lite');
1295
  if($type == 'local-time-picker')
1296
  {
1297
  $this->main->load_time_picker_assets();
1298
 
1299
+ $output .= '<div class="mec-time-picker-search">';
1300
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1301
+ $output .= '<i class="mec-sl-clock"></i>
1302
  <input type="text" class="mec-timepicker-start" id="mec_sf_timepicker_start_'.$this->id.'" placeholder="'.__('Start Time', 'modern-events-calendar-lite').'" data-format="'.$this->main->get_hour_format().'" />
1303
  <input type="text" class="mec-timepicker-end" id="mec_sf_timepicker_end_'.$this->id.'" placeholder="'.__('End Time', 'modern-events-calendar-lite').'" data-format="'.$this->main->get_hour_format().'" />
1304
  </div>';
1306
  }
1307
  elseif($field == 'text_search')
1308
  {
1309
+ $label = __('Text', 'modern-events-calendar-lite');
1310
  if($type == 'text_input')
1311
  {
1312
+ $output .= '<div class="mec-text-input-search">';
1313
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1314
+ $output .= '<i class="mec-sl-magnifier"></i>
1315
  <input type="search" value="'.(isset($this->atts['s']) ? $this->atts['s'] : '').'" id="mec_sf_s_'.$this->id.'" />
1316
  </div>';
1317
  }
1318
  }
1319
  elseif($field == 'address_search')
1320
  {
1321
+ $label = __('Address', 'modern-events-calendar-lite');
1322
  if($type == 'address_input')
1323
  {
1324
+ $output .= '<div class="mec-text-address-search">';
1325
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1326
+ $output .= '<i class="mec-sl-map"></i>
1327
  <input type="search" value="'.(isset($this->atts['address']) ? $this->atts['address'] : '').'" id="mec_sf_address_s_'.$this->id.'" />
1328
  </div>';
1329
  }
1330
  }
1331
  elseif($field == 'event_cost')
1332
  {
1333
+ $label = __('Cost', 'modern-events-calendar-lite');
1334
  if($type == 'minmax')
1335
  {
1336
+ $output .= '<div class="mec-minmax-event-cost">';
1337
+ $display_label == 1 ? $output .='<label for="mec_sf_category_'.$this->id.'">'.$label.': </label>' : null;
1338
+ $output .= '<i class="mec-sl-credit-card"></i>
1339
  <input type="number" min="0" step="0.01" value="'.(isset($this->atts['event-cost-min']) ? $this->atts['event-cost-min'] : '').'" id="mec_sf_event_cost_min_'.$this->id.'" class="mec-minmax-price" placeholder="'.esc_attr__('Min Price', 'modern-events-calendar-lite').'" />
1340
  <input type="number" min="0" step="0.01" value="'.(isset($this->atts['event-cost-max']) ? $this->atts['event-cost-max'] : '').'" id="mec_sf_event_cost_max_'.$this->id.'" class="mec-minmax-price" placeholder="'.esc_attr__('Max Price', 'modern-events-calendar-lite').'" />
1341
  </div>';
app/modules/local-time/type1.php CHANGED
@@ -2,6 +2,8 @@
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
 
 
5
  // MEC Settings
6
  $settings = $this->get_settings();
7
 
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
5
+ /** @var MEC_main $this */
6
+
7
  // MEC Settings
8
  $settings = $this->get_settings();
9
 
app/modules/local-time/type2.php CHANGED
@@ -2,6 +2,8 @@
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
 
 
5
  // MEC Settings
6
  $settings = $this->get_settings();
7
 
@@ -34,7 +36,7 @@ if(empty($MEC_Events_dates_localtime)) $MEC_Events_dates_localtime = $MEC_Events
34
  $dates = array();
35
  if(is_array($MEC_Events_dates_localtime[$event_id]))
36
  {
37
- $k = array_key_first($MEC_Events_dates_localtime[$event_id]);
38
 
39
  $dates = (isset($MEC_Events_dates_localtime[$event_id][$k]) ? $MEC_Events_dates_localtime[$event_id][$k] : NULL);
40
  unset($MEC_Events_dates_localtime[$event_id][$k]);
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
5
+ /** @var MEC_main $this */
6
+
7
  // MEC Settings
8
  $settings = $this->get_settings();
9
 
36
  $dates = array();
37
  if(is_array($MEC_Events_dates_localtime[$event_id]))
38
  {
39
+ $k = $this->array_key_first($MEC_Events_dates_localtime[$event_id]);
40
 
41
  $dates = (isset($MEC_Events_dates_localtime[$event_id][$k]) ? $MEC_Events_dates_localtime[$event_id][$k] : NULL);
42
  unset($MEC_Events_dates_localtime[$event_id][$k]);
app/modules/local-time/type3.php CHANGED
@@ -2,6 +2,8 @@
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
 
 
5
  // MEC Settings
6
  $settings = $this->get_settings();
7
 
2
  /** no direct access **/
3
  defined('MECEXEC') or die();
4
 
5
+ /** @var MEC_main $this */
6
+
7
  // MEC Settings
8
  $settings = $this->get_settings();
9
 
app/skins/agenda.php CHANGED
@@ -59,6 +59,7 @@ class MEC_skin_agenda extends MEC_skins
59
 
60
  // Search Form Status
61
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
62
 
63
  // Generate an ID for the sking
64
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
59
 
60
  // Search Form Status
61
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
62
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
63
 
64
  // Generate an ID for the sking
65
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/custom.php CHANGED
@@ -55,6 +55,7 @@ class MEC_skin_custom extends MEC_skins
55
 
56
  // Search Form Status
57
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
58
 
59
  // Generate an ID for the sking
60
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
55
 
56
  // Search Form Status
57
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
58
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
59
 
60
  // Generate an ID for the sking
61
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/daily_view.php CHANGED
@@ -49,6 +49,7 @@ class MEC_skin_daily_view extends MEC_skins
49
 
50
  // Search Form Status
51
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
52
 
53
  // Generate an ID for the skin
54
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
49
 
50
  // Search Form Status
51
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
52
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
53
 
54
  // Generate an ID for the skin
55
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/default_full_calendar.php CHANGED
@@ -57,6 +57,7 @@ class MEC_skin_default_full_calendar extends MEC_skins
57
 
58
  // Search Form Status
59
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
60
 
61
  // Show Only Expired Events
62
  $this->show_only_expired_events = (isset($this->atts['show_only_past_events']) and trim($this->atts['show_only_past_events'])) ? '1' : '0';
57
 
58
  // Search Form Status
59
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
60
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
61
 
62
  // Show Only Expired Events
63
  $this->show_only_expired_events = (isset($this->atts['show_only_past_events']) and trim($this->atts['show_only_past_events'])) ? '1' : '0';
app/skins/default_full_calendar/tpl.php CHANGED
@@ -59,12 +59,12 @@ do_action('mec_full_skin_head');
59
  <div id="mec_search_form_<?php echo $this->id; ?>">
60
  <?php if($sf_month_filter_status): $sf_columns -= 3; ?>
61
  <div class="col-md-3">
62
- <?php echo $this->sf_search_field('month_filter', $sf_month_filter); ?>
63
  </div>
64
  <?php endif; ?>
65
  <div class="col-md-<?php echo $sf_columns; ?>">
66
  <?php if($sf_text_search_status): ?>
67
- <?php echo $this->sf_search_field('text_search', $sf_text_search); ?>
68
  <?php endif; ?>
69
  </div>
70
  <?php endif; ?>
59
  <div id="mec_search_form_<?php echo $this->id; ?>">
60
  <?php if($sf_month_filter_status): $sf_columns -= 3; ?>
61
  <div class="col-md-3">
62
+ <?php echo $this->sf_search_field('month_filter', $sf_month_filter , 0); ?>
63
  </div>
64
  <?php endif; ?>
65
  <div class="col-md-<?php echo $sf_columns; ?>">
66
  <?php if($sf_text_search_status): ?>
67
+ <?php echo $this->sf_search_field('text_search', $sf_text_search , 0); ?>
68
  <?php endif; ?>
69
  </div>
70
  <?php endif; ?>
app/skins/full_calendar.php CHANGED
@@ -65,6 +65,7 @@ class MEC_skin_full_calendar extends MEC_skins
65
 
66
  // Search Form Status
67
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
68
 
69
  // Show Only Expired Events
70
  $this->show_only_expired_events = (isset($this->atts['show_only_past_events']) and trim($this->atts['show_only_past_events'])) ? '1' : '0';
65
 
66
  // Search Form Status
67
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
68
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
69
 
70
  // Show Only Expired Events
71
  $this->show_only_expired_events = (isset($this->atts['show_only_past_events']) and trim($this->atts['show_only_past_events'])) ? '1' : '0';
app/skins/full_calendar/tpl.php CHANGED
@@ -81,41 +81,41 @@ do_action('mec_full_skin_head');
81
  ?>
82
  <div id="mec_search_form_<?php echo $this->id; ?>" <?php echo $wrapper_class; ?>>
83
  <?php if($sf_category_status): ?>
84
- <?php echo $this->sf_search_field('category', $sf_category); ?>
85
  <?php endif; ?>
86
  <?php if($sf_location_status): ?>
87
- <?php echo $this->sf_search_field('location', $sf_location); ?>
88
  <?php endif; ?>
89
  <?php if($sf_organizer_status): ?>
90
- <?php echo $this->sf_search_field('organizer', $sf_organizer); ?>
91
  <?php endif; ?>
92
  <?php if($sf_speaker_status and $speakers_status): ?>
93
- <?php echo $this->sf_search_field('speaker', $sf_speaker); ?>
94
  <?php endif; ?>
95
  <?php if($sf_tag_status): ?>
96
- <?php echo $this->sf_search_field('tag', $sf_tag); ?>
97
  <?php endif; ?>
98
  <?php if($sf_label_status): ?>
99
- <?php echo $this->sf_search_field('label', $sf_label); ?>
100
  <?php endif; ?>
101
  </div>
102
  <div id="mec_search_form_<?php echo $this->id; ?>">
103
  <?php if($sf_address_search_status): ?>
104
- <?php echo $this->sf_search_field('address_search', $sf_address_search); ?>
105
  <?php endif; ?>
106
  <?php if($sf_event_cost_status): $sf_columns -= 3; ?>
107
- <?php echo $this->sf_search_field('event_cost', $sf_event_cost); ?>
108
  <?php endif; ?>
109
  </div>
110
  <div id="mec_search_form_<?php echo $this->id; ?>" class="mec-full-calendar-search-ends">
111
  <?php if($sf_text_search_status): ?>
112
- <?php echo $this->sf_search_field('text_search', $sf_text_search); ?>
113
  <?php endif; ?>
114
  <?php if($sf_month_filter_status): $sf_columns -= 3; ?>
115
- <?php echo $this->sf_search_field('month_filter', $sf_month_filter); ?>
116
  <?php endif; ?>
117
  <?php if($sf_local_time_status): $sf_columns -= 3; ?>
118
- <?php echo $this->sf_search_field('time_filter', $sf_local_time); ?>
119
  <?php endif; ?>
120
  <div class="col-md-12 mec-tab-loader">
121
  <div class="mec-totalcal-view">
81
  ?>
82
  <div id="mec_search_form_<?php echo $this->id; ?>" <?php echo $wrapper_class; ?>>
83
  <?php if($sf_category_status): ?>
84
+ <?php echo $this->sf_search_field('category', $sf_category , $this->sf_display_label); ?>
85
  <?php endif; ?>
86
  <?php if($sf_location_status): ?>
87
+ <?php echo $this->sf_search_field('location', $sf_location , $this->sf_display_label); ?>
88
  <?php endif; ?>
89
  <?php if($sf_organizer_status): ?>
90
+ <?php echo $this->sf_search_field('organizer', $sf_organizer , $this->sf_display_label); ?>
91
  <?php endif; ?>
92
  <?php if($sf_speaker_status and $speakers_status): ?>
93
+ <?php echo $this->sf_search_field('speaker', $sf_speaker , $this->sf_display_label); ?>
94
  <?php endif; ?>
95
  <?php if($sf_tag_status): ?>
96
+ <?php echo $this->sf_search_field('tag', $sf_tag , $this->sf_display_label); ?>
97
  <?php endif; ?>
98
  <?php if($sf_label_status): ?>
99
+ <?php echo $this->sf_search_field('label', $sf_label , $this->sf_display_label); ?>
100
  <?php endif; ?>
101
  </div>
102
  <div id="mec_search_form_<?php echo $this->id; ?>">
103
  <?php if($sf_address_search_status): ?>
104
+ <?php echo $this->sf_search_field('address_search', $sf_address_search , $this->sf_display_label); ?>
105
  <?php endif; ?>
106
  <?php if($sf_event_cost_status): $sf_columns -= 3; ?>
107
+ <?php echo $this->sf_search_field('event_cost', $sf_event_cost , $this->sf_display_label); ?>
108
  <?php endif; ?>
109
  </div>
110
  <div id="mec_search_form_<?php echo $this->id; ?>" class="mec-full-calendar-search-ends">
111
  <?php if($sf_text_search_status): ?>
112
+ <?php echo $this->sf_search_field('text_search', $sf_text_search , $this->sf_display_label); ?>
113
  <?php endif; ?>
114
  <?php if($sf_month_filter_status): $sf_columns -= 3; ?>
115
+ <?php echo $this->sf_search_field('month_filter', $sf_month_filter , $this->sf_display_label); ?>
116
  <?php endif; ?>
117
  <?php if($sf_local_time_status): $sf_columns -= 3; ?>
118
+ <?php echo $this->sf_search_field('time_filter', $sf_local_time , $this->sf_display_label); ?>
119
  <?php endif; ?>
120
  <div class="col-md-12 mec-tab-loader">
121
  <div class="mec-totalcal-view">
app/skins/grid.php CHANGED
@@ -105,6 +105,7 @@ class MEC_skin_grid extends MEC_skins
105
 
106
  // Search Form Status
107
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
108
 
109
  // Generate an ID for the sking
110
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
105
 
106
  // Search Form Status
107
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
108
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
109
 
110
  // Generate an ID for the sking
111
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/list.php CHANGED
@@ -92,6 +92,7 @@ class MEC_skin_list extends MEC_skins
92
 
93
  // Search Form Status
94
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
95
 
96
  // Generate an ID for the sking
97
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
92
 
93
  // Search Form Status
94
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
95
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
96
 
97
  // Generate an ID for the sking
98
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/map.php CHANGED
@@ -50,6 +50,7 @@ class MEC_skin_map extends MEC_skins
50
 
51
  // Search Form Status
52
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
53
 
54
  // Generate an ID for the sking
55
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
50
 
51
  // Search Form Status
52
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
53
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
54
 
55
  // Generate an ID for the sking
56
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/masonry.php CHANGED
@@ -61,6 +61,7 @@ class MEC_skin_masonry extends MEC_skins
61
 
62
  // Search Form Status
63
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
64
 
65
  // Generate an ID for the sking
66
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
61
 
62
  // Search Form Status
63
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
64
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
65
 
66
  // Generate an ID for the sking
67
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/monthly_view.php CHANGED
@@ -12,6 +12,7 @@ class MEC_skin_monthly_view extends MEC_skins
12
  * @var string
13
  */
14
  public $skin = 'monthly_view';
 
15
 
16
  /**
17
  * Constructor method
@@ -49,6 +50,7 @@ class MEC_skin_monthly_view extends MEC_skins
49
 
50
  // Search Form Status
51
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
52
 
53
  // The events
54
  $this->events_str = '';
@@ -148,6 +150,9 @@ class MEC_skin_monthly_view extends MEC_skins
148
 
149
  // We will extend the end date in the loop
150
  $this->end_date = $this->start_date;
 
 
 
151
  }
152
 
153
  /**
@@ -211,6 +216,12 @@ class MEC_skin_monthly_view extends MEC_skins
211
  {
212
  if(!isset($events[$date])) $events[$date] = array();
213
 
 
 
 
 
 
 
214
  // Day Events
215
  $d = array();
216
 
12
  * @var string
13
  */
14
  public $skin = 'monthly_view';
15
+ public $activate_first_date = false;
16
 
17
  /**
18
  * Constructor method
50
 
51
  // Search Form Status
52
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
53
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
54
 
55
  // The events
56
  $this->events_str = '';
150
 
151
  // We will extend the end date in the loop
152
  $this->end_date = $this->start_date;
153
+
154
+ // Activate First Date With Event
155
+ $this->activate_first_date = (isset($this->skin_options['activate_first_date']) and $this->skin_options['activate_first_date']);
156
  }
157
 
158
  /**
216
  {
217
  if(!isset($events[$date])) $events[$date] = array();
218
 
219
+ if($this->activate_first_date and $this->active_day and strtotime($date) >= current_time('timestamp', 0))
220
+ {
221
+ $this->active_day = $date;
222
+ $this->activate_first_date = false;
223
+ }
224
+
225
  // Day Events
226
  $d = array();
227
 
app/skins/single.php CHANGED
@@ -56,6 +56,7 @@ class MEC_skin_single extends MEC_skins
56
 
57
  // Search Form Status
58
  $this->sf_status = false;
 
59
 
60
  // HTML class
61
  $this->html_class = '';
@@ -554,7 +555,7 @@ class MEC_skin_single extends MEC_skins
554
  if(trim($referer_url))
555
  {
556
  $referer_page_id = url_to_postid($referer_url);
557
- if($referer_page_id)
558
  {
559
  $archive_link = $referer_url;
560
  $archive_title = get_the_title($referer_page_id);
@@ -712,7 +713,7 @@ class MEC_skin_single extends MEC_skins
712
  {
713
  if(get_post_type($event_ID) != $this->main->get_main_post_type()) return false;
714
 
715
- /// Original Event ID for Multilingual Websites
716
  $original_event_id = $this->main->get_original_event($event_ID);
717
 
718
  // MEC Settings
56
 
57
  // Search Form Status
58
  $this->sf_status = false;
59
+ $this->sf_display_label = false;
60
 
61
  // HTML class
62
  $this->html_class = '';
555
  if(trim($referer_url))
556
  {
557
  $referer_page_id = url_to_postid($referer_url);
558
+ if($referer_page_id and strpos(get_post_field('post_content', $referer_page_id), '[MEC') !== false)
559
  {
560
  $archive_link = $referer_url;
561
  $archive_title = get_the_title($referer_page_id);
713
  {
714
  if(get_post_type($event_ID) != $this->main->get_main_post_type()) return false;
715
 
716
+ // Original Event ID for Multilingual Websites
717
  $original_event_id = $this->main->get_original_event($event_ID);
718
 
719
  // MEC Settings
app/skins/single/default.php CHANGED
@@ -195,6 +195,7 @@ $bookings_limit_for_users = isset($booking_options['bookings_limit_for_users'])
195
  ?>
196
 
197
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
 
198
 
199
  <?php
200
  // More Info
@@ -466,6 +467,7 @@ $bookings_limit_for_users = isset($booking_options['bookings_limit_for_users'])
466
  ?>
467
 
468
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
 
469
 
470
  <?php
471
  // Event Location
195
  ?>
196
 
197
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
198
+ <?php do_action('mec_single_zoom_badge', $event->data ); ?>
199
 
200
  <?php
201
  // More Info
467
  ?>
468
 
469
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
470
+ <?php do_action('mec_single_zoom_badge', $event->data ); ?>
471
 
472
  <?php
473
  // Event Location
app/skins/single/m1.php CHANGED
@@ -29,7 +29,7 @@ if(!is_array($booking_options)) $booking_options = array();
29
  <?php echo $this->main->holding_status($event); ?>
30
  </div>
31
 
32
- <?php
33
  if(isset($event->data->meta['mec_hide_time']) and $event->data->meta['mec_hide_time'] == '0')
34
  {
35
  $time_comment = isset($event->data->meta['mec_comment']) ? $event->data->meta['mec_comment'] : '';
@@ -74,7 +74,7 @@ if(!is_array($booking_options)) $booking_options = array();
74
  <div class="mec-single-event-label">
75
  <i class="mec-fa-bookmark-o"></i>
76
  <h3 class="mec-cost"><?php echo $this->main->m('taxonomy_labels', __('Labels', 'modern-events-calendar-lite')); ?></h3>
77
- <?php foreach($event->data->labels as $labels=>$label) :
78
  $seperator = (++$mec_i === $mec_items ) ? '' : ',';
79
  echo '<dd style=color:"' . $label['color'] . '">' . $label["name"] . $seperator . '</dd>';
80
  endforeach; ?>
@@ -87,7 +87,7 @@ if(!is_array($booking_options)) $booking_options = array();
87
  <div class="mec-events-event-image"><?php echo $event->data->thumbnails['full']; ?></div>
88
 
89
  <div class="col-md-4">
90
-
91
  <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (!trim($event->data->meta['mec_more_info']) or (trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
92
  <?php
93
  // Event Organizer
@@ -112,7 +112,7 @@ if(!is_array($booking_options)) $booking_options = array();
112
  <h6><?php _e('Phone', 'modern-events-calendar-lite'); ?></h6>
113
  <a href="tel:<?php echo $organizer['tel']; ?>"><?php echo $organizer['tel']; ?></a>
114
  </dd>
115
- <?php endif;
116
  if(isset($organizer['email']) && !empty($organizer['email'])): ?>
117
  <dd class="mec-organizer-email">
118
  <i class="mec-sl-envelope"></i>
@@ -148,17 +148,18 @@ if(!is_array($booking_options)) $booking_options = array();
148
 
149
  <!-- Weather Module -->
150
  <?php echo $this->main->module('weather.details', array('event'=>$event)); ?>
151
-
152
  <!-- QRCode Module -->
153
  <?php echo $this->main->module('qrcode.details', array('event'=>$event)); ?>
154
 
155
  <!-- Local Time Module -->
156
  <?php echo $this->main->module('local-time.details', array('event'=>$event)); ?>
157
-
158
  <div class="mec-event-meta mec-color-before mec-frontbox">
159
 
160
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
161
-
 
162
  <?php
163
  // Event Location
164
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]))
@@ -211,7 +212,7 @@ if(!is_array($booking_options)) $booking_options = array();
211
  </div>
212
  <?php
213
  }
214
- ?>
215
  <?php
216
  // More Info
217
  if(isset($event->data->meta['mec_more_info']) and trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] != 'http://')
@@ -225,11 +226,11 @@ if(!is_array($booking_options)) $booking_options = array();
225
  <?php
226
  }
227
  ?>
228
-
229
  </div>
230
 
231
  <?php
232
-
233
  if(!empty($this->main->module('speakers.details', array('event'=>$event)))) {
234
  ?>
235
  <div class="mec-color-before mec-frontbox">
@@ -241,9 +242,9 @@ if(!is_array($booking_options)) $booking_options = array();
241
 
242
  <!-- Attendees List Module -->
243
  <?php echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
244
-
245
  <!-- Next Previous Module -->
246
- <?php echo $this->main->module('next-event.details', array('event'=>$event)); ?>
247
  </div>
248
 
249
  <div class="col-md-8">
@@ -264,7 +265,7 @@ if(!is_array($booking_options)) $booking_options = array();
264
  <div class="mec-events-meta-group mec-events-meta-group-gmap">
265
  <?php echo $this->main->module('googlemap.details', array('event'=>$this->events)); ?>
266
  </div>
267
-
268
  <!-- Export Module -->
269
  <?php echo $this->main->module('export.details', array('event'=>$event)); ?>
270
 
@@ -272,7 +273,7 @@ if(!is_array($booking_options)) $booking_options = array();
272
  <?php if($this->main->can_show_countdown_module($event)): ?>
273
  <div class="mec-events-meta-group mec-events-meta-group-countdown">
274
  <?php echo $this->main->module('countdown.details', array('event'=>$this->events)); ?>
275
- </div>
276
  <?php endif; ?>
277
 
278
  <!-- Hourly Schedule -->
@@ -289,7 +290,7 @@ if(!is_array($booking_options)) $booking_options = array();
289
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
290
  echo do_shortcode('[MEC_login]');
291
  } else {
292
- echo $this->main->module('booking.default', array('event'=>$this->events));
293
  }
294
  ?>
295
  </div>
29
  <?php echo $this->main->holding_status($event); ?>
30
  </div>
31
 
32
+ <?php
33
  if(isset($event->data->meta['mec_hide_time']) and $event->data->meta['mec_hide_time'] == '0')
34
  {
35
  $time_comment = isset($event->data->meta['mec_comment']) ? $event->data->meta['mec_comment'] : '';
74
  <div class="mec-single-event-label">
75
  <i class="mec-fa-bookmark-o"></i>
76
  <h3 class="mec-cost"><?php echo $this->main->m('taxonomy_labels', __('Labels', 'modern-events-calendar-lite')); ?></h3>
77
+ <?php foreach($event->data->labels as $labels=>$label) :
78
  $seperator = (++$mec_i === $mec_items ) ? '' : ',';
79
  echo '<dd style=color:"' . $label['color'] . '">' . $label["name"] . $seperator . '</dd>';
80
  endforeach; ?>
87
  <div class="mec-events-event-image"><?php echo $event->data->thumbnails['full']; ?></div>
88
 
89
  <div class="col-md-4">
90
+
91
  <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (!trim($event->data->meta['mec_more_info']) or (trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
92
  <?php
93
  // Event Organizer
112
  <h6><?php _e('Phone', 'modern-events-calendar-lite'); ?></h6>
113
  <a href="tel:<?php echo $organizer['tel']; ?>"><?php echo $organizer['tel']; ?></a>
114
  </dd>
115
+ <?php endif;
116
  if(isset($organizer['email']) && !empty($organizer['email'])): ?>
117
  <dd class="mec-organizer-email">
118
  <i class="mec-sl-envelope"></i>
148
 
149
  <!-- Weather Module -->
150
  <?php echo $this->main->module('weather.details', array('event'=>$event)); ?>
151
+
152
  <!-- QRCode Module -->
153
  <?php echo $this->main->module('qrcode.details', array('event'=>$event)); ?>
154
 
155
  <!-- Local Time Module -->
156
  <?php echo $this->main->module('local-time.details', array('event'=>$event)); ?>
157
+
158
  <div class="mec-event-meta mec-color-before mec-frontbox">
159
 
160
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
161
+ <?php do_action('mec_single_zoom_badge', $event->data ); ?>
162
+
163
  <?php
164
  // Event Location
165
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]))
212
  </div>
213
  <?php
214
  }
215
+ ?>
216
  <?php
217
  // More Info
218
  if(isset($event->data->meta['mec_more_info']) and trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] != 'http://')
226
  <?php
227
  }
228
  ?>
229
+
230
  </div>
231
 
232
  <?php
233
+
234
  if(!empty($this->main->module('speakers.details', array('event'=>$event)))) {
235
  ?>
236
  <div class="mec-color-before mec-frontbox">
242
 
243
  <!-- Attendees List Module -->
244
  <?php echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
245
+
246
  <!-- Next Previous Module -->
247
+ <?php echo $this->main->module('next-event.details', array('event'=>$event)); ?>
248
  </div>
249
 
250
  <div class="col-md-8">
265
  <div class="mec-events-meta-group mec-events-meta-group-gmap">
266
  <?php echo $this->main->module('googlemap.details', array('event'=>$this->events)); ?>
267
  </div>
268
+
269
  <!-- Export Module -->
270
  <?php echo $this->main->module('export.details', array('event'=>$event)); ?>
271
 
273
  <?php if($this->main->can_show_countdown_module($event)): ?>
274
  <div class="mec-events-meta-group mec-events-meta-group-countdown">
275
  <?php echo $this->main->module('countdown.details', array('event'=>$this->events)); ?>
276
+ </div>
277
  <?php endif; ?>
278
 
279
  <!-- Hourly Schedule -->
290
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
291
  echo do_shortcode('[MEC_login]');
292
  } else {
293
+ echo $this->main->module('booking.default', array('event'=>$this->events));
294
  }
295
  ?>
296
  </div>
app/skins/single/m2.php CHANGED
@@ -10,7 +10,7 @@ if(!is_array($booking_options)) $booking_options = array();
10
  <div class="mec-events-event-image"><?php echo $event->data->thumbnails['full']; ?></div>
11
 
12
  <div class="col-md-4">
13
-
14
  <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (!trim($event->data->meta['mec_more_info']) or (trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
15
  <?php
16
  // Event Organizer
@@ -77,11 +77,12 @@ if(!is_array($booking_options)) $booking_options = array();
77
 
78
  <!-- Local Time Module -->
79
  <?php echo $this->main->module('local-time.details', array('event'=>$event)); ?>
80
-
81
  <div class="mec-event-meta mec-color-before mec-frontbox">
82
 
83
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
84
-
 
85
  <?php
86
  // Event Location
87
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]))
@@ -135,7 +136,7 @@ if(!is_array($booking_options)) $booking_options = array();
135
  <?php
136
  }
137
  ?>
138
-
139
  <?php
140
  // More Info
141
  if(isset($event->data->meta['mec_more_info']) and trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] != 'http://')
@@ -149,12 +150,12 @@ if(!is_array($booking_options)) $booking_options = array();
149
  <?php
150
  }
151
  ?>
152
-
153
  </div>
154
 
155
  <!-- Speaker List Module -->
156
  <?php
157
-
158
  if(!empty($this->main->module('speakers.details', array('event'=>$event)))) {
159
  ?>
160
  <div class="mec-color-before mec-frontbox">
@@ -163,12 +164,12 @@ if(!is_array($booking_options)) $booking_options = array();
163
  <?php
164
  }
165
  ?>
166
-
167
  <!-- Attendees List Module -->
168
  <?php echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
169
-
170
  <!-- Next Previous Module -->
171
- <?php echo $this->main->module('next-event.details', array('event'=>$event)); ?>
172
  </div>
173
 
174
  <div class="col-md-8">
@@ -210,7 +211,7 @@ if(!is_array($booking_options)) $booking_options = array();
210
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
211
  echo do_shortcode('[MEC_login]');
212
  } else {
213
- echo $this->main->module('booking.default', array('event'=>$this->events, 'uniqueid'=>$this->uniqueid));
214
  }
215
  ?>
216
  </div>
10
  <div class="mec-events-event-image"><?php echo $event->data->thumbnails['full']; ?></div>
11
 
12
  <div class="col-md-4">
13
+
14
  <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (!trim($event->data->meta['mec_more_info']) or (trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
15
  <?php
16
  // Event Organizer
77
 
78
  <!-- Local Time Module -->
79
  <?php echo $this->main->module('local-time.details', array('event'=>$event)); ?>
80
+
81
  <div class="mec-event-meta mec-color-before mec-frontbox">
82
 
83
  <?php do_action('mec_single_virtual_badge', $event->data ); ?>
84
+ <?php do_action('mec_single_zoom_badge', $event->data ); ?>
85
+
86
  <?php
87
  // Event Location
88
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]))
136
  <?php
137
  }
138
  ?>
139
+
140
  <?php
141
  // More Info
142
  if(isset($event->data->meta['mec_more_info']) and trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] != 'http://')
150
  <?php
151
  }
152
  ?>
153
+
154
  </div>
155
 
156
  <!-- Speaker List Module -->
157
  <?php
158
+
159
  if(!empty($this->main->module('speakers.details', array('event'=>$event)))) {
160
  ?>
161
  <div class="mec-color-before mec-frontbox">
164
  <?php
165
  }
166
  ?>
167
+
168
  <!-- Attendees List Module -->
169
  <?php echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
170
+
171
  <!-- Next Previous Module -->
172
+ <?php echo $this->main->module('next-event.details', array('event'=>$event)); ?>
173
  </div>
174
 
175
  <div class="col-md-8">
211
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
212
  echo do_shortcode('[MEC_login]');
213
  } else {
214
+ echo $this->main->module('booking.default', array('event'=>$this->events, 'uniqueid'=>$this->uniqueid));
215
  }
216
  ?>
217
  </div>
app/skins/single/modern.php CHANGED
@@ -34,9 +34,10 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
34
  <div class="col-md-4<?php if (empty($event->data->thumbnails['full'])) echo ' mec-no-image';?>">
35
 
36
  <?php do_action('mec_single_virtual_badge', $event->data); ?>
 
37
 
38
  <?php if($single->found_value('event_orgnizer', $settings) == 'on' || $single->found_value('register_btn', $settings) == 'on'): ?>
39
- <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (!trim($event->data->meta['mec_more_info']) or (trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
40
  <?php
41
  // Event Organizer
42
  if(isset($event->data->organizers[$event->data->meta['mec_organizer_id']]) && !empty($event->data->organizers[$event->data->meta['mec_organizer_id']]) and $single->found_value('event_orgnizer', $settings) == 'on')
@@ -60,7 +61,7 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
60
  <h6><?php _e('Phone', 'modern-events-calendar-lite'); ?></h6>
61
  <a href="tel:<?php echo $organizer['tel']; ?>"><?php echo $organizer['tel']; ?></a>
62
  </dd>
63
- <?php endif;
64
  if(isset($organizer['email']) && !empty($organizer['email'])): ?>
65
  <dd class="mec-organizer-email">
66
  <i class="mec-sl-envelope"></i>
@@ -88,10 +89,10 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
88
 
89
  <!-- Register Booking Button -->
90
  <?php if($this->main->can_show_booking_module($event) and $single->found_value('register_btn', $settings) == 'on'): ?>
91
- <?php
92
- $data_lity = $data_lity_class = '';
93
  $target_id = 'mec-events-meta-group-booking-'.$this->uniqueid;
94
- if(isset($settings['single_booking_style']) and $settings['single_booking_style'] == 'modal' ){
95
  /* $data_lity = 'onclick="openBookingModal();"'; */
96
  $data_lity_class = 'mec-booking-data-lity';
97
  $target_id = 'mec-events-meta-group-booking-box-'.$this->uniqueid;
@@ -107,10 +108,10 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
107
 
108
  <!-- Local Time Module -->
109
  <?php if($single->found_value('local_time', $settings) == 'on') echo $this->main->module('local-time.details', array('event'=>$event)); ?>
110
-
111
  <?php if($single->found_value('event_location', $settings) == 'on' || $single->found_value('event_categories', $settings) == 'on' || $single->found_value('more_info', $settings) == 'on'): ?>
112
  <div class="mec-event-meta mec-color-before mec-frontbox <?php if (empty($event->data->locations[$event->data->meta['mec_location_id']]) || $single->found_value('event_location', $settings) == '') echo 'mec-util-hidden'; ?>">
113
-
114
  <?php
115
  // Event Location
116
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]) and $single->found_value('event_location', $settings) == 'on')
@@ -179,15 +180,15 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
179
  <?php
180
  }
181
  ?>
182
-
183
  </div>
184
  <?php endif; ?>
185
  <!-- Attendees List Module -->
186
  <?php if($single->found_value('attende_module', $settings) == 'on') echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
187
-
188
  <!-- Next Previous Module -->
189
  <?php if($single->found_value('next_module', $settings) == 'on') echo $this->main->module('next-event.details', array('event'=>$event)); ?>
190
-
191
  <!-- Weather Module -->
192
  <?php if($single->found_value('weather_module', $settings) == 'on') echo $this->main->module('weather.details', array('event'=>$event)); ?>
193
 
@@ -196,7 +197,7 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
196
 
197
  <!-- Widgets -->
198
  <?php dynamic_sidebar('mec-single-sidebar'); ?>
199
-
200
  </div>
201
  <div class="col-md-8">
202
  <div class="mec-single-event-bar">
@@ -219,7 +220,7 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
219
  <?php echo $this->main->holding_status($event); ?>
220
  </div>
221
 
222
- <?php
223
  if(isset($event->data->meta['mec_hide_time']) and $event->data->meta['mec_hide_time'] == '0')
224
  {
225
  $time_comment = isset($event->data->meta['mec_comment']) ? $event->data->meta['mec_comment'] : '';
@@ -229,7 +230,7 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
229
  <i class="mec-sl-clock " style=""></i>
230
  <h3 class="mec-time"><?php _e('Time', 'modern-events-calendar-lite'); ?></h3>
231
  <i class="mec-time-comment"><?php echo (isset($time_comment) ? $time_comment : ''); ?></i>
232
-
233
  <?php if($allday == '0' and isset($event->data->time) and trim($event->data->time['start'])): ?>
234
  <dd><abbr class="mec-events-abbr"><?php echo $event->data->time['start']; ?><?php echo (trim($event->data->time['end']) ? ' - '.$event->data->time['end'] : ''); ?></abbr></dd>
235
  <?php else: ?>
@@ -295,7 +296,7 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
295
  <div class="mec-events-meta-group mec-events-meta-group-gmap">
296
  <?php echo $this->main->module('googlemap.details', array('event'=>$this->events)); ?>
297
  </div>
298
-
299
  <!-- Export Module -->
300
  <?php echo $this->main->module('export.details', array('event'=>$event)); ?>
301
 
@@ -303,26 +304,26 @@ if(is_plugin_active('schema-markup-rich-snippets/schema-markup-rich-snippets.php
303
  <?php if($this->main->can_show_countdown_module($event)): ?>
304
  <div class="mec-events-meta-group mec-events-meta-group-countdown">
305
  <?php echo $this->main->module('countdown.details', array('event'=>$this->events)); ?>
306
- </div>
307
  <?php endif; ?>
308
 
309
  <!-- Hourly Schedule -->
310
  <?php $this->display_hourly_schedules_widget($event); ?>
311
-
312
  <!-- Booking Module -->
313
  <?php if($this->main->is_sold($event) and count($event->dates) <= 1): ?>
314
  <div id="mec-events-meta-group-booking-<?php echo $this->uniqueid; ?>" class="mec-sold-tickets warning-msg"><?php _e('Sold out!', 'modern-events-calendar-lite'); do_action( 'mec_booking_sold_out',$event, null,null,array($event->date) );?> </div>
315
  <?php elseif($this->main->can_show_booking_module($event)): ?>
316
  <?php $data_lity_class = ''; if(isset($settings['single_booking_style']) and $settings['single_booking_style'] == 'modal' ) $data_lity_class = 'lity-hide '; ?>
317
  <div class="mec-single-event <?php echo $data_lity_class; ?>" id="mec-events-meta-group-booking-box-<?php echo $this->uniqueid; ?>">
318
- <div id="mec-events-meta-group-booking-<?php echo $this->uniqueid; ?>" class="mec-events-meta-group mec-events-meta-group-booking">
319
  <?php
320
  if(isset($settings['booking_user_login']) and $settings['booking_user_login'] == '1' and !is_user_logged_in() ) {
321
  echo do_shortcode('[MEC_login]');
322
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
323
  echo do_shortcode('[MEC_login]');
324
  } else {
325
- echo $this->main->module('booking.default', array('event'=>$this->events));
326
  }
327
  ?>
328
  </div>
@@ -356,7 +357,7 @@ jQuery( ".mec-speaker-avatar a" ).click(function(e)
356
  jQuery( ".mec-booking-button.mec-booking-data-lity" ).click(function(e)
357
  {
358
  e.preventDefault();
359
- var book_id = jQuery(this).attr('href');
360
  lity(book_id);
361
  });
362
  </script>
34
  <div class="col-md-4<?php if (empty($event->data->thumbnails['full'])) echo ' mec-no-image';?>">
35
 
36
  <?php do_action('mec_single_virtual_badge', $event->data); ?>
37
+ <?php do_action('mec_single_zoom_badge', $event->data); ?>
38
 
39
  <?php if($single->found_value('event_orgnizer', $settings) == 'on' || $single->found_value('register_btn', $settings) == 'on'): ?>
40
+ <div class="mec-event-meta mec-color-before mec-frontbox <?php echo ((!$this->main->can_show_booking_module($event) and isset($event->data->meta['mec_organizer_id']) and in_array($event->data->meta['mec_organizer_id'], array('0', '1')) and (isset($event->data->meta['mec_more_info']) and !trim($event->data->meta['mec_more_info']) or (isset($event->data->meta['mec_more_info']) and trim($event->data->meta['mec_more_info']) and $event->data->meta['mec_more_info'] == 'http://'))) ? 'mec-util-hidden' : ''); ?>">
41
  <?php
42
  // Event Organizer
43
  if(isset($event->data->organizers[$event->data->meta['mec_organizer_id']]) && !empty($event->data->organizers[$event->data->meta['mec_organizer_id']]) and $single->found_value('event_orgnizer', $settings) == 'on')
61
  <h6><?php _e('Phone', 'modern-events-calendar-lite'); ?></h6>
62
  <a href="tel:<?php echo $organizer['tel']; ?>"><?php echo $organizer['tel']; ?></a>
63
  </dd>
64
+ <?php endif;
65
  if(isset($organizer['email']) && !empty($organizer['email'])): ?>
66
  <dd class="mec-organizer-email">
67
  <i class="mec-sl-envelope"></i>
89
 
90
  <!-- Register Booking Button -->
91
  <?php if($this->main->can_show_booking_module($event) and $single->found_value('register_btn', $settings) == 'on'): ?>
92
+ <?php
93
+ $data_lity = $data_lity_class = '';
94
  $target_id = 'mec-events-meta-group-booking-'.$this->uniqueid;
95
+ if(isset($settings['single_booking_style']) and $settings['single_booking_style'] == 'modal' ){
96
  /* $data_lity = 'onclick="openBookingModal();"'; */
97
  $data_lity_class = 'mec-booking-data-lity';
98
  $target_id = 'mec-events-meta-group-booking-box-'.$this->uniqueid;
108
 
109
  <!-- Local Time Module -->
110
  <?php if($single->found_value('local_time', $settings) == 'on') echo $this->main->module('local-time.details', array('event'=>$event)); ?>
111
+
112
  <?php if($single->found_value('event_location', $settings) == 'on' || $single->found_value('event_categories', $settings) == 'on' || $single->found_value('more_info', $settings) == 'on'): ?>
113
  <div class="mec-event-meta mec-color-before mec-frontbox <?php if (empty($event->data->locations[$event->data->meta['mec_location_id']]) || $single->found_value('event_location', $settings) == '') echo 'mec-util-hidden'; ?>">
114
+
115
  <?php
116
  // Event Location
117
  if(isset($event->data->locations[$event->data->meta['mec_location_id']]) and !empty($event->data->locations[$event->data->meta['mec_location_id']]) and $single->found_value('event_location', $settings) == 'on')
180
  <?php
181
  }
182
  ?>
183
+
184
  </div>
185
  <?php endif; ?>
186
  <!-- Attendees List Module -->
187
  <?php if($single->found_value('attende_module', $settings) == 'on') echo $this->main->module('attendees-list.details', array('event'=>$event)); ?>
188
+
189
  <!-- Next Previous Module -->
190
  <?php if($single->found_value('next_module', $settings) == 'on') echo $this->main->module('next-event.details', array('event'=>$event)); ?>
191
+
192
  <!-- Weather Module -->
193
  <?php if($single->found_value('weather_module', $settings) == 'on') echo $this->main->module('weather.details', array('event'=>$event)); ?>
194
 
197
 
198
  <!-- Widgets -->
199
  <?php dynamic_sidebar('mec-single-sidebar'); ?>
200
+
201
  </div>
202
  <div class="col-md-8">
203
  <div class="mec-single-event-bar">
220
  <?php echo $this->main->holding_status($event); ?>
221
  </div>
222
 
223
+ <?php
224
  if(isset($event->data->meta['mec_hide_time']) and $event->data->meta['mec_hide_time'] == '0')
225
  {
226
  $time_comment = isset($event->data->meta['mec_comment']) ? $event->data->meta['mec_comment'] : '';
230
  <i class="mec-sl-clock " style=""></i>
231
  <h3 class="mec-time"><?php _e('Time', 'modern-events-calendar-lite'); ?></h3>
232
  <i class="mec-time-comment"><?php echo (isset($time_comment) ? $time_comment : ''); ?></i>
233
+
234
  <?php if($allday == '0' and isset($event->data->time) and trim($event->data->time['start'])): ?>
235
  <dd><abbr class="mec-events-abbr"><?php echo $event->data->time['start']; ?><?php echo (trim($event->data->time['end']) ? ' - '.$event->data->time['end'] : ''); ?></abbr></dd>
236
  <?php else: ?>
296
  <div class="mec-events-meta-group mec-events-meta-group-gmap">
297
  <?php echo $this->main->module('googlemap.details', array('event'=>$this->events)); ?>
298
  </div>
299
+
300
  <!-- Export Module -->
301
  <?php echo $this->main->module('export.details', array('event'=>$event)); ?>
302
 
304
  <?php if($this->main->can_show_countdown_module($event)): ?>
305
  <div class="mec-events-meta-group mec-events-meta-group-countdown">
306
  <?php echo $this->main->module('countdown.details', array('event'=>$this->events)); ?>
307
+ </div>
308
  <?php endif; ?>
309
 
310
  <!-- Hourly Schedule -->
311
  <?php $this->display_hourly_schedules_widget($event); ?>
312
+
313
  <!-- Booking Module -->
314
  <?php if($this->main->is_sold($event) and count($event->dates) <= 1): ?>
315
  <div id="mec-events-meta-group-booking-<?php echo $this->uniqueid; ?>" class="mec-sold-tickets warning-msg"><?php _e('Sold out!', 'modern-events-calendar-lite'); do_action( 'mec_booking_sold_out',$event, null,null,array($event->date) );?> </div>
316
  <?php elseif($this->main->can_show_booking_module($event)): ?>
317
  <?php $data_lity_class = ''; if(isset($settings['single_booking_style']) and $settings['single_booking_style'] == 'modal' ) $data_lity_class = 'lity-hide '; ?>
318
  <div class="mec-single-event <?php echo $data_lity_class; ?>" id="mec-events-meta-group-booking-box-<?php echo $this->uniqueid; ?>">
319
+ <div id="mec-events-meta-group-booking-<?php echo $this->uniqueid; ?>" class="mec-events-meta-group mec-events-meta-group-booking">
320
  <?php
321
  if(isset($settings['booking_user_login']) and $settings['booking_user_login'] == '1' and !is_user_logged_in() ) {
322
  echo do_shortcode('[MEC_login]');
323
  } elseif ( isset($settings['booking_user_login']) and $settings['booking_user_login'] == '0' and !is_user_logged_in() and isset($booking_options['bookings_limit_for_users']) and $booking_options['bookings_limit_for_users'] == '1' ) {
324
  echo do_shortcode('[MEC_login]');
325
  } else {
326
+ echo $this->main->module('booking.default', array('event'=>$this->events));
327
  }
328
  ?>
329
  </div>
357
  jQuery( ".mec-booking-button.mec-booking-data-lity" ).click(function(e)
358
  {
359
  e.preventDefault();
360
+ var book_id = jQuery(this).attr('href');
361
  lity(book_id);
362
  });
363
  </script>
app/skins/tile.php CHANGED
@@ -67,6 +67,7 @@ class MEC_skin_tile extends MEC_skins
67
 
68
  // Search Form Status
69
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
70
 
71
  // Generate an ID for the sking
72
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
67
 
68
  // Search Form Status
69
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
70
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
71
 
72
  // Generate an ID for the sking
73
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/timeline.php CHANGED
@@ -64,6 +64,7 @@ class MEC_skin_timeline extends MEC_skins
64
 
65
  // Search Form Status
66
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
67
 
68
  // Generate an ID for the sking
69
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
64
 
65
  // Search Form Status
66
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
67
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
68
 
69
  // Generate an ID for the sking
70
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/timetable.php CHANGED
@@ -56,6 +56,7 @@ class MEC_skin_timetable extends MEC_skins
56
 
57
  // Search Form Status
58
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
59
 
60
  // Generate an ID for the skin
61
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
56
 
57
  // Search Form Status
58
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
59
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
60
 
61
  // Generate an ID for the skin
62
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/weekly_view.php CHANGED
@@ -49,6 +49,7 @@ class MEC_skin_weekly_view extends MEC_skins
49
 
50
  // Search Form Status
51
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
52
 
53
  // Generate an ID for the skin
54
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
49
 
50
  // Search Form Status
51
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
52
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
53
 
54
  // Generate an ID for the skin
55
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/yearly_view.php CHANGED
@@ -56,6 +56,7 @@ class MEC_skin_yearly_view extends MEC_skins
56
 
57
  // Search Form Status
58
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
 
59
 
60
  // Generate an ID for the sking
61
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
56
 
57
  // Search Form Status
58
  $this->sf_status = isset($this->atts['sf_status']) ? $this->atts['sf_status'] : true;
59
+ $this->sf_display_label = isset($this->atts['sf_display_label']) ? $this->atts['sf_display_label'] : false;
60
 
61
  // Generate an ID for the sking
62
  $this->id = isset($this->atts['id']) ? $this->atts['id'] : mt_rand(100, 999);
app/skins/yearly_view/tpl.php CHANGED
@@ -22,10 +22,10 @@ $navigator_html = '';
22
  // Generate Month Navigator
23
  if($this->next_previous_button)
24
  {
25
- // Show previous month handler if showing past events allowed
26
  if(!isset($this->atts['show_past_events']) or
27
  (isset($this->atts['show_past_events']) and $this->atts['show_past_events']) or
28
- (isset($this->atts['show_past_events']) and !$this->atts['show_past_events'] and strtotime(date('Y-m-t', $_1year_before)) >= time())
29
  )
30
  {
31
  $navigator_html .= '<div class="mec-previous-year mec-load-year mec-color-hover" data-mec-year="'.date('Y', $_1year_before).'"><i class="mec-sl-angle-left"></i> '.$this->main->date_i18n('Y', $_1year_before).'</div>';
22
  // Generate Month Navigator
23
  if($this->next_previous_button)
24
  {
25
+ // Show previous year handler if showing past events allowed
26
  if(!isset($this->atts['show_past_events']) or
27
  (isset($this->atts['show_past_events']) and $this->atts['show_past_events']) or
28
+ (isset($this->atts['show_past_events']) and !$this->atts['show_past_events'] and date('Y', $_1year_before) >= current_time('Y'))
29
  )
30
  {
31
  $navigator_html .= '<div class="mec-previous-year mec-load-year mec-color-hover" data-mec-year="'.date('Y', $_1year_before).'"><i class="mec-sl-angle-left"></i> '.$this->main->date_i18n('Y', $_1year_before).'</div>';
assets/css/frontend.css CHANGED
@@ -8133,6 +8133,21 @@ li.mec-no-event-found .mec-event-title {
8133
  margin-bottom:10px;
8134
  }
8135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8136
  .mec-wrap .mec-search-form .mec-date-search select {
8137
  width: calc(100% - 106px);
8138
  }
8133
  margin-bottom:10px;
8134
  }
8135
 
8136
+ .mec-wrap .mec-search-form .mec-text-input-search input,
8137
+ .mec-wrap .mec-search-form .mec-minmax-price input,
8138
+ .mec-wrap .mec-search-form .mec-text-address-search input {
8139
+ margin-bottom:10px;
8140
+ }
8141
+
8142
+ .mec-wrap .mec-totalcal-box label {
8143
+ display: block;
8144
+ line-height: 1.8;
8145
+ margin-bottom: 4px;
8146
+ font-size: 13px;
8147
+ color: #9a9a9a;
8148
+ }
8149
+
8150
+
8151
  .mec-wrap .mec-search-form .mec-date-search select {
8152
  width: calc(100% - 106px);
8153
  }
assets/css/frontend.min.css CHANGED
@@ -1 +1 @@
1
- .lity-container,.mec-wrap,.mec-wrap div:not([class^=elementor-]){font-family:Montserrat,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}.entry-content .mec-wrap h1,.entry-content .mec-wrap h2,.entry-content .mec-wrap h3,.entry-content .mec-wrap h4,.entry-content .mec-wrap h5,.entry-content .mec-wrap h6,.mec-wrap h1,.mec-wrap h2,.mec-wrap h3,.mec-wrap h4,.mec-wrap h5,.mec-wrap h6{font-family:Montserrat,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;color:#171c24;font-weight:300;font-style:inherit;letter-spacing:normal;clear:none}.mec-wrap h1{font-size:50px;line-height:1.16;margin-bottom:12px;letter-spacing:-1px}.mec-wrap h2{font-size:36px;line-height:1.14;margin-bottom:10px}.mec-wrap h3{font-size:28px;line-height:1.2;margin-bottom:8px}.mec-wrap h4{font-size:24px;line-height:1.2;margin-bottom:10px}.mec-wrap h5{font-size:18px;line-height:1.3;margin-bottom:7px}.mec-wrap h6{font-size:16px;line-height:1.3;margin-bottom:4px}.mec-wrap .subheader{color:#849098}.mec-wrap h1 strong{font-weight:700}.mec-wrap p{margin:0 0 20px 0;color:#616161;font-size:14px;line-height:1.8}.mec-wrap .mec-event-article .mec-color-hover{box-shadow:none;border:none}.mec-wrap abbr,.mec-wrap acronym{cursor:auto;border:none}.entry-content .mec-wrap a{box-shadow:none}.mec-wrap .button,.mec-wrap a.button:not(.owl-dot),.mec-wrap button:not(.owl-dot):not(.gm-control-active),.mec-wrap input[type=button],.mec-wrap input[type=reset],.mec-wrap input[type=submit]{position:relative;border:none;border-radius:0;color:#fff;display:inline-block;font-size:12px;letter-spacing:1px;line-height:1.5;text-transform:uppercase;font-weight:600;text-decoration:none;cursor:pointer;margin-bottom:21px;margin-right:10px;line-height:1;padding:18px 20px 16px;background:#24ca4f;-webkit-transition:all .21s ease;-moz-transition:all .21s ease;transition:all .21s ease}.mec-wrap .button:hover,.mec-wrap a.button:hover,.mec-wrap button:hover,.mec-wrap input[type=button]:hover,.mec-wrap input[type=reset]:hover,.mec-wrap input[type=submit]:hover{background:#222;color:#fff}.mec-wrap #mec_woo_add_to_cart_btn_r{min-width:155px;margin-top:5px;border-radius:2px;box-shadow:0 2px 1px rgba(0,0,0,.08);float:left;text-align:center}.mec-booking-form-container button{display:block}.vertical-space,.vertical-space1,.vertical-space2,.vertical-space3,.vertical-space4,.vertical-space5{display:block;width:100%;margin:0;clear:both;border:0 none;height:20px}.vertical-space2{height:40px}.vertical-space3{height:60px}.vertical-space4{height:80px}.vertical-space5{height:100px}@media only screen and (max-width:479px){.vertical-space,.vertical-space1{height:8px}.vertical-space2{height:14px}.vertical-space3{height:28px}.vertical-space4{height:40px}.vertical-space5{height:60px}}@media only screen and (max-width:960px){.vertical-space,.vertical-space1{height:12px}.vertical-space2{height:18px}.vertical-space3{height:36px}.vertical-space4{height:50px}.vertical-space5{height:80px}}.mec-wrap abbr{cursor:auto;border-bottom:0}@-webkit-keyframes rotating{from{-ms-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-ms-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotating{from{-ms-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-ms-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}.mec-wrap{font:14px/25px sans-serif;font-family:Montserrat,Helvetica,Arial,sans-serif;font-weight:400;color:#626262}.mec-wrap .mec-events a{border-bottom:none}.mec-wrap .mec-container a{box-shadow:none}.mec-event-content p{font-family:Roboto,sans-serif;font-weight:300}.mec-wrap .mec-clear:after,.mec-wrap .mec-clear:before{content:" ";display:table}.mec-wrap .mec-clear:after{clear:both}.mec-events-button{background:#fff;padding:12px 34px;font-size:13px;font-weight:400;letter-spacing:0;border:1px solid #e3e3e3;margin-right:10px;transition:.3s}.mec-wrap .mec-events-button:hover{color:#fff}.mec-no-event{display:none}#mec-active-current{display:block}.current-hide #mec-active-current{display:none!important}.mec-event-grid-classic .mec-event-article{position:relative;border:2px solid #e3e3e3;box-shadow:0 2px 0 0 rgba(0,0,0,.016);margin-bottom:30px;max-width:none}.mec-event-grid-classic .mec-event-content{background:#fff;color:#767676;padding:0 20px 5px;text-align:center;min-height:125px}.mec-event-grid-classic .mec-event-title{color:#202020;margin:10px 0;font-weight:700;font-size:20px;letter-spacing:1px;text-transform:uppercase}.mec-event-grid-classic .mec-event-title a{color:#202020;transition:all .24s ease}.mec-event-grid-classic .mec-event-date{font-weight:400;font-size:11px;text-transform:uppercase;letter-spacing:1px;color:#fff;padding:3px 20px;margin:0 -20px 20px -20px;text-align:center}.widget_mec_mec_widget .mec-event-grid-classic .mec-event-date{margin:0}.mec-event-grid-classic .mec-event-content p{font-size:15px;color:#8a8a8a}.mec-event-grid-classic .mec-event-detail{display:none}.mec-event-grid-classic img{margin-bottom:0;width:100%}.mec-event-footer{position:relative;border-top:1px solid #efefef;padding:20px;min-height:80px;margin:0;background:#fafafa}.mec-event-sharing-wrap{left:15px;position:absolute;list-style:none;margin:0;padding-left:0}.mec-event-sharing-wrap .mec-event-sharing{position:absolute;padding:8px 0 2px;left:-6px;bottom:54px;margin:0;margin-top:6px;border-radius:5px;width:50px;visibility:hidden;opacity:0;border:1px solid #e2e2e2;background:#fff;box-shadow:0 0 9px 0 rgba(0,0,0,.06);z-index:99;-webkit-transition:all .18s ease;transition:all .18s ease}.mec-event-sharing-wrap .mec-event-sharing:after,.mec-event-sharing-wrap .mec-event-sharing:before{content:'';display:block;position:absolute;bottom:-10px;left:50%;margin-left:-10px;width:0;height:0;border-style:solid;border-width:10px}.mec-event-sharing-wrap .mec-event-sharing:before{bottom:-21px;border-color:#e2e2e2 transparent transparent transparent}.mec-event-sharing-wrap .mec-event-sharing:after{bottom:-19px;border-color:#fff transparent transparent transparent}.mec-event-sharing-wrap:hover .mec-event-sharing{opacity:1;visibility:visible}.mec-event-sharing-wrap li{text-align:center;border:0;display:block;margin-right:2px;overflow:hidden;margin:0 auto 6px;width:38px}.mec-event-sharing-wrap:hover>li{cursor:pointer;background-color:#40d9f1}.mec-event-sharing-wrap:hover li a{color:#fff}.mec-event-sharing-wrap>li:first-of-type{border:1px solid #d9d9d9}.mec-event-sharing-wrap li a,.mec-event-sharing-wrap:hover li ul li a{border:none;color:#767676}.mec-event-sharing-wrap li i{width:36px;height:36px;display:table-cell;vertical-align:middle}.mec-event-sharing-wrap li svg{height:16px}.mec-event-sharing-wrap .mec-event-sharing li a{display:block}.mec-event-sharing-wrap .mec-event-sharing li:hover a{color:#40d9f1}.mec-event-sharing .mec-event-share:hover .event-sharing-icon{background:#40d9f1;border-width:0 1px 0;cursor:pointer}.mec-event-sharing .mec-event-map{border-width:1px 0 1px}.mec-event-footer .mec-booking-button{box-shadow:none;transition:all .21s ease;font-size:11px;font-weight:500;letter-spacing:1px;text-transform:uppercase;background:#fff;color:#767676;border:1px solid #e8e8e8;position:absolute;top:20px;right:15px;padding:0 16px;line-height:37px;height:38px}.mec-event-footer .mec-booking-button:hover{background:#191919;color:#fff;border-color:#191919}@media only screen and (max-width:960px){.mec-event-grid-classic{margin-bottom:30px}}.mec-widget .mec-event-grid-classic.mec-owl-carousel{padding:36px 0 16px}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav{margin:5px 0;width:100%;position:absolute;top:15px;padding:0}.mec-skin-grid-container.mec-widget{padding-top:18px}.mec-widget .mec-event-grid-classic.mec-owl-carousel{padding:20px 0 16px}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav{margin:0;width:100%;position:absolute;top:0;padding:0}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav div{position:absolute;background:#fff;line-height:0;width:34px;height:26px;padding:6px;text-align:center;margin-top:-17px;border-radius:3px;border:1px solid #e2e2e2;text-align:center;box-shadow:0 2px 0 0 rgba(0,0,0,.028);transition:all .33s ease}.mec-skin-grid-container .mec-categories{padding:0}.mec-skin-grid-container .mec-categories li{list-style:none}.mec-skin-grid-container .mec-categories li a{color:#000;line-height:24px;text-align:left;transition:all .23s ease;-webkit-transition:all .23s ease}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav i{font-size:12px;color:#40d9f1;cursor:pointer}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav .owl-next{right:0}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav .owl-prev{left:0}.mec-widget .mec-event-grid-classic.mec-owl-carousel .mec-event-sharing{display:none}.mec-widget .mec-event-grid-classic.mec-owl-carousel .mec-event-footer{text-align:center}.mec-widget .mec-event-grid-classic.mec-owl-carousel .mec-event-footer .mec-booking-button{position:static;padding:11px 16px}.widget .mec-event-footer ul.mec-event-sharing-wrap li a.mec-event-share-icon{padding:0}@media screen and (min-width:56.875em){.mec-widget .mec-month-container dl{margin-bottom:0}}.mec-widget .mec-event-grid-classic.owl-carousel .mec-event-footer{text-align:right}.mec-widget .mec-event-grid-classic.owl-carousel .mec-event-sharing-wrap{left:5px;padding-left:5px}.mec-widget .mec-event-grid-classic.owl-carousel .mec-event-sharing-wrap .mec-event-sharing{left:0}.mec-widget .mec-event-sharing-wrap .mec-event-sharing{position:absolute;top:auto;bottom:52px;margin:0;margin-top:0;border-radius:5px}.mec-widget .mec-event-sharing-wrap .mec-event-sharing:after{top:auto;bottom:-17px;border-color:#fff transparent transparent transparent}.mec-widget .mec-event-sharing-wrap .mec-event-sharing:before{top:auto;bottom:-18px;border-color:#e2e2e2 transparent transparent transparent}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav button{position:absolute;background:#fff;padding:6px;margin-top:-17px;border-radius:3px;border:1px solid #e2e2e2;box-shadow:0 2px 0 0 rgba(0,0,0,.028)}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav button:hover{background:#40d9f1;border-color:#40d9f1}.mec-widget .mec-event-grid-classic.mec-owl-carousel .owl-nav button:hover i{color:#fff}.mec-widget .mec-event-grid-classic.mec-owl-carousel .mec-booking-button{width:40%;float:right;color:#202020;height:36px;line-height:14px;font-size:12px;width:auto}.mec-widget .mec-event-grid-classic.mec-owl-carousel .mec-booking-button:hover{color:#fff}.mec-widget .mec-event-list-modern .col-md-2.col-sm-2,.mec-widget .mec-event-list-modern .col-md-6.col-sm-6{padding:0;width:100%;display:block;position:unset}.mec-widget .mec-event-list-modern .col-md-4.col-sm-4 .mec-booking-button{width:80%;height:46px;line-height:22px;padding:11px 20px;float:right}.mec-widget .mec-event-list-modern .col-md-4.col-sm-4.mec-btn-wrapper{top:auto;bottom:5%}@media (max-width:480px){.mec-widget .mec-event-list-modern .col-md-4.col-sm-4{padding:0}.mec-widget .mec-event-list-modern .col-md-4.col-sm-4 .mec-booking-button{width:100%}}.mec-event-grid-clean{margin-bottom:10px;max-width:none}.mec-event-grid-clean .mec-event-article{margin-bottom:30px;position:relative;border:1px solid #e2e2e2;text-align:center;padding:15px 15px 0;background:#fff;box-shadow:0 2px 0 0 rgba(0,0,0,.016)}.mec-event-grid-clean .mec-event-content{background:#fff;color:#767676;padding:25px 16px 0;text-align:left}.mec-event-grid-clean .mec-event-title{color:#202020;margin:0 0 10px 0;font-weight:700;font-size:21px;text-transform:capitalize}.mec-event-grid-clean .mec-event-title a{color:#202020;transition:all .24s ease}.mec-event-grid-clean .mec-event-date{font-weight:400;font-size:11px;text-transform:uppercase;letter-spacing:1px;background-color:#40d9f1;color:#fff;padding:3px 0;margin:0;text-align:center}.mec-event-grid-clean .mec-event-content p{font-size:15px;color:#9a9a9a;line-height:1.54}.mec-event-grid-clean img{margin-bottom:0;width:100%}.mec-event-grid-clean .event-grid-t2-head{margin-bottom:10px;color:#fff;padding:9px 14px 6px;text-align:left}.mec-event-grid-clean .event-grid-t2-head .mec-event-date{font-size:50px;line-height:50px;float:left;margin-right:11px}.mec-event-grid-clean .event-grid-t2-head .mec-event-month{text-transform:uppercase;font-size:17px;line-height:20px;padding-top:4px}.mec-event-grid-clean .event-grid-t2-head .mec-event-detail{font-size:12px}.mec-event-grid-clean .event-grid-t2-head .mec-categories li a{margin-bottom:10px;color:#fff}.mec-event-grid-clean .event-grid-t2-head .mec-categories li a:hover{color:#000}.mec-event-grid-clean .mec-event-sharing-wrap{left:0;padding-left:0}.mec-event-grid-clean .mec-event-footer{position:relative;border-top:2px solid;padding:20px 0;margin:0 14px;text-align:left;background:0 0}.mec-event-grid-clean .mec-event-footer .mec-booking-button{right:0}.mec-event-grid-clean .row{margin-bottom:30px}.mec-event-grid-modern{margin-bottom:10px;max-width:none}.mec-event-grid-modern .mec-event-article{position:relative;border:1px solid #e2e2e2;text-align:center;margin-bottom:30px;padding:45px 15px 10px;background:#fff;box-shadow:0 2px 0 0 rgba(0,0,0,.016)}.mec-event-grid-modern .mec-event-content{background:#fff;color:#767676;padding:35px 15px 10px;text-align:left}.mec-event-grid-modern .mec-event-title{color:#202020;margin:0 0 10px 0;font-weight:700;font-size:24px;text-transform:none;letter-spacing:-1px}.mec-event-grid-modern .mec-event-title a{color:#202020;transition:all .24s ease}.mec-event-grid-modern .mec-event-content p{font-size:15px;color:#9a9a9a;line-height:1.54}.mec-event-grid-modern img{margin-bottom:0;width:100%}.mec-event-grid-modern .event-grid-modern-head{margin-bottom:10px;padding:9px 14px 6px;text-align:left}.mec-event-grid-modern .event-grid-modern-head .mec-event-date{font-size:50px;line-height:50px;float:left;margin-right:11px}.mec-event-grid-modern .event-grid-modern-head .mec-event-month{text-transform:uppercase;font-size:17px;line-height:20px;padding-top:4px}.mec-event-grid-modern .event-grid-modern-head .mec-event-detail{font-size:12px}.mec-event-grid-modern .event-grid-modern-head .mec-event-day{margin-top:9px;color:silver;font-family:Roboto,sans-serif;font-size:35px;font-weight:100;text-transform:uppercase;letter-spacing:-1px}.mec-event-grid-modern .mec-event-footer{position:relative;height:90px;padding:20px 0;border:none;margin:0 14px;text-align:left;background:0 0}.mec-event-grid-modern .mec-event-footer .mec-booking-button{right:auto;left:0}.mec-event-grid-modern .mec-event-sharing-wrap{left:auto;right:0;padding-left:0}.mec-event-grid-modern .mec-event-sharing{left:auto;right:-6px}.mec-event-grid-modern .mec-event-sharing-wrap li{border-radius:55px}.mec-event-grid-modern .row{margin-bottom:0}@media only screen and (max-width:479px){.mec-event-grid-modern .mec-event-article{padding-bottom:30px}.mec-event-grid-modern .mec-event-sharing{top:60px;left:0;right:auto}.mec-event-grid-modern .mec-event-footer .mec-booking-button{top:0}}span.mec-event-title-soldout{font-size:8px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;background:#e63360;color:#fff;padding:3px 8px;line-height:1;border-radius:15px;white-space:nowrap;vertical-align:middle}.mec-event-grid-colorful .mec-event-article{min-height:400px;border:none;box-shadow:none;background:#40d9f1;padding-top:25px;margin:0;color:#fff}.mec-event-grid-colorful .mec-event-content{background:0 0}.mec-event-grid-colorful .event-grid-modern-head,.mec-event-grid-colorful .event-grid-modern-head .mec-event-date,.mec-event-grid-colorful .event-grid-modern-head .mec-event-day,.mec-event-grid-colorful .mec-event-content p,.mec-event-grid-colorful .mec-event-sharing-wrap>li>a,.mec-event-grid-colorful .mec-event-title a{color:#fff}.mec-event-grid-colorful .mec-event-footer .mec-booking-button{border:none}.mec-event-grid-colorful .mec-event-sharing-wrap>li{border-color:#fff}.mec-event-grid-colorful .mec-event-sharing-wrap:hover>li{background:#333;border-color:#333}.mec-event-grid-colorful .mec-event-title a.mec-color-hover:hover{color:#fff;text-decoration:underline}.mec-event-grid-colorful .mec-event-title .event-color{display:none}.mec-event-grid-colorful div[class^=col-md-]{padding:0 1px 1px 0;margin:0}.mec-event-grid-colorful .mec-event-article .mec-time-details{color:#fff}@media only screen and (min-width:768px){.mec-wrap.mec-sm959.mec-event-grid-colorful .event-grid-modern-head .mec-event-day{font-size:26px}.mec-wrap.mec-sm959.mec-event-grid-colorful .event-grid-modern-head .mec-event-month{font-size:15px}.mec-wrap.mec-sm959.mec-event-grid-colorful .event-grid-modern-head .mec-event-date{font-size:50px}.mec-wrap.mec-sm959.mec-event-grid-colorful .mec-event-title{font-size:21px}.mec-wrap.mec-sm959.mec-event-grid-colorful .mec-event-content p{font-size:13px}}@media only screen and (min-width:768px) and (max-width:1200px){.mec-wrap.mec-sm959.mec-event-grid-colorful div[class^=col-md-]{width:50%}}.mec-event-list-minimal .mec-event-article{border-bottom:1px solid #efefef;padding:24px 0 16px}.mec-event-list-minimal .mec-wrap .col-md-9{padding:0}.mec-event-list-minimal .mec-event-date{position:relative;float:left;margin-right:30px;color:#fff;width:52px;padding:6px 4px 3px;text-align:center;text-transform:uppercase;border-radius:3px}.mec-event-list-minimal .mec-event-date{min-width:52px;width:fit-content}.mec-event-list-minimal .mec-event-date:nth-child(2){margin:0 30px 0 -20px}.mec-event-list-minimal .mec-event-date span{display:block;font-size:24px;font-weight:700;text-align:center;margin-bottom:4px}.mec-event-list-minimal .mec-event-date:after{display:block;content:"";position:absolute;width:50px;left:1px;top:1px;height:34px;background:rgba(255,255,255,.1);box-shadow:0 4px 4px rgba(0,0,0,.02)}.mec-event-list-minimal .mec-event-date:after{width:100%}.mec-event-list-minimal .mec-event-title{margin-top:0;margin-bottom:10px;font-weight:700;font-size:18px;text-transform:uppercase;letter-spacing:0;padding-top:10px}.mec-event-list-minimal .mec-event-detail,.mec-event-list-minimal .mec-time-details{font-size:15px;font-weight:300;line-height:1;letter-spacing:0;color:#9a9a9a;font-family:Roboto,sans-serif}.mec-event-list-minimal .btn-wrapper{text-align:right;padding-right:0;padding-top:6px}.mec-event-list-minimal .btn-wrapper .mec-detail-button{border-bottom:0;margin-bottom:14px;margin-right:0;box-shadow:none}.mec-event-list-minimal a.mec-detail-button{text-align:center;display:inline-block;background:#ededed;color:#191919;padding:12px;border-radius:2px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:2px;transition:all .24s ease}.mec-event-list-minimal a.mec-detail-button:hover{background:#292929;color:#fff}.vc_col-sm-4 .mec-event-list-minimal .mec-event-date,.vc_col-sm-6 .mec-event-list-minimal .mec-event-date{margin-right:12px}.vc_col-sm-4 .mec-event-list-minimal .mec-event-title,.vc_col-sm-6 .mec-event-list-minimal .mec-event-title{font-size:15px;letter-spacing:2px}@media only screen and (min-width:480px) and (max-width:767px){.mec-event-list-minimal .btn-wrapper{padding-left:0}.mec-event-list-minimal .mec-event-date{margin-right:10px}}@media only screen and (max-width:767px){.mec-event-list-minimal .btn-wrapper .mec-detail-button{display:block;text-align:center;margin:0;margin-top:16px;padding:8px}.mec-event-list-minimal .btn-wrapper{margin:12px 0}}@media only screen and (max-width:479px){.mec-event-list-minimal .mec-event-date{float:none;width:100%;margin-bottom:8px}.mec-event-list-minimal .mec-event-date span{display:inline;padding-right:25px;margin-right:7px;font-size:inherit}.mec-event-list-minimal .mec-event-date:after{width:45%;box-shadow:4px 0 4px rgba(0,0,0,.02)}.mec-event-list-minimal .btn-wrapper{text-align:center;padding-left:0}.mec-event-list-minimal{text-align:center}.mec-event-list-minimal .mec-event-detail{margin-bottom:10px}}.mec-wrap .mec-event-list-modern .mec-event-title{margin-top:0;margin-bottom:10px}.mec-event-list-modern .mec-event-article{border-bottom:1px solid #efefef;padding:30px 0 10px}.mec-event-list-modern .mec-event-article:last-child{border-bottom:none}.mec-event-list-modern .mec-event-title a{color:#191919;transition:all .24s ease;box-shadow:none}.mec-event-list-modern .mec-event-date{text-transform:uppercase;padding:10px 0}.mec-event-list-modern .mec-event-date .event-d{font-size:48px;display:table-cell;padding:10px 0 0}.mec-event-list-modern .mec-event-date .event-d.mec-multiple-dates{font-size:20px;padding:0}.mec-event-list-modern .mec-event-date.mec-multiple-date-event:first-child{padding:10px 0 6px 0;position:relative;width:fit-content}.mec-event-list-modern .mec-event-date.mec-multiple-date-event:first-child:after{content:'';position:absolute;bottom:0;left:0;width:100%;height:1px;background:silver}.mec-event-list-modern .mec-event-date.mec-multiple-date-event:last-child{padding:5px 0 10px 0}.mec-event-list-modern .mec-event-date.mec-multiple-date-event .event-d{font-size:20px;padding:0}.mec-event-list-modern .mec-event-date.mec-multiple-date-event .event-da{font-size:20px;margin:0}.mec-event-list-modern .mec-event-date .event-f{font-size:13px;display:table-cell;vertical-align:middle;padding-left:7px;font-weight:500;letter-spacing:3px;color:#777}.mec-event-list-modern .mec-event-detail{font-weight:300;color:#8a8a8a}.mec-event-list-modern .mec-event-detail .mec-time-details{display:inline}.mec-event-list-modern .mec-event-date .event-da{margin-top:9px;color:silver;font-size:28px;font-weight:100;text-transform:uppercase;letter-spacing:-1px;text-align:left}.mec-event-list-modern .mec-btn-wrapper .mec-booking-button{border-radius:1px;letter-spacing:2px;border:1px solid #e6e6e6;color:#333;background-color:#fff;padding:13px 20px;font-weight:700;font-size:11px;box-shadow:0 2px 0 0 rgba(0,0,0,.016);transition:all .28s ease}.mec-event-list-modern .mec-btn-wrapper .mec-booking-button:hover{border-color:#222;background:#222;color:#fff}.mec-event-list-modern .mec-event-title{font-weight:700;font-size:20px;text-transform:uppercase;letter-spacing:1px}.mec-event-list-modern .mec-event-detail{color:#9a9a9a;font-size:15px;font-weight:300;line-height:25px;font-family:Roboto,sans-serif}.mec-event-list-modern .mec-btn-wrapper{text-align:right;padding:10px 0;text-transform:uppercase}.mec-event-list-modern .mec-event-sharing{position:relative;margin:10px 0;padding-left:0}.mec-event-list-modern .mec-event-sharing>li{display:inline-block;border:none;border-radius:50%;margin-right:3px}.mec-event-list-modern .mec-event-sharing .telegram{min-width:36px;min-height:36px;line-height:36px;padding:9px 1px 10px;border-radius:60px}.mec-event-list-modern .mec-event-sharing .telegram .svg-inline--fa.fa-telegram.fa-w-16{width:2.126rem;padding:2px 10px 0 10px;margin-bottom:-2px}.mec-event-list-modern .mec-event-sharing .telegram .svg-inline--fa.fa-telegram.fa-w-16 path{fill:#767676}.mec-event-list-modern .mec-event-sharing li:hover .telegram{background:#40d9f1}.mec-event-list-modern .mec-event-sharing li:hover .telegram .svg-inline--fa.fa-telegram.fa-w-16 path{fill:#fff}.mec-event-list-modern .mec-event-sharing>li:hover{display:inline-block}.mec-event-list-modern .mec-event-sharing>li:hover a i{color:#fff;background:#40d9f1;border-color:#40d9f1}.mec-event-list-modern .mec-event-sharing>li i{width:36px;display:inline-block;line-height:35px;color:#767676;text-align:center;border-radius:50%;border:1px solid #ddd;font-size:14px}.mec-event-list-modern .mec-event-sharing .mec-event-share:hover .mec-event-sharing-icon{background:#40d9f1;border-color:#40d9f1;cursor:pointer;border-radius:50%}.mec-event-list-modern .mec-event-sharing li:hover a i{background:#40d9f1}@media only screen and (min-width:768px){.mec-event-list-modern .mec-event-article{position:relative;min-height:160px;overflow:hidden}.mec-event-list-modern .col-md-2.col-sm-2{width:210px;position:absolute;left:0;top:20px}.mec-event-list-modern .col-md-4.col-sm-4.mec-btn-wrapper{width:180px;padding:0;position:absolute;right:0;top:30%}.mec-event-list-modern .col-md-6.col-sm-6{width:100%;padding-left:225px;padding-right:195px}}@media only screen and (max-width:767px){.mec-event-list-modern .mec-btn-wrapper .mec-booking-button{letter-spacing:1px;border:1px solid #e1e1e1;padding:8px 16px}.mec-event-list-modern .mec-btn-wrapper{padding:0 0 12px}.mec-event-list-modern .mec-event-sharing{margin-bottom:0}}.mec-event-grid-minimal .mec-event-article{margin:15px 0;min-height:80px;display:table}.mec-event-grid-minimal .event-detail-wrap{display:table-cell;vertical-align:middle}.mec-event-grid-minimal .mec-event-date{width:70px;float:left;margin-right:20px;padding:12px 16px 10px;text-align:center;text-transform:uppercase;border-radius:4px;border:1px solid #e6e6e6;transition:all .37s ease-in-out;box-shadow:0 2px 0 0 rgba(0,0,0,.016)}.mec-event-grid-minimal .mec-event-date span{display:block;font-size:24px;font-weight:700;text-align:center;margin-bottom:4px;color:#2a2a2a;transition:color .3s ease}.mec-event-grid-minimal .mec-event-title{margin-top:0;margin-bottom:10px;font-weight:700;line-height:21px;font-size:16px;text-transform:uppercase;transition:color .3s ease}.mec-event-grid-minimal .mec-event-title a{color:#191919;transition:color .3s ease}.mec-event-grid-minimal .mec-event-detail,.mec-event-grid-minimal .mec-time-details{font-size:15px;font-weight:300;line-height:1;letter-spacing:0;color:#9a9a9a;font-family:Roboto,sans-serif;margin-bottom:5px}.mec-event-grid-minimal .mec-event-date:hover{color:#fff}.mec-event-grid-minimal .mec-event-date:hover span{color:#fff}.mec-wrap .mec-event-grid-minimal .mec-event-date:hover{color:#fff}.mec-event-list-classic .mec-event-article{padding:12px 0;margin-bottom:20px}.mec-event-list-classic .mec-event-image{float:left;width:86px;margin-right:20px}.mec-event-list-classic .mec-event-date,.mec-event-list-classic .mec-event-time{font-weight:400;font-size:13px;letter-spacing:0;line-height:18px;text-align:left;display:initial;margin-right:12px}.mec-event-list-classic .mec-event-time .mec-time-details,.mec-event-list-classic .mec-event-time i{display:inline;margin-right:3px}.mec-event-list-classic .mec-event-date span{font-weight:500;margin-bottom:6px}.mec-event-list-classic .mec-event-title{font-size:15px;margin:10px 0 12px;font-weight:700;text-transform:uppercase}.mec-event-list-classic .mec-event-title a{color:#494949;transition:color .3s ease}.mec-event-list-classic .mec-event-detail{color:#777;font-weight:400;line-height:12px;font-size:12px;overflow:hidden}.mec-event-list-classic a.magicmore{padding:10px 16px;color:#fff;background:#222;letter-spacing:2px;font-size:11px}.mec-event-list-classic a.magicmore:after{content:"";display:none}.mec-event-list-classic a.magicmore:hover{color:#40d9f1}.mec-event-grid-simple .mec-event-article{position:relative;margin-bottom:30px}.mec-event-grid-simple .mec-event-article:after{border-right:1px solid #e6e6e6;height:60px;position:absolute;top:50%;margin-top:-30px;right:-1px}.mec-event-grid-simple .row div:last-child .mec-event-article:after{border:none}.mec-event-grid-simple .row{margin:15px 0 30px;text-align:center}.mec-event-grid-simple .mec-event-date{padding:0;margin:0;text-transform:capitalize;font-size:12px;font-weight:700}.mec-event-grid-simple .mec-event-title{margin-top:0;margin-bottom:10px;font-weight:700;line-height:21px;font-size:15px;padding-top:5px;padding-left:5px;padding-right:5px;text-transform:uppercase;transition:color .37s ease}.mec-event-grid-simple .mec-event-title a{color:#494949;transition:color .3s ease}.mec-event-grid-simple .mec-event-detail{font-family:Roboto,sans-serif;font-weight:400;line-height:1;letter-spacing:0;font-size:13px;color:#777}.mec-event-grid-simple:hover .mec-event-title{color:#40d9f1}.mec-event-grid-simple:hover .mec-event-date{background:0 0}.event-last:after{display:none}@media only screen and (max-width:767px){.mec-event-grid-simple .mec-event-article{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #eee}.mec-event-grid-simple .mec-event-article:after{border:none}}.mec-event-grid-novel .mec-event-article{position:relative;margin-bottom:30px;padding:60px 5% 60px 7%;border:1px solid rgba(255,255,255,.12);border-radius:10px;background-color:#0050fd;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease;z-index:1}.mec-event-grid-novel .mec-event-article .novel-grad-bg{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:10px;opacity:0;z-index:-1;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease}.mec-event-grid-novel .mec-event-article:hover{-webkit-box-shadow:0 13px 36px 0 rgba(0,0,0,.23);box-shadow:0 13px 36px 0 rgba(0,0,0,.23);border-color:transparent}.mec-event-grid-novel .mec-event-article:hover .novel-grad-bg{background-image:-webkit-gradient(linear,left top,right top,from(#262e32),to(#0e1015));background-image:-webkit-linear-gradient(left,#262e32 0,#0e1015 100%);background-image:-o-linear-gradient(left,#262e32 0,#0e1015 100%);background-image:linear-gradient(90deg,#262e32 0,#0e1015 100%);opacity:1}.mec-event-grid-novel .mec-event-image{float:left;width:150px;height:150px}.mec-event-grid-novel .mec-event-image img{width:150px;height:150px;border-radius:50%}.mec-event-grid-novel .mec-event-detail-wrap{margin-left:200px}.mec-event-grid-novel .mec-event-content h4{position:relative;margin-bottom:10px;display:inline-block}.mec-event-grid-novel .mec-event-content h4 a{font-size:24px;line-height:35px;color:#fafcff}.mec-event-grid-novel .mec-event-content h4::before{content:'';position:absolute;top:8px;left:-30px;width:17px;height:17px;background:#5cd0ed;opacity:.4;border-radius:50%}.mec-event-grid-novel .mec-event-content h4::after{content:'';position:absolute;top:12px;left:-26px;width:9px;height:9px;background:#5cd0ed;border-radius:50%}.mec-skin-grid-container .mec-event-grid-novel .mec-categories li a{color:#fff}.mec-event-grid-novel .mec-event-address,.mec-event-grid-novel .mec-event-detail,.mec-event-grid-novel .mec-event-month,.mec-event-grid-novel .mec-local-time-details{position:relative;padding-left:35px;font-size:15px;line-height:30px;color:rgba(255,255,255,.4)}.mec-event-grid-novel .mec-event-address::before,.mec-event-grid-novel .mec-event-detail::before,.mec-event-grid-novel .mec-event-month::before,.mec-event-grid-novel .mec-local-time-details:before{position:absolute;top:6px;left:6px;font-size:17px;font-family:simple-line-icons;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1}.mec-event-grid-novel .mec-local-time-details::before{content:"\e007"}.mec-event-grid-novel .mec-event-month::before{content:"\e075"}.mec-event-grid-novel .mec-event-detail::before{content:"\e081"}.mec-event-grid-novel .mec-event-address::before{content:"\e096"}.mec-event-grid-novel .mec-event-footer{clear:both;padding:20px 0;border-top:none;background:0 0}.mec-event-grid-novel .mec-event-footer .mec-booking-button{right:auto;left:0;height:42px;width:148px;padding:0 20px;font-size:14px;font-weight:400;line-height:42px;text-align:center;color:#fff;background:0 0;border-color:rgba(255,255,255,.1);border-radius:50px}.mec-event-grid-novel .mec-event-footer .mec-booking-button:hover{background-color:rgba(255,255,255,.1)}.mec-event-grid-novel .mec-event-sharing-wrap{left:175px;cursor:pointer;padding-left:0}.mec-event-grid-novel .mec-event-sharing-wrap>li{border-color:rgba(255,255,255,.1);border-radius:50%}.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing{top:-5px;left:0;padding:5px 10px 2px 50px;min-width:150px;width:inherit;height:37px;background-color:rgba(255,255,255,.1);-webkit-box-shadow:none;box-shadow:none;border:none;border-radius:50px}.mec-event-grid-novel .mec-event-sharing-wrap:hover>li{background-color:rgba(255,255,255,.1)}.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing::after,.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing::before{display:none}.mec-event-grid-novel .mec-event-sharing .mec-event-social-icon,.mec-event-grid-novel .mec-event-sharing .mec-event-social-icon a,.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing li i{display:inline}.mec-event-grid-novel .mec-event-sharing .mec-event-social-icon a{padding:0 10px}.mec-event-grid-novel .mec-event-sharing-wrap>li a{color:#fff}.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing li a{color:rgba(255,255,255,.4)}.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing li a:hover{color:rgba(255,255,255,1)}@media only screen and (max-width:1200px){.mec-event-grid-novel .row .col-md-6.col-sm-6{width:100%;float:none}.mec-event-grid-novel .mec-event-image{float:none;margin-top:-20px;margin-bottom:20px}.mec-event-grid-novel .mec-event-detail-wrap{margin-left:20px}.mec-event-grid-novel .mec-event-footer{margin-top:30px}}@media only screen and (max-width:767px){.mec-event-grid-novel .mec-event-footer{margin-top:0;padding-top:30px;margin-bottom:24px}.mec-event-grid-novel .mec-event-footer .mec-booking-button{display:block;position:relative}.mec-event-grid-novel .mec-event-sharing-wrap{left:0;bottom:-55px;padding-left:0}.mec-event-grid-novel .mec-event-content h4 a{font-size:20px;line-height:1.3}}.mec-event-grid-novel .mec-event-sharing-wrap{padding-left:0}.mec-event-grid-novel .mec-event-sharing-wrap .mec-event-sharing{width:fit-content;z-index:999999}@media(min-width:1280px){.mec-event-grid-novel .col-md-4.col-sm-4 .mec-event-article img{width:100px;height:100px}.mec-event-grid-novel .col-md-4.col-sm-4 .mec-event-detail-wrap{margin-left:150px}}@media(min-width:760px) and (max-width:1024px){.mec-event-grid-novel .col-md-4.col-sm-4{width:100%}.mec-event-grid-novel .mec-event-image{float:left}.mec-event-grid-novel .col-md-4.col-sm-4 .mec-event-article img{width:100px;height:100px}}.mec-event-cover-modern{position:relative}.mec-event-cover-modern .mec-event-cover-a{background:0 0;position:absolute;color:#fff;bottom:0;left:0;text-decoration:none}.mec-event-cover-modern .mec-event-cover-a .mec-event-overlay{transition:all .5s;opacity:.8;width:100%;height:100%;position:absolute}.mec-event-cover-modern .mec-event-cover-a:hover .mec-event-overlay{opacity:1}.mec-event-cover-modern .mec-event-detail{padding:40px;position:relative}.mec-event-cover-modern .mec-event-cover-a:hover .mec-event-tag{color:#333;transition:all .5s}.mec-event-cover-modern .mec-event-cover-a .mec-event-title:hover{text-decoration:underline}.mec-event-cover-modern .mec-event-tag{background:#fff;display:inline-block;padding:5px 9px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:1px;margin-bottom:24px}.mec-event-cover-modern .mec-event-date{text-transform:uppercase;font-size:17px;font-weight:300}.mec-event-cover-modern .mec-event-title{color:#fff;text-transform:uppercase;font-size:40px;font-weight:700;margin:6px 0}.mec-event-cover-modern .mec-event-place{font-weight:400;font-size:18px;font-family:Roboto,sans-serif}@media only screen and (max-width:767px){.mec-event-cover-modern .mec-event-cover-a{width:100%}}.mec-event-cover-classic{position:relative;overflow:hidden;background:#fff;padding:6px;border:1px solid #e8e8e8}.mec-event-cover-classic .mec-event-overlay{position:absolute;left:6px;right:6px;bottom:6px;top:6px;width:auto;height:auto;background-color:rgba(36,36,36,.4);transition:all .33s ease-in-out}.mec-event-cover-classic:hover .mec-event-overlay{background-color:rgba(36,36,36,.6)}.mec-event-cover-classic .mec-event-content{font-size:15px;color:#fff;position:absolute;bottom:0;padding:50px 35px;transition:all .33s ease-in-out}.mec-event-cover-classic .mec-event-date{font-size:14px;text-transform:uppercase;font-weight:400;line-height:1.6;text-align:left}.mec-event-cover-classic .mec-event-date span{display:block;font-weight:700;font-size:16px}.mec-event-cover-classic .mec-event-title{color:#fff;margin:20px 0 38px;font-size:24px;font-weight:700;text-transform:uppercase;font-style:normal}.mec-event-cover-classic .mec-btn-wrapper{text-align:left}.mec-event-cover-classic .mec-event-icon{font-size:18px;float:left;margin-right:14px;color:#fff;padding:13px}.mec-event-cover-classic .mec-event-button{color:#fff;background-color:#191919;border:2px #191919 solid;padding:12px 20px;letter-spacing:3px;font-size:12px;font-weight:700;font-style:normal;transition:all .22s ease;text-decoration:none}.mec-event-cover-classic .mec-event-button:hover{color:#191919;background-color:#fff;border-color:#fff;border-radius:1px}.mec-event-cover-classic .mec-event-image img{min-width:100%}@media only screen and (max-width:960px){.mec-event-cover-classic .mec-event-content{padding:20px}.mec-event-cover-classic .mec-event-button{font-size:11px;padding:7px 10px;letter-spacing:1px}.mec-event-cover-classic .mec-event-title{font-size:19px;margin:15px 0 25px}.mec-event-cover-classic .mec-event-date{font-size:12px}}@media only screen and (max-width:767px){.mec-event-cover-classic{margin-bottom:30px}}@media only screen and (max-width:479px){.mec-event-cover-classic .mec-event-content{padding:15px;font-size:15px}.mec-event-cover-classic .mec-event-title{font-size:15px;margin:10px 0}.mec-event-cover-classic .mec-event-button{font-size:10px;padding:6px;letter-spacing:1px}.mec-event-cover-classic .mec-event-icon{padding:10px}}.mec-load-more-wrap{text-align:center;display:block;width:100%;padding-top:20px;text-align:center;position:relative}.mec-load-more-button{box-shadow:none;transition:all .21s ease;font-size:12px;font-weight:500;letter-spacing:1px;text-transform:uppercase;background:#fff;color:#767676;border:2px solid #e8e8e8;border-radius:50px;padding:0 28px;margin-bottom:20px;cursor:pointer;line-height:40px;font-family:Montserrat,Helvetica,Arial,sans-serif;height:42px;display:inline-block}.mec-load-more-button:hover{background:#191919;color:#fff;border-color:#191919}.mec-load-more-loading{content:url(../img/ajax-loader.gif);cursor:wait;background:0 0;border-style:none}.mec-load-more-loading:hover{background:0 0}.mec-modal-preloader,.mec-month-navigator-loading{width:100%;height:100%;background:no-repeat rgba(255,255,255,.88) url(../img/ajax-loader.gif) center;border-style:none;position:fixed;left:0;right:0;bottom:0;top:0;z-index:9}.mec-event-calendar-classic .mec-calendar-side .mec-calendar-table{min-height:1024px}.mec-calendar-side .mec-calendar-table{min-height:450px}.mec-skin-weekly-view-events-container.mec-month-navigator-loading{margin-top:0}.mec-calendar.mec-event-calendar-classic .mec-calendar-side{display:block}.mec-skin-daily-view-events-container.mec-month-navigator-loading{margin-top:0}@media only screen and (min-width:961px){.mec-wrap.mec-sm959 .mec-calendar-side .mec-calendar-table{min-height:1px}}@media only screen and (max-width:479px){.mec-calendar-side .mec-calendar-table{min-height:1px}}.mec-event-cover-clean{position:relative;border:1px solid #e6e6e6;padding:8px}.mec-event-cover-clean .mec-event-overlay{height:100%;background-color:rgba(36,36,36,.4);position:absolute;width:100%;left:0;border:8px solid #fff;top:0;transition:all .5s ease-in-out}.mec-event-cover-clean .mec-event-content{color:#fff;position:absolute;bottom:20px;padding:40px 60px;transition:all .5s ease-in-out}.mec-event-cover-clean .mec-event-title{color:#fff;font-weight:700;margin:46px 0 19px;font-size:29px;text-transform:uppercase;text-shadow:0 0 1px rgba(0,0,0,.5)}.mec-event-cover-clean .mec-event-title a{color:#fff;transition:all .5s;text-decoration:none;outline:0;border:none;box-shadow:none}.mec-event-cover-clean .mec-event-title a:hover{text-decoration:underline}.mec-event-cover-clean .mec-event-date{position:absolute;top:-20px;right:60px;color:#fff;width:60px;padding:14px 10px;z-index:1}.mec-event-cover-clean .mec-event-date div{text-align:center;text-transform:uppercase;letter-spacing:1px;line-height:16px}.mec-event-cover-clean .mec-event-date .dday{padding-bottom:15px;border-bottom:1px solid rgba(255,255,255,.5);margin-bottom:13px;font-size:24px}.mec-event-cover-clean .mec-event-date .dmonth{letter-spacing:2px}.mec-event-cover-clean .mec-event-place{font-size:18px;font-family:Roboto,sans-serif}.mec-event-cover-clean .mec-event-image img{width:100%}@media only screen and (max-width:768px){.mec-event-cover-clean .mec-event-content{padding:20px;bottom:5px}.mec-event-cover-clean .mec-event-title{font-size:23px}.mec-event-cover-clean .mec-event-date{right:20px;padding:10px;width:50px}}@media only screen and (max-width:479px){.mec-event-cover-clean .mec-event-content{padding:10px}.mec-event-cover-clean .mec-event-title{font-size:19px;padding-right:25px}.mec-event-cover-clean .mec-event-date{right:-20px;top:-10px}.mec-event-cover-clean .mec-event-detail{font-size:12px}}.mec-month-divider{text-align:center;margin:60px 0 40px 0}.widget .mec-month-divider{margin:10px 0}.mec-month-divider span{text-transform:uppercase;font-size:22px;font-weight:700;padding-bottom:5px;color:#313131;border-bottom:4px solid #ebebeb;width:100%;display:block;padding-bottom:10px;position:relative}.mec-month-divider span:before{border-bottom:4px solid #40d9f1;font-size:6px;content:"";text-align:center;position:absolute;bottom:-4px;margin-left:-30px;left:50%;width:60px}.widget .mec-month-divider span{font-size:13px}.mec-event-list-standard .mec-events-pagination{margin-top:60px;border-top:4px solid #ebebeb;min-height:80px;padding-top:20px}.mec-event-list-standard .mec-events-pagination .mec-events-pag-previous{float:left;margin-left:0}.mec-event-list-standard .mec-events-pagination .mec-events-pag-next{float:right;margin-right:0}.mec-event-list-standard .mec-event-article{position:relative;display:block;margin-bottom:25px;border:1px solid #e9e9e9;box-shadow:0 2px 0 0 rgba(0,0,0,.016)}.mec-event-list-standard .mec-topsec{display:table;width:100%}.mec-event-list-standard .col-md-3.mec-event-image-wrap{padding-left:0}.mec-event-list-standard .mec-event-content{padding-top:15px;padding-right:30px}.mec-event-list-standard .mec-event-title{font-size:29px;font-weight:700;letter-spacing:-1px;margin:0 0 10px}.mec-event-list-standard .mec-event-title a{color:#292929;transition:color .3s ease}.mec-event-list-standard .mec-col-table-c{display:table-cell;height:100%;vertical-align:middle;float:none!important}.mec-event-list-standard .mec-col-table-c.mec-event-meta-wrap{padding-top:15px}.mec-event-list-standard .mec-col-table-c.mec-event-image-wrap{vertical-align:top}.mec-topsec .mec-event-image{line-height:1px}.mec-event-list-standard .mec-event-meta-wrap{border-left:1px solid #eee}.mec-event-list-standard .mec-time-details{text-transform:uppercase;font-size:11px;font-weight:300;padding-top:0;text-align:left;padding-left:30px}.mec-event-list-standard .mec-event-meta .mec-event-address{font-style:normal;letter-spacing:0;font-size:13px;color:#8a8a8a}.mec-event-list-standard .mec-event-meta span.mec-event-d,.mec-event-list-standard .mec-event-meta span.mec-event-m{font-size:17px;font-weight:700;padding-right:6px;color:#444;text-transform:uppercase}.mec-event-list-standard .mec-date-details,.mec-event-list-standard .mec-local-time-details,.mec-event-list-standard .mec-time-details,.mec-event-list-standard .mec-venue-details{position:relative;padding-left:28px;margin-bottom:10px}.mec-event-list-standard .mec-date-details:before,.mec-event-list-standard .mec-local-time-details:before,.mec-event-list-standard .mec-time-details:before,.mec-event-list-standard .mec-venue-details:before{content:"\f041";font-family:fontawesome;position:absolute;left:6px;font-size:15px}.mec-event-list-standard .mec-date-details:before{content:"\f073"}.mec-event-list-standard .mec-time-details:before{content:"\f017"}.mec-event-list-standard .mec-local-time-details:before{content:"\f0ac"}.mec-event-list-standard .mec-local-time-details .mec-local-title{display:block}.mec-event-list-standard .mec-local-time-details .mec-local-date,.mec-event-list-standard .mec-local-time-details .mec-local-time{font-style:normal;letter-spacing:0;font-size:11px;color:#8a8a8a;font-weight:300;line-height:1.6}.mec-event-list-minimal .mec-event-title a{color:#292929;transition:color .3s ease}.mec-event-meta-wrap .mec-price-details{margin-bottom:10px}.mec-price-details i{margin-right:4px;vertical-align:text-top}.mec-event-meta-wrap .mec-event-meta .mec-price-details i:before{font-size:15px}.mec-event-list-standard .mec-price-details{text-transform:uppercase;font-size:11px;font-weight:300}.mec-event-list-standard .mec-price-details i{margin-left:6px}.mec-month-side .mec-price-details{margin-left:2px}.mec-event-article .mec-price-details i,.mec-month-side .mec-price-details i,.tooltipster-sidetip.tooltipster-shadow .tooltipster-content .mec-price-details i{padding-top:4px;vertical-align:unset}.mec-event-list-standard ul.mec-categories{position:relative;padding-left:28px;margin-bottom:10px}.mec-event-list-standard ul.mec-categories li.mec-category a:before{font-size:16px!important;content:"\f105";position:absolute;font-family:fontawesome;left:8px;font-size:15px}@media only screen and (max-width:960px){.mec-event-list-standard .mec-topsec{display:block}.mec-event-list-standard .mec-col-table-c.mec-event-image-wrap{display:block;width:40%}.mec-event-list-standard .mec-col-table-c.mec-event-content-wrap{display:block;min-height:230px}.mec-event-list-standard .mec-event-meta-wrap{display:block;border-left:none;border-top:1px solid #eee;width:100%;float:none;padding-top:20px}}@media only screen and (min-width:480px) and (max-width:960px){.mec-event-list-standard .mec-col-table-c.mec-event-content-wrap,.mec-event-list-standard .mec-col-table-c.mec-event-image-wrap{display:table-cell}}@media only screen and (max-width:479px){.mec-event-list-standard .mec-col-table-c.mec-event-image-wrap,.mec-event-list-standard .mec-col-table-c.mec-event-image-wrap img{float:none;width:100%;padding:0}.mec-event-list-standard .mec-col-table-c.mec-event-content-wrap{padding:10px 10px 10px 30px}}.mec-localtime-details{color:#777;font-weight:400;line-height:12px;font-size:12px}.mec-localtime-details .mec-localdate,.mec-localtime-details .mec-localtime,.mec-localtime-details .mec-localtitle{display:inline-block}.mec-localtime-details .mec-start-date-label{padding-right:5px}.mec-localtime-details .mec-localtime{padding-left:5px}.mec-event-list-minimal .mec-localtime-details{display:inline-flex;font-size:15px;font-weight:300;line-height:1;letter-spacing:0;color:#9a9a9a;padding-left:9px}.mec-event-grid-classic .mec-localtime-details,.mec-event-grid-clean .mec-localtime-details{color:#fff;font-weight:400;font-size:11px;text-transform:uppercase;letter-spacing:-.02em;color:#fff;padding:0 0;line-height:18px;margin-top:-3px}.mec-event-grid-clean .mec-localtime-details,.mec-event-grid-colorful .mec-localtime-details,.tooltipster-box .mec-localtime-details{line-height:22px;padding-top:10px}.mec-event-grid-colorful .mec-localtime-details{color:#fff}.mec-event-grid-classic .mec-localtime-details{text-align:center}.mec-event-grid-minimal .mec-localtime-details{line-height:22px}.mec-wrap .mec-yearly-view-wrap .mec-localtime-wrap i{display:inline-block;margin-left:-1px}.mec-timetable-t2-content .mec-local-time-details{padding-left:19px}.mec-timetable-t2-content .mec-local-time-details{position:relative}.mec-timetable-t2-content .mec-local-time-details:before{content:"\e007";font-family:simple-line-icons;position:absolute;font-size:12px;margin-right:4px;left:0}.mec-masonry .mec-masonry-col6 .mec-localtime-details{margin-top:10px;line-height:21px}.mec-masonry .mec-masonry-col6 .mec-localtime-details i{height:auto}.mec-event-cover-classic .mec-localtime-details{color:#fff;margin-top:12px}.mec-event-cover-classic .mec-localtime-details i{padding-right:8px}.mec-event-cover-clean .mec-localtime-details{color:#fff;margin-bottom:20px}.mec-event-cover-modern .mec-localtime-details{color:#fff;margin:10px 0;font-weight:400;font-size:18px}.mec-event-countdown-style1 .mec-localtime-details,.mec-event-countdown-style2 .mec-localtime-details,.mec-event-countdown-style3 .mec-localtime-details{color:#fff;padding:8px 5px 0;font-size:14px;line-height:25px}.mec-event-countdown-style1 .mec-localtime-details{text-align:center}.mec-event-hover-carousel-type4 .mec-localtime-details{display:block;color:#fff;font-size:11px}.mec-event-footer-carousel-type3 .mec-localtime-details .mec-localdate,.mec-event-footer-carousel-type3 .mec-localtime-details .mec-localtime,.mec-event-footer-carousel-type3 .mec-localtime-details .mec-localtitle,.mec-event-footer-carousel-type3 .mec-localtime-details span{display:inline-flex;line-height:20px;text-align:left;margin:0!important;font-size:12px;color:#777;line-height:28px}.mec-owl-crousel-skin-type1 .mec-localtime-details{margin-top:-7px;margin-bottom:12px}.mec-wrap .mec-slider-t5 .mec-localtime-details{margin-top:14px;line-height:20px}.mec-wrap .mec-slider-t5 .mec-localtime-details i{font-size:18px;height:20px}.mec-timeline-event-local-time{background:rgba(64,217,241,.11);display:inline-block;padding:7px 20px 11px;border-radius:20px;line-height:1.24}.mec-timeline-event-local-time .mec-localtime-details{font-size:13px;font-weight:500;vertical-align:middle;margin-left:6px;color:inherit;line-height:24px}.mec-timeline-event-local-time .mec-localtime-details i{font-size:17px;vertical-align:middle;margin-left:-7px;padding-right:3px}.mec-booking-modal{background-color:#e6f7ff}.mec-booking-modal .mec-booking-shortcode .mec-book-form-gateway-label input[type=radio]:before{top:-1px}.mec-modal-booking-button{box-shadow:none;transition:all .21s ease;font-size:11px;font-weight:500;letter-spacing:1px;text-transform:uppercase;background:#fff;color:#767676;border:1px solid #e8e8e8;padding:12px 16px;line-height:37px;height:38px;margin:12px 0}.mec-modal-booking-button:hover{background:#191919;color:#fff;border-color:#191919}.mec-modal-booking-button.mec-mb-icon i{font-size:14px}.mec-event-list-classic .mec-modal-booking-button{height:0;line-height:1;margin:7px 0 0;display:inline-table;letter-spacing:0;padding:12px 14px}.mec-event-grid-novel ul.mec-categories{position:relative;line-height:30px;font-size:15px}.mec-event-grid-novel ul.mec-categories li.mec-category a{padding-left:35px;color:rgba(255,255,255,.4);line-height:30px;font-size:15px}.mec-event-grid-novel ul.mec-categories li.mec-category a:before{font-size:16px!important;content:"\f105";position:absolute;font-family:fontawesome;left:8px;font-size:15px;color:rgba(255,255,255,.4)}.mec-calendar-events-side .mec-modal-booking-button,.mec-event-container-classic .mec-modal-booking-button,.mec-event-grid-minimal .mec-modal-booking-button,.mec-event-list-minimal .mec-modal-booking-button,.mec-timetable-t2-col .mec-modal-booking-button{margin:0;color:#282828;font-size:12px;transition:all .5s ease;-webkit-transition:all .5s ease;position:relative;padding:0 0 0 24px;background:0 0;text-align:left;display:inline;border:0;font-weight:700}.mec-timetable-t2-col .mec-modal-booking-button{color:#fff;padding-left:19px}.mec-timetable-t2-col .mec-modal-booking-button:hover{color:#282828}.mec-event-list-minimal .mec-modal-booking-button{margin:0 4px 0 84px}.mec-calendar-events-side .mec-modal-booking-button:before,.mec-event-container-classic .mec-modal-booking-button:before,.mec-event-grid-minimal .mec-modal-booking-button:before,.mec-event-list-minimal .mec-modal-booking-button:before{content:'';position:absolute;background:#7a7272;width:18px;height:1px;left:0;top:45%;transition:all .1s ease;-webkit-transition:all .1s ease}.mec-skin-carousel-container .mec-modal-booking-button{line-height:70px}.mec-event-list-modern .mec-modal-booking-button.mec-mb-icon{border-radius:1px;letter-spacing:2px;border:1px solid #e6e6e6;color:#333;background-color:#fff;padding:13px 12px 13px 14px;font-weight:700;box-shadow:0 2px 0 0 rgba(0,0,0,.016);transition:all .28s ease;line-height:unset}.mec-event-list-modern .mec-modal-booking-button.mec-mb-icon:hover{border-color:#222;background:#222;color:#fff}.mec-event-footer .mec-modal-booking-button,.mec-skin-carousel-container .mec-event-footer-carousel-type2 .mec-modal-booking-button{position:absolute;top:20px;right:125px;margin:0;padding:0 16px;line-height:37px}.mec-skin-carousel-container .mec-event-footer-carousel-type2 .mec-modal-booking-button{top:0;line-height:41px;height:41px;right:121px}.mec-skin-carousel-container .mec-event-footer-carousel-type3 .mec-modal-booking-button{line-height:18px;font-size:12px;letter-spacing:0;float:right;height:41px;margin:0 12px 0 0}.mec-skin-carousel-container .mec-owl-crousel-skin-type4 .mec-modal-booking-button{color:#fff;background-color:#191919;border:2px #191919 solid;padding:10px 14px;letter-spacing:1.5px;font-size:11px;font-weight:700;font-style:normal;transition:all .22s ease;text-decoration:none;margin:0 0 0 12px}.mec-skin-carousel-container .mec-owl-crousel-skin-type4 .mec-modal-booking-button:hover{color:#191919;background-color:#fff;border:2px #fff solid}.mec-event-grid-modern .mec-event-footer .mec-modal-booking-button{right:auto;left:110px}.mec-event-grid-simple .mec-modal-booking-button,.mec-events-agenda .mec-modal-booking-button{margin:0;font-size:12px;transition:all .5s ease;-webkit-transition:all .5s ease;position:relative;padding:0;background:0 0;text-align:left;display:inline;border:0;font-weight:700}.mec-events-agenda .mec-modal-booking-button{display:block;height:unset;padding-left:173px;line-height:14px;margin-bottom:7px}.mec-yearly-view-wrap .mec-modal-booking-button{margin:0;padding-left:14px;text-transform:capitalize}.mec-event-grid-novel .mec-event-footer .mec-modal-booking-button.mec-mb-icon{right:auto;left:238px;width:36px;height:36px;display:table-cell;vertical-align:middle;padding:0 10px;border-color:rgba(255,255,255,.1);background-color:rgba(0,0,0,0);color:#fff;border-radius:36px}.mec-event-grid-novel .mec-event-footer .mec-modal-booking-button.mec-mb-icon:hover{background-color:rgba(255,255,255,.1)}.mec-event-grid-simple .mec-modal-booking-button:hover,.mec-events-agenda .mec-modal-booking-button:hover,.mec-events-yearlu .mec-modal-booking-button:hover{color:#191919}.mec-event-masonry .mec-event-footer .mec-modal-booking-button{font-size:12px;padding:0 31px;line-height:49px;height:50px;top:0;box-shadow:0 5px 11px -3px rgba(0,0,0,.05);right:auto;left:155px}.mec-timeline-event .mec-modal-booking-button{position:absolute;top:0;right:0;display:inline-block;padding:7px 20px 7px;line-height:22px;height:unset;border:unset;text-transform:capitalize;font-weight:500;font-size:13px;letter-spacing:0;margin:0;border-radius:0 0 0 10px}.mec-timeline-event .mec-modal-booking-button:hover{background:#191919;color:#fff}.mec-skin-daily-view-events-container .mec-modal-booking-button,.mec-weekly-view-dates-events .mec-event-article .mec-modal-booking-button{position:absolute;top:50%;transform:translateY(-50%);right:15px;line-height:26px;height:49px;border:unset;text-align:center;display:inline-block;background:#ededed;color:#191919;padding:12px;border-radius:2px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:2px;transition:all .24s ease;margin:0}.mec-skin-daily-view-events-container .mec-modal-booking-button:hover,.mec-weekly-view-dates-events .mec-event-article .mec-modal-booking-button:hover{background:#292929;color:#fff}@media(max-width:1023px){.mec-skin-daily-view-events-container .mec-modal-booking-button,.mec-weekly-view-dates-events .mec-event-article .mec-modal-booking-button{position:relative;top:unset;transform:unset;margin:14px 16px 0;padding:8px;line-height:20px;height:35px}}@media(max-width:768px){.featherlight .featherlight-inner{width:100%}.mec-events-agenda .mec-modal-booking-button{padding:0}}@media(max-width:480px){.mec-booking-modal .mec-events-meta-group-booking-shortcode{padding:20px}.mec-booking-modal .mec-booking-shortcode .mec-book-reg-field-mec_email,.mec-booking-modal .mec-booking-shortcode .mec-book-reg-field-name{width:100%}.mec-booking-modal .mec-booking-shortcode button#mec-book-form-btn-step-2{margin-left:20px}.mec-booking-modal .mec-booking-shortcode .mec-click-pay button[type=submit]{bottom:22px}.mec-calendar-events-side .mec-modal-booking-button:before,.mec-event-container-classic .mec-modal-booking-button:before,.mec-event-grid-minimal .mec-modal-booking-button:before,.mec-event-list-minimal .mec-modal-booking-button:before{display:none}.mec-calendar-events-side .mec-modal-booking-button,.mec-event-container-classic .mec-modal-booking-button,.mec-event-grid-minimal .mec-modal-booking-button,.mec-event-list-minimal .mec-modal-booking-button,.mec-timetable-t2-col .mec-modal-booking-button{margin:0;padding:0}.mec-event-grid-modern .mec-event-footer .mec-booking-button{top:20px}}.mec-wrap .mec-events-cal-links{margin-bottom:0}.mec-single-event #mec-wrap{padding:0;margin-top:35px}.mec-wrap .mec-single-title,.single-mec-events .mec-wrap.mec-no-access-error h1{margin-top:0;margin-bottom:30px;font-weight:700;font-size:33px}.mec-single-event .mec-event-content{padding:40px 0 30px;margin-bottom:10px}.mec-single-event .mec-events-meta-group-booking,.mec-single-event .mec-frontbox{margin-bottom:30px;padding:20px 30px;background:#fff;border:1px solid #e6e6e6;box-shadow:0 2px 0 0 rgba(0,0,0,.016)}.mec-wrap #main-content{overflow:hidden;padding-top:35px}.mec-single-event .mec-map-get-direction-address-cnt{position:relative}.mec-single-event .mec-map-get-direction-address-cnt input.mec-map-get-direction-address{width:100%;height:46px;padding:13px 10px;margin-bottom:0;background:#fcfcfc;border:1px solid #e0e0e0;border-radius:0;box-shadow:inset 0 2px 5px rgba(0,0,0,.081)}.mec-single-event .mec-map-get-direction-address-cnt input.mec-map-get-direction-address:focus{color:#444;background:#fff;border-color:#b0b0b0;box-shadow:0 0 3px rgba(0,0,0,.2)}.mec-single-event .mec-map-get-direction-btn-cnt input{width:100%}.mec-single-event .mec-map-get-direction-reset{position:absolute;z-index:2;top:5px;right:10px;font-size:11px;cursor:pointer}.mec-events-meta-group-tags{margin-top:20px}.mec-events-meta-group-tags a{display:inline-block;color:#444;font-size:11px;text-transform:uppercase;letter-spacing:1.5px;font-weight:500;padding:3px 7px;border:1px solid #ddd;border-radius:2px;background:#fff;margin:1px 3px}.mec-events-meta-group-tags a:hover{text-decoration:underline;background:#f9f9f9}.mec-local-time-details li{list-style:none}.mec-single-event:not(.mec-single-modern) .mec-local-time-details{background:#f7f7f7;padding:12px 14px 8px;margin-bottom:12px;vertical-align:baseline;position:relative;border:none}.mec-single-event:not(.mec-single-modern) .mec-local-time-details ul{margin:0;padding-left:35px}.mec-single-event:not(.mec-single-modern) .mec-local-time-details h3{border:none;padding-left:15px}.mec-single-event:not(.mec-single-modern) .mec-local-time-details h3:before{display:none}.mec-single-event.mec-single-modern i.mec-sl-speedometer{display:none}.mec-single-event .mec-events-meta-group-booking{padding-bottom:30px}.mec-single-event .mec-events-meta-group-booking ul{list-style:none;margin-left:0;padding-left:0}.mec-single-event .mec-booking .mec-book-bfixed-fields-container{padding-left:15px}.mec-single-event .mec-events-meta-group-booking ul li{padding:0;list-style:none;margin-top:40px}.mec-single-event .mec-events-meta-group-booking h4{margin-bottom:20px;font-size:23px;font-weight:700}.mec-single-event .mec-events-meta-group-booking li h4{font-size:19px}.mec-single-event .mec-events-meta-group-booking button,.mec-single-event .mec-events-meta-group-booking input{border-radius:0;margin-bottom:6px}.mec-single-event .mec-events-meta-group-booking button{min-width:155px;margin-top:5px;margin-left:10px;border-radius:2px;box-shadow:0 2px 1px rgba(0,0,0,.08)}.mec-single-event .mec-events-meta-group-booking button.mec-book-form-back-button{background:#c4cace;float:left}.mec-single-event .mec-events-meta-group-booking button.mec-book-form-back-button:hover{background:#000}.mec-single-event .mec-events-meta-group-booking button.mec-book-form-next-button{float:left;margin-left:0}button#mec-book-form-back-btn-step-3{float:none}.mec-next-occ-booking,.mec-next-occ-booking-p{padding-left:15px}.mec-events-meta-group-booking .mec-next-occ-booking,.mec-events-meta-group-booking .mec-next-occ-booking-p{padding:0;font-size:12px;letter-spacing:0;margin:3px 0;padding:5px 1em 3px 0}.mec-book-username-password-wrapper{padding:0 15px}.lity-container .mec-next-occ-booking,.lity-container .mec-next-occ-booking-p{padding-left:0}.mec-single-event .mec-events-meta-group-booking .mec-click-pay{max-width:350px}.mec-single-event .mec-events-meta-group-booking .mec-click-pay #mec_woo_add_to_cart_btn_r,.mec-single-event .mec-events-meta-group-booking .mec-click-pay button.mec-book-form-next-button{float:right}.mec-single-event .mec-events-meta-group-booking .mec-click-pay #mec_woo_add_to_cart_btn_r:hover,.mec-single-event .mec-events-meta-group-booking .mec-click-pay button.mec-book-form-next-button:hover{background:#000}.lity-container .mec-click-pay{max-width:400px}.lity-container .mec-book-form-btn-wrap button.mec-book-form-next-button,.lity-container .mec-click-pay #mec_woo_add_to_cart_btn_r{float:right}.lity-container button.mec-book-form-next-button{float:right}.lity-container .mec-click-pay #mec_woo_add_to_cart_btn_r:hover,.lity-container .mec-click-pay button.mec-book-form-next-button:hover{background:#000}.mec-single-event .mec-events-meta-group-booking .mec-click-next{float:right;position:relative;width:calc(100% - 186px)}.lity-container .mec-click-next{float:right;position:relative;width:calc(100% - 186px)}.mec-single-event .mec-book-form-coupon button{margin-left:0}.mec-single-event .mec-book-form-gateway-checkout button{margin-left:0}.mec-single-event .mec-single-event .mec-book-form-gateway-checkout button{margin-right:20px}.lity-content .mec-book-form-back-button{position:relative;border:none;border-radius:0;color:#fff;display:inline-block;font-size:12px;letter-spacing:1px;line-height:1.5;text-transform:uppercase;font-weight:600;text-decoration:none;cursor:pointer;margin-right:10px;line-height:1;padding:18px 20px 16px;-webkit-transition:all .21s ease;-moz-transition:all .21s ease;transition:all .21s ease;min-width:170px;margin-top:5px;border-radius:0;margin-bottom:6px;background:#c4cace}.lity-content .mec-book-form-back-button:hover{background:#000}.lity-content button#mec-book-form-back-btn-step-3{float:none}.lity-content .mec-book-form-next-button{float:left}.lity-content .mec-book-bfixed-fields-container{list-style:none;padding-left:0}.mec-single-event .mec-book-first,.mec-single-event .mec-book-form-gateways,.mec-single-event .mec-book-form-price,.mec-single-event .mec-event-tickets-list,.mec-single-event form.mec-click-next{padding-left:0;padding-right:0}.mec-single-event label.mec-fill-attendees{margin-left:0}.mec-wrap .mec-events-meta-group-booking #mec-book-form-back-btn-step-2,.mec-wrap .mec-events-meta-group-booking #mec-book-form-back-btn-step-3,.mec-wrap .mec-events-meta-group-booking #mec-book-form-btn-step-1{margin-left:0}.mec-wrap .mec-booking-form-container .col-md-12{padding-left:0}.mec-wrap .mec-events-meta-group-booking .mec-wrap-checkout.row{margin:0}.mec-wrap .mec-wrap-checkout .mec-book-form-gateways .mec-book-form-gateway-label{padding-left:3px}.mec-wrap p.mec-gateway-comment{margin-top:20px}.mec-single-event .mec-events-meta-group-booking .mec-event-ticket-available{display:block;margin-bottom:20px;margin-top:-17px;font-size:11px;color:#8a8a8a}.mec-single-event .mec-events-meta-group-booking .mec-book-price-total{display:inline-block;margin-bottom:10px;font-size:26px;color:#39c36e;font-weight:700;padding:10px 0}.mec-single-event .mec-events-meta-group-booking form{margin:0}.mec-single-event .mec-events-meta-group-booking h5 span,.mec-single-event .mec-events-meta-group-booking label{color:#424242;font-size:12px;font-weight:300;letter-spacing:0;margin:3px 0;display:block;clear:none;padding:5px 1em 3px 0}.mec-single-event .mec-events-meta-group-booking h5 span{display:inline-block}.mec-single-event .mec-events-meta-group-booking h5 span.mec-ticket-variation-name{padding-right:5px;text-transform:capitalize}.mec-single-event .mec-events-meta-group-booking input::-webkit-input-placeholder{color:#aaa}.mec-single-event .mec-events-meta-group-booking input:-moz-placeholder{color:#aaa}.mec-single-event .mec-events-meta-group-booking input[type=date],.mec-single-event .mec-events-meta-group-booking input[type=email],.mec-single-event .mec-events-meta-group-booking input[type=number],.mec-single-event .mec-events-meta-group-booking input[type=password],.mec-single-event .mec-events-meta-group-booking input[type=tel],.mec-single-event .mec-events-meta-group-booking input[type=text],.mec-single-event .mec-events-meta-group-booking select,.mec-single-event .mec-events-meta-group-booking textarea{display:block;background:#fcfcfc;min-height:42px;min-width:180px;font-size:13px;border:1px solid #e0e0e0;padding:13px 10px;width:330px;margin-bottom:20px;box-shadow:inset 0 2px 4px rgba(0,0,0,.051);clear:both}.wbmec-mandatory{padding-left:5px;font-size:14px}.mec-single-event .mec-events-meta-group-booking .mec-red-notification input,.mec-single-event .mec-events-meta-group-booking .mec-red-notification select,.mec-single-event .mec-events-meta-group-booking .mec-red-notification textarea{border:1px solid #ff3c3c!important}.lity .mec-events-meta-group-booking .mec-red-notification input[type=checkbox],.lity .mec-events-meta-group-booking .mec-red-notification input[type=radio],.mec-single-event .mec-events-meta-group-booking .mec-red-notification input[type=checkbox],.mec-single-event .mec-events-meta-group-booking .mec-red-notification input[type=radio]{outline:1px solid #ff3c3c!important}.lity .mec-book-ticket-container .mec-red-notification input,.lity .mec-book-ticket-container .mec-red-notification select,.lity .mec-book-ticket-container .mec-red-notification textarea{border:1px solid #ff3c3c!important}.mec-booking .woocommerce-notices-wrapper .woocommerce-message{color:#0dbf52;background-color:#cef7ce;margin:0;padding-top:1rem;line-height:2.9rem;border:0}.mec-booking .woocommerce-notices-wrapper .woocommerce-message a{margin:0}@media only screen and (max-width:479px){.mec-single-event .mec-events-meta-group-booking input[type=date],.mec-single-event .mec-events-meta-group-booking input[type=email],.mec-single-event .mec-events-meta-group-booking input[type=number],.mec-single-event .mec-events-meta-group-booking input[type=password],.mec-single-event .mec-events-meta-group-booking input[type=tel],.mec-single-event .mec-events-meta-group-booking input[type=text],.mec-single-event .mec-events-meta-group-booking select,.mec-single-event .mec-events-meta-group-booking textarea{width:100%}}.mec-single-event .mec-events-meta-group-booking input[type=email]:focus,.mec-single-event .mec-events-meta-group-booking input[type=number]:focus,.mec-single-event .mec-events-meta-group-booking input[type=password]:focus,.mec-single-event .mec-events-meta-group-booking input[type=tel]:focus,.mec-single-event .mec-events-meta-group-booking input[type=text]:.mec-single-event .mec-events-meta-group-booking input[type=date],.mec-single-event .mec-events-meta-group-booking select:focus,.mec-single-event .mec-events-meta-group-booking textarea:focus,focus{border:1px solid #aaa;color:#444;background:#fff;-moz-box-shadow:0 0 3px rgba(0,0,0,.2);-webkit-box-shadow:0 0 3px rgba(0,0,0,.2);box-shadow:0 0 3px rgba(0,0,0,.2);outline:0}.mec-single-event .mec-events-meta-group-booking input[type=checkbox],.mec-single-event .mec-events-meta-group-booking input[type=radio]{margin-right:6px;margin-top:5px;min-height:20px;clear:none;margin:0 0 0 2px}.lity-container .mec-events-meta-group-booking input[type=radio]:before,.mec-single-event .mec-events-meta-group-booking input[type=radio]:before{content:"";display:inline-block;background:#fff;border-radius:18px;width:18px;height:18px;margin:-1px 0 0 -3px;cursor:pointer;border:2px solid #e1e7ed;box-shadow:0 2px 15px -3px rgba(69,77,89,.32)}.lity-container .mec-events-meta-group-booking input[type=radio]:checked:before,.mec-single-event .mec-events-meta-group-booking input[type=radio]:checked:before{border:7px solid #008aff;background:#fff;box-shadow:0 3px 16px -3px #008aff}.lity-container .mec-events-meta-group-booking input[type=radio],.mec-single-event .mec-events-meta-group-booking input[type=radio]{min-height:0;margin:0;margin-right:6px}.mec-single-event .mec-events-meta-group-booking input[type=checkbox]{float:left}.lity-container .mec-events-meta-group-booking .mec_book_first_for_all,.mec-single-event .mec-events-meta-group-booking .mec_book_first_for_all{display:none}.mec-events-meta-group-booking ul.mec-book-price-details{list-style:none;border:1px solid #eee;padding:0;overflow:hidden}.mec-events-meta-group-booking ul.mec-book-price-details li{font-size:15px;color:#a9a9a9;list-style:none;padding:13px 18px;margin:0;float:left;border-right:1px solid #eee}.mec-events-meta-group-booking ul.mec-book-price-details li:last-child{border-right:none}.mec-events-meta-group-booking ul.mec-book-price-details li span.mec-book-price-detail-amount{font-weight:700;font-size:21px;color:#222;display:contents}.lity-container .mec-events-meta-group-booking label.wn-checkbox-label,.mec-single-event .mec-events-meta-group-booking label.wn-checkbox-label{height:14px;width:14px;background-color:transparent;border:1px solid #d4d4d4;position:relative;display:inline-block;-moz-transition:border-color ease .2s;-o-transition:border-color ease .2s;-webkit-transition:border-color ease .2s;transition:border-color ease .2s;cursor:pointer;box-shadow:0 2px 16px -2px rgba(0,0,0,.2);vertical-align:middle;margin-right:3px;margin-top:-2px}.lity-container .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label,.mec-single-event .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label{border-color:#008aff;box-shadow:0 2px 14px -3px #008aff}.lity-container .mec-events-meta-group-booking label.wn-checkbox-label:after,.lity-container .mec-events-meta-group-booking label.wn-checkbox-label:before,.mec-single-event .mec-events-meta-group-booking label.wn-checkbox-label:after,.mec-single-event .mec-events-meta-group-booking label.wn-checkbox-label:before{position:absolute;height:0;width:1px;background-color:#008aff;display:inline-block;-moz-transform-origin:left top;-ms-transform-origin:left top;-o-transform-origin:left top;-webkit-transform-origin:left top;transform-origin:left top;content:'';-webkit-transition:opacity ease .5;-moz-transition:opacity ease .5;transition:opacity ease .5}.lity-container .mec-events-meta-group-booking label.wn-checkbox-label:before,.mec-single-event .mec-events-meta-group-booking label.wn-checkbox-label:before{top:8px;left:7px;box-shadow:0 0 0 2px #fff;-moz-transform:rotate(-145deg);-ms-transform:rotate(-145deg);-o-transform:rotate(-145deg);-webkit-transform:rotate(-145deg);transform:rotate(-145deg)}.lity-container .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label::before,.mec-single-event .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label::before{height:12px;-moz-animation:dothatopcheck .16s ease 0s forwards;-o-animation:dothatopcheck .16s ease 0s forwards;-webkit-animation:dothatopcheck .16s ease 0s forwards;animation:dothatopcheck .16s ease 0s forwards}.lity-container .mec-events-meta-group-booking label.wn-checkbox-label:after,.mec-single-event .mec-events-meta-group-booking label.wn-checkbox-label:after{top:6px;left:3px;-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.lity-container .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label::after,.mec-single-event .mec-events-meta-group-booking input[type=checkbox]:checked+.wn-checkbox-label::after{-moz-animation:dothabottomcheck 80ms ease 0s forwards;-o-animation:dothabottomcheck 80ms ease 0s forwards;-webkit-animation:dothabottomcheck 80ms ease 0s forwards;animation:dothabottomcheck 80ms ease 0s forwards;height:4px}.mec-single-event .mec-events-meta-group-booking button[type=submit]:after,.mec-single-event a.button:after{display:none;font-family:simple-line-icons;content:"\e098";margin-left:4px;-webkit-animation:rotating 1.2s linear infinite;-moz-animation:rotating 1.2s linear infinite;-ms-animation:rotating 1.2s linear infinite;-o-animation:rotating 1.2s linear infinite;animation:rotating 1.2s linear infinite}.mec-single-event .mec-events-meta-group-booking button[type=submit].loading:after,.mec-single-event a.button.loading:after{display:inline-block}.mec-single-event .mec-event-export-module{display:block}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul{display:table;width:100%}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul li{display:table-cell}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul li:last-child{text-align:right}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul li a:hover{color:#fff}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul{padding-left:0;margin:15px 5px}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting{padding-left:0;margin:0}.mec-ticket-price{margin-left:10px;font-size:13px;font-weight:300}.mec-book-reg-field-checkbox label,.mec-book-reg-field-radio label{line-height:1.36}.mec-book-reg-field-checkbox input[type=checkbox],.mec-book-reg-field-radio input[type=radio]{float:left;margin-right:5px!important}.mec-ticket-available-spots .mec-event-ticket-description,.mec-ticket-available-spots .mec-event-ticket-price{font-size:11px}.mec-book-ticket-container .mec-reg-mandatory:nth-child(2) label:after,.mec-book-ticket-container .mec-reg-mandatory:nth-child(3) label:after,.mec-book-ticket-container .wbmec-mandatory{content:"";color:red;width:50px;height:50px;font-size:14px;padding-left:5px}@media only screen and (max-width:767px){.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul li{width:100%;min-height:40px;margin-bottom:15px;text-align:center;float:none;display:block}.mec-single-event .mec-event-export-module.mec-frontbox .mec-event-exporting .mec-export-details ul li a{width:100%;padding-left:0;padding-right:0;text-align:center;display:block;font-size:12px}}.mec-single-event .mec-events-meta-group{margin-bottom:0}@media only screen and (max-width:767px){.mec-single-event .mec-events-meta-group-booking{margin-bottom:30px}}.mec-single-event .mec-event-meta dt,.mec-single-event .mec-event-meta h3{text-transform:uppercase;font-size:16px;font-weight:700;padding-bottom:5px;display:inline;color:#000;padding-left:10px}.mec-single-event .mec-event-meta h6{text-transform:uppercase;font-size:13px;padding-bottom:5px;display:inline;color:#222;padding-left:0}.mec-single-event .mec-event-meta .mec-events-event-categories a,.mec-single-event .mec-event-meta dd{font-size:14px;color:#8d8d8d}.mec-single-event .mec-event-meta .mec-location dd.author{color:#3c3b3b}.mec-sing