Version Description
- 2022-10-12 =
- Add - Support for 3DS2 / EMV 3DS cards.
- Fix - Upgrade Braintree PHP SDK from v3.34.0 to v6.7.0.
- Tweak - Bump minimum WP version from 4.4 to 5.6.
- Tweak - Bump minimum PHP version from 5.4 to 7.3.
- Tweak - Bump minimum WC version from 3.0.9 to 6.0.
- Tweak - Bump WC tested up to version to 6.7.
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce PayPal Powered by Braintree Payment Gateway |
Version | 2.8.0 |
Comparing to | |
See all releases |
Code changes from version 2.7.0 to 2.8.0
- changelog.txt +8 -0
- class-wc-braintree.php +1 -1
- includes/api/class-wc-braintree-api.php +2 -2
- includes/api/requests/abstract-wc-braintree-api-request.php +1 -1
- includes/api/responses/class-wc-braintree-api-customer-response.php +2 -3
- includes/class-wc-gateway-braintree-credit-card.php +1 -1
- readme.txt +14 -6
- vendor/autoload.php +6 -1
- vendor/braintree/braintree_php/ACKNOWLEDGEMENTS.md +0 -6
- vendor/braintree/braintree_php/CHANGELOG.md +239 -1
- vendor/braintree/braintree_php/Dockerfile +0 -13
- vendor/braintree/braintree_php/LICENSE +1 -1
- vendor/braintree/braintree_php/Makefile +0 -10
- vendor/braintree/braintree_php/README.md +50 -34
- vendor/braintree/braintree_php/Rakefile +0 -81
- vendor/braintree/braintree_php/ci.sh +0 -11
- vendor/braintree/braintree_php/lib/Braintree.php +20 -11
- vendor/braintree/braintree_php/lib/Braintree/AccountUpdaterDailyReport.php +13 -9
- vendor/braintree/braintree_php/lib/Braintree/AchMandate.php +8 -17
- vendor/braintree/braintree_php/lib/Braintree/AddOn.php +14 -3
- vendor/braintree/braintree_php/lib/Braintree/AddOnGateway.php +8 -19
- vendor/braintree/braintree_php/lib/Braintree/Address.php +57 -52
- vendor/braintree/braintree_php/lib/Braintree/AddressGateway.php +47 -82
- vendor/braintree/braintree_php/lib/Braintree/AmexExpressCheckoutCard.php +0 -79
- vendor/braintree/braintree_php/lib/Braintree/AndroidPayCard.php +0 -89
- vendor/braintree/braintree_php/lib/Braintree/ApplePayCard.php +8 -26
- vendor/braintree/braintree_php/lib/Braintree/ApplePayGateway.php +30 -19
- vendor/braintree/braintree_php/lib/Braintree/ApplePayOptions.php +9 -5
- vendor/braintree/braintree_php/lib/Braintree/AuthorizationAdjustment.php +11 -8
- vendor/braintree/braintree_php/lib/Braintree/Base.php +36 -21
- vendor/braintree/braintree_php/lib/Braintree/BinData.php +16 -8
- vendor/braintree/braintree_php/lib/Braintree/ClientToken.php +28 -13
- vendor/braintree/braintree_php/lib/Braintree/ClientTokenGateway.php +32 -38
- vendor/braintree/braintree_php/lib/Braintree/CoinbaseAccount.php +0 -110
- vendor/braintree/braintree_php/lib/Braintree/Collection.php +59 -27
- vendor/braintree/braintree_php/lib/Braintree/Configuration.php +368 -161
- vendor/braintree/braintree_php/lib/Braintree/ConnectedMerchantPayPalStatusChanged.php +7 -10
- vendor/braintree/braintree_php/lib/Braintree/ConnectedMerchantStatusTransitioned.php +7 -10
- vendor/braintree/braintree_php/lib/Braintree/CredentialsParser.php +48 -16
- vendor/braintree/braintree_php/lib/Braintree/CreditCard.php +162 -50
- vendor/braintree/braintree_php/lib/Braintree/CreditCardGateway.php +139 -156
- vendor/braintree/braintree_php/lib/Braintree/CreditCardVerification.php +45 -4
- vendor/braintree/braintree_php/lib/Braintree/CreditCardVerificationGateway.php +32 -4
- vendor/braintree/braintree_php/lib/Braintree/CreditCardVerificationSearch.php +91 -16
- vendor/braintree/braintree_php/lib/Braintree/Customer.php +136 -181
- vendor/braintree/braintree_php/lib/Braintree/CustomerGateway.php +122 -211
- vendor/braintree/braintree_php/lib/Braintree/CustomerSearch.php +247 -28
- vendor/braintree/braintree_php/lib/Braintree/Descriptor.php +4 -1
- vendor/braintree/braintree_php/lib/Braintree/Digest.php +9 -6
- vendor/braintree/braintree_php/lib/Braintree/Disbursement.php +33 -6
- vendor/braintree/braintree_php/lib/Braintree/DisbursementDetails.php +10 -11
- vendor/braintree/braintree_php/lib/Braintree/Discount.php +22 -4
- vendor/braintree/braintree_php/lib/Braintree/DiscountGateway.php +12 -1
- vendor/braintree/braintree_php/lib/Braintree/Dispute.php +91 -42
- vendor/braintree/braintree_php/lib/Braintree/Dispute/EvidenceDetails.php +3 -12
- vendor/braintree/braintree_php/lib/Braintree/Dispute/PayPalMessageDetails.php +14 -0
- vendor/braintree/braintree_php/lib/Braintree/Dispute/StatusHistoryDetails.php +2 -8
- vendor/braintree/braintree_php/lib/Braintree/Dispute/TransactionDetails.php +2 -13
- vendor/braintree/braintree_php/lib/Braintree/DisputeGateway.php +46 -40
- vendor/braintree/braintree_php/lib/Braintree/DisputeSearch.php +101 -2
- vendor/braintree/braintree_php/lib/Braintree/DocumentUpload.php +16 -4
- vendor/braintree/braintree_php/lib/Braintree/DocumentUploadGateway.php +14 -21
- vendor/braintree/braintree_php/lib/Braintree/EndsWithNode.php +18 -1
- vendor/braintree/braintree_php/lib/Braintree/EnrichedCustomerData.php +46 -0
- vendor/braintree/braintree_php/lib/Braintree/EqualityNode.php +13 -2
- vendor/braintree/braintree_php/lib/Braintree/Error/Codes.php +209 -115
- vendor/braintree/braintree_php/lib/Braintree/Error/ErrorCollection.php +33 -21
- vendor/braintree/braintree_php/lib/Braintree/Error/Validation.php +10 -27
- vendor/braintree/braintree_php/lib/Braintree/Error/ValidationErrorCollection.php +55 -39
- vendor/braintree/braintree_php/lib/Braintree/EuropeBankAccount.php +0 -67
- vendor/braintree/braintree_php/lib/Braintree/Exception.php +1 -4
- vendor/braintree/braintree_php/lib/Braintree/Exception/Authentication.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/Authorization.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/Configuration.php +2 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/Connection.php +2 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/DownForMaintenance.php +0 -16
- vendor/braintree/braintree_php/lib/Braintree/Exception/ForgedQueryString.php +0 -20
- vendor/braintree/braintree_php/lib/Braintree/Exception/GatewayTimeout.php +12 -0
- vendor/braintree/braintree_php/lib/Braintree/Exception/InvalidChallenge.php +6 -1
- vendor/braintree/braintree_php/lib/Braintree/Exception/InvalidSignature.php +6 -1
- vendor/braintree/braintree_php/lib/Braintree/Exception/NotFound.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/RequestTimeout.php +12 -0
- vendor/braintree/braintree_php/lib/Braintree/Exception/SSLCaFileNotFound.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/SSLCertificate.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/ServerError.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/ServiceUnavailable.php +12 -0
- vendor/braintree/braintree_php/lib/Braintree/Exception/TestOperationPerformedInProduction.php +1 -4
- vendor/braintree/braintree_php/lib/Braintree/Exception/Timeout.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/TooManyRequests.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/Unexpected.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/UpgradeRequired.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/Exception/ValidationsFailed.php +1 -5
- vendor/braintree/braintree_php/lib/Braintree/FacilitatedDetails.php +18 -8
- vendor/braintree/braintree_php/lib/Braintree/FacilitatorDetails.php +18 -8
- vendor/braintree/braintree_php/lib/Braintree/Gateway.php +10 -23
- vendor/braintree/braintree_php/lib/Braintree/GooglePayCard.php +68 -0
- vendor/braintree/braintree_php/lib/Braintree/GrantedPaymentInstrumentUpdate.php +9 -26
- vendor/braintree/braintree_php/lib/Braintree/GraphQL.php +58 -0
- vendor/braintree/braintree_php/lib/Braintree/GraphQLClient.php +29 -0
- vendor/braintree/braintree_php/lib/Braintree/Http.php +60 -176
- vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/Curl.php +190 -0
- vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/CurlRequest.php +51 -0
- vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/HttpRequest.php +20 -0
- vendor/braintree/braintree_php/lib/Braintree/IbanBankAccount.php +0 -57
- vendor/braintree/braintree_php/lib/Braintree/IdealPayment.php +0 -92
- vendor/braintree/braintree_php/lib/Braintree/IdealPaymentGateway.php +0 -104
- vendor/braintree/braintree_php/lib/Braintree/Instance.php +38 -13
- vendor/braintree/braintree_php/lib/Braintree/IsNode.php +18 -1
- vendor/braintree/braintree_php/lib/Braintree/KeyValueNode.php +20 -2
- vendor/braintree/braintree_php/lib/Braintree/LocalPaymentCompleted.php +60 -0
- vendor/braintree/braintree_php/lib/Braintree/LocalPaymentExpired.php +36 -0
- vendor/braintree/braintree_php/lib/Braintree/LocalPaymentFunded.php +46 -0
- vendor/braintree/braintree_php/lib/Braintree/LocalPaymentReversed.php +51 -0
- vendor/braintree/braintree_php/lib/Braintree/MasterpassCard.php +0 -141
- vendor/braintree/braintree_php/lib/Braintree/Merchant.php +15 -8
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccount.php +12 -2
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/AddressDetails.php +4 -1
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/BusinessDetails.php +13 -1
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/FundingDetails.php +6 -1
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/IndividualDetails.php +13 -1
- vendor/braintree/braintree_php/lib/Braintree/MerchantAccountGateway.php +12 -43
- vendor/braintree/braintree_php/lib/Braintree/MerchantGateway.php +5 -4
- vendor/braintree/braintree_php/lib/Braintree/Modification.php +17 -2
- vendor/braintree/braintree_php/lib/Braintree/MultipleValueNode.php +36 -10
- vendor/braintree/braintree_php/lib/Braintree/MultipleValueOrTextNode.php +46 -1
- vendor/braintree/braintree_php/lib/Braintree/OAuthAccessRevocation.php +9 -7
- vendor/braintree/braintree_php/lib/Braintree/OAuthCredentials.php +10 -9
- vendor/braintree/braintree_php/lib/Braintree/OAuthGateway.php +35 -17
- vendor/braintree/braintree_php/lib/Braintree/OAuthResult.php +10 -9
- vendor/braintree/braintree_php/lib/Braintree/PaginatedCollection.php +28 -20
- vendor/braintree/braintree_php/lib/Braintree/PaginatedResult.php +20 -1
- vendor/braintree/braintree_php/lib/Braintree/PartialMatchNode.php +20 -1
- vendor/braintree/braintree_php/lib/Braintree/PartnerMerchant.php +6 -7
- vendor/braintree/braintree_php/lib/Braintree/PayPalAccount.php +52 -31
- vendor/braintree/braintree_php/lib/Braintree/PayPalAccountGateway.php +37 -42
- vendor/braintree/braintree_php/lib/Braintree/PaymentInstrumentType.php +14 -10
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethod.php +44 -11
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethodCustomerDataUpdatedMetadata.php +49 -0
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethodGateway.php +138 -145
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethodNonce.php +37 -16
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethodNonceGateway.php +31 -20
- vendor/braintree/braintree_php/lib/Braintree/PaymentMethodParser.php +43 -0
- vendor/braintree/braintree_php/lib/Braintree/Plan.php +60 -7
- vendor/braintree/braintree_php/lib/Braintree/PlanGateway.php +162 -2
- vendor/braintree/braintree_php/lib/Braintree/ProcessorResponseTypes.php +13 -0
- vendor/braintree/braintree_php/lib/Braintree/RangeNode.php +41 -2
- vendor/braintree/braintree_php/lib/Braintree/ResourceCollection.php +30 -25
- vendor/braintree/braintree_php/lib/Braintree/Result/CreditCardVerification.php +27 -31
- vendor/braintree/braintree_php/lib/Braintree/Result/Error.php +58 -65
- vendor/braintree/braintree_php/lib/Braintree/Result/Successful.php +28 -36
- vendor/braintree/braintree_php/lib/Braintree/Result/UsBankAccountVerification.php +23 -29
- vendor/braintree/braintree_php/lib/Braintree/RevokedPaymentMethodMetadata.php +38 -0
- vendor/braintree/braintree_php/lib/Braintree/RiskData.php +22 -5
- vendor/braintree/braintree_php/lib/Braintree/SamsungPayCard.php +104 -0
- vendor/braintree/braintree_php/lib/Braintree/SettlementBatchSummary.php +21 -9
- vendor/braintree/braintree_php/lib/Braintree/SettlementBatchSummaryGateway.php +15 -41
- vendor/braintree/braintree_php/lib/Braintree/ShippingMethod.php +18 -0
- vendor/braintree/braintree_php/lib/Braintree/SignatureService.php +3 -3
- vendor/braintree/braintree_php/lib/Braintree/Subscription.php +83 -26
- vendor/braintree/braintree_php/lib/Braintree/Subscription/StatusDetails.php +2 -11
- vendor/braintree/braintree_php/lib/Braintree/SubscriptionGateway.php +67 -24
- vendor/braintree/braintree_php/lib/Braintree/SubscriptionSearch.php +64 -1
- vendor/braintree/braintree_php/lib/Braintree/Test/AuthenticationIds.php +34 -0
- vendor/braintree/braintree_php/lib/Braintree/Test/CreditCardNumbers.php +21 -9
- vendor/braintree/braintree_php/lib/Braintree/Test/MerchantAccount.php +1 -6
- vendor/braintree/braintree_php/lib/Braintree/Test/Nonces.php +71 -60
- vendor/braintree/braintree_php/lib/Braintree/Test/Transaction.php +9 -5
- vendor/braintree/braintree_php/lib/Braintree/Test/TransactionAmounts.php +4 -6
- vendor/braintree/braintree_php/lib/Braintree/Test/VenmoSdk.php +9 -8
- vendor/braintree/braintree_php/lib/Braintree/TestingGateway.php +2 -1
- vendor/braintree/braintree_php/lib/Braintree/TextNode.php +12 -1
- vendor/braintree/braintree_php/lib/Braintree/ThreeDSecureInfo.php +16 -8
- vendor/braintree/braintree_php/lib/Braintree/Transaction.php +299 -120
- vendor/braintree/braintree_php/lib/Braintree/Transaction/AddressDetails.php +2 -14
- vendor/braintree/braintree_php/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php +0 -43
- vendor/braintree/braintree_php/lib/Braintree/Transaction/AndroidPayCardDetails.php +0 -47
- vendor/braintree/braintree_php/lib/Braintree/Transaction/ApplePayCardDetails.php +3 -17
- vendor/braintree/braintree_php/lib/Braintree/Transaction/CoinbaseDetails.php +0 -38
- vendor/braintree/braintree_php/lib/Braintree/Transaction/CreditCardDetails.php +3 -18
- vendor/braintree/braintree_php/lib/Braintree/Transaction/CustomerDetails.php +2 -12
- vendor/braintree/braintree_php/lib/Braintree/Transaction/EuropeBankAccountDetails.php +0 -24
- vendor/braintree/braintree_php/lib/Braintree/Transaction/GooglePayCardDetails.php +27 -0
- vendor/braintree/braintree_php/lib/Braintree/Transaction/IdealPaymentDetails.php +0 -23
- vendor/braintree/braintree_php/lib/Braintree/Transaction/LineItem.php +0 -4
- vendor/braintree/braintree_php/lib/Braintree/Transaction/LocalPaymentDetails.php +25 -0
- vendor/braintree/braintree_php/lib/Braintree/Transaction/MasterpassCardDetails.php +0 -51
- vendor/braintree/braintree_php/lib/Braintree/Transaction/PayPalDetails.php +3 -19
- vendor/braintree/braintree_php/lib/Braintree/Transaction/PayPalHereDetails.php +25 -0
- vendor/braintree/braintree_php/lib/Braintree/Transaction/SamsungPayCardDetails.php +24 -0
- vendor/braintree/braintree_php/lib/Braintree/Transaction/StatusDetails.php +2 -8
- vendor/braintree/braintree_php/lib/Braintree/Transaction/SubscriptionDetails.php +2 -6
- vendor/braintree/braintree_php/lib/Braintree/Transaction/UsBankAccountDetails.php +3 -15
- vendor/braintree/braintree_php/lib/Braintree/Transaction/VenmoAccountDetails.php +4 -21
- vendor/braintree/braintree_php/lib/Braintree/Transaction/VisaCheckoutCardDetails.php +3 -31
- vendor/braintree/braintree_php/lib/Braintree/TransactionGateway.php +333 -123
- vendor/braintree/braintree_php/lib/Braintree/TransactionLineItem.php +13 -28
- vendor/braintree/braintree_php/lib/Braintree/TransactionLineItemGateway.php +13 -11
- vendor/braintree/braintree_php/lib/Braintree/TransactionReview.php +34 -0
- vendor/braintree/braintree_php/lib/Braintree/TransactionSearch.php +619 -58
- vendor/braintree/braintree_php/lib/Braintree/TransparentRedirect.php +0 -100
- vendor/braintree/braintree_php/lib/Braintree/TransparentRedirectGateway.php +0 -289
- vendor/braintree/braintree_php/lib/Braintree/UnknownPaymentMethod.php +7 -22
- vendor/braintree/braintree_php/lib/Braintree/UsBankAccount.php +26 -40
- vendor/braintree/braintree_php/lib/Braintree/UsBankAccountGateway.php +16 -23
- vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerification.php +21 -29
- vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerificationGateway.php +22 -18
- vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerificationSearch.php +81 -9
- vendor/braintree/braintree_php/lib/Braintree/Util.php +191 -103
- vendor/braintree/braintree_php/lib/Braintree/VenmoAccount.php +7 -22
- vendor/braintree/braintree_php/lib/Braintree/VenmoProfileData.php +36 -0
- vendor/braintree/braintree_php/lib/Braintree/Version.php +5 -11
- vendor/braintree/braintree_php/lib/Braintree/VisaCheckoutCard.php +12 -50
- vendor/braintree/braintree_php/lib/Braintree/WebhookNotification.php +94 -24
- vendor/braintree/braintree_php/lib/Braintree/WebhookNotificationGateway.php +26 -5
- vendor/braintree/braintree_php/lib/Braintree/WebhookTesting.php +2 -2
- vendor/braintree/braintree_php/lib/Braintree/WebhookTestingGateway.php +344 -45
- vendor/braintree/braintree_php/lib/Braintree/Xml.php +9 -9
- vendor/braintree/braintree_php/lib/Braintree/Xml/Generator.php +29 -23
- vendor/braintree/braintree_php/lib/Braintree/Xml/Parser.php +59 -55
- vendor/braintree/braintree_php/lib/autoload.php +2 -1
- vendor/braintree/braintree_php/phpcs.xml +70 -0
- vendor/braintree/braintree_php/phpunit.xml.dist +0 -24
- vendor/composer/ClassLoader.php +102 -11
- vendor/composer/InstalledVersions.php +21 -6
- vendor/composer/autoload_classmap.php +1 -1
- vendor/composer/autoload_namespaces.php +1 -2
- vendor/composer/autoload_psr4.php +1 -1
- vendor/composer/autoload_real.php +7 -26
- vendor/composer/autoload_static.php +4 -15
- vendor/composer/installed.json +13 -14
- vendor/composer/installed.php +7 -7
- vendor/composer/platform_check.php +2 -2
- woocommerce-gateway-paypal-powered-by-braintree.php +10 -8
changelog.txt
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
*** Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 2.7.0 - 2022-09-06 =
|
4 |
* Add - PayPal Pay Later support to buyers from Italy and Spain.
|
5 |
|
1 |
*** Changelog ***
|
2 |
|
3 |
+
= 2.8.0 - 2022-10-12 =
|
4 |
+
* Add - Support for 3DS2 / EMV 3DS cards.
|
5 |
+
* Fix - Upgrade Braintree PHP SDK from v3.34.0 to v6.7.0.
|
6 |
+
* Tweak - Bump minimum WP version from 4.4 to 5.6.
|
7 |
+
* Tweak - Bump minimum PHP version from 5.4 to 7.3.
|
8 |
+
* Tweak - Bump minimum WC version from 3.0.9 to 6.0.
|
9 |
+
* Tweak - Bump WC tested up to version to 6.7.
|
10 |
+
|
11 |
= 2.7.0 - 2022-09-06 =
|
12 |
* Add - PayPal Pay Later support to buyers from Italy and Spain.
|
13 |
|
class-wc-braintree.php
CHANGED
@@ -35,7 +35,7 @@ class WC_Braintree extends Framework\SV_WC_Payment_Gateway_Plugin {
|
|
35 |
|
36 |
|
37 |
/** plugin version number */
|
38 |
-
const VERSION = '2.
|
39 |
|
40 |
/** Braintree JS SDK version */
|
41 |
const BRAINTREE_JS_SDK_VERSION = '3.73.1';
|
35 |
|
36 |
|
37 |
/** plugin version number */
|
38 |
+
const VERSION = '2.8.0';
|
39 |
|
40 |
/** Braintree JS SDK version */
|
41 |
const BRAINTREE_JS_SDK_VERSION = '3.73.1';
|
includes/api/class-wc-braintree-api.php
CHANGED
@@ -490,7 +490,7 @@ class WC_Braintree_API extends Framework\SV_WC_API_Base implements Framework\SV_
|
|
490 |
*
|
491 |
* @since 3.0.0
|
492 |
* @see SV_WC_API_Base::do_remote_request()
|
493 |
-
* @param string $callback SDK static callback, e.g.
|
494 |
* @param array $callback_params parameters to pass to the static callback
|
495 |
* @return \Exception|mixed
|
496 |
*/
|
@@ -579,7 +579,7 @@ class WC_Braintree_API extends Framework\SV_WC_API_Base implements Framework\SV_
|
|
579 |
$message = __( 'Authorization Failed, please verify the user for the API credentials provided can perform transactions and that the request data is correct.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
580 |
break;
|
581 |
|
582 |
-
case 'Braintree\Exception\
|
583 |
$message = __( 'Braintree is currently down for maintenance, please try again later.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
584 |
break;
|
585 |
|
490 |
*
|
491 |
* @since 3.0.0
|
492 |
* @see SV_WC_API_Base::do_remote_request()
|
493 |
+
* @param string $callback SDK static callback, e.g. `\Braintree\ClientToken::generate`
|
494 |
* @param array $callback_params parameters to pass to the static callback
|
495 |
* @return \Exception|mixed
|
496 |
*/
|
579 |
$message = __( 'Authorization Failed, please verify the user for the API credentials provided can perform transactions and that the request data is correct.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
580 |
break;
|
581 |
|
582 |
+
case 'Braintree\Exception\ServiceUnavailable':
|
583 |
$message = __( 'Braintree is currently down for maintenance, please try again later.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
584 |
break;
|
585 |
|
includes/api/requests/abstract-wc-braintree-api-request.php
CHANGED
@@ -89,7 +89,7 @@ abstract class WC_Braintree_API_Request implements Framework\SV_WC_Payment_Gatew
|
|
89 |
* Set the static callback for the request
|
90 |
*
|
91 |
* @since 3.0.0
|
92 |
-
* @param string $callback, e.g.
|
93 |
*/
|
94 |
protected function set_callback( $callback ) {
|
95 |
|
89 |
* Set the static callback for the request
|
90 |
*
|
91 |
* @since 3.0.0
|
92 |
+
* @param string $callback, e.g. `\Braintree\ClientToken::generate`
|
93 |
*/
|
94 |
protected function set_callback( $callback ) {
|
95 |
|
includes/api/responses/class-wc-braintree-api-customer-response.php
CHANGED
@@ -38,10 +38,9 @@ defined( 'ABSPATH' ) or exit;
|
|
38 |
class WC_Braintree_API_Customer_Response extends WC_Braintree_API_Vault_Response implements Framework\SV_WC_Payment_Gateway_API_Create_Payment_Token_Response, Framework\SV_WC_Payment_Gateway_API_Get_Tokenized_Payment_Methods_Response, Framework\SV_WC_Payment_Gateway_API_Customer_Response {
|
39 |
|
40 |
|
41 |
-
/** @var \Braintree\CreditCard|\
|
42 |
protected $payment_method;
|
43 |
|
44 |
-
|
45 |
/**
|
46 |
* Override the default constructor to set created payment method since
|
47 |
* Braintree simply provides a list of payment methods instead of an object
|
@@ -180,7 +179,7 @@ class WC_Braintree_API_Customer_Response extends WC_Braintree_API_Vault_Response
|
|
180 |
* either a credit card or PayPal account
|
181 |
*
|
182 |
* @since 3.0.0
|
183 |
-
* @return \
|
184 |
*/
|
185 |
protected function get_created_payment_method() {
|
186 |
|
38 |
class WC_Braintree_API_Customer_Response extends WC_Braintree_API_Vault_Response implements Framework\SV_WC_Payment_Gateway_API_Create_Payment_Token_Response, Framework\SV_WC_Payment_Gateway_API_Get_Tokenized_Payment_Methods_Response, Framework\SV_WC_Payment_Gateway_API_Customer_Response {
|
39 |
|
40 |
|
41 |
+
/** @var \Braintree\CreditCard|\Braintree\PayPalAccount created payment method */
|
42 |
protected $payment_method;
|
43 |
|
|
|
44 |
/**
|
45 |
* Override the default constructor to set created payment method since
|
46 |
* Braintree simply provides a list of payment methods instead of an object
|
179 |
* either a credit card or PayPal account
|
180 |
*
|
181 |
* @since 3.0.0
|
182 |
+
* @return \Braintree\CreditCard|\Braintree\PayPalAccount
|
183 |
*/
|
184 |
protected function get_created_payment_method() {
|
185 |
|
includes/class-wc-gateway-braintree-credit-card.php
CHANGED
@@ -542,7 +542,7 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
542 |
protected function maybe_void_instead_of_refund( $order, $response ) {
|
543 |
|
544 |
// Braintree conveniently returns a validation error code that indicates a void can be performed instead of refund
|
545 |
-
return $response->has_validation_errors() && in_array(
|
546 |
}
|
547 |
|
548 |
|
542 |
protected function maybe_void_instead_of_refund( $order, $response ) {
|
543 |
|
544 |
// Braintree conveniently returns a validation error code that indicates a void can be performed instead of refund
|
545 |
+
return $response->has_validation_errors() && in_array( \Braintree\Error\Codes::TRANSACTION_CANNOT_REFUND_UNLESS_SETTLED, array_keys( $response->get_validation_errors() ) );
|
546 |
}
|
547 |
|
548 |
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Braintree for WooCommerce Payment Gateway ===
|
2 |
Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
4 |
-
Requires at least:
|
5 |
Tested up to: 6.0
|
6 |
-
Requires PHP:
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -36,9 +36,9 @@ Braintree for WooCommerce provides several advanced features for transaction pro
|
|
36 |
|
37 |
= Minimum Requirements =
|
38 |
|
39 |
-
- PHP
|
40 |
-
- WooCommerce
|
41 |
-
- WordPress
|
42 |
- An SSL certificate
|
43 |
- cURL support (most hosts have this enabled by default)
|
44 |
|
@@ -107,6 +107,14 @@ If not, please get in touch with us through the [plugin forums](https://wordpres
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 2.7.0 - 2022-09-06 =
|
111 |
* Add - PayPal Pay Later support to buyers from Italy and Spain.
|
112 |
|
1 |
=== Braintree for WooCommerce Payment Gateway ===
|
2 |
Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
4 |
+
Requires at least: 5.6
|
5 |
Tested up to: 6.0
|
6 |
+
Requires PHP: 7.3
|
7 |
+
Stable tag: 2.8.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
36 |
|
37 |
= Minimum Requirements =
|
38 |
|
39 |
+
- PHP 7.3+ (you can see this under <strong>WooCommerce > Status</strong>)</li>
|
40 |
+
- WooCommerce 6.0+
|
41 |
+
- WordPress 5.6+
|
42 |
- An SSL certificate
|
43 |
- cURL support (most hosts have this enabled by default)
|
44 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 2.8.0 - 2022-10-12 =
|
111 |
+
* Add - Support for 3DS2 / EMV 3DS cards.
|
112 |
+
* Fix - Upgrade Braintree PHP SDK from v3.34.0 to v6.7.0.
|
113 |
+
* Tweak - Bump minimum WP version from 4.4 to 5.6.
|
114 |
+
* Tweak - Bump minimum PHP version from 5.4 to 7.3.
|
115 |
+
* Tweak - Bump minimum WC version from 3.0.9 to 6.0.
|
116 |
+
* Tweak - Bump WC tested up to version to 6.7.
|
117 |
+
|
118 |
= 2.7.0 - 2022-09-06 =
|
119 |
* Add - PayPal Pay Later support to buyers from Italy and Spain.
|
120 |
|
vendor/autoload.php
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
|
3 |
// autoload.php @generated by Composer
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
2 |
|
3 |
// autoload.php @generated by Composer
|
4 |
|
5 |
+
if (PHP_VERSION_ID < 50600) {
|
6 |
+
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
7 |
+
exit(1);
|
8 |
+
}
|
9 |
+
|
10 |
require_once __DIR__ . '/composer/autoload_real.php';
|
11 |
|
12 |
+
return ComposerAutoloaderInit6493576a93c8a5819bd1c57c1ca2bae7::getLoader();
|
vendor/braintree/braintree_php/ACKNOWLEDGEMENTS.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
Acknowledgements
|
2 |
-
----------------
|
3 |
-
|
4 |
-
The Braintree SDK uses code from the following libraries:
|
5 |
-
|
6 |
-
* [phpunit](https://github.com/sebastianbergmann/phpunit), BSD-3-Clause License
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/CHANGELOG.md
CHANGED
@@ -1,3 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
## 3.34.0
|
2 |
* Allow payee ID to be passed in options params for transaction create
|
3 |
* Add `merchant_id` to `ConnectedMerchantStatusTransitioned` and `ConnectedMerchantPayPalStatusChanged` Auth webhooks
|
@@ -267,7 +505,7 @@
|
|
267 |
* Allow payee_email to be passed in options params for Transaction create
|
268 |
|
269 |
## 2.31.0
|
270 |
-
* Added paypal specific fields to transaction calls
|
271 |
* Added SettlementPending, SettlementDeclined transaction statuses
|
272 |
|
273 |
## 2.30.0
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
## 6.7.0
|
4 |
+
* Fix lint errors on unit test
|
5 |
+
|
6 |
+
## 6.6.0
|
7 |
+
* Add `PaymentMethodCustomerDataUpdated` webhook notification support
|
8 |
+
|
9 |
+
## 6.5.1
|
10 |
+
* Address PHP 8.1 Deprecation warnings
|
11 |
+
|
12 |
+
## 6.5.0
|
13 |
+
* Add plan create/update/find API endpoint
|
14 |
+
* Add `TransactionReview` webhook notification
|
15 |
+
|
16 |
+
## 6.4.1
|
17 |
+
* Add `exchangeRateQuoteId` to `Transaction.sale`
|
18 |
+
* Add error code `EXCHANGE_RATE_QUOTE_ID_IS_TOO_LONG`
|
19 |
+
* Added the following fields to GooglePayCard and ApplePayCard:
|
20 |
+
* `commercial`
|
21 |
+
* `debit`
|
22 |
+
* `durbinRegulated`
|
23 |
+
* `healthcare`
|
24 |
+
* `payroll`
|
25 |
+
* `prepaid`
|
26 |
+
* `productId`
|
27 |
+
* `countryOfIssuance`
|
28 |
+
* `issuingBank`
|
29 |
+
* Add `LocalPaymentExpired` and `LocalPaymentFunded` webhook notification support
|
30 |
+
|
31 |
+
## 6.3.0
|
32 |
+
* Add `paymentReaderCardDetails` parameter to `Transaction.sale`
|
33 |
+
* Add error code `TRANSACTION_TAX_AMOUNT_IS_REQUIRED_FOR_AIB_SWEDISH` for attribute `taxAmount` in `transaction` key for AIB:Domestic transactions in Sweden.
|
34 |
+
|
35 |
+
## 6.2.0
|
36 |
+
* Add `chargebackProtectionLevel ` to `Dispute` and `DisputeSearch`
|
37 |
+
* Add `skipAdvancedFraudChecking` to:
|
38 |
+
* `CreditCard.create` and `CreditCard.update`
|
39 |
+
* `PaymentMethod.create` and `PaymentMethod.update`
|
40 |
+
|
41 |
+
## 6.1.0
|
42 |
+
* Add `paypalMessages` to `Dispute`
|
43 |
+
* Fix bug where `__isset` methods in `Instance` and `Base` classes treated `null` value as set (Thanks @sklodzio)
|
44 |
+
* Add `tax_identifiers` parameter to `Customer.create` and `Customer.update`
|
45 |
+
* Add webhook sample for `GrantedPaymentMethodRevoked`
|
46 |
+
* Add sample webhook notifications for `SUBSCRIPTION_EXPIRED`, `SUBSCRIPTION_CANCELED` and `SUBSCRIPTION_WENT_PAST_DUE` (thanks @antonvolokha)
|
47 |
+
|
48 |
+
## 6.0.0
|
49 |
+
* Add `LocalPaymentReversed` webhook
|
50 |
+
* Add `adjustAuthorization` method to Transaction, for supporting multiple authorizations on a single transaction
|
51 |
+
* Add `storeId` and `storeIds` to Transaction search
|
52 |
+
* Add `merchantAccountId` parameter to Transaction refund
|
53 |
+
* Parameters that supported DateTime objects can also support DateTimeImmutable objects (closes #278)
|
54 |
+
* Add `toArray` function to Base and Instance classes (resolves #289)
|
55 |
+
* Add `jsonSerialize` to Instance class
|
56 |
+
* Breaking Changes:
|
57 |
+
* Require PHP 7.3 or higher
|
58 |
+
* Rename `AndroidPayCard` to `GooglePayCard`
|
59 |
+
* Rename `AndroidPayCardDetails` to `GooglePayCardDetails`
|
60 |
+
* Remove Configuration#isAuthenticatedInstanceProxy method in favor of Configuration#isAuthenticatedProxy
|
61 |
+
* Remove Configuration#isUsingInstanceProxy method in favor of Configuration#isUsingProxy
|
62 |
+
* Remove `TRANSACTION_EXTERNAL_VAULT_CARD_TYPE_IS_INVALID ` and `RISK_DATA_CUSTOMER_BROWSER_IS_TOO_LONG` error codes
|
63 |
+
* Remove `customer_ip` and `customer_browser` snake case parameters in favor of camel case `customerIp` and `customerBrowser` accepted in `Customer#create` and `Transaction#sale`
|
64 |
+
* Remove `AmexExpressCheckoutCard` and `AmexExpressCheckoutCardDetails`
|
65 |
+
* Remove `MasterpassCard` and `MasterpassCardDetails`
|
66 |
+
* Remove deprecated parameters:
|
67 |
+
* `deviceSessionId` from CreditCardGateway#update, CreditCardGateway#create, CustomerGateway#create, CustomerGateway#update, PaymentMethodGateay#update, and TransactionGateway#create
|
68 |
+
* `fraudMerchantId` from CreditCardGateway#update, CreditCardGateway#create, CustomerGateway#create, CustomerGateway#update, PaymentMethodGateay#update, and TransactionGateway#create
|
69 |
+
|
70 |
+
## 5.5.0
|
71 |
+
* Add `scaExemption` to Transaction sale
|
72 |
+
* Deprecate `deviceSessionId` and `fraudMerchantId` in `CreditCardGateway`, `CustomerGateway`, `PaymentMethodGateway`, and `TransactionGateway` classes
|
73 |
+
* Add `installments` to Transaction sale
|
74 |
+
* Add `count` to `installments`
|
75 |
+
|
76 |
+
## 5.4.0
|
77 |
+
* Add `AcquirerReferenceNumber` to `Transaction`
|
78 |
+
* Add `billingAgreementId` to `PayPalDetails`
|
79 |
+
* Deprecate `recurring` in Transaction sale
|
80 |
+
* Deprecate `tag` in Dispute add text evidence
|
81 |
+
|
82 |
+
## 5.3.1
|
83 |
+
* Deprecate `masterpassCard` and `amexExpressCheckoutCard` payment methods
|
84 |
+
* Deprecate `amexExpressCheckoutCardDetails`
|
85 |
+
|
86 |
+
## 5.3.0
|
87 |
+
* Add `RISK_THRESHOLD` to `GatewayRejectionReason` constants
|
88 |
+
* Add `networkTransactionId` to `CreditCardVerification`
|
89 |
+
* Add `processedWithNetworkToken` to `Transaction`
|
90 |
+
* Add `isNetworkTokenized` to `CreditCard`
|
91 |
+
* Add `productSku` to `Transaction`
|
92 |
+
* Add `phoneNumber` and `shippingMethod` to `Address`
|
93 |
+
* Add `customerDeviceId`, `customerLocationZip`, and `customerTenure` to `RiskData`
|
94 |
+
* Add error codes
|
95 |
+
* `TRANSACTION_PRODUCT_SKU_IS_INVALID`
|
96 |
+
* `TRANSACTION_SHIPPING_METHOD_IS_INVALID`
|
97 |
+
* `TRANSACTION_SHIPPING_PHONE_NUMBER_IS_INVALID`
|
98 |
+
* `TRANSACTION_BILLING_PHONE_NUMBER_IS_INVALID`
|
99 |
+
* `RISK_DATA_CUSTOMER_BROWSER_IS_TOO_LONG`
|
100 |
+
* `RISK_DATA_CUSTOMER_DEVICE_ID_IS_TOO_LONG`
|
101 |
+
* `RISK_DATA_CUSTOMER_LOCATION_ZIP_INVALID_CHARACTERS`
|
102 |
+
* `RISK_DATA_CUSTOMER_LOCATION_ZIP_IS_INVALID`
|
103 |
+
* `RISK_DATA_CUSTOMER_LOCATION_ZIP_IS_TOO_LONG`
|
104 |
+
* `RISK_DATA_CUSTOMER_TENURE_IS_TOO_LONG`
|
105 |
+
* `RISK_DATA_CUSTOMER_TENURE_IS_INVALID`
|
106 |
+
|
107 |
+
## 5.2.0
|
108 |
+
* Add `retrieval_reference_number` to `Transaction`
|
109 |
+
* Fix class alias issue where Exceptions could not be thrown for missing libraries or older PHP versions.
|
110 |
+
* Fix issue where `proxyHost`, `proxyPort`, `proxyType`, `proxyUser`, `proxyPassword`, and `sslVersion` were not being set on Gateway or Configuration objects.
|
111 |
+
|
112 |
+
## 5.1.0
|
113 |
+
* Add `threeDSecurePassThru` parameters to `Customer.create`, `PaymentMethod.create`, `CreditCard.create`, `Customer.update`, `PaymentMethod.update` and `CreditCard.update`
|
114 |
+
* Add `recurringCustomerConsent` and `recurringMaxAmount` to `authenticationInsightOptions` for `PaymentMethodNonce.create`
|
115 |
+
* Add `DOCUMENT_UPLOAD_FILE_IS_EMPTY` error code
|
116 |
+
* phpDocs fixes (thanks @pupitooo)
|
117 |
+
|
118 |
+
## 5.0.0
|
119 |
+
* Add `DISPUTE_ACCEPTED`, `DISPUTE_DISPUTED`, and `DISPUTE_EXPIRED` webhook constants
|
120 |
+
* Breaking Changes:
|
121 |
+
* Upgrade API version to retrieve declined refund transactions
|
122 |
+
* Throw `RequestTimeout` instead of `Timeout` for transaction search
|
123 |
+
* Drop PSR-0 Support and remove class aliases
|
124 |
+
* Remove EuropeBankAccount and IbanBankAccount modules
|
125 |
+
* Remove deprecated SEPA error codes
|
126 |
+
* Remove `paypalVaultWithoutUpgrade`
|
127 |
+
* Invalid transaction IDs are validated by the gateway and not the SDK
|
128 |
+
|
129 |
+
## 4.8.0
|
130 |
+
* Add `Authentication Insight` to payment method nonce create
|
131 |
+
* Add `threeDSecureAuthenticationId` support to transaction sale
|
132 |
+
* Add ThreeDSecure test payment method nonces
|
133 |
+
* Add test `AuthenticationId`s
|
134 |
+
|
135 |
+
## 4.7.0
|
136 |
+
* Add `RefundAuthHardDeclined` and `RefundAuthSoftDeclined` to validation errors
|
137 |
+
* Add level 2 processing options `purchaseOrderNumber`, `taxAmount`, and `taxExempt` to Transaction submit for settlement
|
138 |
+
* Add level 3 processing options `discountAmount`, `shippingAmount`, `shipsFromPostalCode`, and `lineItems` to Transaction submit for settlement
|
139 |
+
|
140 |
+
## 4.6.0
|
141 |
+
* Add `isNetworkTokenized` to `AndroidPayCard` and `AndroidPayCardDetails`
|
142 |
+
* Add GraphQL ID to `CreditCardVerification`, `Customer`, `Dispute`, and `Transaction`
|
143 |
+
* Add support for PHP 7.4 (#262 thanks @slt)
|
144 |
+
* Add `threeDSecurePassThru` params to PaymentMethod update
|
145 |
+
|
146 |
+
## 4.5.0
|
147 |
+
* Add `PROCESSOR_DOES_NOT_SUPPORT_MOTO_FOR_CARD_TYPE` to validation errors
|
148 |
+
* Make errors JSON serializable (#256 thanks @sebdesign)
|
149 |
+
|
150 |
+
## 4.4.0
|
151 |
+
* Add `AMOUNT_NOT_SUPPORTED_BY_PROCESSOR` to validation errors
|
152 |
+
* Forward `forwardedComments` to `processorComments`
|
153 |
+
|
154 |
+
## 4.3.0
|
155 |
+
* Add `PayPalHereDetails` to transactions
|
156 |
+
* Add `network_response_code` and `network_response_text` to `Transaction` and `CreditCardVerification`
|
157 |
+
* Add `xid`, `cavv`, `eciFlag`, `dsTransactionId`, and `threeDSecureVersion` to `ThreeDSecureInfo`
|
158 |
+
* Add `threeDSecureInfo` to `CreditCardVerification`
|
159 |
+
* Add `GraphQLClient` to `BraintreeGateway` class
|
160 |
+
|
161 |
+
## 4.2.0
|
162 |
+
* Add `captureId` to `LocalPaymentDetails`
|
163 |
+
* Add `debugId` to `LocalPaymentDetails`
|
164 |
+
* Add `refundId` to `LocalPaymentDetails`
|
165 |
+
* Add `transactionFeeAmount` to `LocalPaymentDetails`
|
166 |
+
* Add `transactionFeeCurrencyIsoCode` to `LocalPaymentDetails`
|
167 |
+
* Add `refundFromTransactionFeeAmount` to `LocalPaymentDetails`
|
168 |
+
* Add `refundFromTransactionFeeCurrencyIsoCode` to `LocalPaymentDetails`
|
169 |
+
* Add `threeDSecureVersion`, `authenticationResponse`, `directoryResponse`, `cavvAlgorithm` and `dsTransactionId` to 3DS pass thru fields
|
170 |
+
* Add `payerInfo` to `PaymentMethodNonce` details
|
171 |
+
* Add `roomTax` field to Transaction sale
|
172 |
+
* Add `noShow` field to Transaction sale
|
173 |
+
* Add `advancedDeposit` field to Transaction sale
|
174 |
+
* Add `fireSafe` field to Transaction sale
|
175 |
+
* Add `propertyPhone` field to Transaction sale
|
176 |
+
* Add `additionalCharges` field to Transaction sale
|
177 |
+
* Add `PostalCodeIsRequiredForCardBrandAndProcessor` to validation errors
|
178 |
+
|
179 |
+
## 4.1.0
|
180 |
+
* Add `revokedAt` field to `PayPalAccount`
|
181 |
+
* Add support for `PAYMENT_METHOD_REVOKED_BY_CUSTOMER` webhook
|
182 |
+
* Add `payment_method_nonce` field to `LocalPaymentCompleted` webhook
|
183 |
+
* Add `transaction` field to `LocalPaymentCompleted` webhook
|
184 |
+
* Add `localPaymentDetail` to transactions
|
185 |
+
* Add `TOKEN_ISSUANCE` gatewayRejectionReason enum to `Transaction`
|
186 |
+
|
187 |
+
## 4.0.0
|
188 |
+
* Add support for PHP 7 (Thanks to @briandotdev)
|
189 |
+
* Require PHP 7.2 or higher
|
190 |
+
* Remove support for HHVM and PHP 5
|
191 |
+
* Update to PHPUnit 7
|
192 |
+
* Remove deprecated `GRANTED_PAYMENT_INSTRUMENT_UPDATE`
|
193 |
+
* Remove deprecated Coinbase payment method
|
194 |
+
* Remove deprecated iDEAL payment method
|
195 |
+
* Remove deprecated `MerchantAccountGateway` creation with `applicantDetails`. Please use `individual`, `business`, and `funding`.
|
196 |
+
* When a `Customer` is created, the `customFields` property is always an array rather than potentially `null`.
|
197 |
+
* Remove Transparent Redirect
|
198 |
+
* Remove `riskData`, `applePay`, `applePayCard`, `threeDSecure`, and `venmo.profileId` snakecase attributes
|
199 |
+
* HTTPS requests throw an `SSLCertificate` exception when related to SSL, otherwise a `Connection` exception is thrown.
|
200 |
+
* Rename `DownForMaintence` Exception to `ServiceUnavailable`. Throw `Timeout` exception for transaction search errors instead of `DownForMaintenance`.
|
201 |
+
* Add `RequestTimeout` and `GatewayTimeout` exceptions.
|
202 |
+
* Add `revokedAt` field to `PayPalAccount`
|
203 |
+
* Add support for `PAYMENT_METHOD_REVOKED_BY_CUSTOMER` webhook
|
204 |
+
|
205 |
+
## 3.40.0
|
206 |
+
* Deprecate `GRANTED_PAYMENT_INSTRUMENT_UPDATE` and add `GRANTOR_UPDATED_GRANTED_PAYMENT_METHOD` and `RECIPIENT_UPDATED_GRANTED_PAYMENT_METHOD`
|
207 |
+
* Add `accountType` field to `TransactionGateway`, `CreditCardGateway`, `PaymentMethodGateway`, and `CreditCardVerification`.
|
208 |
+
* Add Hiper and Hipercard test numbers.
|
209 |
+
* Add `refundFromTransactionFeeAmount` field to `PayPalDetails`
|
210 |
+
* Add `refundFromTransactionFeeCurrencyIsoCode` field to `PayPalDetails`
|
211 |
+
|
212 |
+
## 3.39.0
|
213 |
+
* Add `bin` field to `paymentMethodNonceDetails`
|
214 |
+
* Add Error indicating pdf uploads too long for dispute evidence.
|
215 |
+
* Add `GrantedPaymentMethodRevoked` webhook response objects
|
216 |
+
|
217 |
+
## 3.38.0
|
218 |
+
* Add `fraudServiceProvider` field in `riskData`
|
219 |
+
* Fix issue where merchant reporting calls would throw an exception in PHP 7 (#236)
|
220 |
+
|
221 |
+
## 3.37.0
|
222 |
+
* Add `processorResponseType` to `Transaction`, `AuthorizationAdjustment`, and `CreditCardVerification`.
|
223 |
+
* Add `authorizationExpiresAt` to `Transaction`
|
224 |
+
* Add support for additional PayPal options when vaulting a PayPal Order during customer update
|
225 |
+
* Allow PayPal payment ID and payer ID to be passed during transaction create
|
226 |
+
* Add `travel_flight` support to industry-specific data
|
227 |
+
|
228 |
+
## 3.36.0
|
229 |
+
* Fix dispute results in transactions not showing the correct status sometimes
|
230 |
+
* Add `externalVault` option to transaction sale
|
231 |
+
* Add `LocalPaymentCompleted` webhook
|
232 |
+
|
233 |
+
## 3.35.0
|
234 |
+
* Add subscription charged unsuccessfully sample webhook to webhook testing gateway
|
235 |
+
* Add `processor_response_code` and `processor_response_text` to authorization adjustments subfield in transaction response.
|
236 |
+
* Fix issue where result objects could not be printed with `echo` (thanks @cmeon)
|
237 |
+
* Add Samsung Pay support
|
238 |
+
|
239 |
## 3.34.0
|
240 |
* Allow payee ID to be passed in options params for transaction create
|
241 |
* Add `merchant_id` to `ConnectedMerchantStatusTransitioned` and `ConnectedMerchantPayPalStatusChanged` Auth webhooks
|
505 |
* Allow payee_email to be passed in options params for Transaction create
|
506 |
|
507 |
## 2.31.0
|
508 |
+
* Added paypal specific fields to transaction calls
|
509 |
* Added SettlementPending, SettlementDeclined transaction statuses
|
510 |
|
511 |
## 2.30.0
|
vendor/braintree/braintree_php/Dockerfile
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
FROM debian:wheezy
|
2 |
-
|
3 |
-
RUN apt-get update
|
4 |
-
|
5 |
-
# For installing hhvm
|
6 |
-
RUN apt-get install -y apt-transport-https software-properties-common
|
7 |
-
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
|
8 |
-
RUN echo deb https://dl.hhvm.com/debian wheezy main > /etc/apt/sources.list.d/hhvm.list
|
9 |
-
RUN apt-get update
|
10 |
-
|
11 |
-
RUN apt-get -y install curl rake php5 php5-cli php5-curl php-pear hhvm phpunit
|
12 |
-
|
13 |
-
WORKDIR /braintree-php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright (c)
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person
|
4 |
obtaining a copy of this software and associated documentation
|
1 |
+
Copyright (c) 2021 Braintree, a division of PayPal, Inc.
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person
|
4 |
obtaining a copy of this software and associated documentation
|
vendor/braintree/braintree_php/Makefile
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
.PHONY: console build
|
2 |
-
|
3 |
-
console: build
|
4 |
-
docker run -it -v="$(PWD):/braintree-php" --net="host" braintree-php /bin/bash -l -c "\
|
5 |
-
curl -sS https://getcomposer.org/installer | php -d suhosin.executor.include.whitelist=phar && \
|
6 |
-
php -d suhosin.executor.include.whitelist=phar ./composer.phar install; \
|
7 |
-
bash"
|
8 |
-
|
9 |
-
build:
|
10 |
-
docker build -t braintree-php .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/README.md
CHANGED
@@ -2,13 +2,11 @@
|
|
2 |
|
3 |
The Braintree PHP library provides integration access to the Braintree Gateway.
|
4 |
|
5 |
-
##
|
6 |
-
> **The Payment Card Industry (PCI) Council has [mandated](https://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, Braintree
|
7 |
|
8 |
## Dependencies
|
9 |
|
10 |
-
PHP version >= 5.4.0 is required.
|
11 |
-
|
12 |
The following PHP extensions are required:
|
13 |
|
14 |
* curl
|
@@ -17,6 +15,27 @@ The following PHP extensions are required:
|
|
17 |
* openssl
|
18 |
* xmlwriter
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
## Quick Start Example
|
21 |
|
22 |
```php
|
@@ -25,16 +44,16 @@ The following PHP extensions are required:
|
|
25 |
require_once 'PATH_TO_BRAINTREE/lib/Braintree.php';
|
26 |
|
27 |
// Instantiate a Braintree Gateway either like this:
|
28 |
-
$gateway = new
|
29 |
-
'environment' => 'sandbox'
|
30 |
'merchantId' => 'your_merchant_id',
|
31 |
'publicKey' => 'your_public_key',
|
32 |
'privateKey' => 'your_private_key'
|
33 |
]);
|
34 |
|
35 |
// or like this:
|
36 |
-
$config = new
|
37 |
-
'environment' => 'sandbox'
|
38 |
'merchantId' => 'your_merchant_id',
|
39 |
'publicKey' => 'your_public_key',
|
40 |
'privateKey' => 'your_private_key'
|
@@ -43,9 +62,10 @@ $gateway = new Braintree\Gateway($config)
|
|
43 |
|
44 |
// Then, create a transaction:
|
45 |
$result = $gateway->transaction()->sale([
|
46 |
-
'amount' => '
|
47 |
-
'paymentMethodNonce' =>
|
48 |
-
'
|
|
|
49 |
]);
|
50 |
|
51 |
if ($result->success) {
|
@@ -55,17 +75,19 @@ if ($result->success) {
|
|
55 |
print_r("\n code: " . $result->transaction->processorResponseCode);
|
56 |
print_r("\n text: " . $result->transaction->processorResponseText);
|
57 |
} else {
|
58 |
-
|
59 |
-
|
|
|
60 |
}
|
61 |
```
|
62 |
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
```php
|
67 |
$gateway = new Braintree\Gateway([
|
68 |
-
'environment' => 'sandbox'
|
69 |
'merchantId' => 'your_merchant_id',
|
70 |
'publicKey' => 'your_public_key',
|
71 |
'privateKey' => 'your_private_key'
|
@@ -74,7 +96,7 @@ $gateway = new Braintree\Gateway([
|
|
74 |
// or
|
75 |
|
76 |
$config = new Braintree\Configuration([
|
77 |
-
'environment' => 'sandbox'
|
78 |
'merchantId' => 'your_merchant_id',
|
79 |
'publicKey' => 'your_public_key',
|
80 |
'privateKey' => 'your_private_key'
|
@@ -82,10 +104,6 @@ $config = new Braintree\Configuration([
|
|
82 |
$gateway = new Braintree\Gateway($config)
|
83 |
```
|
84 |
|
85 |
-
## HHVM Support
|
86 |
-
|
87 |
-
The Braintree PHP library will run on HHVM >= 3.4.2.
|
88 |
-
|
89 |
## Google App Engine Support
|
90 |
|
91 |
When using Google App Engine include the curl extention in your `php.ini` file (see [#190](https://github.com/braintree/braintree_php/issues/190) for more information):
|
@@ -98,20 +116,12 @@ and turn off accepting gzip responses:
|
|
98 |
|
99 |
```php
|
100 |
$gateway = new Braintree\Gateway([
|
101 |
-
'environment' => 'sandbox'
|
102 |
// ...
|
103 |
'acceptGzipEncoding' => false,
|
104 |
]);
|
105 |
```
|
106 |
|
107 |
-
## Legacy PHP Support
|
108 |
-
|
109 |
-
Version [2.40.0](https://github.com/braintree/braintree_php/releases/tag/2.40.0) is compatible with PHP 5.2 and 5.3. You can find it on our releases page.
|
110 |
-
|
111 |
-
## Documentation
|
112 |
-
|
113 |
-
* [Official documentation](https://developers.braintreepayments.com/php/sdk/server/overview)
|
114 |
-
|
115 |
## Developing (Docker)
|
116 |
|
117 |
The `Makefile` and `Dockerfile` will build an image containing the dependencies and drop you to a terminal where you can run tests.
|
@@ -120,14 +130,20 @@ The `Makefile` and `Dockerfile` will build an image containing the dependencies
|
|
120 |
make
|
121 |
```
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
## Testing
|
124 |
|
125 |
The unit specs can be run by anyone on any system, but the integration specs are meant to be run against a local development server of our gateway code. These integration specs are not meant for public consumption and will likely fail if run on your system. To run unit tests use rake: `rake test:unit`.
|
126 |
|
127 |
-
|
128 |
-
```
|
129 |
-
phpunit tests/unit/
|
130 |
-
```
|
131 |
|
132 |
## License
|
133 |
|
2 |
|
3 |
The Braintree PHP library provides integration access to the Braintree Gateway.
|
4 |
|
5 |
+
## TLS 1.2 required
|
6 |
+
> **The Payment Card Industry (PCI) Council has [mandated](https://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, Braintree has updated its services to require TLS 1.2 for all HTTPS connections. Braintrees require HTTP/1.1 for all connections. Please see our [technical documentation](https://github.com/paypal/tls-update) for more information.**
|
7 |
|
8 |
## Dependencies
|
9 |
|
|
|
|
|
10 |
The following PHP extensions are required:
|
11 |
|
12 |
* curl
|
15 |
* openssl
|
16 |
* xmlwriter
|
17 |
|
18 |
+
PHP version >= 7.3 is required. The Braintree PHP SDK is tested against PHP versions 7.3 and 7.4, and 8.0.
|
19 |
+
|
20 |
+
_The PHP core development community has released [End-of-Life branches](https://www.php.net/eol.php) for PHP versions 5.4 - 7.2, and are no longer receiving security updates. As a result, Braintree does not support these versions of PHP._
|
21 |
+
|
22 |
+
## Versions
|
23 |
+
|
24 |
+
Braintree employs a deprecation policy for our SDKs. For more information on the statuses of an SDK check our [developer docs](https://developer.paypal.com/braintree/docs/reference/general/server-sdk-deprecation-policy).
|
25 |
+
|
26 |
+
| Major version number | Status | Released | Deprecated | Unsupported |
|
27 |
+
| -------------------- | ------ | -------- | ---------- | ----------- |
|
28 |
+
| 6.x.x | Active | March 2021 | TBA | TBA |
|
29 |
+
| 5.x.x | Inactive | March 2020 | March 2023 | March 2024 |
|
30 |
+
| 4.x.x | Inactive | May 2019 | March 2022 | March 2023 |
|
31 |
+
| 3.x.x | Inactive | May 2015 | March 2022 | March 2023 |
|
32 |
+
|
33 |
+
## Documentation
|
34 |
+
|
35 |
+
* [Official documentation](https://developer.paypal.com/braintree/docs/start/hello-server/php)
|
36 |
+
|
37 |
+
Updating from an Inactive, Deprecated, or Unsupported version of this SDK? Check our [Migration Guide](https://developer.paypal.com/braintree/docs/reference/general/server-sdk-migration-guide/php) for tips.
|
38 |
+
|
39 |
## Quick Start Example
|
40 |
|
41 |
```php
|
44 |
require_once 'PATH_TO_BRAINTREE/lib/Braintree.php';
|
45 |
|
46 |
// Instantiate a Braintree Gateway either like this:
|
47 |
+
$gateway = new Braintree\Gateway([
|
48 |
+
'environment' => 'sandbox',
|
49 |
'merchantId' => 'your_merchant_id',
|
50 |
'publicKey' => 'your_public_key',
|
51 |
'privateKey' => 'your_private_key'
|
52 |
]);
|
53 |
|
54 |
// or like this:
|
55 |
+
$config = new Braintree\Configuration([
|
56 |
+
'environment' => 'sandbox',
|
57 |
'merchantId' => 'your_merchant_id',
|
58 |
'publicKey' => 'your_public_key',
|
59 |
'privateKey' => 'your_private_key'
|
62 |
|
63 |
// Then, create a transaction:
|
64 |
$result = $gateway->transaction()->sale([
|
65 |
+
'amount' => '10.00',
|
66 |
+
'paymentMethodNonce' => $nonceFromTheClient,
|
67 |
+
'deviceData' => $deviceDataFromTheClient,
|
68 |
+
'options' => [ 'submitForSettlement' => True ]
|
69 |
]);
|
70 |
|
71 |
if ($result->success) {
|
75 |
print_r("\n code: " . $result->transaction->processorResponseCode);
|
76 |
print_r("\n text: " . $result->transaction->processorResponseText);
|
77 |
} else {
|
78 |
+
foreach($result->errors->deepAll() AS $error) {
|
79 |
+
print_r($error->code . ": " . $error->message . "\n");
|
80 |
+
}
|
81 |
}
|
82 |
```
|
83 |
|
84 |
+
## Namespacing
|
85 |
+
|
86 |
+
As of major version 5.x.x, only PSR-4 namespacing is supported. This means you'll have to reference classes using PSR-4 namespacing:
|
87 |
|
88 |
```php
|
89 |
$gateway = new Braintree\Gateway([
|
90 |
+
'environment' => 'sandbox',
|
91 |
'merchantId' => 'your_merchant_id',
|
92 |
'publicKey' => 'your_public_key',
|
93 |
'privateKey' => 'your_private_key'
|
96 |
// or
|
97 |
|
98 |
$config = new Braintree\Configuration([
|
99 |
+
'environment' => 'sandbox',
|
100 |
'merchantId' => 'your_merchant_id',
|
101 |
'publicKey' => 'your_public_key',
|
102 |
'privateKey' => 'your_private_key'
|
104 |
$gateway = new Braintree\Gateway($config)
|
105 |
```
|
106 |
|
|
|
|
|
|
|
|
|
107 |
## Google App Engine Support
|
108 |
|
109 |
When using Google App Engine include the curl extention in your `php.ini` file (see [#190](https://github.com/braintree/braintree_php/issues/190) for more information):
|
116 |
|
117 |
```php
|
118 |
$gateway = new Braintree\Gateway([
|
119 |
+
'environment' => 'sandbox',
|
120 |
// ...
|
121 |
'acceptGzipEncoding' => false,
|
122 |
]);
|
123 |
```
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
## Developing (Docker)
|
126 |
|
127 |
The `Makefile` and `Dockerfile` will build an image containing the dependencies and drop you to a terminal where you can run tests.
|
130 |
make
|
131 |
```
|
132 |
|
133 |
+
## Linting
|
134 |
+
|
135 |
+
The Rakefile includes commands to run [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) and [PHP Code Beautifier & Fixer](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically). To run the linter commands use rake:
|
136 |
+
|
137 |
+
```sh
|
138 |
+
rake lint:fix # runs the auto-fixer first, then sniffs for any remaining code smells
|
139 |
+
rake lint:sniff[y] # gives a detailed report of code smells
|
140 |
+
```
|
141 |
+
|
142 |
## Testing
|
143 |
|
144 |
The unit specs can be run by anyone on any system, but the integration specs are meant to be run against a local development server of our gateway code. These integration specs are not meant for public consumption and will likely fail if run on your system. To run unit tests use rake: `rake test:unit`.
|
145 |
|
146 |
+
To lint and run all tests, use rake: `rake test`.
|
|
|
|
|
|
|
147 |
|
148 |
## License
|
149 |
|
vendor/braintree/braintree_php/Rakefile
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
task :default => :test
|
2 |
-
task :test => %w[test:unit test:integration]
|
3 |
-
|
4 |
-
namespace :test do
|
5 |
-
task :unit => %w[test:php:unit test:hhvm:unit]
|
6 |
-
task :integration => %w[test:php:integration test:hhvm:integration]
|
7 |
-
|
8 |
-
namespace :php do
|
9 |
-
desc "print PHP version"
|
10 |
-
task :version do
|
11 |
-
print_php_version("php")
|
12 |
-
end
|
13 |
-
|
14 |
-
desc "run unit tests under PHP"
|
15 |
-
task :unit => :version do
|
16 |
-
run_php_test_suite("php", "unit")
|
17 |
-
end
|
18 |
-
|
19 |
-
desc "run integration tests under PHP"
|
20 |
-
task :integration do
|
21 |
-
run_php_test_suite("php", "integration")
|
22 |
-
end
|
23 |
-
end
|
24 |
-
|
25 |
-
namespace :hhvm do
|
26 |
-
desc "print HHVM version"
|
27 |
-
task :version do
|
28 |
-
print_php_version("hhvm")
|
29 |
-
end
|
30 |
-
|
31 |
-
desc "run tests under HHVM"
|
32 |
-
task :test => [:unit, :integration]
|
33 |
-
|
34 |
-
desc "run unit tests under HHVM"
|
35 |
-
task :unit => :version do
|
36 |
-
run_php_test_suite("hhvm", "unit")
|
37 |
-
end
|
38 |
-
|
39 |
-
desc "run integration tests under HHVM"
|
40 |
-
task :integration do
|
41 |
-
run_php_test_suite("hhvm", "integration")
|
42 |
-
end
|
43 |
-
end
|
44 |
-
|
45 |
-
desc "run tests under PHP"
|
46 |
-
task :php => %w[php:unit php:integration]
|
47 |
-
|
48 |
-
desc "run tests under HHVM"
|
49 |
-
task :hhvm => %w[hhvm:unit hhvm:integration]
|
50 |
-
|
51 |
-
desc "run a single test file"
|
52 |
-
task :file, :file_path do |t, args|
|
53 |
-
run_php_test_file(args[:file_path])
|
54 |
-
end
|
55 |
-
|
56 |
-
desc "run single test (e.g. rake test:single[GatewayTest::testConfigGetsAssertedValid])"
|
57 |
-
task :single, :test_name do |t, args|
|
58 |
-
run_php_test(args[:test_name])
|
59 |
-
end
|
60 |
-
end
|
61 |
-
|
62 |
-
desc "update the copyright year"
|
63 |
-
task :copyright, :from_year, :to_year do |t, args|
|
64 |
-
sh "find tests lib -type f -name '*.php' -exec sed -i 's/#{args[:from_year]} Braintree/#{args[:to_year]} Braintree/g' {} +"
|
65 |
-
end
|
66 |
-
|
67 |
-
def print_php_version(interpreter)
|
68 |
-
sh "#{interpreter} --version"
|
69 |
-
end
|
70 |
-
|
71 |
-
def run_php_test_suite(interpreter, test_suite)
|
72 |
-
sh "#{interpreter} ./vendor/bin/phpunit --testsuite #{test_suite}"
|
73 |
-
end
|
74 |
-
|
75 |
-
def run_php_test_file(test_file)
|
76 |
-
sh "./vendor/bin/phpunit #{test_file}"
|
77 |
-
end
|
78 |
-
|
79 |
-
def run_php_test(test_name)
|
80 |
-
sh "./vendor/bin/phpunit --filter #{test_name}"
|
81 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/ci.sh
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
curl -sS https://getcomposer.org/installer | php -d suhosin.executor.include.whitelist=phar
|
4 |
-
|
5 |
-
php -d suhosin.executor.include.whitelist=phar ./composer.phar install
|
6 |
-
|
7 |
-
if [ "$1" == "hhvm" ]; then
|
8 |
-
rake test:hhvm --trace
|
9 |
-
else
|
10 |
-
rake test:php --trace
|
11 |
-
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree.php
CHANGED
@@ -1,21 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Braintree PHP Library
|
4 |
-
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
|
5 |
-
*/
|
6 |
|
7 |
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
|
8 |
|
9 |
-
if (version_compare(PHP_VERSION, '
|
10 |
-
throw new
|
11 |
}
|
12 |
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
$requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
|
16 |
-
foreach ($requiredExtensions
|
17 |
if (!extension_loaded($ext)) {
|
18 |
-
throw new
|
19 |
}
|
20 |
}
|
21 |
}
|
1 |
+
<?php // phpcs:disable
|
|
|
|
|
|
|
|
|
2 |
|
3 |
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
|
4 |
|
5 |
+
if (version_compare(PHP_VERSION, '7.3.0', '<')) {
|
6 |
+
throw new Braintree\Exception('PHP version >= 7.3.0 required');
|
7 |
}
|
8 |
|
9 |
+
/**
|
10 |
+
* Braintree PHP Library
|
11 |
+
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
|
12 |
+
*/
|
13 |
+
class Braintree
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Checks for required dependencies
|
17 |
+
*
|
18 |
+
* @throws Braintree/Exception With the missing extension
|
19 |
+
*
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public static function requireDependencies()
|
23 |
+
{
|
24 |
$requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
|
25 |
+
foreach ($requiredExtensions as $ext) {
|
26 |
if (!extension_loaded($ext)) {
|
27 |
+
throw new Braintree\Exception('The Braintree library requires the ' . $ext . ' extension.');
|
28 |
}
|
29 |
}
|
30 |
}
|
vendor/braintree/braintree_php/lib/Braintree/AccountUpdaterDailyReport.php
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Creates an instance of AccountUpdaterDailyReport
|
6 |
*
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
*
|
10 |
-
* @property-read string $reportUrl
|
11 |
-
* @property-read date $reportDate
|
12 |
*/
|
13 |
class AccountUpdaterDailyReport extends Base
|
14 |
{
|
@@ -19,6 +16,13 @@ class AccountUpdaterDailyReport extends Base
|
|
19 |
$this->_attributes = $disputeAttribs;
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
public static function factory($attributes)
|
23 |
{
|
24 |
$instance = new self();
|
@@ -26,18 +30,18 @@ class AccountUpdaterDailyReport extends Base
|
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
-
|
|
|
30 |
{
|
31 |
$display = [
|
32 |
'reportDate', 'reportUrl'
|
33 |
];
|
34 |
|
35 |
$displayAttributes = [];
|
36 |
-
foreach ($display
|
37 |
$displayAttributes[$attrib] = $this->$attrib;
|
38 |
}
|
39 |
return __CLASS__ . '[' .
|
40 |
-
Util::attributesToString($displayAttributes) .']';
|
41 |
}
|
42 |
}
|
43 |
-
class_alias('Braintree\AccountUpdaterDailyReport', 'Braintree_AccountUpdaterDailyReport');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Creates an instance of AccountUpdaterDailyReport
|
7 |
*
|
8 |
+
* For attributes see our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/account-updater/php#notification-kinds developer documentation}
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
class AccountUpdaterDailyReport extends Base
|
11 |
{
|
16 |
$this->_attributes = $disputeAttribs;
|
17 |
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Creates an instance of an AccountUpdaterDailyReport from given attributes
|
21 |
+
*
|
22 |
+
* @param array $attributes to generate new AccountUpdaterDailyReport
|
23 |
+
*
|
24 |
+
* @return AccountUpdaterDailyReport
|
25 |
+
*/
|
26 |
public static function factory($attributes)
|
27 |
{
|
28 |
$instance = new self();
|
30 |
return $instance;
|
31 |
}
|
32 |
|
33 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
34 |
+
public function __toString()
|
35 |
{
|
36 |
$display = [
|
37 |
'reportDate', 'reportUrl'
|
38 |
];
|
39 |
|
40 |
$displayAttributes = [];
|
41 |
+
foreach ($display as $attrib) {
|
42 |
$displayAttributes[$attrib] = $this->$attrib;
|
43 |
}
|
44 |
return __CLASS__ . '[' .
|
45 |
+
Util::attributesToString($displayAttributes) . ']';
|
46 |
}
|
47 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AchMandate.php
CHANGED
@@ -1,24 +1,16 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree AchMandate module
|
6 |
-
* PHP Version 5
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
*
|
10 |
-
*
|
11 |
-
* @property-read string $acceptedAt
|
12 |
*/
|
13 |
class AchMandate extends Base
|
14 |
{
|
15 |
-
|
16 |
-
|
17 |
-
* ClassName[property=value, property=value]
|
18 |
-
* @ignore
|
19 |
-
* @return string
|
20 |
-
*/
|
21 |
-
public function __toString()
|
22 |
{
|
23 |
return __CLASS__ . '[' .
|
24 |
Util::attributesToString($this->_attributes) . ']';
|
@@ -27,9 +19,8 @@ class AchMandate extends Base
|
|
27 |
/**
|
28 |
* sets instance properties from an array of values
|
29 |
*
|
30 |
-
* @ignore
|
31 |
-
* @access protected
|
32 |
* @param array $achAttribs array of achMandate data
|
|
|
33 |
* @return void
|
34 |
*/
|
35 |
protected function _initialize($achAttribs)
|
@@ -41,7 +32,9 @@ class AchMandate extends Base
|
|
41 |
/**
|
42 |
* factory method: returns an instance of AchMandate
|
43 |
* to the requesting method, with populated properties
|
44 |
-
*
|
|
|
|
|
45 |
* @return AchMandate
|
46 |
*/
|
47 |
public static function factory($attributes)
|
@@ -49,7 +42,5 @@ class AchMandate extends Base
|
|
49 |
$instance = new self();
|
50 |
$instance->_initialize($attributes);
|
51 |
return $instance;
|
52 |
-
|
53 |
}
|
54 |
}
|
55 |
-
class_alias('Braintree\AchMandate', 'Braintree_Mandate');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree AchMandate module
|
|
|
|
|
|
|
7 |
*
|
8 |
+
* See our {link https://developer.paypal.com/braintree/docs/reference/response/us-bank-account/php#ach_mandate developer docs} for information on attributes
|
|
|
9 |
*/
|
10 |
class AchMandate extends Base
|
11 |
{
|
12 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
13 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
|
|
14 |
{
|
15 |
return __CLASS__ . '[' .
|
16 |
Util::attributesToString($this->_attributes) . ']';
|
19 |
/**
|
20 |
* sets instance properties from an array of values
|
21 |
*
|
|
|
|
|
22 |
* @param array $achAttribs array of achMandate data
|
23 |
+
*
|
24 |
* @return void
|
25 |
*/
|
26 |
protected function _initialize($achAttribs)
|
32 |
/**
|
33 |
* factory method: returns an instance of AchMandate
|
34 |
* to the requesting method, with populated properties
|
35 |
+
*
|
36 |
+
* @param array $attributes response object attributes
|
37 |
+
*
|
38 |
* @return AchMandate
|
39 |
*/
|
40 |
public static function factory($attributes)
|
42 |
$instance = new self();
|
43 |
$instance->_initialize($attributes);
|
44 |
return $instance;
|
|
|
45 |
}
|
46 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AddOn.php
CHANGED
@@ -1,11 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class AddOn extends Modification
|
5 |
{
|
6 |
/**
|
|
|
|
|
|
|
7 |
*
|
8 |
-
* @param array $attributes
|
9 |
* @return AddOn
|
10 |
*/
|
11 |
public static function factory($attributes)
|
@@ -17,7 +27,9 @@ class AddOn extends Modification
|
|
17 |
|
18 |
|
19 |
/**
|
20 |
-
* static methods redirecting to gateway
|
|
|
|
|
21 |
*
|
22 |
* @return AddOn[]
|
23 |
*/
|
@@ -26,4 +38,3 @@ class AddOn extends Modification
|
|
26 |
return Configuration::gateway()->addOn()->all();
|
27 |
}
|
28 |
}
|
29 |
-
class_alias('Braintree\AddOn', 'Braintree_AddOn');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree AddOn class
|
7 |
+
*
|
8 |
+
* Object containing information on AddOns of a subscription
|
9 |
+
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/add-on developer docs} for information on attributes
|
11 |
+
*/
|
12 |
class AddOn extends Modification
|
13 |
{
|
14 |
/**
|
15 |
+
* Creates an instance of an AddOn from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
*
|
|
|
19 |
* @return AddOn
|
20 |
*/
|
21 |
public static function factory($attributes)
|
27 |
|
28 |
|
29 |
/**
|
30 |
+
* static methods redirecting to gateway class
|
31 |
+
*
|
32 |
+
* @see AddOnGateway::all()
|
33 |
*
|
34 |
* @return AddOn[]
|
35 |
*/
|
38 |
return Configuration::gateway()->addOn()->all();
|
39 |
}
|
40 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AddOnGateway.php
CHANGED
@@ -1,30 +1,19 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class AddOnGateway
|
5 |
{
|
6 |
-
/**
|
7 |
-
*
|
8 |
-
* @var Gateway
|
9 |
-
*/
|
10 |
private $_gateway;
|
11 |
-
|
12 |
-
/**
|
13 |
-
*
|
14 |
-
* @var Configuration
|
15 |
-
*/
|
16 |
private $_config;
|
17 |
-
|
18 |
-
/**
|
19 |
-
*
|
20 |
-
* @var Http
|
21 |
-
*/
|
22 |
private $_http;
|
23 |
|
24 |
-
|
25 |
-
*
|
26 |
-
* @param Gateway $gateway
|
27 |
-
*/
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -34,6 +23,7 @@ class AddOnGateway
|
|
34 |
}
|
35 |
|
36 |
/**
|
|
|
37 |
*
|
38 |
* @return AddOn[]
|
39 |
*/
|
@@ -50,4 +40,3 @@ class AddOnGateway
|
|
50 |
);
|
51 |
}
|
52 |
}
|
53 |
-
class_alias('Braintree\AddOnGateway', 'Braintree_AddOnGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree AddOnGateway module
|
7 |
+
*
|
8 |
+
* Manages subscription addons
|
9 |
+
*/
|
10 |
class AddOnGateway
|
11 |
{
|
|
|
|
|
|
|
|
|
12 |
private $_gateway;
|
|
|
|
|
|
|
|
|
|
|
13 |
private $_config;
|
|
|
|
|
|
|
|
|
|
|
14 |
private $_http;
|
15 |
|
16 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
17 |
public function __construct($gateway)
|
18 |
{
|
19 |
$this->_gateway = $gateway;
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
+
* Retrieve all add ons
|
27 |
*
|
28 |
* @return AddOn[]
|
29 |
*/
|
40 |
);
|
41 |
}
|
42 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Address.php
CHANGED
@@ -1,30 +1,16 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree Address module
|
6 |
-
* PHP Version 5
|
7 |
* Creates and manages Braintree Addresses
|
8 |
*
|
9 |
* An Address belongs to a Customer. It can be associated to a
|
10 |
* CreditCard as the billing address. It can also be used
|
11 |
* as the shipping address when creating a Transaction.
|
12 |
*
|
13 |
-
* @
|
14 |
-
*
|
15 |
-
* @property-read string $company
|
16 |
-
* @property-read string $countryName
|
17 |
-
* @property-read string $createdAt
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $extendedAddress
|
20 |
-
* @property-read string $firstName
|
21 |
-
* @property-read string $id
|
22 |
-
* @property-read string $lastName
|
23 |
-
* @property-read string $locality
|
24 |
-
* @property-read string $postalCode
|
25 |
-
* @property-read string $region
|
26 |
-
* @property-read string $streetAddress
|
27 |
-
* @property-read string $updatedAt
|
28 |
*/
|
29 |
class Address extends Base
|
30 |
{
|
@@ -33,6 +19,7 @@ class Address extends Base
|
|
33 |
* or is a Address with a different id
|
34 |
*
|
35 |
* @param object $other address to compare against
|
|
|
36 |
* @return boolean
|
37 |
*/
|
38 |
public function isEqual($other)
|
@@ -42,26 +29,14 @@ class Address extends Base
|
|
42 |
($this->id === $other->id && $this->customerId === $other->customerId);
|
43 |
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
* ClassName[property=value, property=value]
|
48 |
-
* @ignore
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function __toString()
|
52 |
{
|
53 |
return __CLASS__ . '[' .
|
54 |
Util::attributesToString($this->_attributes) . ']';
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
* sets instance properties from an array of values
|
59 |
-
*
|
60 |
-
* @ignore
|
61 |
-
* @access protected
|
62 |
-
* @param array $addressAttribs array of address data
|
63 |
-
* @return void
|
64 |
-
*/
|
65 |
protected function _initialize($addressAttribs)
|
66 |
{
|
67 |
// set the attributes
|
@@ -69,9 +44,10 @@ class Address extends Base
|
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
-
*
|
73 |
-
*
|
74 |
-
* @
|
|
|
75 |
* @return Address
|
76 |
*/
|
77 |
public static function factory($attributes)
|
@@ -79,16 +55,16 @@ class Address extends Base
|
|
79 |
$instance = new self();
|
80 |
$instance->_initialize($attributes);
|
81 |
return $instance;
|
82 |
-
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
// static methods redirecting to gateway
|
87 |
-
|
88 |
/**
|
|
|
89 |
*
|
90 |
-
* @param array $attribs
|
91 |
-
*
|
|
|
|
|
|
|
92 |
*/
|
93 |
public static function create($attribs)
|
94 |
{
|
@@ -96,8 +72,14 @@ class Address extends Base
|
|
96 |
}
|
97 |
|
98 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
*
|
100 |
-
* @param array $attribs
|
101 |
* @return Address
|
102 |
*/
|
103 |
public static function createNoValidate($attribs)
|
@@ -106,11 +88,14 @@ class Address extends Base
|
|
106 |
}
|
107 |
|
108 |
/**
|
|
|
|
|
|
|
|
|
109 |
*
|
110 |
-
* @
|
111 |
-
*
|
112 |
-
* @
|
113 |
-
* @return Result\Successful
|
114 |
*/
|
115 |
public static function delete($customerOrId = null, $addressId = null)
|
116 |
{
|
@@ -118,10 +103,15 @@ class Address extends Base
|
|
118 |
}
|
119 |
|
120 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
*
|
122 |
-
* @param Customer|int $customerOrId
|
123 |
-
* @param int $addressId
|
124 |
* @throws Exception\NotFound
|
|
|
125 |
* @return Address
|
126 |
*/
|
127 |
public static function find($customerOrId, $addressId)
|
@@ -130,11 +120,14 @@ class Address extends Base
|
|
130 |
}
|
131 |
|
132 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
*
|
134 |
-
* @param Customer|int $customerOrId
|
135 |
-
* @param int $addressId
|
136 |
-
* @param array $attributes
|
137 |
-
* @throws Exception\Unexpected
|
138 |
* @return Result\Successful|Result\Error
|
139 |
*/
|
140 |
public static function update($customerOrId, $addressId, $attributes)
|
@@ -142,9 +135,21 @@ class Address extends Base
|
|
142 |
return Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes);
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
public static function updateNoValidate($customerOrId, $addressId, $attributes)
|
146 |
{
|
147 |
return Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);
|
148 |
}
|
149 |
}
|
150 |
-
class_alias('Braintree\Address', 'Braintree_Address');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree Address module
|
|
|
7 |
* Creates and manages Braintree Addresses
|
8 |
*
|
9 |
* An Address belongs to a Customer. It can be associated to a
|
10 |
* CreditCard as the billing address. It can also be used
|
11 |
* as the shipping address when creating a Transaction.
|
12 |
*
|
13 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/address developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
*/
|
15 |
class Address extends Base
|
16 |
{
|
19 |
* or is a Address with a different id
|
20 |
*
|
21 |
* @param object $other address to compare against
|
22 |
+
*
|
23 |
* @return boolean
|
24 |
*/
|
25 |
public function isEqual($other)
|
29 |
($this->id === $other->id && $this->customerId === $other->customerId);
|
30 |
}
|
31 |
|
32 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
33 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
|
|
34 |
{
|
35 |
return __CLASS__ . '[' .
|
36 |
Util::attributesToString($this->_attributes) . ']';
|
37 |
}
|
38 |
|
39 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
protected function _initialize($addressAttribs)
|
41 |
{
|
42 |
// set the attributes
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
+
* Creates an instance of an Address from given attributes
|
48 |
+
*
|
49 |
+
* @param array $attributes response object attributes
|
50 |
+
*
|
51 |
* @return Address
|
52 |
*/
|
53 |
public static function factory($attributes)
|
55 |
$instance = new self();
|
56 |
$instance->_initialize($attributes);
|
57 |
return $instance;
|
|
|
58 |
}
|
59 |
|
|
|
|
|
|
|
60 |
/**
|
61 |
+
* static method redirecting to gateway class
|
62 |
*
|
63 |
+
* @param array $attribs containing request parameters
|
64 |
+
*
|
65 |
+
* @see AddressGateway::create()
|
66 |
+
*
|
67 |
+
* @return Result\Successful|Result\Error
|
68 |
*/
|
69 |
public static function create($attribs)
|
70 |
{
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
+
* static method redirecting to gateway class
|
76 |
+
*
|
77 |
+
* @param array $attribs containing request parameters
|
78 |
+
*
|
79 |
+
* @see AddressGateway::createNoValidate()
|
80 |
+
*
|
81 |
+
* @throws Exception\ValidationError
|
82 |
*
|
|
|
83 |
* @return Address
|
84 |
*/
|
85 |
public static function createNoValidate($attribs)
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
+
* static method redirecting to gateway class
|
92 |
+
*
|
93 |
+
* @param mixed $customerOrId either a customer object or string ID of customer
|
94 |
+
* @param string $addressId optional unique identifier
|
95 |
*
|
96 |
+
* @see AddressGateway::delete()
|
97 |
+
*
|
98 |
+
* @return Result\Successful|Result\Error
|
|
|
99 |
*/
|
100 |
public static function delete($customerOrId = null, $addressId = null)
|
101 |
{
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
+
* static method redirecting to gateway class
|
107 |
+
*
|
108 |
+
* @param mixed $customerOrId either a customer object or string ID of customer
|
109 |
+
* @param string $addressId optional unique identifier
|
110 |
+
*
|
111 |
+
* @see AddressGateway::find()
|
112 |
*
|
|
|
|
|
113 |
* @throws Exception\NotFound
|
114 |
+
*
|
115 |
* @return Address
|
116 |
*/
|
117 |
public static function find($customerOrId, $addressId)
|
120 |
}
|
121 |
|
122 |
/**
|
123 |
+
* static method redirecting to gateway class
|
124 |
+
*
|
125 |
+
* @param mixed $customerOrId (only used in call)
|
126 |
+
* @param string $addressId (only used in call)
|
127 |
+
* @param array $attributes containing request parameters
|
128 |
+
*
|
129 |
+
* @see AddressGateway::update()
|
130 |
*
|
|
|
|
|
|
|
|
|
131 |
* @return Result\Successful|Result\Error
|
132 |
*/
|
133 |
public static function update($customerOrId, $addressId, $attributes)
|
135 |
return Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes);
|
136 |
}
|
137 |
|
138 |
+
/**
|
139 |
+
* static method redirecting to gateway class
|
140 |
+
*
|
141 |
+
* @param mixed $customerOrId (only used in call)
|
142 |
+
* @param string $addressId (only used in call)
|
143 |
+
* @param array $attributes containing request parameters
|
144 |
+
*
|
145 |
+
* @see AddressGateway::updateNoValidate()
|
146 |
+
*
|
147 |
+
* @throws Exception\ValidationsFailed
|
148 |
+
*
|
149 |
+
* @return Address
|
150 |
+
*/
|
151 |
public static function updateNoValidate($customerOrId, $addressId, $attributes)
|
152 |
{
|
153 |
return Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);
|
154 |
}
|
155 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AddressGateway.php
CHANGED
@@ -1,43 +1,24 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
6 |
/**
|
7 |
* Braintree AddressGateway module
|
8 |
-
* PHP Version 5
|
9 |
* Creates and manages Braintree Addresses
|
10 |
*
|
11 |
* An Address belongs to a Customer. It can be associated to a
|
12 |
* CreditCard as the billing address. It can also be used
|
13 |
* as the shipping address when creating a Transaction.
|
14 |
-
*
|
15 |
-
* @package Braintree
|
16 |
*/
|
17 |
class AddressGateway
|
18 |
{
|
19 |
-
/**
|
20 |
-
*
|
21 |
-
* @var Gateway
|
22 |
-
*/
|
23 |
private $_gateway;
|
24 |
-
|
25 |
-
/**
|
26 |
-
*
|
27 |
-
* @var Configuration
|
28 |
-
*/
|
29 |
private $_config;
|
30 |
-
|
31 |
-
/**
|
32 |
-
*
|
33 |
-
* @var Http
|
34 |
-
*/
|
35 |
private $_http;
|
36 |
|
37 |
-
|
38 |
-
*
|
39 |
-
* @param Gateway $gateway
|
40 |
-
*/
|
41 |
public function __construct($gateway)
|
42 |
{
|
43 |
$this->_gateway = $gateway;
|
@@ -47,11 +28,11 @@ class AddressGateway
|
|
47 |
}
|
48 |
|
49 |
|
50 |
-
/* public class methods */
|
51 |
/**
|
|
|
|
|
|
|
52 |
*
|
53 |
-
* @access public
|
54 |
-
* @param array $attribs
|
55 |
* @return Result\Successful|Result\Error
|
56 |
*/
|
57 |
public function create($attribs)
|
@@ -79,23 +60,25 @@ class AddressGateway
|
|
79 |
* attempts the create operation assuming all data will validate
|
80 |
* returns a Address object instead of a Result
|
81 |
*
|
82 |
-
* @
|
83 |
-
*
|
84 |
-
* @return self
|
85 |
* @throws Exception\ValidationError
|
|
|
|
|
86 |
*/
|
87 |
public function createNoValidate($attribs)
|
88 |
{
|
89 |
$result = $this->create($attribs);
|
90 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
91 |
-
|
92 |
}
|
93 |
|
94 |
/**
|
95 |
* delete an address by id
|
96 |
*
|
97 |
-
* @param mixed
|
98 |
-
* @param string $addressId
|
|
|
|
|
99 |
*/
|
100 |
public function delete($customerOrId = null, $addressId = null)
|
101 |
{
|
@@ -113,12 +96,12 @@ class AddressGateway
|
|
113 |
* to the given <b>customerOrId</b>.
|
114 |
* If the address cannot be found, a NotFound exception will be thrown.
|
115 |
*
|
|
|
|
|
116 |
*
|
117 |
-
* @access public
|
118 |
-
* @param mixed $customerOrId
|
119 |
-
* @param string $addressId
|
120 |
-
* @return Address
|
121 |
* @throws Exception\NotFound
|
|
|
|
|
122 |
*/
|
123 |
public function find($customerOrId, $addressId)
|
124 |
{
|
@@ -132,11 +115,10 @@ class AddressGateway
|
|
132 |
return Address::factory($response['address']);
|
133 |
} catch (Exception\NotFound $e) {
|
134 |
throw new Exception\NotFound(
|
135 |
-
|
136 |
' with id ' . $addressId . ' not found.'
|
137 |
);
|
138 |
}
|
139 |
-
|
140 |
}
|
141 |
|
142 |
/**
|
@@ -146,11 +128,10 @@ class AddressGateway
|
|
146 |
* customerOrId is the 2nd attribute, addressId 3rd.
|
147 |
* customerOrId & addressId are not sent in object context.
|
148 |
*
|
|
|
|
|
|
|
149 |
*
|
150 |
-
* @access public
|
151 |
-
* @param array $attributes
|
152 |
-
* @param mixed $customerOrId (only used in call)
|
153 |
-
* @param string $addressId (only used in call)
|
154 |
* @return Result\Successful|Result\Error
|
155 |
*/
|
156 |
public function update($customerOrId, $addressId, $attributes)
|
@@ -163,7 +144,6 @@ class AddressGateway
|
|
163 |
$response = $this->_http->put($path, ['address' => $attributes]);
|
164 |
|
165 |
return $this->_verifyGatewayResponse($response);
|
166 |
-
|
167 |
}
|
168 |
|
169 |
/**
|
@@ -173,12 +153,15 @@ class AddressGateway
|
|
173 |
* customerOrId is the 2nd attribute, addressId 3rd.
|
174 |
* customerOrId & addressId are not sent in object context.
|
175 |
*
|
176 |
-
* @
|
177 |
-
* @param
|
178 |
-
* @param
|
179 |
-
*
|
180 |
* @throws Exception\ValidationsFailed
|
|
|
181 |
* @see Address::update()
|
|
|
|
|
182 |
*/
|
183 |
public function updateNoValidate($customerOrId, $addressId, $attributes)
|
184 |
{
|
@@ -188,6 +171,7 @@ class AddressGateway
|
|
188 |
|
189 |
/**
|
190 |
* creates a full array signature of a valid create request
|
|
|
191 |
* @return array gateway create request format
|
192 |
*/
|
193 |
public static function createSignature()
|
@@ -201,60 +185,65 @@ class AddressGateway
|
|
201 |
|
202 |
/**
|
203 |
* creates a full array signature of a valid update request
|
|
|
204 |
* @return array gateway update request format
|
205 |
*/
|
206 |
public static function updateSignature()
|
207 |
{
|
208 |
-
// TODO: remove customerId from update signature
|
209 |
return self::createSignature();
|
210 |
-
|
211 |
}
|
212 |
|
213 |
/**
|
214 |
* verifies that a valid address id is being used
|
215 |
-
*
|
216 |
* @param string $id address id
|
|
|
217 |
* @throws InvalidArgumentException
|
|
|
|
|
218 |
*/
|
219 |
private function _validateId($id = null)
|
220 |
{
|
221 |
if (empty($id) || trim($id) == "") {
|
222 |
throw new InvalidArgumentException(
|
223 |
-
|
224 |
);
|
225 |
}
|
226 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
227 |
throw new InvalidArgumentException(
|
228 |
-
|
229 |
);
|
230 |
}
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
* verifies that a valid customer id is being used
|
235 |
-
*
|
236 |
* @param string $id customer id
|
|
|
237 |
* @throws InvalidArgumentException
|
|
|
|
|
238 |
*/
|
239 |
private function _validateCustomerId($id = null)
|
240 |
{
|
241 |
if (empty($id) || trim($id) == "") {
|
242 |
throw new InvalidArgumentException(
|
243 |
-
|
244 |
);
|
245 |
}
|
246 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
247 |
throw new InvalidArgumentException(
|
248 |
-
|
249 |
);
|
250 |
}
|
251 |
-
|
252 |
}
|
253 |
|
254 |
/**
|
255 |
* determines if a string id or Customer object was passed
|
256 |
-
*
|
257 |
-
* @param mixed $customerOrId
|
|
|
258 |
* @return string customerId
|
259 |
*/
|
260 |
private function _determineCustomerId($customerOrId)
|
@@ -262,17 +251,8 @@ class AddressGateway
|
|
262 |
$customerId = ($customerOrId instanceof Customer) ? $customerOrId->id : $customerOrId;
|
263 |
$this->_validateCustomerId($customerId);
|
264 |
return $customerId;
|
265 |
-
|
266 |
}
|
267 |
|
268 |
-
/* private class methods */
|
269 |
-
/**
|
270 |
-
* sends the create request to the gateway
|
271 |
-
* @ignore
|
272 |
-
* @param string $subPath
|
273 |
-
* @param array $params
|
274 |
-
* @return Result\Successful|Result\Error
|
275 |
-
*/
|
276 |
private function _doCreate($subPath, $params)
|
277 |
{
|
278 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -281,19 +261,6 @@ class AddressGateway
|
|
281 |
return $this->_verifyGatewayResponse($response);
|
282 |
}
|
283 |
|
284 |
-
/**
|
285 |
-
* generic method for validating incoming gateway responses
|
286 |
-
*
|
287 |
-
* creates a new Address object and encapsulates
|
288 |
-
* it inside a Result\Successful object, or
|
289 |
-
* encapsulates an Errors object inside a Result\Error
|
290 |
-
* alternatively, throws an Unexpected exception if the response is invalid
|
291 |
-
*
|
292 |
-
* @ignore
|
293 |
-
* @param array $response gateway response values
|
294 |
-
* @return Result\Successful|Result\Error
|
295 |
-
* @throws Exception\Unexpected
|
296 |
-
*/
|
297 |
private function _verifyGatewayResponse($response)
|
298 |
{
|
299 |
if (isset($response['address'])) {
|
@@ -301,14 +268,12 @@ class AddressGateway
|
|
301 |
return new Result\Successful(
|
302 |
Address::factory($response['address'])
|
303 |
);
|
304 |
-
}
|
305 |
return new Result\Error($response['apiErrorResponse']);
|
306 |
} else {
|
307 |
throw new Exception\Unexpected(
|
308 |
-
|
309 |
);
|
310 |
}
|
311 |
-
|
312 |
}
|
313 |
}
|
314 |
-
class_alias('Braintree\AddressGateway', 'Braintree_AddressGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
/**
|
8 |
* Braintree AddressGateway module
|
|
|
9 |
* Creates and manages Braintree Addresses
|
10 |
*
|
11 |
* An Address belongs to a Customer. It can be associated to a
|
12 |
* CreditCard as the billing address. It can also be used
|
13 |
* as the shipping address when creating a Transaction.
|
|
|
|
|
14 |
*/
|
15 |
class AddressGateway
|
16 |
{
|
|
|
|
|
|
|
|
|
17 |
private $_gateway;
|
|
|
|
|
|
|
|
|
|
|
18 |
private $_config;
|
|
|
|
|
|
|
|
|
|
|
19 |
private $_http;
|
20 |
|
21 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
22 |
public function __construct($gateway)
|
23 |
{
|
24 |
$this->_gateway = $gateway;
|
28 |
}
|
29 |
|
30 |
|
|
|
31 |
/**
|
32 |
+
* Create an Address
|
33 |
+
*
|
34 |
+
* @param array $attribs containing request parameters
|
35 |
*
|
|
|
|
|
36 |
* @return Result\Successful|Result\Error
|
37 |
*/
|
38 |
public function create($attribs)
|
60 |
* attempts the create operation assuming all data will validate
|
61 |
* returns a Address object instead of a Result
|
62 |
*
|
63 |
+
* @param array $attribs containing request parameters
|
64 |
+
*
|
|
|
65 |
* @throws Exception\ValidationError
|
66 |
+
*
|
67 |
+
* @return Address
|
68 |
*/
|
69 |
public function createNoValidate($attribs)
|
70 |
{
|
71 |
$result = $this->create($attribs);
|
72 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
76 |
* delete an address by id
|
77 |
*
|
78 |
+
* @param mixed $customerOrId either a customer object or string ID of customer
|
79 |
+
* @param string $addressId optional unique identifier
|
80 |
+
*
|
81 |
+
* @return Result\Successful|Result\Error
|
82 |
*/
|
83 |
public function delete($customerOrId = null, $addressId = null)
|
84 |
{
|
96 |
* to the given <b>customerOrId</b>.
|
97 |
* If the address cannot be found, a NotFound exception will be thrown.
|
98 |
*
|
99 |
+
* @param mixed $customerOrId either a customer object or string ID of customer
|
100 |
+
* @param string $addressId optional unique identifier
|
101 |
*
|
|
|
|
|
|
|
|
|
102 |
* @throws Exception\NotFound
|
103 |
+
*
|
104 |
+
* @return Address
|
105 |
*/
|
106 |
public function find($customerOrId, $addressId)
|
107 |
{
|
115 |
return Address::factory($response['address']);
|
116 |
} catch (Exception\NotFound $e) {
|
117 |
throw new Exception\NotFound(
|
118 |
+
'address for customer ' . $customerId .
|
119 |
' with id ' . $addressId . ' not found.'
|
120 |
);
|
121 |
}
|
|
|
122 |
}
|
123 |
|
124 |
/**
|
128 |
* customerOrId is the 2nd attribute, addressId 3rd.
|
129 |
* customerOrId & addressId are not sent in object context.
|
130 |
*
|
131 |
+
* @param mixed $customerOrId (only used in call)
|
132 |
+
* @param string $addressId (only used in call)
|
133 |
+
* @param array $attributes containing request parameters
|
134 |
*
|
|
|
|
|
|
|
|
|
135 |
* @return Result\Successful|Result\Error
|
136 |
*/
|
137 |
public function update($customerOrId, $addressId, $attributes)
|
144 |
$response = $this->_http->put($path, ['address' => $attributes]);
|
145 |
|
146 |
return $this->_verifyGatewayResponse($response);
|
|
|
147 |
}
|
148 |
|
149 |
/**
|
153 |
* customerOrId is the 2nd attribute, addressId 3rd.
|
154 |
* customerOrId & addressId are not sent in object context.
|
155 |
*
|
156 |
+
* @param mixed $customerOrId (only used in call)
|
157 |
+
* @param string $addressId (only used in call)
|
158 |
+
* @param array $attributes containing request parameters
|
159 |
+
*
|
160 |
* @throws Exception\ValidationsFailed
|
161 |
+
*
|
162 |
* @see Address::update()
|
163 |
+
*
|
164 |
+
* @return Address
|
165 |
*/
|
166 |
public function updateNoValidate($customerOrId, $addressId, $attributes)
|
167 |
{
|
171 |
|
172 |
/**
|
173 |
* creates a full array signature of a valid create request
|
174 |
+
*
|
175 |
* @return array gateway create request format
|
176 |
*/
|
177 |
public static function createSignature()
|
185 |
|
186 |
/**
|
187 |
* creates a full array signature of a valid update request
|
188 |
+
*
|
189 |
* @return array gateway update request format
|
190 |
*/
|
191 |
public static function updateSignature()
|
192 |
{
|
|
|
193 |
return self::createSignature();
|
|
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
* verifies that a valid address id is being used
|
198 |
+
*
|
199 |
* @param string $id address id
|
200 |
+
*
|
201 |
* @throws InvalidArgumentException
|
202 |
+
*
|
203 |
+
* @return self
|
204 |
*/
|
205 |
private function _validateId($id = null)
|
206 |
{
|
207 |
if (empty($id) || trim($id) == "") {
|
208 |
throw new InvalidArgumentException(
|
209 |
+
'expected address id to be set'
|
210 |
);
|
211 |
}
|
212 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
213 |
throw new InvalidArgumentException(
|
214 |
+
$id . ' is an invalid address id.'
|
215 |
);
|
216 |
}
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
* verifies that a valid customer id is being used
|
221 |
+
*
|
222 |
* @param string $id customer id
|
223 |
+
*
|
224 |
* @throws InvalidArgumentException
|
225 |
+
*
|
226 |
+
* @return self
|
227 |
*/
|
228 |
private function _validateCustomerId($id = null)
|
229 |
{
|
230 |
if (empty($id) || trim($id) == "") {
|
231 |
throw new InvalidArgumentException(
|
232 |
+
'expected customer id to be set'
|
233 |
);
|
234 |
}
|
235 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
236 |
throw new InvalidArgumentException(
|
237 |
+
$id . ' is an invalid customer id.'
|
238 |
);
|
239 |
}
|
|
|
240 |
}
|
241 |
|
242 |
/**
|
243 |
* determines if a string id or Customer object was passed
|
244 |
+
*
|
245 |
+
* @param mixed $customerOrId either a customer object or string unique identifier
|
246 |
+
*
|
247 |
* @return string customerId
|
248 |
*/
|
249 |
private function _determineCustomerId($customerOrId)
|
251 |
$customerId = ($customerOrId instanceof Customer) ? $customerOrId->id : $customerOrId;
|
252 |
$this->_validateCustomerId($customerId);
|
253 |
return $customerId;
|
|
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
private function _doCreate($subPath, $params)
|
257 |
{
|
258 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
261 |
return $this->_verifyGatewayResponse($response);
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
private function _verifyGatewayResponse($response)
|
265 |
{
|
266 |
if (isset($response['address'])) {
|
268 |
return new Result\Successful(
|
269 |
Address::factory($response['address'])
|
270 |
);
|
271 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
272 |
return new Result\Error($response['apiErrorResponse']);
|
273 |
} else {
|
274 |
throw new Exception\Unexpected(
|
275 |
+
"Expected address or apiErrorResponse"
|
276 |
);
|
277 |
}
|
|
|
278 |
}
|
279 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AmexExpressCheckoutCard.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree AmexExpressCheckoutCard module
|
6 |
-
* Creates and manages Braintree Amex Express Checkout cards
|
7 |
-
*
|
8 |
-
* <b>== More information ==</b>
|
9 |
-
*
|
10 |
-
* See {@link https://developers.braintreepayments.com/javascript+php}<br />
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $createdAt
|
16 |
-
* @property-read string $default
|
17 |
-
* @property-read string $updatedAt
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $cardType
|
20 |
-
* @property-read string $bin
|
21 |
-
* @property-read string $cardMemberExpiryDate
|
22 |
-
* @property-read string $cardMemberNumber
|
23 |
-
* @property-read string $sourceDescription
|
24 |
-
* @property-read string $token
|
25 |
-
* @property-read string $imageUrl
|
26 |
-
* @property-read string $expirationMonth
|
27 |
-
* @property-read string $expirationYear
|
28 |
-
*/
|
29 |
-
class AmexExpressCheckoutCard extends Base
|
30 |
-
{
|
31 |
-
/* instance methods */
|
32 |
-
/**
|
33 |
-
* returns false if default is null or false
|
34 |
-
*
|
35 |
-
* @return boolean
|
36 |
-
*/
|
37 |
-
public function isDefault()
|
38 |
-
{
|
39 |
-
return $this->default;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* factory method: returns an instance of AmexExpressCheckoutCard
|
44 |
-
* to the requesting method, with populated properties
|
45 |
-
*
|
46 |
-
* @ignore
|
47 |
-
* @return AmexExpressCheckoutCard
|
48 |
-
*/
|
49 |
-
public static function factory($attributes)
|
50 |
-
{
|
51 |
-
|
52 |
-
$instance = new self();
|
53 |
-
$instance->_initialize($attributes);
|
54 |
-
return $instance;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* sets instance properties from an array of values
|
59 |
-
*
|
60 |
-
* @access protected
|
61 |
-
* @param array $amexExpressCheckoutCardAttribs array of Amex Express Checkout card properties
|
62 |
-
* @return void
|
63 |
-
*/
|
64 |
-
protected function _initialize($amexExpressCheckoutCardAttribs)
|
65 |
-
{
|
66 |
-
// set the attributes
|
67 |
-
$this->_attributes = $amexExpressCheckoutCardAttribs;
|
68 |
-
|
69 |
-
$subscriptionArray = [];
|
70 |
-
if (isset($amexExpressCheckoutCardAttribs['subscriptions'])) {
|
71 |
-
foreach ($amexExpressCheckoutCardAttribs['subscriptions'] AS $subscription) {
|
72 |
-
$subscriptionArray[] = Subscription::factory($subscription);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
$this->_set('subscriptions', $subscriptionArray);
|
77 |
-
}
|
78 |
-
}
|
79 |
-
class_alias('Braintree\AmexExpressCheckoutCard', 'Braintree_AmexExpressCheckoutCard');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/AndroidPayCard.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree AndroidPayCard module
|
6 |
-
* Creates and manages Braintree Android Pay cards
|
7 |
-
*
|
8 |
-
* <b>== More information ==</b>
|
9 |
-
*
|
10 |
-
* See {@link https://developers.braintreepayments.com/javascript+php}<br />
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $bin
|
16 |
-
* @property-read string $cardType
|
17 |
-
* @property-read string $createdAt
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $default
|
20 |
-
* @property-read string $expirationMonth
|
21 |
-
* @property-read string $expirationYear
|
22 |
-
* @property-read string $googleTransactionId
|
23 |
-
* @property-read string $imageUrl
|
24 |
-
* @property-read string $last4
|
25 |
-
* @property-read string $sourceCardLast4
|
26 |
-
* @property-read string $sourceCardType
|
27 |
-
* @property-read string $sourceDescription
|
28 |
-
* @property-read string $token
|
29 |
-
* @property-read string $updatedAt
|
30 |
-
* @property-read string $virtualCardLast4
|
31 |
-
* @property-read string $virtualCardType
|
32 |
-
*/
|
33 |
-
class AndroidPayCard extends Base
|
34 |
-
{
|
35 |
-
/* instance methods */
|
36 |
-
/**
|
37 |
-
* returns false if default is null or false
|
38 |
-
*
|
39 |
-
* @return boolean
|
40 |
-
*/
|
41 |
-
public function isDefault()
|
42 |
-
{
|
43 |
-
return $this->default;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* factory method: returns an instance of AndroidPayCard
|
48 |
-
* to the requesting method, with populated properties
|
49 |
-
*
|
50 |
-
* @ignore
|
51 |
-
* @return AndroidPayCard
|
52 |
-
*/
|
53 |
-
public static function factory($attributes)
|
54 |
-
{
|
55 |
-
$defaultAttributes = [
|
56 |
-
'expirationMonth' => '',
|
57 |
-
'expirationYear' => '',
|
58 |
-
'last4' => $attributes['virtualCardLast4'],
|
59 |
-
'cardType' => $attributes['virtualCardType'],
|
60 |
-
];
|
61 |
-
|
62 |
-
$instance = new self();
|
63 |
-
$instance->_initialize(array_merge($defaultAttributes, $attributes));
|
64 |
-
return $instance;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* sets instance properties from an array of values
|
69 |
-
*
|
70 |
-
* @access protected
|
71 |
-
* @param array $androidPayCardAttribs array of Android Pay card properties
|
72 |
-
* @return void
|
73 |
-
*/
|
74 |
-
protected function _initialize($androidPayCardAttribs)
|
75 |
-
{
|
76 |
-
// set the attributes
|
77 |
-
$this->_attributes = $androidPayCardAttribs;
|
78 |
-
|
79 |
-
$subscriptionArray = [];
|
80 |
-
if (isset($androidPayCardAttribs['subscriptions'])) {
|
81 |
-
foreach ($androidPayCardAttribs['subscriptions'] AS $subscription) {
|
82 |
-
$subscriptionArray[] = Subscription::factory($subscription);
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
$this->_set('subscriptions', $subscriptionArray);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
class_alias('Braintree\AndroidPayCard', 'Braintree_AndroidPayCard');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/ApplePayCard.php
CHANGED
@@ -1,30 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree ApplePayCard module
|
6 |
* Creates and manages Braintree Apple Pay cards
|
7 |
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* See {@link https://developers.braintreepayments.com/javascript+php}<br />
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $bin
|
16 |
-
* @property-read string $cardType
|
17 |
-
* @property-read string $createdAt
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $expirationDate
|
20 |
-
* @property-read string $expirationMonth
|
21 |
-
* @property-read string $expirationYear
|
22 |
-
* @property-read string $imageUrl
|
23 |
-
* @property-read string $last4
|
24 |
-
* @property-read string $token
|
25 |
-
* @property-read string $paymentInstrumentName
|
26 |
-
* @property-read string $sourceDescription
|
27 |
-
* @property-read string $updatedAt
|
28 |
*/
|
29 |
class ApplePayCard extends Base
|
30 |
{
|
@@ -58,14 +40,15 @@ class ApplePayCard extends Base
|
|
58 |
* factory method: returns an instance of ApplePayCard
|
59 |
* to the requesting method, with populated properties
|
60 |
*
|
61 |
-
* @
|
|
|
62 |
* @return ApplePayCard
|
63 |
*/
|
64 |
public static function factory($attributes)
|
65 |
{
|
66 |
$defaultAttributes = [
|
67 |
-
'expirationMonth'
|
68 |
-
'expirationYear'
|
69 |
'last4' => '',
|
70 |
];
|
71 |
|
@@ -77,8 +60,8 @@ class ApplePayCard extends Base
|
|
77 |
/**
|
78 |
* sets instance properties from an array of values
|
79 |
*
|
80 |
-
* @access protected
|
81 |
* @param array $applePayCardAttribs array of Apple Pay card properties
|
|
|
82 |
* @return void
|
83 |
*/
|
84 |
protected function _initialize($applePayCardAttribs)
|
@@ -88,7 +71,7 @@ class ApplePayCard extends Base
|
|
88 |
|
89 |
$subscriptionArray = [];
|
90 |
if (isset($applePayCardAttribs['subscriptions'])) {
|
91 |
-
foreach ($applePayCardAttribs['subscriptions']
|
92 |
$subscriptionArray[] = Subscription::factory($subscription);
|
93 |
}
|
94 |
}
|
@@ -97,4 +80,3 @@ class ApplePayCard extends Base
|
|
97 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
98 |
}
|
99 |
}
|
100 |
-
class_alias('Braintree\ApplePayCard', 'Braintree_ApplePayCard');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree ApplePayCard module
|
7 |
* Creates and manages Braintree Apple Pay cards
|
8 |
*
|
9 |
+
* See our reference docs for a complete list of properties {@link https://developer.paypal.com/braintree/docs/reference/response/apple-pay-card/php}<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class ApplePayCard extends Base
|
12 |
{
|
40 |
* factory method: returns an instance of ApplePayCard
|
41 |
* to the requesting method, with populated properties
|
42 |
*
|
43 |
+
* @param mixed $attributes of the ApplePayCard object
|
44 |
+
*
|
45 |
* @return ApplePayCard
|
46 |
*/
|
47 |
public static function factory($attributes)
|
48 |
{
|
49 |
$defaultAttributes = [
|
50 |
+
'expirationMonth' => '',
|
51 |
+
'expirationYear' => '',
|
52 |
'last4' => '',
|
53 |
];
|
54 |
|
60 |
/**
|
61 |
* sets instance properties from an array of values
|
62 |
*
|
|
|
63 |
* @param array $applePayCardAttribs array of Apple Pay card properties
|
64 |
+
*
|
65 |
* @return void
|
66 |
*/
|
67 |
protected function _initialize($applePayCardAttribs)
|
71 |
|
72 |
$subscriptionArray = [];
|
73 |
if (isset($applePayCardAttribs['subscriptions'])) {
|
74 |
+
foreach ($applePayCardAttribs['subscriptions'] as $subscription) {
|
75 |
$subscriptionArray[] = Subscription::factory($subscription);
|
76 |
}
|
77 |
}
|
80 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
81 |
}
|
82 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ApplePayGateway.php
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree ApplePayGateway module
|
6 |
* Manages Apple Pay for Web
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
* @category Resources
|
10 |
*/
|
11 |
class ApplePayGateway
|
12 |
{
|
@@ -14,6 +12,7 @@ class ApplePayGateway
|
|
14 |
private $_config;
|
15 |
private $_http;
|
16 |
|
|
|
17 |
public function __construct($gateway)
|
18 |
{
|
19 |
$this->_gateway = $gateway;
|
@@ -22,44 +21,56 @@ class ApplePayGateway
|
|
22 |
$this->_http = new Http($gateway->config);
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
public function registerDomain($domain)
|
26 |
{
|
27 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/validate_domains';
|
28 |
$response = $this->_http->post($path, ['url' => $domain]);
|
29 |
-
if (array_key_exists('response', $response) && $response['response']['success'])
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
-
else if (array_key_exists('apiErrorResponse', $response))
|
34 |
-
{
|
35 |
return new Result\Error($response['apiErrorResponse']);
|
36 |
}
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
public function unregisterDomain($domain)
|
40 |
{
|
41 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/unregister_domain';
|
42 |
$this->_http->delete($path, ['url' => $domain]);
|
43 |
-
return new Result\Successful;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
public function registeredDomains()
|
47 |
{
|
48 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/registered_domains';
|
49 |
$response = $this->_http->get($path);
|
50 |
-
if (array_key_exists('response', $response) && array_key_exists('domains', $response['response']))
|
51 |
-
{
|
52 |
$options = ApplePayOptions::factory($response['response']);
|
53 |
return new Result\Successful($options, 'applePayOptions');
|
54 |
-
}
|
55 |
-
else if (array_key_exists('apiErrorResponse', $response))
|
56 |
-
{
|
57 |
return new Result\Error($response['apiErrorResponse']);
|
58 |
-
}
|
59 |
-
else
|
60 |
-
{
|
61 |
throw new Exception\Unexpected('expected response or apiErrorResponse');
|
62 |
}
|
63 |
}
|
64 |
}
|
65 |
-
class_alias('Braintree\ApplePayGateway', 'Braintree_ApplePayGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree ApplePayGateway module
|
7 |
* Manages Apple Pay for Web
|
|
|
|
|
|
|
8 |
*/
|
9 |
class ApplePayGateway
|
10 |
{
|
12 |
private $_config;
|
13 |
private $_http;
|
14 |
|
15 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
16 |
public function __construct($gateway)
|
17 |
{
|
18 |
$this->_gateway = $gateway;
|
21 |
$this->_http = new Http($gateway->config);
|
22 |
}
|
23 |
|
24 |
+
/*
|
25 |
+
* Register a domain for apple pay
|
26 |
+
*
|
27 |
+
* @see https://developer.paypal.com/braintree/docs/guides/apple-pay/configuration#domain-registration
|
28 |
+
*
|
29 |
+
* @param string $domain to be registered
|
30 |
+
*
|
31 |
+
* @return Result\Successful|Result\Error
|
32 |
+
*/
|
33 |
public function registerDomain($domain)
|
34 |
{
|
35 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/validate_domains';
|
36 |
$response = $this->_http->post($path, ['url' => $domain]);
|
37 |
+
if (array_key_exists('response', $response) && $response['response']['success']) {
|
38 |
+
return new Result\Successful();
|
39 |
+
} elseif (array_key_exists('apiErrorResponse', $response)) {
|
|
|
|
|
|
|
40 |
return new Result\Error($response['apiErrorResponse']);
|
41 |
}
|
42 |
}
|
43 |
|
44 |
+
/*
|
45 |
+
* Unregister a domain for apple pay
|
46 |
+
*
|
47 |
+
* @param string $domain to be unregistered
|
48 |
+
*
|
49 |
+
* @return Result\Successful
|
50 |
+
*/
|
51 |
public function unregisterDomain($domain)
|
52 |
{
|
53 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/unregister_domain';
|
54 |
$this->_http->delete($path, ['url' => $domain]);
|
55 |
+
return new Result\Successful();
|
56 |
}
|
57 |
|
58 |
+
/*
|
59 |
+
* Retrieve a list of all registered domains for apple pay
|
60 |
+
*
|
61 |
+
* @return Result\Successful|Result\Error
|
62 |
+
*/
|
63 |
public function registeredDomains()
|
64 |
{
|
65 |
$path = $this->_config->merchantPath() . '/processing/apple_pay/registered_domains';
|
66 |
$response = $this->_http->get($path);
|
67 |
+
if (array_key_exists('response', $response) && array_key_exists('domains', $response['response'])) {
|
|
|
68 |
$options = ApplePayOptions::factory($response['response']);
|
69 |
return new Result\Successful($options, 'applePayOptions');
|
70 |
+
} elseif (array_key_exists('apiErrorResponse', $response)) {
|
|
|
|
|
71 |
return new Result\Error($response['apiErrorResponse']);
|
72 |
+
} else {
|
|
|
|
|
73 |
throw new Exception\Unexpected('expected response or apiErrorResponse');
|
74 |
}
|
75 |
}
|
76 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ApplePayOptions.php
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree ApplePayOptions module
|
6 |
* Manages configuration and options for Apple Pay
|
7 |
*
|
8 |
-
* @
|
9 |
-
* @category Resources
|
10 |
-
*
|
11 |
-
* @property-read array $domains
|
12 |
*/
|
13 |
|
14 |
class ApplePayOptions extends Base
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public static function factory($attributes)
|
17 |
{
|
18 |
$instance = new self();
|
@@ -25,4 +30,3 @@ class ApplePayOptions extends Base
|
|
25 |
$this->_attributes = $attributes;
|
26 |
}
|
27 |
}
|
28 |
-
class_alias('Braintree\ApplePayOptions', 'Braintree_ApplePayOptions');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree ApplePayOptions module
|
7 |
* Manages configuration and options for Apple Pay
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/apple-pay-options developer docs} for information on attributes
|
|
|
|
|
|
|
10 |
*/
|
11 |
|
12 |
class ApplePayOptions extends Base
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Creates an instance of an ApplePayOptions from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return ApplePayOptions
|
20 |
+
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
23 |
$instance = new self();
|
30 |
$this->_attributes = $attributes;
|
31 |
}
|
32 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/AuthorizationAdjustment.php
CHANGED
@@ -1,19 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Creates an instance of AuthorizationAdjustment as returned from a transaction
|
6 |
*
|
7 |
-
* @
|
8 |
-
*
|
9 |
-
* @property-read string $amount
|
10 |
-
* @property-read DateTime $timestamp
|
11 |
-
* @property-read boolean $success
|
12 |
-
*
|
13 |
*/
|
14 |
|
15 |
class AuthorizationAdjustment extends Base
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public static function factory($attributes)
|
18 |
{
|
19 |
$instance = new self();
|
@@ -27,9 +30,9 @@ class AuthorizationAdjustment extends Base
|
|
27 |
$this->_attributes = $authorizationAdjustmentAttribs;
|
28 |
}
|
29 |
|
30 |
-
|
|
|
31 |
{
|
32 |
return __CLASS__ . '[' . Util::attributesToString($this->_attributes) . ']';
|
33 |
}
|
34 |
}
|
35 |
-
class_alias('Braintree\AuthorizationAdjustment', 'Braintree_Authorization_Adjustment');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Creates an instance of AuthorizationAdjustment as returned from a transaction
|
7 |
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#authorization-adjustments developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
class AuthorizationAdjustment extends Base
|
12 |
{
|
13 |
+
/**
|
14 |
+
* Creates an instance of an AuthorizationAdjustment from given attributes
|
15 |
+
*
|
16 |
+
* @param array $attributes response object attributes
|
17 |
+
*
|
18 |
+
* @return AuthorizationAdjustment
|
19 |
+
*/
|
20 |
public static function factory($attributes)
|
21 |
{
|
22 |
$instance = new self();
|
30 |
$this->_attributes = $authorizationAdjustmentAttribs;
|
31 |
}
|
32 |
|
33 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
34 |
+
public function __toString()
|
35 |
{
|
36 |
return __CLASS__ . '[' . Util::attributesToString($this->_attributes) . ']';
|
37 |
}
|
38 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Base.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use JsonSerializable;
|
@@ -8,15 +9,12 @@ use JsonSerializable;
|
|
8 |
*
|
9 |
* Braintree base class and initialization
|
10 |
* Provides methods to child classes. This class cannot be instantiated.
|
11 |
-
*
|
12 |
-
* PHP version 5
|
13 |
*/
|
14 |
abstract class Base implements JsonSerializable
|
15 |
{
|
16 |
protected $_attributes = [];
|
17 |
|
18 |
/**
|
19 |
-
* @ignore
|
20 |
* don't permit an explicit call of the constructor!
|
21 |
* (like $t = new Transaction())
|
22 |
*/
|
@@ -26,8 +24,6 @@ abstract class Base implements JsonSerializable
|
|
26 |
|
27 |
/**
|
28 |
* Disable cloning of objects
|
29 |
-
*
|
30 |
-
* @ignore
|
31 |
*/
|
32 |
protected function __clone()
|
33 |
{
|
@@ -36,53 +32,72 @@ abstract class Base implements JsonSerializable
|
|
36 |
/**
|
37 |
* Accessor for instance properties stored in the private $_attributes property
|
38 |
*
|
39 |
-
* @
|
40 |
-
*
|
41 |
* @return mixed
|
42 |
*/
|
43 |
public function __get($name)
|
44 |
{
|
|
|
|
|
|
|
45 |
if (array_key_exists($name, $this->_attributes)) {
|
46 |
return $this->_attributes[$name];
|
47 |
-
}
|
48 |
-
else {
|
49 |
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
|
50 |
return null;
|
51 |
}
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
-
* Checks for the
|
|
|
|
|
56 |
*
|
57 |
-
* @ignore
|
58 |
-
* @param string $name
|
59 |
* @return boolean
|
60 |
*/
|
61 |
public function __isset($name)
|
62 |
{
|
63 |
-
return
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
* Mutator for instance properties stored in the private $_attributes property
|
68 |
*
|
69 |
-
* @
|
70 |
-
* @param
|
71 |
-
*
|
|
|
72 |
*/
|
73 |
public function _set($key, $value)
|
74 |
{
|
75 |
$this->_attributes[$key] = $value;
|
76 |
}
|
77 |
-
|
78 |
/**
|
79 |
-
* Implementation of JsonSerializable
|
80 |
-
*
|
81 |
-
* @ignore
|
82 |
* @return array
|
83 |
*/
|
|
|
84 |
public function jsonSerialize()
|
85 |
{
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
}
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use JsonSerializable;
|
9 |
*
|
10 |
* Braintree base class and initialization
|
11 |
* Provides methods to child classes. This class cannot be instantiated.
|
|
|
|
|
12 |
*/
|
13 |
abstract class Base implements JsonSerializable
|
14 |
{
|
15 |
protected $_attributes = [];
|
16 |
|
17 |
/**
|
|
|
18 |
* don't permit an explicit call of the constructor!
|
19 |
* (like $t = new Transaction())
|
20 |
*/
|
24 |
|
25 |
/**
|
26 |
* Disable cloning of objects
|
|
|
|
|
27 |
*/
|
28 |
protected function __clone()
|
29 |
{
|
32 |
/**
|
33 |
* Accessor for instance properties stored in the private $_attributes property
|
34 |
*
|
35 |
+
* @param string $name of the key whose value is to be returned
|
36 |
+
*
|
37 |
* @return mixed
|
38 |
*/
|
39 |
public function __get($name)
|
40 |
{
|
41 |
+
if (isset($this->_attributes['globalId'])) {
|
42 |
+
$this->_attributes['graphQLId'] = $this->_attributes['globalId'];
|
43 |
+
}
|
44 |
if (array_key_exists($name, $this->_attributes)) {
|
45 |
return $this->_attributes[$name];
|
46 |
+
} else {
|
|
|
47 |
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
|
48 |
return null;
|
49 |
}
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* Checks for the existence of a property stored in the private $_attributes property
|
54 |
+
*
|
55 |
+
* @param string $name of the key
|
56 |
*
|
|
|
|
|
57 |
* @return boolean
|
58 |
*/
|
59 |
public function __isset($name)
|
60 |
{
|
61 |
+
return isset($this->_attributes[$name]);
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
* Mutator for instance properties stored in the private $_attributes property
|
66 |
*
|
67 |
+
* @param string $key to be set
|
68 |
+
* @param mixed $value to be set
|
69 |
+
*
|
70 |
+
* @return mixed
|
71 |
*/
|
72 |
public function _set($key, $value)
|
73 |
{
|
74 |
$this->_attributes[$key] = $value;
|
75 |
}
|
76 |
+
|
77 |
/**
|
78 |
+
* Implementation of JsonSerializable
|
79 |
+
*
|
|
|
80 |
* @return array
|
81 |
*/
|
82 |
+
#[\ReturnTypeWillChange]
|
83 |
public function jsonSerialize()
|
84 |
{
|
85 |
+
return $this->_attributes;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Implementation of to an Array
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
public function toArray()
|
94 |
+
{
|
95 |
+
return array_map(function ($value) {
|
96 |
+
if (!is_array($value)) {
|
97 |
+
return method_exists($value, 'toArray') ? $value->toArray() : $value;
|
98 |
+
} else {
|
99 |
+
return $value;
|
100 |
+
}
|
101 |
+
}, $this->_attributes);
|
102 |
}
|
103 |
}
|
vendor/braintree/braintree_php/lib/Braintree/BinData.php
CHANGED
@@ -1,8 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class BinData extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -16,15 +29,10 @@ class BinData extends Base
|
|
16 |
$this->_attributes = $attributes;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
public function __toString()
|
24 |
{
|
25 |
return __CLASS__ . '[' .
|
26 |
-
Util::attributesToString($this->_attributes) .']';
|
27 |
}
|
28 |
-
|
29 |
}
|
30 |
-
class_alias('Braintree\BinData', 'Braintree_BinData');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Bank Identification Number (BIN) Data Class
|
7 |
+
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/payment-method-nonce/php#bin_data developer docs} for information on attributes
|
9 |
+
*/
|
10 |
class BinData extends Base
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Creates an instance of an BinData from given attributes
|
14 |
+
*
|
15 |
+
* @param array $attributes response object attributes
|
16 |
+
*
|
17 |
+
* @return BinData
|
18 |
+
*/
|
19 |
public static function factory($attributes)
|
20 |
{
|
21 |
$instance = new self();
|
29 |
$this->_attributes = $attributes;
|
30 |
}
|
31 |
|
32 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
33 |
+
public function __toString()
|
|
|
|
|
|
|
34 |
{
|
35 |
return __CLASS__ . '[' .
|
36 |
+
Util::attributesToString($this->_attributes) . ']';
|
37 |
}
|
|
|
38 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ClientToken.php
CHANGED
@@ -1,49 +1,64 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class ClientToken
|
5 |
{
|
6 |
const DEFAULT_VERSION = 2;
|
7 |
|
8 |
-
|
9 |
-
// static methods redirecting to gateway
|
10 |
-
|
11 |
/**
|
|
|
|
|
|
|
|
|
|
|
12 |
*
|
13 |
-
* @param array $params
|
14 |
* @return string
|
15 |
*/
|
16 |
-
public static function generate($params=[])
|
17 |
{
|
18 |
return Configuration::gateway()->clientToken()->generate($params);
|
19 |
}
|
20 |
|
21 |
-
|
|
|
|
|
|
|
22 |
*
|
23 |
-
* @
|
24 |
-
*
|
|
|
25 |
*/
|
26 |
public static function conditionallyVerifyKeys($params)
|
27 |
{
|
28 |
return Configuration::gateway()->clientToken()->conditionallyVerifyKeys($params);
|
29 |
}
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
32 |
*
|
33 |
-
* @return string client token retrieved from server
|
34 |
*/
|
35 |
public static function generateWithCustomerIdSignature()
|
36 |
{
|
37 |
return Configuration::gateway()->clientToken()->generateWithCustomerIdSignature();
|
38 |
}
|
39 |
|
40 |
-
|
|
|
|
|
|
|
41 |
*
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function generateWithoutCustomerIdSignature()
|
45 |
{
|
46 |
return Configuration::gateway()->clientToken()->generateWithoutCustomerIdSignature();
|
47 |
}
|
48 |
}
|
49 |
-
class_alias('Braintree\ClientToken', 'Braintree_ClientToken');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintre ClientToken create and manage client tokens for authorization
|
7 |
+
*/
|
8 |
class ClientToken
|
9 |
{
|
10 |
const DEFAULT_VERSION = 2;
|
11 |
|
|
|
|
|
|
|
12 |
/**
|
13 |
+
* static method redirecting to gateway class
|
14 |
+
*
|
15 |
+
* @param array $params to be supplied in api request
|
16 |
+
*
|
17 |
+
* @see ClientTokenGateway::generate()
|
18 |
*
|
|
|
19 |
* @return string
|
20 |
*/
|
21 |
+
public static function generate($params = [])
|
22 |
{
|
23 |
return Configuration::gateway()->clientToken()->generate($params);
|
24 |
}
|
25 |
|
26 |
+
/*
|
27 |
+
* static method redirecting to gateway class
|
28 |
+
*
|
29 |
+
* @param array $params to be verified
|
30 |
*
|
31 |
+
* @see ClientTokenGateway::conditionallyVerifyKeys()
|
32 |
+
*
|
33 |
+
* @return array
|
34 |
*/
|
35 |
public static function conditionallyVerifyKeys($params)
|
36 |
{
|
37 |
return Configuration::gateway()->clientToken()->conditionallyVerifyKeys($params);
|
38 |
}
|
39 |
|
40 |
+
/*
|
41 |
+
* static method redirecting to gateway class
|
42 |
+
*
|
43 |
+
* @see ClientTokenGateway::generateWithCustomerIdSignature()
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
*
|
|
|
47 |
*/
|
48 |
public static function generateWithCustomerIdSignature()
|
49 |
{
|
50 |
return Configuration::gateway()->clientToken()->generateWithCustomerIdSignature();
|
51 |
}
|
52 |
|
53 |
+
/*
|
54 |
+
* static method redirecting to gateway class
|
55 |
+
*
|
56 |
+
* @see ClientTokenGateway::generateWithoutCustomerIdSignature()
|
57 |
*
|
58 |
+
* @return array
|
59 |
*/
|
60 |
public static function generateWithoutCustomerIdSignature()
|
61 |
{
|
62 |
return Configuration::gateway()->clientToken()->generateWithoutCustomerIdSignature();
|
63 |
}
|
64 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ClientTokenGateway.php
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
class ClientTokenGateway
|
7 |
{
|
8 |
-
/**
|
9 |
-
*
|
10 |
-
* @var Gateway
|
11 |
-
*/
|
12 |
private $_gateway;
|
13 |
-
|
14 |
-
/**
|
15 |
-
*
|
16 |
-
* @var Configuration
|
17 |
-
*/
|
18 |
private $_config;
|
19 |
-
|
20 |
-
/**
|
21 |
-
*
|
22 |
-
* @var Http
|
23 |
-
*/
|
24 |
private $_http;
|
25 |
|
26 |
-
|
27 |
-
*
|
28 |
-
* @param Gateway $gateway
|
29 |
-
*/
|
30 |
public function __construct($gateway)
|
31 |
{
|
32 |
$this->_gateway = $gateway;
|
@@ -35,7 +25,14 @@ class ClientTokenGateway
|
|
35 |
$this->_http = new Http($gateway->config);
|
36 |
}
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
{
|
40 |
if (!array_key_exists("version", $params)) {
|
41 |
$params["version"] = ClientToken::DEFAULT_VERSION;
|
@@ -47,14 +44,7 @@ class ClientTokenGateway
|
|
47 |
return $this->_doGenerate('/client_token', $generateParams);
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
* sends the generate request to the gateway
|
52 |
-
*
|
53 |
-
* @ignore
|
54 |
-
* @param var $url
|
55 |
-
* @param array $params
|
56 |
-
* @return string
|
57 |
-
*/
|
58 |
public function _doGenerate($subPath, $params)
|
59 |
{
|
60 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -63,10 +53,12 @@ class ClientTokenGateway
|
|
63 |
return $this->_verifyGatewayResponse($response);
|
64 |
}
|
65 |
|
66 |
-
|
|
|
|
|
|
|
67 |
*
|
68 |
-
* @
|
69 |
-
* @throws InvalidArgumentException
|
70 |
*/
|
71 |
public function conditionallyVerifyKeys($params)
|
72 |
{
|
@@ -77,9 +69,11 @@ class ClientTokenGateway
|
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
|
|
|
|
|
|
|
81 |
*
|
82 |
-
* @return mixed[]
|
83 |
*/
|
84 |
public function generateWithCustomerIdSignature()
|
85 |
{
|
@@ -89,9 +83,10 @@ class ClientTokenGateway
|
|
89 |
"merchantAccountId"];
|
90 |
}
|
91 |
|
92 |
-
|
|
|
93 |
*
|
94 |
-
* @return
|
95 |
*/
|
96 |
public function generateWithoutCustomerIdSignature()
|
97 |
{
|
@@ -105,10 +100,11 @@ class ClientTokenGateway
|
|
105 |
* Otherwise, throws an InvalidArgumentException with the error
|
106 |
* response from the Gateway or an HTTP status code exception.
|
107 |
*
|
108 |
-
* @ignore
|
109 |
* @param array $response gateway response values
|
110 |
-
*
|
111 |
* @throws InvalidArgumentException | HTTP status code exception
|
|
|
|
|
112 |
*/
|
113 |
private function _verifyGatewayResponse($response)
|
114 |
{
|
@@ -124,6 +120,4 @@ class ClientTokenGateway
|
|
124 |
);
|
125 |
}
|
126 |
}
|
127 |
-
|
128 |
}
|
129 |
-
class_alias('Braintree\ClientTokenGateway', 'Braintree_ClientTokenGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
+
/**
|
8 |
+
* Braintree ClientTokenGateway module
|
9 |
+
*
|
10 |
+
* Manages Braintree ClientTokens
|
11 |
+
* For more detailed information on ClientTokens, see {@link https://developer.paypal.com/braintree/docsreference/response/client-token/php our developer docs}. <br />
|
12 |
+
*/
|
13 |
class ClientTokenGateway
|
14 |
{
|
|
|
|
|
|
|
|
|
15 |
private $_gateway;
|
|
|
|
|
|
|
|
|
|
|
16 |
private $_config;
|
|
|
|
|
|
|
|
|
|
|
17 |
private $_http;
|
18 |
|
19 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
20 |
public function __construct($gateway)
|
21 |
{
|
22 |
$this->_gateway = $gateway;
|
25 |
$this->_http = new Http($gateway->config);
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Generate a client token for client-side authorization
|
30 |
+
*
|
31 |
+
* @param Optional $params containing request parameters
|
32 |
+
*
|
33 |
+
* @return string client token
|
34 |
+
*/
|
35 |
+
public function generate($params = [])
|
36 |
{
|
37 |
if (!array_key_exists("version", $params)) {
|
38 |
$params["version"] = ClientToken::DEFAULT_VERSION;
|
44 |
return $this->_doGenerate('/client_token', $generateParams);
|
45 |
}
|
46 |
|
47 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
public function _doGenerate($subPath, $params)
|
49 |
{
|
50 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
53 |
return $this->_verifyGatewayResponse($response);
|
54 |
}
|
55 |
|
56 |
+
/*
|
57 |
+
* Checks if customer id is provided prior to verifying keys provided in params
|
58 |
+
*
|
59 |
+
* @param array $params to be verified
|
60 |
*
|
61 |
+
* @return array
|
|
|
62 |
*/
|
63 |
public function conditionallyVerifyKeys($params)
|
64 |
{
|
69 |
}
|
70 |
}
|
71 |
|
72 |
+
/*
|
73 |
+
* returns an array of keys including customer id
|
74 |
+
*
|
75 |
+
* @return array
|
76 |
*
|
|
|
77 |
*/
|
78 |
public function generateWithCustomerIdSignature()
|
79 |
{
|
83 |
"merchantAccountId"];
|
84 |
}
|
85 |
|
86 |
+
/*
|
87 |
+
* returns an array of keys without customer id
|
88 |
*
|
89 |
+
* @return array
|
90 |
*/
|
91 |
public function generateWithoutCustomerIdSignature()
|
92 |
{
|
100 |
* Otherwise, throws an InvalidArgumentException with the error
|
101 |
* response from the Gateway or an HTTP status code exception.
|
102 |
*
|
|
|
103 |
* @param array $response gateway response values
|
104 |
+
*
|
105 |
* @throws InvalidArgumentException | HTTP status code exception
|
106 |
+
*
|
107 |
+
* @return string client token
|
108 |
*/
|
109 |
private function _verifyGatewayResponse($response)
|
110 |
{
|
120 |
);
|
121 |
}
|
122 |
}
|
|
|
123 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CoinbaseAccount.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree CoinbaseAccount module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Manages Braintree CoinbaseAccounts
|
13 |
-
*
|
14 |
-
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
-
* @property-read string $customerId
|
21 |
-
* @property-read string $token
|
22 |
-
* @property-read string $userId
|
23 |
-
* @property-read string $userName
|
24 |
-
* @property-read string $userEmail
|
25 |
-
*/
|
26 |
-
class CoinbaseAccount extends Base
|
27 |
-
{
|
28 |
-
/**
|
29 |
-
* factory method: returns an instance of CoinbaseAccount
|
30 |
-
* to the requesting method, with populated properties
|
31 |
-
*
|
32 |
-
* @ignore
|
33 |
-
* @return CoinbaseAccount
|
34 |
-
*/
|
35 |
-
public static function factory($attributes)
|
36 |
-
{
|
37 |
-
$instance = new self();
|
38 |
-
$instance->_initialize($attributes);
|
39 |
-
return $instance;
|
40 |
-
}
|
41 |
-
|
42 |
-
/* instance methods */
|
43 |
-
|
44 |
-
/**
|
45 |
-
* returns false if default is null or false
|
46 |
-
*
|
47 |
-
* @return boolean
|
48 |
-
*/
|
49 |
-
public function isDefault()
|
50 |
-
{
|
51 |
-
return $this->default;
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* sets instance properties from an array of values
|
56 |
-
*
|
57 |
-
* @access protected
|
58 |
-
* @param array $coinbaseAccountAttribs array of coinbaseAccount data
|
59 |
-
* @return void
|
60 |
-
*/
|
61 |
-
protected function _initialize($coinbaseAccountAttribs)
|
62 |
-
{
|
63 |
-
// set the attributes
|
64 |
-
$this->_attributes = $coinbaseAccountAttribs;
|
65 |
-
|
66 |
-
$subscriptionArray = [];
|
67 |
-
if (isset($coinbaseAccountAttribs['subscriptions'])) {
|
68 |
-
foreach ($coinbaseAccountAttribs['subscriptions'] AS $subscription) {
|
69 |
-
$subscriptionArray[] = Subscription::factory($subscription);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
$this->_set('subscriptions', $subscriptionArray);
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* create a printable representation of the object as:
|
78 |
-
* ClassName[property=value, property=value]
|
79 |
-
* @return string
|
80 |
-
*/
|
81 |
-
public function __toString()
|
82 |
-
{
|
83 |
-
return __CLASS__ . '[' .
|
84 |
-
Util::attributesToString($this->_attributes) .']';
|
85 |
-
}
|
86 |
-
|
87 |
-
|
88 |
-
// static methods redirecting to gateway
|
89 |
-
|
90 |
-
public static function find($token)
|
91 |
-
{
|
92 |
-
return Configuration::gateway()->coinbaseAccount()->find($token);
|
93 |
-
}
|
94 |
-
|
95 |
-
public static function update($token, $attributes)
|
96 |
-
{
|
97 |
-
return Configuration::gateway()->coinbaseAccount()->update($token, $attributes);
|
98 |
-
}
|
99 |
-
|
100 |
-
public static function delete($token)
|
101 |
-
{
|
102 |
-
return Configuration::gateway()->coinbaseAccount()->delete($token);
|
103 |
-
}
|
104 |
-
|
105 |
-
public static function sale($token, $transactionAttribs)
|
106 |
-
{
|
107 |
-
return Configuration::gateway()->coinbaseAccount()->sale($token, $transactionAttribs);
|
108 |
-
}
|
109 |
-
}
|
110 |
-
class_alias('Braintree\CoinbaseAccount', 'Braintree_CoinbaseAccount');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Collection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use Countable;
|
@@ -10,26 +11,20 @@ use ArrayIterator;
|
|
10 |
/**
|
11 |
* Braintree Generic collection
|
12 |
*
|
13 |
-
* PHP Version 5
|
14 |
-
*
|
15 |
* Based on Generic Collection class from:
|
16 |
* {@link http://codeutopia.net/code/library/CU/Collection.php}
|
17 |
-
*
|
18 |
-
* @package Braintree
|
19 |
-
* @subpackage Utility
|
20 |
*/
|
21 |
|
22 |
class Collection implements Countable, IteratorAggregate, ArrayAccess
|
23 |
{
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @var array collection storage
|
27 |
-
*/
|
28 |
protected $_collection = [];
|
29 |
|
30 |
/**
|
31 |
* Add a value into the collection
|
32 |
-
*
|
|
|
|
|
|
|
33 |
*/
|
34 |
public function add($value)
|
35 |
{
|
@@ -38,62 +33,81 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
38 |
|
39 |
/**
|
40 |
* Set index's value
|
41 |
-
*
|
42 |
-
* @param
|
|
|
|
|
43 |
* @throws OutOfRangeException
|
|
|
|
|
44 |
*/
|
45 |
public function set($index, $value)
|
46 |
{
|
47 |
-
if($index >= $this->count())
|
48 |
throw new OutOfRangeException('Index out of range');
|
|
|
49 |
|
50 |
$this->_collection[$index] = $value;
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
* Remove a value from the collection
|
|
|
55 |
* @param integer $index index to remove
|
|
|
56 |
* @throws OutOfRangeException if index is out of range
|
|
|
|
|
57 |
*/
|
58 |
public function remove($index)
|
59 |
{
|
60 |
-
if($index >= $this->count())
|
61 |
throw new OutOfRangeException('Index out of range');
|
|
|
62 |
|
63 |
array_splice($this->_collection, $index, 1);
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
* Return value at index
|
68 |
-
*
|
69 |
-
* @
|
|
|
70 |
* @throws OutOfRangeException
|
|
|
|
|
71 |
*/
|
72 |
public function get($index)
|
73 |
{
|
74 |
-
if($index >= $this->count())
|
75 |
throw new OutOfRangeException('Index out of range');
|
|
|
76 |
|
77 |
return $this->_collection[$index];
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
* Determine if index exists
|
82 |
-
*
|
|
|
|
|
83 |
* @return boolean
|
84 |
*/
|
85 |
public function exists($index)
|
86 |
{
|
87 |
-
if($index >= $this->count())
|
88 |
return false;
|
|
|
89 |
|
90 |
return true;
|
91 |
}
|
92 |
/**
|
93 |
* Return count of items in collection
|
94 |
* Implements countable
|
|
|
95 |
* @return integer
|
96 |
*/
|
|
|
97 |
public function count()
|
98 |
{
|
99 |
return count($this->_collection);
|
@@ -103,8 +117,10 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
103 |
/**
|
104 |
* Return an iterator
|
105 |
* Implements IteratorAggregate
|
|
|
106 |
* @return ArrayIterator
|
107 |
*/
|
|
|
108 |
public function getIterator()
|
109 |
{
|
110 |
return new ArrayIterator($this->_collection);
|
@@ -113,10 +129,15 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
113 |
/**
|
114 |
* Set offset to value
|
115 |
* Implements ArrayAccess
|
116 |
-
*
|
117 |
* @param integer $offset
|
118 |
-
* @param mixed
|
|
|
|
|
|
|
|
|
119 |
*/
|
|
|
120 |
public function offsetSet($offset, $value)
|
121 |
{
|
122 |
$this->set($offset, $value);
|
@@ -125,9 +146,14 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
125 |
/**
|
126 |
* Unset offset
|
127 |
* Implements ArrayAccess
|
128 |
-
*
|
129 |
* @param integer $offset
|
|
|
|
|
|
|
|
|
130 |
*/
|
|
|
131 |
public function offsetUnset($offset)
|
132 |
{
|
133 |
$this->remove($offset);
|
@@ -136,10 +162,14 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
136 |
/**
|
137 |
* get an offset's value
|
138 |
* Implements ArrayAccess
|
139 |
-
*
|
140 |
* @param integer $offset
|
|
|
|
|
|
|
141 |
* @return mixed
|
142 |
*/
|
|
|
143 |
public function offsetGet($offset)
|
144 |
{
|
145 |
return $this->get($offset);
|
@@ -148,14 +178,16 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess
|
|
148 |
/**
|
149 |
* Determine if offset exists
|
150 |
* Implements ArrayAccess
|
151 |
-
*
|
152 |
* @param integer $offset
|
|
|
|
|
|
|
153 |
* @return boolean
|
154 |
*/
|
|
|
155 |
public function offsetExists($offset)
|
156 |
{
|
157 |
return $this->exists($offset);
|
158 |
}
|
159 |
-
|
160 |
}
|
161 |
-
class_alias('Braintree\Collection', 'Braintree_Collection');
|
1 |
+
<?php // phpcs:disable PEAR.Commenting.FunctionComment.MissingParamComment
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use Countable;
|
11 |
/**
|
12 |
* Braintree Generic collection
|
13 |
*
|
|
|
|
|
14 |
* Based on Generic Collection class from:
|
15 |
* {@link http://codeutopia.net/code/library/CU/Collection.php}
|
|
|
|
|
|
|
16 |
*/
|
17 |
|
18 |
class Collection implements Countable, IteratorAggregate, ArrayAccess
|
19 |
{
|
|
|
|
|
|
|
|
|
20 |
protected $_collection = [];
|
21 |
|
22 |
/**
|
23 |
* Add a value into the collection
|
24 |
+
*
|
25 |
+
* @param string $value to be added
|
26 |
+
*
|
27 |
+
* @return mixed
|
28 |
*/
|
29 |
public function add($value)
|
30 |
{
|
33 |
|
34 |
/**
|
35 |
* Set index's value
|
36 |
+
*
|
37 |
+
* @param integer $index thats being set
|
38 |
+
* @param mixed $value to set at the index
|
39 |
+
*
|
40 |
* @throws OutOfRangeException
|
41 |
+
*
|
42 |
+
* @return mixed
|
43 |
*/
|
44 |
public function set($index, $value)
|
45 |
{
|
46 |
+
if ($index >= $this->count()) {
|
47 |
throw new OutOfRangeException('Index out of range');
|
48 |
+
}
|
49 |
|
50 |
$this->_collection[$index] = $value;
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
* Remove a value from the collection
|
55 |
+
*
|
56 |
* @param integer $index index to remove
|
57 |
+
*
|
58 |
* @throws OutOfRangeException if index is out of range
|
59 |
+
*
|
60 |
+
* @return mixed
|
61 |
*/
|
62 |
public function remove($index)
|
63 |
{
|
64 |
+
if ($index >= $this->count()) {
|
65 |
throw new OutOfRangeException('Index out of range');
|
66 |
+
}
|
67 |
|
68 |
array_splice($this->_collection, $index, 1);
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
* Return value at index
|
73 |
+
*
|
74 |
+
* @param integer $index of value to be retrieved
|
75 |
+
*
|
76 |
* @throws OutOfRangeException
|
77 |
+
*
|
78 |
+
* @return mixed
|
79 |
*/
|
80 |
public function get($index)
|
81 |
{
|
82 |
+
if ($index >= $this->count()) {
|
83 |
throw new OutOfRangeException('Index out of range');
|
84 |
+
}
|
85 |
|
86 |
return $this->_collection[$index];
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
* Determine if index exists
|
91 |
+
*
|
92 |
+
* @param integer $index to check for existence
|
93 |
+
*
|
94 |
* @return boolean
|
95 |
*/
|
96 |
public function exists($index)
|
97 |
{
|
98 |
+
if ($index >= $this->count()) {
|
99 |
return false;
|
100 |
+
}
|
101 |
|
102 |
return true;
|
103 |
}
|
104 |
/**
|
105 |
* Return count of items in collection
|
106 |
* Implements countable
|
107 |
+
*
|
108 |
* @return integer
|
109 |
*/
|
110 |
+
#[\ReturnTypeWillChange]
|
111 |
public function count()
|
112 |
{
|
113 |
return count($this->_collection);
|
117 |
/**
|
118 |
* Return an iterator
|
119 |
* Implements IteratorAggregate
|
120 |
+
*
|
121 |
* @return ArrayIterator
|
122 |
*/
|
123 |
+
#[\ReturnTypeWillChange]
|
124 |
public function getIterator()
|
125 |
{
|
126 |
return new ArrayIterator($this->_collection);
|
129 |
/**
|
130 |
* Set offset to value
|
131 |
* Implements ArrayAccess
|
132 |
+
*
|
133 |
* @param integer $offset
|
134 |
+
* @param mixed $value
|
135 |
+
*
|
136 |
+
* @see set
|
137 |
+
*
|
138 |
+
* @return mixed
|
139 |
*/
|
140 |
+
#[\ReturnTypeWillChange]
|
141 |
public function offsetSet($offset, $value)
|
142 |
{
|
143 |
$this->set($offset, $value);
|
146 |
/**
|
147 |
* Unset offset
|
148 |
* Implements ArrayAccess
|
149 |
+
*
|
150 |
* @param integer $offset
|
151 |
+
*
|
152 |
+
* @see remove
|
153 |
+
*
|
154 |
+
* @return mixed
|
155 |
*/
|
156 |
+
#[\ReturnTypeWillChange]
|
157 |
public function offsetUnset($offset)
|
158 |
{
|
159 |
$this->remove($offset);
|
162 |
/**
|
163 |
* get an offset's value
|
164 |
* Implements ArrayAccess
|
165 |
+
*
|
166 |
* @param integer $offset
|
167 |
+
*
|
168 |
+
* @see get
|
169 |
+
*
|
170 |
* @return mixed
|
171 |
*/
|
172 |
+
#[\ReturnTypeWillChange]
|
173 |
public function offsetGet($offset)
|
174 |
{
|
175 |
return $this->get($offset);
|
178 |
/**
|
179 |
* Determine if offset exists
|
180 |
* Implements ArrayAccess
|
181 |
+
*
|
182 |
* @param integer $offset
|
183 |
+
*
|
184 |
+
* @see exists
|
185 |
+
*
|
186 |
* @return boolean
|
187 |
*/
|
188 |
+
#[\ReturnTypeWillChange]
|
189 |
public function offsetExists($offset)
|
190 |
{
|
191 |
return $this->exists($offset);
|
192 |
}
|
|
|
193 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Configuration.php
CHANGED
@@ -1,14 +1,10 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
-
*
|
6 |
* Configuration registry
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
* @subpackage Utility
|
10 |
*/
|
11 |
-
|
12 |
class Configuration
|
13 |
{
|
14 |
public static $global;
|
@@ -31,10 +27,11 @@ class Configuration
|
|
31 |
|
32 |
/**
|
33 |
* Braintree API version to use
|
34 |
-
* @access public
|
35 |
*/
|
36 |
-
|
|
|
37 |
|
|
|
38 |
public function __construct($attribs = [])
|
39 |
{
|
40 |
foreach ($attribs as $kind => $value) {
|
@@ -51,16 +48,36 @@ class Configuration
|
|
51 |
if ($kind == 'privateKey') {
|
52 |
$this->_privateKey = $value;
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if ($kind == 'timeout') {
|
55 |
$this->_timeout = $value;
|
56 |
}
|
|
|
|
|
|
|
57 |
if ($kind == 'acceptGzipEncoding') {
|
58 |
$this->_acceptGzipEncoding = $value;
|
59 |
}
|
60 |
}
|
61 |
|
62 |
if (isset($attribs['clientId']) || isset($attribs['accessToken'])) {
|
|
|
63 |
if (isset($attribs['environment']) || isset($attribs['merchantId']) || isset($attribs['publicKey']) || isset($attribs['privateKey'])) {
|
|
|
64 |
throw new Exception\Configuration('Cannot mix OAuth credentials (clientId, clientSecret, accessToken) with key credentials (publicKey, privateKey, environment, merchantId).');
|
65 |
}
|
66 |
$parsedCredentials = new CredentialsParser($attribs);
|
@@ -75,19 +92,32 @@ class Configuration
|
|
75 |
|
76 |
/**
|
77 |
* resets configuration to default
|
78 |
-
*
|
|
|
79 |
*/
|
80 |
public static function reset()
|
81 |
{
|
82 |
self::$global = new Configuration();
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
public static function gateway()
|
86 |
{
|
87 |
return new Gateway(self::$global);
|
88 |
}
|
89 |
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
{
|
92 |
if (empty($value)) {
|
93 |
return self::$global->getEnvironment();
|
@@ -96,7 +126,14 @@ class Configuration
|
|
96 |
self::$global->setEnvironment($value);
|
97 |
}
|
98 |
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
{
|
101 |
if (empty($value)) {
|
102 |
return self::$global->getMerchantId();
|
@@ -104,7 +141,14 @@ class Configuration
|
|
104 |
self::$global->setMerchantId($value);
|
105 |
}
|
106 |
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
{
|
109 |
if (empty($value)) {
|
110 |
return self::$global->getPublicKey();
|
@@ -112,7 +156,14 @@ class Configuration
|
|
112 |
self::$global->setPublicKey($value);
|
113 |
}
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
{
|
117 |
if (empty($value)) {
|
118 |
return self::$global->getPrivateKey();
|
@@ -124,9 +175,10 @@ class Configuration
|
|
124 |
* Sets or gets the read timeout to use for making requests.
|
125 |
*
|
126 |
* @param integer $value If provided, sets the read timeout
|
|
|
127 |
* @return integer The read timeout used for connecting to Braintree
|
128 |
*/
|
129 |
-
public static function timeout($value=null)
|
130 |
{
|
131 |
if (empty($value)) {
|
132 |
return self::$global->getTimeout();
|
@@ -140,9 +192,10 @@ class Configuration
|
|
140 |
* CURLOPT_SSLVERSION values.
|
141 |
*
|
142 |
* @param integer $value If provided, sets the SSL version
|
|
|
143 |
* @return integer The SSL version used for connecting to Braintree
|
144 |
*/
|
145 |
-
public static function sslVersion($value=null)
|
146 |
{
|
147 |
if (empty($value)) {
|
148 |
return self::$global->getSslVersion();
|
@@ -154,6 +207,7 @@ class Configuration
|
|
154 |
* Sets or gets the proxy host to use for connecting to Braintree
|
155 |
*
|
156 |
* @param string $value If provided, sets the proxy host
|
|
|
157 |
* @return string The proxy host used for connecting to Braintree
|
158 |
*/
|
159 |
public static function proxyHost($value = null)
|
@@ -168,6 +222,7 @@ class Configuration
|
|
168 |
* Sets or gets the port of the proxy to use for connecting to Braintree
|
169 |
*
|
170 |
* @param string $value If provided, sets the port of the proxy
|
|
|
171 |
* @return string The port of the proxy used for connecting to Braintree
|
172 |
*/
|
173 |
public static function proxyPort($value = null)
|
@@ -183,6 +238,7 @@ class Configuration
|
|
183 |
* can be any of the CURLOPT_PROXYTYPE options in PHP cURL.
|
184 |
*
|
185 |
* @param string $value If provided, sets the proxy type
|
|
|
186 |
* @return string The proxy type used for connecting to Braintree
|
187 |
*/
|
188 |
public static function proxyType($value = null)
|
@@ -194,17 +250,12 @@ class Configuration
|
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
-
*
|
198 |
*
|
199 |
-
* @
|
|
|
|
|
200 |
*/
|
201 |
-
public static function isUsingProxy()
|
202 |
-
{
|
203 |
-
$proxyHost = self::$global->getProxyHost();
|
204 |
-
$proxyPort = self::$global->getProxyPort();
|
205 |
-
return !empty($proxyHost) && !empty($proxyPort);
|
206 |
-
}
|
207 |
-
|
208 |
public static function proxyUser($value = null)
|
209 |
{
|
210 |
if (empty($value)) {
|
@@ -213,6 +264,14 @@ class Configuration
|
|
213 |
self::$global->setProxyUser($value);
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
public static function proxyPassword($value = null)
|
217 |
{
|
218 |
if (empty($value)) {
|
@@ -221,24 +280,14 @@ class Configuration
|
|
221 |
self::$global->setProxyPassword($value);
|
222 |
}
|
223 |
|
224 |
-
/**
|
225 |
-
* Specified whether or not a username and password have been provided for
|
226 |
-
* use with an authenticated proxy
|
227 |
-
*
|
228 |
-
* @return bool true if both proxyUser and proxyPassword are present
|
229 |
-
*/
|
230 |
-
public static function isAuthenticatedProxy()
|
231 |
-
{
|
232 |
-
$proxyUser = self::$global->getProxyUser();
|
233 |
-
$proxyPwd = self::$global->getProxyPassword();
|
234 |
-
return !empty($proxyUser) && !empty($proxyPwd);
|
235 |
-
}
|
236 |
-
|
237 |
/**
|
238 |
* Specify if the HTTP client is able to decode gzipped responses.
|
239 |
*
|
240 |
-
*
|
241 |
-
*
|
|
|
|
|
|
|
242 |
*/
|
243 |
public static function acceptGzipEncoding($value = null)
|
244 |
{
|
@@ -248,32 +297,55 @@ class Configuration
|
|
248 |
self::$global->setAcceptGzipEncoding($value);
|
249 |
}
|
250 |
|
|
|
251 |
public static function assertGlobalHasAccessTokenOrKeys()
|
252 |
{
|
253 |
self::$global->assertHasAccessTokenOrKeys();
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
public function assertHasAccessTokenOrKeys()
|
257 |
{
|
258 |
if (empty($this->_accessToken)) {
|
259 |
if (empty($this->_merchantId)) {
|
|
|
260 |
throw new Exception\Configuration('Braintree\\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\\Gateway).');
|
261 |
-
}
|
262 |
throw new Exception\Configuration('Braintree\\Configuration::environment needs to be set.');
|
263 |
-
}
|
264 |
throw new Exception\Configuration('Braintree\\Configuration::publicKey needs to be set.');
|
265 |
-
}
|
266 |
throw new Exception\Configuration('Braintree\\Configuration::privateKey needs to be set.');
|
267 |
}
|
268 |
}
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
public function assertHasClientCredentials()
|
272 |
{
|
273 |
$this->assertHasClientId();
|
274 |
$this->assertHasClientSecret();
|
275 |
}
|
276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
public function assertHasClientId()
|
278 |
{
|
279 |
if (empty($this->_clientId)) {
|
@@ -281,6 +353,13 @@ class Configuration
|
|
281 |
}
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
public function assertHasClientSecret()
|
285 |
{
|
286 |
if (empty($this->_clientSecret)) {
|
@@ -288,167 +367,253 @@ class Configuration
|
|
288 |
}
|
289 |
}
|
290 |
|
|
|
|
|
|
|
|
|
|
|
291 |
public function getEnvironment()
|
292 |
{
|
293 |
return $this->_environment;
|
294 |
}
|
295 |
|
296 |
-
|
297 |
-
*
|
|
|
|
|
298 |
*/
|
299 |
-
public function setEnvironment($value)
|
300 |
-
{
|
301 |
-
$this->_environment = $value;
|
302 |
-
}
|
303 |
-
|
304 |
public function getMerchantId()
|
305 |
{
|
306 |
return $this->_merchantId;
|
307 |
}
|
308 |
|
309 |
-
|
310 |
-
*
|
|
|
|
|
311 |
*/
|
312 |
-
public function setMerchantId($value)
|
313 |
-
{
|
314 |
-
$this->_merchantId = $value;
|
315 |
-
}
|
316 |
-
|
317 |
public function getPublicKey()
|
318 |
{
|
319 |
return $this->_publicKey;
|
320 |
}
|
321 |
|
|
|
|
|
|
|
|
|
|
|
322 |
public function getClientId()
|
323 |
{
|
324 |
return $this->_clientId;
|
325 |
}
|
326 |
|
327 |
-
|
328 |
-
*
|
|
|
|
|
329 |
*/
|
330 |
-
public function setPublicKey($value)
|
331 |
-
{
|
332 |
-
$this->_publicKey = $value;
|
333 |
-
}
|
334 |
-
|
335 |
public function getPrivateKey()
|
336 |
{
|
337 |
return $this->_privateKey;
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
|
|
340 |
public function getClientSecret()
|
341 |
{
|
342 |
return $this->_clientSecret;
|
343 |
}
|
344 |
|
345 |
-
|
346 |
-
*
|
|
|
|
|
347 |
*/
|
348 |
-
public function
|
349 |
{
|
350 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
}
|
352 |
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
{
|
355 |
-
$this->
|
356 |
}
|
357 |
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
359 |
{
|
360 |
-
return $this->
|
361 |
}
|
362 |
|
363 |
-
|
|
|
|
|
|
|
|
|
|
|
364 |
{
|
365 |
-
$this->
|
366 |
}
|
367 |
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
369 |
{
|
370 |
-
return $this->
|
371 |
}
|
372 |
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
374 |
{
|
375 |
-
$this->
|
376 |
}
|
377 |
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
379 |
{
|
380 |
-
return $this->
|
381 |
}
|
382 |
|
383 |
-
|
|
|
|
|
|
|
|
|
384 |
{
|
385 |
-
$this->
|
386 |
}
|
387 |
|
388 |
-
|
|
|
|
|
|
|
389 |
{
|
390 |
-
|
391 |
}
|
392 |
|
393 |
-
|
|
|
|
|
|
|
394 |
{
|
395 |
-
$this->
|
396 |
}
|
397 |
|
398 |
-
|
|
|
|
|
|
|
399 |
{
|
400 |
-
|
401 |
}
|
402 |
|
403 |
-
private function
|
404 |
{
|
405 |
-
$this->
|
406 |
}
|
407 |
|
408 |
-
|
409 |
{
|
410 |
-
|
411 |
}
|
412 |
|
413 |
-
private function
|
414 |
{
|
415 |
-
$this->
|
416 |
}
|
417 |
|
418 |
-
private function
|
419 |
{
|
420 |
-
|
421 |
}
|
422 |
|
423 |
-
|
424 |
{
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
}
|
427 |
|
428 |
private function setAcceptGzipEncoding($value)
|
429 |
{
|
430 |
$this->_acceptGzipEncoding = $value;
|
431 |
}
|
|
|
432 |
|
|
|
|
|
|
|
|
|
|
|
433 |
public function getAccessToken()
|
434 |
{
|
435 |
return $this->_accessToken;
|
436 |
}
|
437 |
|
|
|
|
|
|
|
|
|
|
|
438 |
public function isAccessToken()
|
439 |
{
|
440 |
return !empty($this->_accessToken);
|
441 |
}
|
442 |
|
|
|
|
|
|
|
|
|
|
|
443 |
public function isClientCredentials()
|
444 |
{
|
445 |
return !empty($this->_clientId);
|
446 |
}
|
|
|
447 |
/**
|
448 |
* returns the base braintree gateway URL based on config values
|
449 |
*
|
450 |
-
* @access public
|
451 |
-
* @param none
|
452 |
* @return string braintree gateway URL
|
453 |
*/
|
454 |
public function baseUrl()
|
@@ -456,11 +621,19 @@ class Configuration
|
|
456 |
return sprintf('%s://%s:%d', $this->protocol(), $this->serverName(), $this->portNumber());
|
457 |
}
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
/**
|
460 |
* sets the merchant path based on merchant ID
|
461 |
*
|
462 |
-
* @access protected
|
463 |
-
* @param none
|
464 |
* @return string merchant path uri
|
465 |
*/
|
466 |
public function merchantPath()
|
@@ -471,18 +644,17 @@ class Configuration
|
|
471 |
/**
|
472 |
* sets the physical path for the location of the CA certs
|
473 |
*
|
474 |
-
* @
|
475 |
-
*
|
476 |
* @return string filepath
|
477 |
*/
|
478 |
-
public function caFile($sslPath =
|
479 |
{
|
480 |
$sslPath = $sslPath ? $sslPath : DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
|
481 |
'ssl' . DIRECTORY_SEPARATOR;
|
482 |
$caPath = __DIR__ . $sslPath . 'api_braintreegateway_com.ca.crt';
|
483 |
|
484 |
-
if (!file_exists($caPath))
|
485 |
-
{
|
486 |
throw new Exception\SSLCaFileNotFound();
|
487 |
}
|
488 |
|
@@ -492,8 +664,6 @@ class Configuration
|
|
492 |
/**
|
493 |
* returns the port number depending on environment
|
494 |
*
|
495 |
-
* @access public
|
496 |
-
* @param none
|
497 |
* @return int portnumber
|
498 |
*/
|
499 |
public function portNumber()
|
@@ -504,11 +674,47 @@ class Configuration
|
|
504 |
return getenv("GATEWAY_PORT") ? getenv("GATEWAY_PORT") : 3000;
|
505 |
}
|
506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
/**
|
508 |
* returns http protocol depending on environment
|
509 |
*
|
510 |
-
* @access public
|
511 |
-
* @param none
|
512 |
* @return string http || https
|
513 |
*/
|
514 |
public function protocol()
|
@@ -519,85 +725,87 @@ class Configuration
|
|
519 |
/**
|
520 |
* returns gateway server name depending on environment
|
521 |
*
|
522 |
-
* @access public
|
523 |
-
* @param none
|
524 |
* @return string server domain name
|
525 |
*/
|
526 |
public function serverName()
|
527 |
{
|
528 |
-
switch($this->_environment) {
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
}
|
544 |
|
545 |
return $serverName;
|
546 |
}
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
|
|
|
|
|
|
|
|
|
|
565 |
}
|
566 |
|
567 |
-
return $
|
568 |
}
|
569 |
|
570 |
/**
|
571 |
* returns boolean indicating SSL is on or off for this session,
|
572 |
* depending on environment
|
573 |
*
|
574 |
-
* @access public
|
575 |
-
* @param none
|
576 |
* @return boolean
|
577 |
*/
|
578 |
public function sslOn()
|
579 |
{
|
580 |
-
switch($this->_environment) {
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
}
|
592 |
|
593 |
-
|
594 |
}
|
595 |
|
596 |
/**
|
597 |
* log message to default logger
|
598 |
*
|
599 |
-
* @param string $message
|
600 |
*
|
|
|
601 |
*/
|
602 |
public function logMessage($message)
|
603 |
{
|
@@ -605,4 +813,3 @@ class Configuration
|
|
605 |
}
|
606 |
}
|
607 |
Configuration::reset();
|
608 |
-
class_alias('Braintree\Configuration', 'Braintree_Configuration');
|
1 |
+
<?php // phpcs:ignore
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
|
|
6 |
* Configuration registry
|
|
|
|
|
|
|
7 |
*/
|
|
|
8 |
class Configuration
|
9 |
{
|
10 |
public static $global;
|
27 |
|
28 |
/**
|
29 |
* Braintree API version to use
|
|
|
30 |
*/
|
31 |
+
const API_VERSION = 6;
|
32 |
+
const GRAPHQL_API_VERSION = '2018-09-10';
|
33 |
|
34 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
35 |
public function __construct($attribs = [])
|
36 |
{
|
37 |
foreach ($attribs as $kind => $value) {
|
48 |
if ($kind == 'privateKey') {
|
49 |
$this->_privateKey = $value;
|
50 |
}
|
51 |
+
if ($kind == 'proxyHost') {
|
52 |
+
$this->_proxyHost = $value;
|
53 |
+
}
|
54 |
+
if ($kind == 'proxyPort') {
|
55 |
+
$this->_proxyPort = $value;
|
56 |
+
}
|
57 |
+
if ($kind == 'proxyType') {
|
58 |
+
$this->_proxyType = $value;
|
59 |
+
}
|
60 |
+
if ($kind == 'proxyUser') {
|
61 |
+
$this->_proxyUser = $value;
|
62 |
+
}
|
63 |
+
if ($kind == 'proxyPassword') {
|
64 |
+
$this->_proxyPassword = $value;
|
65 |
+
}
|
66 |
if ($kind == 'timeout') {
|
67 |
$this->_timeout = $value;
|
68 |
}
|
69 |
+
if ($kind == 'sslVersion') {
|
70 |
+
$this->_sslVersion = $value;
|
71 |
+
}
|
72 |
if ($kind == 'acceptGzipEncoding') {
|
73 |
$this->_acceptGzipEncoding = $value;
|
74 |
}
|
75 |
}
|
76 |
|
77 |
if (isset($attribs['clientId']) || isset($attribs['accessToken'])) {
|
78 |
+
// phpcs:ignore Generic.Files.LineLength
|
79 |
if (isset($attribs['environment']) || isset($attribs['merchantId']) || isset($attribs['publicKey']) || isset($attribs['privateKey'])) {
|
80 |
+
// phpcs:ignore Generic.Files.LineLength
|
81 |
throw new Exception\Configuration('Cannot mix OAuth credentials (clientId, clientSecret, accessToken) with key credentials (publicKey, privateKey, environment, merchantId).');
|
82 |
}
|
83 |
$parsedCredentials = new CredentialsParser($attribs);
|
92 |
|
93 |
/**
|
94 |
* resets configuration to default
|
95 |
+
*
|
96 |
+
* @return Configuration
|
97 |
*/
|
98 |
public static function reset()
|
99 |
{
|
100 |
self::$global = new Configuration();
|
101 |
}
|
102 |
|
103 |
+
/**
|
104 |
+
* Create new gateway
|
105 |
+
*
|
106 |
+
* @return Gateway
|
107 |
+
*/
|
108 |
public static function gateway()
|
109 |
{
|
110 |
return new Gateway(self::$global);
|
111 |
}
|
112 |
|
113 |
+
/**
|
114 |
+
* Getter/Setter for configuration environment
|
115 |
+
*
|
116 |
+
* @param string $value If provided, sets the environment
|
117 |
+
*
|
118 |
+
* @return self
|
119 |
+
*/
|
120 |
+
public static function environment($value = null)
|
121 |
{
|
122 |
if (empty($value)) {
|
123 |
return self::$global->getEnvironment();
|
126 |
self::$global->setEnvironment($value);
|
127 |
}
|
128 |
|
129 |
+
/**
|
130 |
+
* Getter/Setter for configuration merchant ID
|
131 |
+
*
|
132 |
+
* @param string $value If provided, sets the merchantId
|
133 |
+
*
|
134 |
+
* @return self
|
135 |
+
*/
|
136 |
+
public static function merchantId($value = null)
|
137 |
{
|
138 |
if (empty($value)) {
|
139 |
return self::$global->getMerchantId();
|
141 |
self::$global->setMerchantId($value);
|
142 |
}
|
143 |
|
144 |
+
/**
|
145 |
+
* Getter/Setter for configuration public key
|
146 |
+
*
|
147 |
+
* @param string $value If provided, sets the public key
|
148 |
+
*
|
149 |
+
* @return self
|
150 |
+
*/
|
151 |
+
public static function publicKey($value = null)
|
152 |
{
|
153 |
if (empty($value)) {
|
154 |
return self::$global->getPublicKey();
|
156 |
self::$global->setPublicKey($value);
|
157 |
}
|
158 |
|
159 |
+
/**
|
160 |
+
* Getter/Setter for configuration private key
|
161 |
+
*
|
162 |
+
* @param string $value If provided, sets the private key
|
163 |
+
*
|
164 |
+
* @return self
|
165 |
+
*/
|
166 |
+
public static function privateKey($value = null)
|
167 |
{
|
168 |
if (empty($value)) {
|
169 |
return self::$global->getPrivateKey();
|
175 |
* Sets or gets the read timeout to use for making requests.
|
176 |
*
|
177 |
* @param integer $value If provided, sets the read timeout
|
178 |
+
*
|
179 |
* @return integer The read timeout used for connecting to Braintree
|
180 |
*/
|
181 |
+
public static function timeout($value = null)
|
182 |
{
|
183 |
if (empty($value)) {
|
184 |
return self::$global->getTimeout();
|
192 |
* CURLOPT_SSLVERSION values.
|
193 |
*
|
194 |
* @param integer $value If provided, sets the SSL version
|
195 |
+
*
|
196 |
* @return integer The SSL version used for connecting to Braintree
|
197 |
*/
|
198 |
+
public static function sslVersion($value = null)
|
199 |
{
|
200 |
if (empty($value)) {
|
201 |
return self::$global->getSslVersion();
|
207 |
* Sets or gets the proxy host to use for connecting to Braintree
|
208 |
*
|
209 |
* @param string $value If provided, sets the proxy host
|
210 |
+
*
|
211 |
* @return string The proxy host used for connecting to Braintree
|
212 |
*/
|
213 |
public static function proxyHost($value = null)
|
222 |
* Sets or gets the port of the proxy to use for connecting to Braintree
|
223 |
*
|
224 |
* @param string $value If provided, sets the port of the proxy
|
225 |
+
*
|
226 |
* @return string The port of the proxy used for connecting to Braintree
|
227 |
*/
|
228 |
public static function proxyPort($value = null)
|
238 |
* can be any of the CURLOPT_PROXYTYPE options in PHP cURL.
|
239 |
*
|
240 |
* @param string $value If provided, sets the proxy type
|
241 |
+
*
|
242 |
* @return string The proxy type used for connecting to Braintree
|
243 |
*/
|
244 |
public static function proxyType($value = null)
|
250 |
}
|
251 |
|
252 |
/**
|
253 |
+
* Sets or gets the proxy user to use for connecting to Braintree.
|
254 |
*
|
255 |
+
* @param string $value If provided, sets the proxy username
|
256 |
+
*
|
257 |
+
* @return string The proxy type used for connecting to Braintree
|
258 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
public static function proxyUser($value = null)
|
260 |
{
|
261 |
if (empty($value)) {
|
264 |
self::$global->setProxyUser($value);
|
265 |
}
|
266 |
|
267 |
+
/**
|
268 |
+
* Sets or gets the proxy password to use for connecting to Braintree. This value
|
269 |
+
* can be any of the CURLOPT_PROXYUSERPWD options in PHP cURL.
|
270 |
+
*
|
271 |
+
* @param string $value If provided, sets the proxy password
|
272 |
+
*
|
273 |
+
* @return string The proxy type used for connecting to Braintree
|
274 |
+
*/
|
275 |
public static function proxyPassword($value = null)
|
276 |
{
|
277 |
if (empty($value)) {
|
280 |
self::$global->setProxyPassword($value);
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
/**
|
284 |
* Specify if the HTTP client is able to decode gzipped responses.
|
285 |
*
|
286 |
+
* // phpcs:ignore Generic.Files.LineLength
|
287 |
+
*
|
288 |
+
* @param boolean $value If true, will send an Accept-Encoding header with a gzip value. If false, will not send an Accept-Encoding header with a gzip value.
|
289 |
+
*
|
290 |
+
* @return boolean true if an Accept-Encoding header with a gzip value will be sent, false if not
|
291 |
*/
|
292 |
public static function acceptGzipEncoding($value = null)
|
293 |
{
|
297 |
self::$global->setAcceptGzipEncoding($value);
|
298 |
}
|
299 |
|
300 |
+
//phpcs:ignore
|
301 |
public static function assertGlobalHasAccessTokenOrKeys()
|
302 |
{
|
303 |
self::$global->assertHasAccessTokenOrKeys();
|
304 |
}
|
305 |
|
306 |
+
/*
|
307 |
+
* Check if configuration has an access token, or api keys
|
308 |
+
*
|
309 |
+
* @throws Exception\Configuration
|
310 |
+
*
|
311 |
+
* @return self
|
312 |
+
*/
|
313 |
public function assertHasAccessTokenOrKeys()
|
314 |
{
|
315 |
if (empty($this->_accessToken)) {
|
316 |
if (empty($this->_merchantId)) {
|
317 |
+
// phpcs:ignore Generic.Files.LineLength
|
318 |
throw new Exception\Configuration('Braintree\\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\\Gateway).');
|
319 |
+
} elseif (empty($this->_environment)) {
|
320 |
throw new Exception\Configuration('Braintree\\Configuration::environment needs to be set.');
|
321 |
+
} elseif (empty($this->_publicKey)) {
|
322 |
throw new Exception\Configuration('Braintree\\Configuration::publicKey needs to be set.');
|
323 |
+
} elseif (empty($this->_privateKey)) {
|
324 |
throw new Exception\Configuration('Braintree\\Configuration::privateKey needs to be set.');
|
325 |
}
|
326 |
}
|
327 |
}
|
328 |
|
329 |
+
/*
|
330 |
+
* Check if configuration has a client id and secret
|
331 |
+
*
|
332 |
+
* @throws Exception\Configuration
|
333 |
+
*
|
334 |
+
* @return self
|
335 |
+
*/
|
336 |
public function assertHasClientCredentials()
|
337 |
{
|
338 |
$this->assertHasClientId();
|
339 |
$this->assertHasClientSecret();
|
340 |
}
|
341 |
|
342 |
+
/*
|
343 |
+
* Check if configuration has a client id
|
344 |
+
*
|
345 |
+
* @throws Exception\Configuration
|
346 |
+
*
|
347 |
+
* @return self
|
348 |
+
*/
|
349 |
public function assertHasClientId()
|
350 |
{
|
351 |
if (empty($this->_clientId)) {
|
353 |
}
|
354 |
}
|
355 |
|
356 |
+
/*
|
357 |
+
* Check if configuration has a client secret
|
358 |
+
*
|
359 |
+
* @throws Exception\Configuration
|
360 |
+
*
|
361 |
+
* @return self
|
362 |
+
*/
|
363 |
public function assertHasClientSecret()
|
364 |
{
|
365 |
if (empty($this->_clientSecret)) {
|
367 |
}
|
368 |
}
|
369 |
|
370 |
+
/*
|
371 |
+
* Getter function
|
372 |
+
*
|
373 |
+
* @return string environment
|
374 |
+
*/
|
375 |
public function getEnvironment()
|
376 |
{
|
377 |
return $this->_environment;
|
378 |
}
|
379 |
|
380 |
+
/*
|
381 |
+
* Getter function
|
382 |
+
*
|
383 |
+
* @return string merchant id
|
384 |
*/
|
|
|
|
|
|
|
|
|
|
|
385 |
public function getMerchantId()
|
386 |
{
|
387 |
return $this->_merchantId;
|
388 |
}
|
389 |
|
390 |
+
/*
|
391 |
+
* Getter function
|
392 |
+
*
|
393 |
+
* @return string public key
|
394 |
*/
|
|
|
|
|
|
|
|
|
|
|
395 |
public function getPublicKey()
|
396 |
{
|
397 |
return $this->_publicKey;
|
398 |
}
|
399 |
|
400 |
+
/*
|
401 |
+
* Getter function
|
402 |
+
*
|
403 |
+
* @return string client id
|
404 |
+
*/
|
405 |
public function getClientId()
|
406 |
{
|
407 |
return $this->_clientId;
|
408 |
}
|
409 |
|
410 |
+
/*
|
411 |
+
* Getter function
|
412 |
+
*
|
413 |
+
* @return string private key
|
414 |
*/
|
|
|
|
|
|
|
|
|
|
|
415 |
public function getPrivateKey()
|
416 |
{
|
417 |
return $this->_privateKey;
|
418 |
}
|
419 |
|
420 |
+
/*
|
421 |
+
* Getter function
|
422 |
+
*
|
423 |
+
* @return string client secret
|
424 |
+
*/
|
425 |
public function getClientSecret()
|
426 |
{
|
427 |
return $this->_clientSecret;
|
428 |
}
|
429 |
|
430 |
+
/*
|
431 |
+
* Getter function
|
432 |
+
*
|
433 |
+
* @return string proxy host
|
434 |
*/
|
435 |
+
public function getProxyHost()
|
436 |
{
|
437 |
+
return $this->_proxyHost;
|
438 |
+
}
|
439 |
+
/*
|
440 |
+
* Getter function
|
441 |
+
*
|
442 |
+
* @return string proxy port
|
443 |
+
*/
|
444 |
+
public function getProxyPort()
|
445 |
+
{
|
446 |
+
return $this->_proxyPort;
|
447 |
}
|
448 |
|
449 |
+
|
450 |
+
/*
|
451 |
+
* Getter function
|
452 |
+
*
|
453 |
+
* @return string proxy type
|
454 |
+
*/
|
455 |
+
public function getProxyType()
|
456 |
{
|
457 |
+
return $this->_proxyType;
|
458 |
}
|
459 |
|
460 |
+
/*
|
461 |
+
* Getter function
|
462 |
+
*
|
463 |
+
* @return string proxy username
|
464 |
+
*/
|
465 |
+
public function getProxyUser()
|
466 |
{
|
467 |
+
return $this->_proxyUser;
|
468 |
}
|
469 |
|
470 |
+
/*
|
471 |
+
* Getter function
|
472 |
+
*
|
473 |
+
* @return string proxy password
|
474 |
+
*/
|
475 |
+
public function getProxyPassword()
|
476 |
{
|
477 |
+
return $this->_proxyPassword;
|
478 |
}
|
479 |
|
480 |
+
/*
|
481 |
+
* Getter function
|
482 |
+
*
|
483 |
+
* @return int timeout
|
484 |
+
*/
|
485 |
+
public function getTimeout()
|
486 |
{
|
487 |
+
return $this->_timeout;
|
488 |
}
|
489 |
|
490 |
+
/*
|
491 |
+
* Getter function
|
492 |
+
*
|
493 |
+
* @return string ssl version
|
494 |
+
*/
|
495 |
+
public function getSslVersion()
|
496 |
{
|
497 |
+
return $this->_sslVersion;
|
498 |
}
|
499 |
|
500 |
+
/*
|
501 |
+
* Getter function
|
502 |
+
*
|
503 |
+
* @return bool
|
504 |
+
*/
|
505 |
+
public function getAcceptGzipEncoding()
|
506 |
{
|
507 |
+
return $this->_acceptGzipEncoding;
|
508 |
}
|
509 |
|
510 |
+
//phpcs:disable PEAR.Commenting
|
511 |
+
/**
|
512 |
+
* Do not use this method directly. Pass in the environment to the constructor.
|
513 |
+
*/
|
514 |
+
public function setEnvironment($value)
|
515 |
{
|
516 |
+
$this->_environment = $value;
|
517 |
}
|
518 |
|
519 |
+
/**
|
520 |
+
* Do not use this method directly. Pass in the merchantId to the constructor.
|
521 |
+
*/
|
522 |
+
public function setMerchantId($value)
|
523 |
{
|
524 |
+
$this->_merchantId = $value;
|
525 |
}
|
526 |
|
527 |
+
/**
|
528 |
+
* Do not use this method directly. Pass in the publicKey to the constructor.
|
529 |
+
*/
|
530 |
+
public function setPublicKey($value)
|
531 |
{
|
532 |
+
$this->_publicKey = $value;
|
533 |
}
|
534 |
|
535 |
+
/**
|
536 |
+
* Do not use this method directly. Pass in the privateKey to the constructor.
|
537 |
+
*/
|
538 |
+
public function setPrivateKey($value)
|
539 |
{
|
540 |
+
$this->_privateKey = $value;
|
541 |
}
|
542 |
|
543 |
+
private function setProxyHost($value)
|
544 |
{
|
545 |
+
$this->_proxyHost = $value;
|
546 |
}
|
547 |
|
548 |
+
private function setProxyPort($value)
|
549 |
{
|
550 |
+
$this->_proxyPort = $value;
|
551 |
}
|
552 |
|
553 |
+
private function setProxyType($value)
|
554 |
{
|
555 |
+
$this->_proxyType = $value;
|
556 |
}
|
557 |
|
558 |
+
private function setProxyUser($value)
|
559 |
{
|
560 |
+
$this->_proxyUser = $value;
|
561 |
}
|
562 |
|
563 |
+
private function setProxyPassword($value)
|
564 |
{
|
565 |
+
$this->_proxyPassword = $value;
|
566 |
+
}
|
567 |
+
|
568 |
+
private function setTimeout($value)
|
569 |
+
{
|
570 |
+
$this->_timeout = $value;
|
571 |
+
}
|
572 |
+
|
573 |
+
private function setSslVersion($value)
|
574 |
+
{
|
575 |
+
$this->_sslVersion = $value;
|
576 |
}
|
577 |
|
578 |
private function setAcceptGzipEncoding($value)
|
579 |
{
|
580 |
$this->_acceptGzipEncoding = $value;
|
581 |
}
|
582 |
+
//phpcs:enable PEAR.Commenting
|
583 |
|
584 |
+
/*
|
585 |
+
* Getter function
|
586 |
+
*
|
587 |
+
* @return string access token
|
588 |
+
*/
|
589 |
public function getAccessToken()
|
590 |
{
|
591 |
return $this->_accessToken;
|
592 |
}
|
593 |
|
594 |
+
/*
|
595 |
+
* Checks for presence of access token
|
596 |
+
*
|
597 |
+
* @return bool
|
598 |
+
*/
|
599 |
public function isAccessToken()
|
600 |
{
|
601 |
return !empty($this->_accessToken);
|
602 |
}
|
603 |
|
604 |
+
/*
|
605 |
+
* Checks for presence of client credentials
|
606 |
+
*
|
607 |
+
* @return bool
|
608 |
+
*/
|
609 |
public function isClientCredentials()
|
610 |
{
|
611 |
return !empty($this->_clientId);
|
612 |
}
|
613 |
+
|
614 |
/**
|
615 |
* returns the base braintree gateway URL based on config values
|
616 |
*
|
|
|
|
|
617 |
* @return string braintree gateway URL
|
618 |
*/
|
619 |
public function baseUrl()
|
621 |
return sprintf('%s://%s:%d', $this->protocol(), $this->serverName(), $this->portNumber());
|
622 |
}
|
623 |
|
624 |
+
/**
|
625 |
+
* returns the base URL for Braintree's GraphQL endpoint based on config values
|
626 |
+
*
|
627 |
+
* @return string Braintree GraphQL URL
|
628 |
+
*/
|
629 |
+
public function graphQLBaseUrl()
|
630 |
+
{
|
631 |
+
return sprintf('%s://%s:%d/graphql', $this->protocol(), $this->graphQLServerName(), $this->graphQLPortNumber());
|
632 |
+
}
|
633 |
+
|
634 |
/**
|
635 |
* sets the merchant path based on merchant ID
|
636 |
*
|
|
|
|
|
637 |
* @return string merchant path uri
|
638 |
*/
|
639 |
public function merchantPath()
|
644 |
/**
|
645 |
* sets the physical path for the location of the CA certs
|
646 |
*
|
647 |
+
* @param string $sslPath optional
|
648 |
+
*
|
649 |
* @return string filepath
|
650 |
*/
|
651 |
+
public function caFile($sslPath = null)
|
652 |
{
|
653 |
$sslPath = $sslPath ? $sslPath : DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
|
654 |
'ssl' . DIRECTORY_SEPARATOR;
|
655 |
$caPath = __DIR__ . $sslPath . 'api_braintreegateway_com.ca.crt';
|
656 |
|
657 |
+
if (!file_exists($caPath)) {
|
|
|
658 |
throw new Exception\SSLCaFileNotFound();
|
659 |
}
|
660 |
|
664 |
/**
|
665 |
* returns the port number depending on environment
|
666 |
*
|
|
|
|
|
667 |
* @return int portnumber
|
668 |
*/
|
669 |
public function portNumber()
|
674 |
return getenv("GATEWAY_PORT") ? getenv("GATEWAY_PORT") : 3000;
|
675 |
}
|
676 |
|
677 |
+
/**
|
678 |
+
* returns the port number depending on environment
|
679 |
+
*
|
680 |
+
* @return integer graphql portnumber
|
681 |
+
*/
|
682 |
+
public function graphQLPortNumber()
|
683 |
+
{
|
684 |
+
if ($this->sslOn()) {
|
685 |
+
return 443;
|
686 |
+
}
|
687 |
+
return getenv("GRAPHQL_PORT") ?: 8080;
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Specifies whether or not a proxy is properly configured
|
692 |
+
*
|
693 |
+
* @return boolean true if a proxy is configured properly, false if not
|
694 |
+
*/
|
695 |
+
public function isUsingProxy()
|
696 |
+
{
|
697 |
+
$proxyHost = $this->getProxyHost();
|
698 |
+
$proxyPort = $this->getProxyPort();
|
699 |
+
return !empty($proxyHost) && !empty($proxyPort);
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Specified whether or not a username and password have been provided for
|
704 |
+
* use with an authenticated proxy
|
705 |
+
*
|
706 |
+
* @return boolean true if both proxyUser and proxyPassword are present
|
707 |
+
*/
|
708 |
+
public function isAuthenticatedProxy()
|
709 |
+
{
|
710 |
+
$proxyUser = $this->getProxyUser();
|
711 |
+
$proxyPwd = $this->getProxyPassword();
|
712 |
+
return !empty($proxyUser) && !empty($proxyPwd);
|
713 |
+
}
|
714 |
+
|
715 |
/**
|
716 |
* returns http protocol depending on environment
|
717 |
*
|
|
|
|
|
718 |
* @return string http || https
|
719 |
*/
|
720 |
public function protocol()
|
725 |
/**
|
726 |
* returns gateway server name depending on environment
|
727 |
*
|
|
|
|
|
728 |
* @return string server domain name
|
729 |
*/
|
730 |
public function serverName()
|
731 |
{
|
732 |
+
switch ($this->_environment) {
|
733 |
+
case 'production':
|
734 |
+
$serverName = 'api.braintreegateway.com';
|
735 |
+
break;
|
736 |
+
case 'qa':
|
737 |
+
$serverName = 'gateway.qa.braintreepayments.com';
|
738 |
+
break;
|
739 |
+
case 'sandbox':
|
740 |
+
$serverName = 'api.sandbox.braintreegateway.com';
|
741 |
+
break;
|
742 |
+
case 'development':
|
743 |
+
case 'integration':
|
744 |
+
default:
|
745 |
+
$serverName = 'localhost';
|
746 |
+
break;
|
747 |
}
|
748 |
|
749 |
return $serverName;
|
750 |
}
|
751 |
|
752 |
+
/**
|
753 |
+
* returns Braintree GraphQL server name depending on environment
|
754 |
+
*
|
755 |
+
* @return string graphql domain name
|
756 |
+
*/
|
757 |
+
public function graphQLServerName()
|
758 |
+
{
|
759 |
+
switch ($this->_environment) {
|
760 |
+
case 'production':
|
761 |
+
$graphQLServerName = 'payments.braintree-api.com';
|
762 |
+
break;
|
763 |
+
case 'qa':
|
764 |
+
$graphQLServerName = 'payments-qa.dev.braintree-api.com';
|
765 |
+
break;
|
766 |
+
case 'sandbox':
|
767 |
+
$graphQLServerName = 'payments.sandbox.braintree-api.com';
|
768 |
+
break;
|
769 |
+
case 'development':
|
770 |
+
case 'integration':
|
771 |
+
default:
|
772 |
+
$graphQLServerName = 'graphql.bt.local';
|
773 |
+
break;
|
774 |
}
|
775 |
|
776 |
+
return $graphQLServerName;
|
777 |
}
|
778 |
|
779 |
/**
|
780 |
* returns boolean indicating SSL is on or off for this session,
|
781 |
* depending on environment
|
782 |
*
|
|
|
|
|
783 |
* @return boolean
|
784 |
*/
|
785 |
public function sslOn()
|
786 |
{
|
787 |
+
switch ($this->_environment) {
|
788 |
+
case 'integration':
|
789 |
+
case 'development':
|
790 |
+
$ssl = false;
|
791 |
+
break;
|
792 |
+
case 'production':
|
793 |
+
case 'qa':
|
794 |
+
case 'sandbox':
|
795 |
+
default:
|
796 |
+
$ssl = true;
|
797 |
+
break;
|
798 |
}
|
799 |
|
800 |
+
return $ssl;
|
801 |
}
|
802 |
|
803 |
/**
|
804 |
* log message to default logger
|
805 |
*
|
806 |
+
* @param string $message to log
|
807 |
*
|
808 |
+
* @return string
|
809 |
*/
|
810 |
public function logMessage($message)
|
811 |
{
|
813 |
}
|
814 |
}
|
815 |
Configuration::reset();
|
|
vendor/braintree/braintree_php/lib/Braintree/ConnectedMerchantPayPalStatusChanged.php
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Connected Merchant PayPal Status Changed Payload
|
6 |
*
|
7 |
-
* @
|
8 |
-
*
|
9 |
-
* @property-read string $merchantPublicId
|
10 |
-
* @property-read string $action
|
11 |
-
* @property-read string $oauthApplicationClientId
|
12 |
*/
|
13 |
class ConnectedMerchantPayPalStatusChanged extends Base
|
14 |
{
|
15 |
protected $_attributes = [];
|
16 |
|
17 |
/**
|
18 |
-
*
|
|
|
|
|
|
|
|
|
19 |
*/
|
20 |
public static function factory($attributes)
|
21 |
{
|
@@ -26,12 +27,8 @@ class ConnectedMerchantPayPalStatusChanged extends Base
|
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
-
/**
|
30 |
-
* @ignore
|
31 |
-
*/
|
32 |
protected function _initialize($attributes)
|
33 |
{
|
34 |
$this->_attributes = $attributes;
|
35 |
}
|
36 |
}
|
37 |
-
class_alias('Braintree\ConnectedMerchantPayPalStatusChanged', 'Braintree_ConnectedMerchantPayPalStatusChanged');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Connected Merchant PayPal Status Changed Payload
|
7 |
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/braintree-auth/php#notification-type-connected_merchant_paypal_status_changed developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
class ConnectedMerchantPayPalStatusChanged extends Base
|
11 |
{
|
12 |
protected $_attributes = [];
|
13 |
|
14 |
/**
|
15 |
+
* Creates an instance of a ConnectedMerchantPayPalStatusChanged from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return ConnectedMerchantPayPalStatusChanged
|
20 |
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
27 |
return $instance;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
30 |
protected function _initialize($attributes)
|
31 |
{
|
32 |
$this->_attributes = $attributes;
|
33 |
}
|
34 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ConnectedMerchantStatusTransitioned.php
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Connected Merchant Status Transitioned Payload
|
6 |
*
|
7 |
-
* @
|
8 |
-
*
|
9 |
-
* @property-read string $merchantPublicId
|
10 |
-
* @property-read string $status
|
11 |
-
* @property-read string $oauthApplicationClientId
|
12 |
*/
|
13 |
class ConnectedMerchantStatusTransitioned extends Base
|
14 |
{
|
15 |
protected $_attributes = [];
|
16 |
|
17 |
/**
|
18 |
-
*
|
|
|
|
|
|
|
|
|
19 |
*/
|
20 |
public static function factory($attributes)
|
21 |
{
|
@@ -26,12 +27,8 @@ class ConnectedMerchantStatusTransitioned extends Base
|
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
-
/**
|
30 |
-
* @ignore
|
31 |
-
*/
|
32 |
protected function _initialize($attributes)
|
33 |
{
|
34 |
$this->_attributes = $attributes;
|
35 |
}
|
36 |
}
|
37 |
-
class_alias('Braintree\ConnectedMerchantStatusTransitioned', 'Braintree_ConnectedMerchantStatusTransitioned');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Connected Merchant Status Transitioned Payload
|
7 |
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/braintree-auth/php#notification-type-connected_merchant_paypal_status_changed developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
class ConnectedMerchantStatusTransitioned extends Base
|
11 |
{
|
12 |
protected $_attributes = [];
|
13 |
|
14 |
/**
|
15 |
+
* Creates an instance of a ConnectedMerchantStatusTransitioned from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return ConnectedMerchantStatusTransitioned
|
20 |
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
27 |
return $instance;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
30 |
protected function _initialize($attributes)
|
31 |
{
|
32 |
$this->_attributes = $attributes;
|
33 |
}
|
34 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CredentialsParser.php
CHANGED
@@ -1,12 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
-
*
|
6 |
* CredentialsParser registry
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
* @subpackage Utility
|
10 |
*/
|
11 |
|
12 |
class CredentialsParser
|
@@ -17,6 +14,7 @@ class CredentialsParser
|
|
17 |
private $_environment;
|
18 |
private $_merchantId;
|
19 |
|
|
|
20 |
public function __construct($attribs)
|
21 |
{
|
22 |
foreach ($attribs as $kind => $value) {
|
@@ -33,12 +31,6 @@ class CredentialsParser
|
|
33 |
$this->parse();
|
34 |
}
|
35 |
|
36 |
-
/**
|
37 |
-
*
|
38 |
-
* @access protected
|
39 |
-
* @static
|
40 |
-
* @var array valid environments, used for validation
|
41 |
-
*/
|
42 |
private static $_validEnvironments = [
|
43 |
'development',
|
44 |
'integration',
|
@@ -47,7 +39,11 @@ class CredentialsParser
|
|
47 |
'qa',
|
48 |
];
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
public function parse()
|
52 |
{
|
53 |
$environments = [];
|
@@ -55,6 +51,7 @@ class CredentialsParser
|
|
55 |
$environments[] = ['clientId', $this->_parseClientCredential('clientId', $this->_clientId, 'client_id')];
|
56 |
}
|
57 |
if (!empty($this->_clientSecret)) {
|
|
|
58 |
$environments[] = ['clientSecret', $this->_parseClientCredential('clientSecret', $this->_clientSecret, 'client_secret')];
|
59 |
}
|
60 |
if (!empty($this->_accessToken)) {
|
@@ -66,7 +63,8 @@ class CredentialsParser
|
|
66 |
if ($env[1] !== $checkEnv[1]) {
|
67 |
throw new Exception\Configuration(
|
68 |
'Mismatched credential environments: ' . $checkEnv[0] . ' environment is ' . $checkEnv[1] .
|
69 |
-
' and ' . $env[0] . ' environment is ' . $env[1]
|
|
|
70 |
}
|
71 |
}
|
72 |
|
@@ -74,7 +72,15 @@ class CredentialsParser
|
|
74 |
$this->_environment = $checkEnv[1];
|
75 |
}
|
76 |
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
if (!in_array($environment, self::$_validEnvironments)) {
|
79 |
throw new Exception\Configuration('"' .
|
80 |
$environment . '" is not a valid environment.');
|
@@ -85,7 +91,8 @@ class CredentialsParser
|
|
85 |
{
|
86 |
$explodedCredential = explode('$', $value);
|
87 |
if (sizeof($explodedCredential) != 3) {
|
88 |
-
|
|
|
89 |
}
|
90 |
|
91 |
$gotValuePrefix = $explodedCredential[0];
|
@@ -103,7 +110,8 @@ class CredentialsParser
|
|
103 |
{
|
104 |
$accessTokenExploded = explode('$', $this->_accessToken);
|
105 |
if (sizeof($accessTokenExploded) != 4) {
|
106 |
-
|
|
|
107 |
}
|
108 |
|
109 |
$gotValuePrefix = $accessTokenExploded[0];
|
@@ -119,29 +127,53 @@ class CredentialsParser
|
|
119 |
return $environment;
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
122 |
public function getClientId()
|
123 |
{
|
124 |
return $this->_clientId;
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
public function getClientSecret()
|
128 |
{
|
129 |
return $this->_clientSecret;
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
|
|
132 |
public function getAccessToken()
|
133 |
{
|
134 |
return $this->_accessToken;
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
137 |
public function getEnvironment()
|
138 |
{
|
139 |
return $this->_environment;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
142 |
public function getMerchantId()
|
143 |
{
|
144 |
return $this->_merchantId;
|
145 |
}
|
146 |
}
|
147 |
-
class_alias('Braintree\CredentialsParser', 'Braintree_CredentialsParser');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
|
|
6 |
* CredentialsParser registry
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
class CredentialsParser
|
14 |
private $_environment;
|
15 |
private $_merchantId;
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
18 |
public function __construct($attribs)
|
19 |
{
|
20 |
foreach ($attribs as $kind => $value) {
|
31 |
$this->parse();
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
private static $_validEnvironments = [
|
35 |
'development',
|
36 |
'integration',
|
39 |
'qa',
|
40 |
];
|
41 |
|
42 |
+
/*
|
43 |
+
* Parses environment credentials and sets the _environment variable
|
44 |
+
*
|
45 |
+
* @return object|Exception\Configuration
|
46 |
+
*/
|
47 |
public function parse()
|
48 |
{
|
49 |
$environments = [];
|
51 |
$environments[] = ['clientId', $this->_parseClientCredential('clientId', $this->_clientId, 'client_id')];
|
52 |
}
|
53 |
if (!empty($this->_clientSecret)) {
|
54 |
+
// phpcs:ignore Generic.Files.LineLength
|
55 |
$environments[] = ['clientSecret', $this->_parseClientCredential('clientSecret', $this->_clientSecret, 'client_secret')];
|
56 |
}
|
57 |
if (!empty($this->_accessToken)) {
|
63 |
if ($env[1] !== $checkEnv[1]) {
|
64 |
throw new Exception\Configuration(
|
65 |
'Mismatched credential environments: ' . $checkEnv[0] . ' environment is ' . $checkEnv[1] .
|
66 |
+
' and ' . $env[0] . ' environment is ' . $env[1]
|
67 |
+
);
|
68 |
}
|
69 |
}
|
70 |
|
72 |
$this->_environment = $checkEnv[1];
|
73 |
}
|
74 |
|
75 |
+
/*
|
76 |
+
* Checks that the environment passed is valid
|
77 |
+
*
|
78 |
+
* @param string $environment
|
79 |
+
*
|
80 |
+
* @return self|Exception\Configuration
|
81 |
+
*/
|
82 |
+
public static function assertValidEnvironment($environment)
|
83 |
+
{
|
84 |
if (!in_array($environment, self::$_validEnvironments)) {
|
85 |
throw new Exception\Configuration('"' .
|
86 |
$environment . '" is not a valid environment.');
|
91 |
{
|
92 |
$explodedCredential = explode('$', $value);
|
93 |
if (sizeof($explodedCredential) != 3) {
|
94 |
+
$message = 'Incorrect ' . $credentialType . ' format. Expected: type$environment$token';
|
95 |
+
throw new Exception\Configuration($message);
|
96 |
}
|
97 |
|
98 |
$gotValuePrefix = $explodedCredential[0];
|
110 |
{
|
111 |
$accessTokenExploded = explode('$', $this->_accessToken);
|
112 |
if (sizeof($accessTokenExploded) != 4) {
|
113 |
+
$message = 'Incorrect accessToken syntax. Expected: type$environment$merchant_id$token';
|
114 |
+
throw new Exception\Configuration($message);
|
115 |
}
|
116 |
|
117 |
$gotValuePrefix = $accessTokenExploded[0];
|
127 |
return $environment;
|
128 |
}
|
129 |
|
130 |
+
/*
|
131 |
+
* Getter methid to retrieve the ClientId
|
132 |
+
*
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
public function getClientId()
|
136 |
{
|
137 |
return $this->_clientId;
|
138 |
}
|
139 |
|
140 |
+
/*
|
141 |
+
* Getter methid to retrieve the ClientSecret
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
public function getClientSecret()
|
146 |
{
|
147 |
return $this->_clientSecret;
|
148 |
}
|
149 |
|
150 |
+
/*
|
151 |
+
* Getter methid to retrieve the AccessToken
|
152 |
+
*
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
public function getAccessToken()
|
156 |
{
|
157 |
return $this->_accessToken;
|
158 |
}
|
159 |
|
160 |
+
/*
|
161 |
+
* Getter methid to retrieve the Environment
|
162 |
+
*
|
163 |
+
* @return string
|
164 |
+
*/
|
165 |
public function getEnvironment()
|
166 |
{
|
167 |
return $this->_environment;
|
168 |
}
|
169 |
|
170 |
+
/*
|
171 |
+
* Getter methid to retrieve the Merchant Id
|
172 |
+
*
|
173 |
+
* @return string
|
174 |
+
*/
|
175 |
public function getMerchantId()
|
176 |
{
|
177 |
return $this->_merchantId;
|
178 |
}
|
179 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CreditCard.php
CHANGED
@@ -1,32 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree CreditCard module
|
6 |
* Creates and manages Braintree CreditCards
|
7 |
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* For more detailed information on CreditCards, see {@link https://developers.braintreepayments.com/reference/response/credit-card/php https://developers.braintreepayments.com/reference/response/credit-card/php}<br />
|
11 |
-
* For more detailed information on CreditCard verifications, see {@link https://developers.braintreepayments.com/reference/response/credit-card-verification/php https://developers.braintreepayments.com/reference/response/credit-card-verification/php}
|
12 |
-
*
|
13 |
-
* @package Braintree
|
14 |
-
* @category Resources
|
15 |
-
*
|
16 |
-
* @property-read string $billingAddress
|
17 |
-
* @property-read string $bin
|
18 |
-
* @property-read string $cardType
|
19 |
-
* @property-read string $cardholderName
|
20 |
-
* @property-read string $createdAt
|
21 |
-
* @property-read string $customerId
|
22 |
-
* @property-read string $expirationDate
|
23 |
-
* @property-read string $expirationMonth
|
24 |
-
* @property-read string $expirationYear
|
25 |
-
* @property-read string $imageUrl
|
26 |
-
* @property-read string $last4
|
27 |
-
* @property-read string $maskedNumber
|
28 |
-
* @property-read string $token
|
29 |
-
* @property-read string $updatedAt
|
30 |
*/
|
31 |
class CreditCard extends Base
|
32 |
{
|
@@ -36,6 +17,7 @@ class CreditCard extends Base
|
|
36 |
const CHINA_UNION_PAY = 'China UnionPay';
|
37 |
const DINERS_CLUB_INTERNATIONAL = 'Diners Club';
|
38 |
const DISCOVER = 'Discover';
|
|
|
39 |
const JCB = 'JCB';
|
40 |
const LASER = 'Laser';
|
41 |
const MAESTRO = 'Maestro';
|
@@ -112,8 +94,8 @@ class CreditCard extends Base
|
|
112 |
/**
|
113 |
* sets instance properties from an array of values
|
114 |
*
|
115 |
-
* @access protected
|
116 |
* @param array $creditCardAttribs array of creditcard data
|
|
|
117 |
* @return void
|
118 |
*/
|
119 |
protected function _initialize($creditCardAttribs)
|
@@ -128,7 +110,7 @@ class CreditCard extends Base
|
|
128 |
|
129 |
$subscriptionArray = [];
|
130 |
if (isset($creditCardAttribs['subscriptions'])) {
|
131 |
-
foreach ($creditCardAttribs['subscriptions']
|
132 |
$subscriptionArray[] = Subscription::factory($subscription);
|
133 |
}
|
134 |
}
|
@@ -138,7 +120,7 @@ class CreditCard extends Base
|
|
138 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
139 |
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
140 |
|
141 |
-
if(isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
|
142 |
$verifications = $creditCardAttribs['verifications'];
|
143 |
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
|
144 |
|
@@ -156,6 +138,7 @@ class CreditCard extends Base
|
|
156 |
* or is a CreditCard with a different id
|
157 |
*
|
158 |
* @param object $otherCreditCard customer to compare against
|
|
|
159 |
* @return boolean
|
160 |
*/
|
161 |
public function isEqual($otherCreditCard)
|
@@ -163,22 +146,18 @@ class CreditCard extends Base
|
|
163 |
return !($otherCreditCard instanceof self) ? false : $this->token === $otherCreditCard->token;
|
164 |
}
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
* ClassName[property=value, property=value]
|
169 |
-
* @return string
|
170 |
-
*/
|
171 |
-
public function __toString()
|
172 |
{
|
173 |
return __CLASS__ . '[' .
|
174 |
-
Util::attributesToString($this->_attributes) .']';
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
-
*
|
179 |
-
*
|
|
|
180 |
*
|
181 |
-
* @ignore
|
182 |
* @return CreditCard
|
183 |
*/
|
184 |
public static function factory($attributes)
|
@@ -195,105 +174,238 @@ class CreditCard extends Base
|
|
195 |
return $instance;
|
196 |
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
public static function create($attribs)
|
202 |
{
|
203 |
return Configuration::gateway()->creditCard()->create($attribs);
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
public static function createNoValidate($attribs)
|
207 |
{
|
208 |
return Configuration::gateway()->creditCard()->createNoValidate($attribs);
|
209 |
}
|
210 |
|
211 |
-
|
212 |
-
{
|
213 |
-
return Configuration::gateway()->creditCard()->createFromTransparentRedirect($queryString);
|
214 |
-
}
|
215 |
-
|
216 |
public static function createCreditCardUrl()
|
217 |
{
|
218 |
return Configuration::gateway()->creditCard()->createCreditCardUrl();
|
219 |
}
|
220 |
|
|
|
|
|
|
|
|
|
|
|
221 |
public static function expired()
|
222 |
{
|
223 |
return Configuration::gateway()->creditCard()->expired();
|
224 |
}
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
public static function fetchExpired($ids)
|
227 |
{
|
228 |
return Configuration::gateway()->creditCard()->fetchExpired($ids);
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
public static function expiringBetween($startDate, $endDate)
|
232 |
{
|
233 |
return Configuration::gateway()->creditCard()->expiringBetween($startDate, $endDate);
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
public static function fetchExpiring($startDate, $endDate, $ids)
|
237 |
{
|
238 |
return Configuration::gateway()->creditCard()->fetchExpiring($startDate, $endDate, $ids);
|
239 |
}
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
public static function find($token)
|
242 |
{
|
243 |
return Configuration::gateway()->creditCard()->find($token);
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
public static function fromNonce($nonce)
|
247 |
{
|
248 |
return Configuration::gateway()->creditCard()->fromNonce($nonce);
|
249 |
}
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
public static function credit($token, $transactionAttribs)
|
252 |
{
|
253 |
return Configuration::gateway()->creditCard()->credit($token, $transactionAttribs);
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
public static function creditNoValidate($token, $transactionAttribs)
|
257 |
{
|
258 |
return Configuration::gateway()->creditCard()->creditNoValidate($token, $transactionAttribs);
|
259 |
}
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
public static function sale($token, $transactionAttribs)
|
262 |
{
|
263 |
return Configuration::gateway()->creditCard()->sale($token, $transactionAttribs);
|
264 |
}
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
public static function saleNoValidate($token, $transactionAttribs)
|
267 |
{
|
268 |
return Configuration::gateway()->creditCard()->saleNoValidate($token, $transactionAttribs);
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
public static function update($token, $attributes)
|
272 |
{
|
273 |
return Configuration::gateway()->creditCard()->update($token, $attributes);
|
274 |
}
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
public static function updateNoValidate($token, $attributes)
|
277 |
{
|
278 |
return Configuration::gateway()->creditCard()->updateNoValidate($token, $attributes);
|
279 |
}
|
280 |
|
|
|
281 |
public static function updateCreditCardUrl()
|
282 |
{
|
283 |
return Configuration::gateway()->creditCard()->updateCreditCardUrl();
|
284 |
}
|
285 |
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
291 |
public static function delete($token)
|
292 |
{
|
293 |
return Configuration::gateway()->creditCard()->delete($token);
|
294 |
}
|
295 |
|
296 |
-
/**
|
|
|
|
|
|
|
|
|
297 |
public static function allCardTypes()
|
298 |
{
|
299 |
return [
|
@@ -302,6 +414,7 @@ class CreditCard extends Base
|
|
302 |
CreditCard::CHINA_UNION_PAY,
|
303 |
CreditCard::DINERS_CLUB_INTERNATIONAL,
|
304 |
CreditCard::DISCOVER,
|
|
|
305 |
CreditCard::JCB,
|
306 |
CreditCard::LASER,
|
307 |
CreditCard::MAESTRO,
|
@@ -313,4 +426,3 @@ class CreditCard extends Base
|
|
313 |
];
|
314 |
}
|
315 |
}
|
316 |
-
class_alias('Braintree\CreditCard', 'Braintree_CreditCard');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree CreditCard module
|
7 |
* Creates and manages Braintree CreditCards
|
8 |
*
|
9 |
+
* For more detailed information on CreditCards, see {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card our developer docs}<br />
|
10 |
+
* For more detailed information on CreditCard verifications, see {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card-verification our developer docs}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class CreditCard extends Base
|
13 |
{
|
17 |
const CHINA_UNION_PAY = 'China UnionPay';
|
18 |
const DINERS_CLUB_INTERNATIONAL = 'Diners Club';
|
19 |
const DISCOVER = 'Discover';
|
20 |
+
const ELO = 'Elo';
|
21 |
const JCB = 'JCB';
|
22 |
const LASER = 'Laser';
|
23 |
const MAESTRO = 'Maestro';
|
94 |
/**
|
95 |
* sets instance properties from an array of values
|
96 |
*
|
|
|
97 |
* @param array $creditCardAttribs array of creditcard data
|
98 |
+
*
|
99 |
* @return void
|
100 |
*/
|
101 |
protected function _initialize($creditCardAttribs)
|
110 |
|
111 |
$subscriptionArray = [];
|
112 |
if (isset($creditCardAttribs['subscriptions'])) {
|
113 |
+
foreach ($creditCardAttribs['subscriptions'] as $subscription) {
|
114 |
$subscriptionArray[] = Subscription::factory($subscription);
|
115 |
}
|
116 |
}
|
120 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
121 |
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
122 |
|
123 |
+
if (isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
|
124 |
$verifications = $creditCardAttribs['verifications'];
|
125 |
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
|
126 |
|
138 |
* or is a CreditCard with a different id
|
139 |
*
|
140 |
* @param object $otherCreditCard customer to compare against
|
141 |
+
*
|
142 |
* @return boolean
|
143 |
*/
|
144 |
public function isEqual($otherCreditCard)
|
146 |
return !($otherCreditCard instanceof self) ? false : $this->token === $otherCreditCard->token;
|
147 |
}
|
148 |
|
149 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
150 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
151 |
{
|
152 |
return __CLASS__ . '[' .
|
153 |
+
Util::attributesToString($this->_attributes) . ']';
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
+
* Creates an instance of an CreditCard from given attributes
|
158 |
+
*
|
159 |
+
* @param array $attributes response object attributes
|
160 |
*
|
|
|
161 |
* @return CreditCard
|
162 |
*/
|
163 |
public static function factory($attributes)
|
174 |
return $instance;
|
175 |
}
|
176 |
|
177 |
+
/**
|
178 |
+
* static method redirecting to gateway class
|
179 |
+
*
|
180 |
+
* @param array $attribs containing request parameters
|
181 |
+
*
|
182 |
+
* @see CreditCardGateway::create()
|
183 |
+
*
|
184 |
+
* @throws Exception\ValidationError
|
185 |
+
*
|
186 |
+
* @return Result\Successful|Result\Error
|
187 |
+
*/
|
188 |
public static function create($attribs)
|
189 |
{
|
190 |
return Configuration::gateway()->creditCard()->create($attribs);
|
191 |
}
|
192 |
|
193 |
+
/**
|
194 |
+
* Attempts the create operation assuming all data will validate
|
195 |
+
* returns a CreditCard object instead of a Result
|
196 |
+
*
|
197 |
+
* @param array $attribs containing request parameters
|
198 |
+
*
|
199 |
+
* @throws Exception\ValidationError
|
200 |
+
*
|
201 |
+
* @return CreditCard
|
202 |
+
*/
|
203 |
public static function createNoValidate($attribs)
|
204 |
{
|
205 |
return Configuration::gateway()->creditCard()->createNoValidate($attribs);
|
206 |
}
|
207 |
|
208 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
209 |
public static function createCreditCardUrl()
|
210 |
{
|
211 |
return Configuration::gateway()->creditCard()->createCreditCardUrl();
|
212 |
}
|
213 |
|
214 |
+
/**
|
215 |
+
* Returns a ResourceCollection of expired credit cards
|
216 |
+
*
|
217 |
+
* @return ResourceCollection
|
218 |
+
*/
|
219 |
public static function expired()
|
220 |
{
|
221 |
return Configuration::gateway()->creditCard()->expired();
|
222 |
}
|
223 |
|
224 |
+
/**
|
225 |
+
* Returns a ResourceCollection of expired credit cards
|
226 |
+
*
|
227 |
+
* @param string $ids containing credit card IDs
|
228 |
+
*
|
229 |
+
* @return ResourceCollection
|
230 |
+
*/
|
231 |
public static function fetchExpired($ids)
|
232 |
{
|
233 |
return Configuration::gateway()->creditCard()->fetchExpired($ids);
|
234 |
}
|
235 |
|
236 |
+
/**
|
237 |
+
* Returns a ResourceCollection of credit cards expiring between start/end
|
238 |
+
*
|
239 |
+
* @param string $startDate the start date of search
|
240 |
+
* @param string $endDate the end date of search
|
241 |
+
*
|
242 |
+
* @return ResourceCollection
|
243 |
+
*/
|
244 |
public static function expiringBetween($startDate, $endDate)
|
245 |
{
|
246 |
return Configuration::gateway()->creditCard()->expiringBetween($startDate, $endDate);
|
247 |
}
|
248 |
|
249 |
+
/**
|
250 |
+
* Returns a ResourceCollection of credit cards expiring between start/end given a set of IDs
|
251 |
+
*
|
252 |
+
* @param string $startDate the start date of search
|
253 |
+
* @param string $endDate the end date of search
|
254 |
+
* @param string $ids containing ids to search
|
255 |
+
*
|
256 |
+
* @return ResourceCollection
|
257 |
+
*/
|
258 |
public static function fetchExpiring($startDate, $endDate, $ids)
|
259 |
{
|
260 |
return Configuration::gateway()->creditCard()->fetchExpiring($startDate, $endDate, $ids);
|
261 |
}
|
262 |
|
263 |
+
/**
|
264 |
+
* Find a creditcard by token
|
265 |
+
*
|
266 |
+
* @param string $token credit card unique id
|
267 |
+
*
|
268 |
+
* @throws Exception\NotFound
|
269 |
+
*
|
270 |
+
* @return CreditCard
|
271 |
+
*/
|
272 |
public static function find($token)
|
273 |
{
|
274 |
return Configuration::gateway()->creditCard()->find($token);
|
275 |
}
|
276 |
|
277 |
+
/**
|
278 |
+
* Convert a payment method nonce to a credit card
|
279 |
+
*
|
280 |
+
* @param string $nonce payment method nonce
|
281 |
+
*
|
282 |
+
* @throws Exception\NotFound
|
283 |
+
*
|
284 |
+
* @return CreditCard
|
285 |
+
*/
|
286 |
public static function fromNonce($nonce)
|
287 |
{
|
288 |
return Configuration::gateway()->creditCard()->fromNonce($nonce);
|
289 |
}
|
290 |
|
291 |
+
/**
|
292 |
+
* Create a credit on the card for the passed transaction
|
293 |
+
*
|
294 |
+
* @param string $token belonging to the credit card
|
295 |
+
* @param array $transactionAttribs containing request parameters
|
296 |
+
*
|
297 |
+
* @return Result\Successful|Result\Error
|
298 |
+
*/
|
299 |
public static function credit($token, $transactionAttribs)
|
300 |
{
|
301 |
return Configuration::gateway()->creditCard()->credit($token, $transactionAttribs);
|
302 |
}
|
303 |
|
304 |
+
/**
|
305 |
+
* Create a credit on this card, assuming validations will pass
|
306 |
+
*
|
307 |
+
* Returns a Transaction object on success
|
308 |
+
*
|
309 |
+
* @param string $token belonging to the credit card
|
310 |
+
* @param array $transactionAttribs containing request parameters
|
311 |
+
*
|
312 |
+
* @throws Exception\ValidationError
|
313 |
+
*
|
314 |
+
* @return Transaction
|
315 |
+
*/
|
316 |
public static function creditNoValidate($token, $transactionAttribs)
|
317 |
{
|
318 |
return Configuration::gateway()->creditCard()->creditNoValidate($token, $transactionAttribs);
|
319 |
}
|
320 |
|
321 |
+
/**
|
322 |
+
* Create a new sale for the current card
|
323 |
+
*
|
324 |
+
* @param string $token belonging to the credit card
|
325 |
+
* @param array $transactionAttribs containing request parameters
|
326 |
+
*
|
327 |
+
* @return Result\Successful|Result\Error
|
328 |
+
*/
|
329 |
public static function sale($token, $transactionAttribs)
|
330 |
{
|
331 |
return Configuration::gateway()->creditCard()->sale($token, $transactionAttribs);
|
332 |
}
|
333 |
|
334 |
+
/**
|
335 |
+
* Create a new sale using this card, assuming validations will pass
|
336 |
+
*
|
337 |
+
* Returns a Transaction object on success
|
338 |
+
*
|
339 |
+
* @param string $token belonging to the credit card
|
340 |
+
* @param array $transactionAttribs containing request parameters
|
341 |
+
*
|
342 |
+
* @throws Exception\ValidationsFailed
|
343 |
+
*
|
344 |
+
* @return Transaction
|
345 |
+
*/
|
346 |
public static function saleNoValidate($token, $transactionAttribs)
|
347 |
{
|
348 |
return Configuration::gateway()->creditCard()->saleNoValidate($token, $transactionAttribs);
|
349 |
}
|
350 |
|
351 |
+
/**
|
352 |
+
* Updates the creditcard record
|
353 |
+
*
|
354 |
+
* If calling this method in context, $token
|
355 |
+
* is the 2nd attribute. $token is not sent in object context.
|
356 |
+
*
|
357 |
+
* @param string $token (optional)
|
358 |
+
* @param array $attributes containing request parameters
|
359 |
+
*
|
360 |
+
* @return Result\Successful|Result\Error
|
361 |
+
*/
|
362 |
public static function update($token, $attributes)
|
363 |
{
|
364 |
return Configuration::gateway()->creditCard()->update($token, $attributes);
|
365 |
}
|
366 |
|
367 |
+
/**
|
368 |
+
* Update a creditcard record, assuming validations will pass
|
369 |
+
*
|
370 |
+
* If calling this method in context, $token
|
371 |
+
* is the 2nd attribute. $token is not sent in object context.
|
372 |
+
* returns a CreditCard object on success
|
373 |
+
*
|
374 |
+
* @param string $token (optional)
|
375 |
+
* @param array $attributes containing request parameters
|
376 |
+
*
|
377 |
+
* @return CreditCard
|
378 |
+
*
|
379 |
+
* @throws Exception\ValidationsFailed
|
380 |
+
*/
|
381 |
public static function updateNoValidate($token, $attributes)
|
382 |
{
|
383 |
return Configuration::gateway()->creditCard()->updateNoValidate($token, $attributes);
|
384 |
}
|
385 |
|
386 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
387 |
public static function updateCreditCardUrl()
|
388 |
{
|
389 |
return Configuration::gateway()->creditCard()->updateCreditCardUrl();
|
390 |
}
|
391 |
|
392 |
+
/**
|
393 |
+
* Delete a credit card record
|
394 |
+
*
|
395 |
+
* @param string $token credit card identifier
|
396 |
+
*
|
397 |
+
* @return Result
|
398 |
+
*/
|
399 |
public static function delete($token)
|
400 |
{
|
401 |
return Configuration::gateway()->creditCard()->delete($token);
|
402 |
}
|
403 |
|
404 |
+
/**
|
405 |
+
* All credit card types in an array
|
406 |
+
*
|
407 |
+
* @return array
|
408 |
+
*/
|
409 |
public static function allCardTypes()
|
410 |
{
|
411 |
return [
|
414 |
CreditCard::CHINA_UNION_PAY,
|
415 |
CreditCard::DINERS_CLUB_INTERNATIONAL,
|
416 |
CreditCard::DISCOVER,
|
417 |
+
CreditCard::ELO,
|
418 |
CreditCard::JCB,
|
419 |
CreditCard::LASER,
|
420 |
CreditCard::MAESTRO,
|
426 |
];
|
427 |
}
|
428 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CreditCardGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -7,13 +8,8 @@ use InvalidArgumentException;
|
|
7 |
* Braintree CreditCardGateway module
|
8 |
* Creates and manages Braintree CreditCards
|
9 |
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
* For more detailed information on CreditCards, see {@link https://developers.braintreepayments.com/reference/response/credit-card/php https://developers.braintreepayments.com/reference/response/credit-card/php}<br />
|
13 |
-
* For more detailed information on CreditCard verifications, see {@link https://developers.braintreepayments.com/reference/response/credit-card-verification/php https://developers.braintreepayments.com/reference/response/credit-card-verification/php}
|
14 |
-
*
|
15 |
-
* @package Braintree
|
16 |
-
* @category Resources
|
17 |
*/
|
18 |
class CreditCardGateway
|
19 |
{
|
@@ -21,6 +17,7 @@ class CreditCardGateway
|
|
21 |
private $_config;
|
22 |
private $_http;
|
23 |
|
|
|
24 |
public function __construct($gateway)
|
25 |
{
|
26 |
$this->_gateway = $gateway;
|
@@ -29,6 +26,16 @@ class CreditCardGateway
|
|
29 |
$this->_http = new Http($gateway->config);
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
public function create($attribs)
|
33 |
{
|
34 |
Util::verifyKeys(self::createSignature(), $attribs);
|
@@ -36,55 +43,24 @@ class CreditCardGateway
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
* returns a CreditCard object instead of a Result
|
41 |
*
|
42 |
-
* @
|
43 |
-
*
|
44 |
-
* @return CreditCard
|
45 |
* @throws Exception\ValidationError
|
|
|
|
|
46 |
*/
|
47 |
public function createNoValidate($attribs)
|
48 |
{
|
49 |
$result = $this->create($attribs);
|
50 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
51 |
}
|
52 |
-
/**
|
53 |
-
* create a customer from a TransparentRedirect operation
|
54 |
-
*
|
55 |
-
* @deprecated since version 2.3.0
|
56 |
-
* @access public
|
57 |
-
* @param array $attribs
|
58 |
-
* @return Result\Successful|Result\Error
|
59 |
-
*/
|
60 |
-
public function createFromTransparentRedirect($queryString)
|
61 |
-
{
|
62 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
|
63 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
64 |
-
$queryString
|
65 |
-
);
|
66 |
-
return $this->_doCreate(
|
67 |
-
'/payment_methods/all/confirm_transparent_redirect_request',
|
68 |
-
['id' => $params['id']]
|
69 |
-
);
|
70 |
-
}
|
71 |
|
72 |
/**
|
|
|
73 |
*
|
74 |
-
* @deprecated since version 2.3.0
|
75 |
-
* @access public
|
76 |
-
* @param none
|
77 |
-
* @return string
|
78 |
-
*/
|
79 |
-
public function createCreditCardUrl()
|
80 |
-
{
|
81 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
|
82 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath().
|
83 |
-
'/payment_methods/all/create_via_transparent_redirect_request';
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* returns a ResourceCollection of expired credit cards
|
88 |
* @return ResourceCollection
|
89 |
*/
|
90 |
public function expired()
|
@@ -100,6 +76,13 @@ class CreditCardGateway
|
|
100 |
return new ResourceCollection($response, $pager);
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
public function fetchExpired($ids)
|
104 |
{
|
105 |
$path = $this->_config->merchantPath() . "/payment_methods/all/expired";
|
@@ -110,14 +93,21 @@ class CreditCardGateway
|
|
110 |
'creditCard'
|
111 |
);
|
112 |
}
|
|
|
113 |
/**
|
114 |
-
*
|
|
|
|
|
|
|
115 |
*
|
116 |
* @return ResourceCollection
|
117 |
*/
|
118 |
public function expiringBetween($startDate, $endDate)
|
119 |
{
|
120 |
-
$
|
|
|
|
|
|
|
121 |
$response = $this->_http->post($queryPath);
|
122 |
$pager = [
|
123 |
'object' => $this,
|
@@ -128,9 +118,21 @@ class CreditCardGateway
|
|
128 |
return new ResourceCollection($response, $pager);
|
129 |
}
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
public function fetchExpiring($startDate, $endDate, $ids)
|
132 |
{
|
133 |
-
$
|
|
|
|
|
|
|
134 |
$response = $this->_http->post($queryPath, ['search' => ['ids' => $ids]]);
|
135 |
|
136 |
return Util::extractAttributeAsArray(
|
@@ -140,12 +142,13 @@ class CreditCardGateway
|
|
140 |
}
|
141 |
|
142 |
/**
|
143 |
-
*
|
144 |
*
|
145 |
-
* @access public
|
146 |
* @param string $token credit card unique id
|
147 |
-
*
|
148 |
* @throws Exception\NotFound
|
|
|
|
|
149 |
*/
|
150 |
public function find($token)
|
151 |
{
|
@@ -159,16 +162,16 @@ class CreditCardGateway
|
|
159 |
'credit card with token ' . $token . ' not found'
|
160 |
);
|
161 |
}
|
162 |
-
|
163 |
}
|
164 |
|
165 |
/**
|
166 |
* Convert a payment method nonce to a credit card
|
167 |
*
|
168 |
-
* @access public
|
169 |
* @param string $nonce payment method nonce
|
170 |
-
*
|
171 |
* @throws Exception\NotFound
|
|
|
|
|
172 |
*/
|
173 |
public function fromNonce($nonce)
|
174 |
{
|
@@ -182,14 +185,14 @@ class CreditCardGateway
|
|
182 |
'credit card with nonce ' . $nonce . ' locked, consumed or not found'
|
183 |
);
|
184 |
}
|
185 |
-
|
186 |
}
|
187 |
|
188 |
/**
|
189 |
-
*
|
|
|
|
|
|
|
190 |
*
|
191 |
-
* @access public
|
192 |
-
* @param array $attribs
|
193 |
* @return Result\Successful|Result\Error
|
194 |
*/
|
195 |
public function credit($token, $transactionAttribs)
|
@@ -204,14 +207,16 @@ class CreditCardGateway
|
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
-
*
|
208 |
*
|
209 |
-
*
|
|
|
|
|
|
|
210 |
*
|
211 |
-
* @access public
|
212 |
-
* @param array $attribs
|
213 |
-
* @return Transaction
|
214 |
* @throws Exception\ValidationError
|
|
|
|
|
215 |
*/
|
216 |
public function creditNoValidate($token, $transactionAttribs)
|
217 |
{
|
@@ -220,12 +225,12 @@ class CreditCardGateway
|
|
220 |
}
|
221 |
|
222 |
/**
|
223 |
-
*
|
|
|
|
|
|
|
224 |
*
|
225 |
-
* @param string $token
|
226 |
-
* @param array $transactionAttribs
|
227 |
* @return Result\Successful|Result\Error
|
228 |
-
* @see Transaction::sale()
|
229 |
*/
|
230 |
public function sale($token, $transactionAttribs)
|
231 |
{
|
@@ -239,16 +244,16 @@ class CreditCardGateway
|
|
239 |
}
|
240 |
|
241 |
/**
|
242 |
-
*
|
243 |
*
|
244 |
-
*
|
|
|
|
|
|
|
245 |
*
|
246 |
-
* @access public
|
247 |
-
* @param array $transactionAttribs
|
248 |
-
* @param string $token
|
249 |
-
* @return Transaction
|
250 |
* @throws Exception\ValidationsFailed
|
251 |
-
*
|
|
|
252 |
*/
|
253 |
public function saleNoValidate($token, $transactionAttribs)
|
254 |
{
|
@@ -257,14 +262,14 @@ class CreditCardGateway
|
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
-
*
|
261 |
*
|
262 |
-
*
|
263 |
* is the 2nd attribute. $token is not sent in object context.
|
264 |
*
|
265 |
-
* @
|
266 |
-
* @param array
|
267 |
-
*
|
268 |
* @return Result\Successful|Result\Error
|
269 |
*/
|
270 |
public function update($token, $attributes)
|
@@ -275,16 +280,17 @@ class CreditCardGateway
|
|
275 |
}
|
276 |
|
277 |
/**
|
278 |
-
*
|
279 |
*
|
280 |
-
*
|
281 |
* is the 2nd attribute. $token is not sent in object context.
|
282 |
* returns a CreditCard object on success
|
283 |
*
|
284 |
-
* @
|
285 |
-
* @param array
|
286 |
-
*
|
287 |
* @return CreditCard
|
|
|
288 |
* @throws Exception\ValidationsFailed
|
289 |
*/
|
290 |
public function updateNoValidate($token, $attributes)
|
@@ -292,40 +298,14 @@ class CreditCardGateway
|
|
292 |
$result = $this->update($token, $attributes);
|
293 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
294 |
}
|
295 |
-
/**
|
296 |
-
*
|
297 |
-
* @access public
|
298 |
-
* @param none
|
299 |
-
* @return string
|
300 |
-
*/
|
301 |
-
public function updateCreditCardUrl()
|
302 |
-
{
|
303 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
|
304 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath() .
|
305 |
-
'/payment_methods/all/update_via_transparent_redirect_request';
|
306 |
-
}
|
307 |
|
308 |
/**
|
309 |
-
*
|
|
|
|
|
310 |
*
|
311 |
-
* @
|
312 |
-
* @access public
|
313 |
-
* @param array $attribs
|
314 |
-
* @return object
|
315 |
*/
|
316 |
-
public function updateFromTransparentRedirect($queryString)
|
317 |
-
{
|
318 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
|
319 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
320 |
-
$queryString
|
321 |
-
);
|
322 |
-
return $this->_doUpdate(
|
323 |
-
'post',
|
324 |
-
'/payment_methods/all/confirm_transparent_redirect_request',
|
325 |
-
['id' => $params['id']]
|
326 |
-
);
|
327 |
-
}
|
328 |
-
|
329 |
public function delete($token)
|
330 |
{
|
331 |
$this->_validateId($token);
|
@@ -336,15 +316,23 @@ class CreditCardGateway
|
|
336 |
|
337 |
private static function baseOptions()
|
338 |
{
|
339 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
|
342 |
private static function baseSignature($options)
|
343 |
{
|
344 |
return [
|
345 |
-
'billingAddressId', 'cardholderName', 'cvv', 'number',
|
346 |
'expirationDate', 'expirationMonth', 'expirationYear', 'token', 'venmoSdkPaymentMethodCode',
|
347 |
-
'deviceData', '
|
348 |
['options' => $options],
|
349 |
[
|
350 |
'billingAddress' => self::billingAddressSignature()
|
@@ -352,6 +340,7 @@ class CreditCardGateway
|
|
352 |
];
|
353 |
}
|
354 |
|
|
|
355 |
public static function billingAddressSignature()
|
356 |
{
|
357 |
return [
|
@@ -370,20 +359,41 @@ class CreditCardGateway
|
|
370 |
];
|
371 |
}
|
372 |
|
|
|
373 |
public static function createSignature()
|
374 |
{
|
375 |
$options = self::baseOptions();
|
376 |
$options[] = "failOnDuplicatePaymentMethod";
|
377 |
$signature = self::baseSignature($options);
|
378 |
$signature[] = 'customerId';
|
|
|
379 |
return $signature;
|
380 |
}
|
381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
public static function updateSignature()
|
383 |
{
|
384 |
$options = self::baseOptions();
|
385 |
$options[] = "failOnDuplicatePaymentMethod";
|
386 |
$signature = self::baseSignature($options);
|
|
|
387 |
|
388 |
$updateExistingBillingSignature = [
|
389 |
[
|
@@ -393,8 +403,9 @@ class CreditCardGateway
|
|
393 |
]
|
394 |
];
|
395 |
|
396 |
-
foreach($signature
|
397 |
-
if(is_array($value) and array_key_exists('billingAddress', $value)) {
|
|
|
398 |
$signature[$key]['billingAddress'] = array_merge_recursive($value['billingAddress'], $updateExistingBillingSignature);
|
399 |
}
|
400 |
}
|
@@ -402,14 +413,7 @@ class CreditCardGateway
|
|
402 |
return $signature;
|
403 |
}
|
404 |
|
405 |
-
|
406 |
-
* sends the create request to the gateway
|
407 |
-
*
|
408 |
-
* @ignore
|
409 |
-
* @param string $subPath
|
410 |
-
* @param array $params
|
411 |
-
* @return mixed
|
412 |
-
*/
|
413 |
public function _doCreate($subPath, $params)
|
414 |
{
|
415 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -418,35 +422,20 @@ class CreditCardGateway
|
|
418 |
return $this->_verifyGatewayResponse($response);
|
419 |
}
|
420 |
|
421 |
-
/**
|
422 |
-
* verifies that a valid credit card identifier is being used
|
423 |
-
* @ignore
|
424 |
-
* @param string $identifier
|
425 |
-
* @param Optional $string $identifierType type of identifier supplied, default "token"
|
426 |
-
* @throws InvalidArgumentException
|
427 |
-
*/
|
428 |
private function _validateId($identifier = null, $identifierType = "token")
|
429 |
{
|
430 |
if (empty($identifier)) {
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
}
|
435 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
436 |
throw new InvalidArgumentException(
|
437 |
-
|
438 |
-
|
439 |
}
|
440 |
}
|
441 |
|
442 |
-
/**
|
443 |
-
* sends the update request to the gateway
|
444 |
-
*
|
445 |
-
* @ignore
|
446 |
-
* @param string $url
|
447 |
-
* @param array $params
|
448 |
-
* @return mixed
|
449 |
-
*/
|
450 |
private function _doUpdate($httpVerb, $subPath, $params)
|
451 |
{
|
452 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -455,32 +444,26 @@ class CreditCardGateway
|
|
455 |
}
|
456 |
|
457 |
/**
|
458 |
-
*
|
459 |
*
|
460 |
-
*
|
461 |
* it inside a Result\Successful object, or
|
462 |
* encapsulates a Errors object inside a Result\Error
|
463 |
* alternatively, throws an Unexpected exception if the response is invalid
|
464 |
-
*
|
465 |
-
* @ignore
|
466 |
-
* @param array $response gateway response values
|
467 |
-
* @return Result\Successful|Result\Error
|
468 |
-
* @throws Exception\Unexpected
|
469 |
*/
|
470 |
private function _verifyGatewayResponse($response)
|
471 |
{
|
472 |
if (isset($response['creditCard'])) {
|
473 |
// return a populated instance of Address
|
474 |
return new Result\Successful(
|
475 |
-
|
476 |
);
|
477 |
} elseif (isset($response['apiErrorResponse'])) {
|
478 |
return new Result\Error($response['apiErrorResponse']);
|
479 |
} else {
|
480 |
throw new Exception\Unexpected(
|
481 |
-
|
482 |
);
|
483 |
}
|
484 |
}
|
485 |
}
|
486 |
-
class_alias('Braintree\CreditCardGateway', 'Braintree_CreditCardGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
8 |
* Braintree CreditCardGateway module
|
9 |
* Creates and manages Braintree CreditCards
|
10 |
*
|
11 |
+
* For more detailed information on CreditCards, see {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card/php our developer docs}<br />
|
12 |
+
* For more detailed information on CreditCard verifications, see {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card-verification/php our reference documentation}
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class CreditCardGateway
|
15 |
{
|
17 |
private $_config;
|
18 |
private $_http;
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
public function __construct($gateway)
|
22 |
{
|
23 |
$this->_gateway = $gateway;
|
26 |
$this->_http = new Http($gateway->config);
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Attempts the create operation
|
31 |
+
* returns a Result on success or an Error on failure
|
32 |
+
*
|
33 |
+
* @param array $attribs containing request parameterss
|
34 |
+
*
|
35 |
+
* @throws Exception\ValidationError
|
36 |
+
*
|
37 |
+
* @return Result\Successful|Result\Error
|
38 |
+
*/
|
39 |
public function create($attribs)
|
40 |
{
|
41 |
Util::verifyKeys(self::createSignature(), $attribs);
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
+
* Attempts the create operation assuming all data will validate
|
47 |
* returns a CreditCard object instead of a Result
|
48 |
*
|
49 |
+
* @param array $attribs containing request parameters
|
50 |
+
*
|
|
|
51 |
* @throws Exception\ValidationError
|
52 |
+
*
|
53 |
+
* @return CreditCard
|
54 |
*/
|
55 |
public function createNoValidate($attribs)
|
56 |
{
|
57 |
$result = $this->create($attribs);
|
58 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
59 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
/**
|
62 |
+
* Returns a ResourceCollection of expired credit cards
|
63 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
* @return ResourceCollection
|
65 |
*/
|
66 |
public function expired()
|
76 |
return new ResourceCollection($response, $pager);
|
77 |
}
|
78 |
|
79 |
+
/**
|
80 |
+
* Returns a ResourceCollection of expired credit cards
|
81 |
+
*
|
82 |
+
* @param string $ids containing credit card IDs
|
83 |
+
*
|
84 |
+
* @return ResourceCollection
|
85 |
+
*/
|
86 |
public function fetchExpired($ids)
|
87 |
{
|
88 |
$path = $this->_config->merchantPath() . "/payment_methods/all/expired";
|
93 |
'creditCard'
|
94 |
);
|
95 |
}
|
96 |
+
|
97 |
/**
|
98 |
+
* Returns a ResourceCollection of credit cards expiring between start/end
|
99 |
+
*
|
100 |
+
* @param string $startDate the start date of search
|
101 |
+
* @param string $endDate the end date of search
|
102 |
*
|
103 |
* @return ResourceCollection
|
104 |
*/
|
105 |
public function expiringBetween($startDate, $endDate)
|
106 |
{
|
107 |
+
$start = date('mY', $startDate);
|
108 |
+
$end = date('mY', $endDate);
|
109 |
+
$query = '/payment_methods/all/expiring_ids?start=' . $start . '&end=' . $end;
|
110 |
+
$queryPath = $this->_config->merchantPath() . $query;
|
111 |
$response = $this->_http->post($queryPath);
|
112 |
$pager = [
|
113 |
'object' => $this,
|
118 |
return new ResourceCollection($response, $pager);
|
119 |
}
|
120 |
|
121 |
+
/**
|
122 |
+
* Returns a ResourceCollection of credit cards expiring between start/end given a set of IDs
|
123 |
+
*
|
124 |
+
* @param string $startDate the start date of search
|
125 |
+
* @param string $endDate the end date of search
|
126 |
+
* @param string $ids containing ids to search
|
127 |
+
*
|
128 |
+
* @return ResourceCollection
|
129 |
+
*/
|
130 |
public function fetchExpiring($startDate, $endDate, $ids)
|
131 |
{
|
132 |
+
$start = date('mY', $startDate);
|
133 |
+
$end = date('mY', $endDate);
|
134 |
+
$query = '/payment_methods/all/expiring?start=' . $start . '&end=' . $end;
|
135 |
+
$queryPath = $this->_config->merchantPath() . $query;
|
136 |
$response = $this->_http->post($queryPath, ['search' => ['ids' => $ids]]);
|
137 |
|
138 |
return Util::extractAttributeAsArray(
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
+
* Find a creditcard by token
|
146 |
*
|
|
|
147 |
* @param string $token credit card unique id
|
148 |
+
*
|
149 |
* @throws Exception\NotFound
|
150 |
+
*
|
151 |
+
* @return CreditCard
|
152 |
*/
|
153 |
public function find($token)
|
154 |
{
|
162 |
'credit card with token ' . $token . ' not found'
|
163 |
);
|
164 |
}
|
|
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
* Convert a payment method nonce to a credit card
|
169 |
*
|
|
|
170 |
* @param string $nonce payment method nonce
|
171 |
+
*
|
172 |
* @throws Exception\NotFound
|
173 |
+
*
|
174 |
+
* @return CreditCard
|
175 |
*/
|
176 |
public function fromNonce($nonce)
|
177 |
{
|
185 |
'credit card with nonce ' . $nonce . ' locked, consumed or not found'
|
186 |
);
|
187 |
}
|
|
|
188 |
}
|
189 |
|
190 |
/**
|
191 |
+
* Create a credit on the card for the passed transaction
|
192 |
+
*
|
193 |
+
* @param string $token belonging to the credit card
|
194 |
+
* @param array $transactionAttribs containing request parameters
|
195 |
*
|
|
|
|
|
196 |
* @return Result\Successful|Result\Error
|
197 |
*/
|
198 |
public function credit($token, $transactionAttribs)
|
207 |
}
|
208 |
|
209 |
/**
|
210 |
+
* Create a credit on this card, assuming validations will pass
|
211 |
*
|
212 |
+
* Returns a Transaction object on success
|
213 |
+
*
|
214 |
+
* @param string $token belonging to the credit card
|
215 |
+
* @param array $transactionAttribs containing request parameters
|
216 |
*
|
|
|
|
|
|
|
217 |
* @throws Exception\ValidationError
|
218 |
+
*
|
219 |
+
* @return Transaction
|
220 |
*/
|
221 |
public function creditNoValidate($token, $transactionAttribs)
|
222 |
{
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
+
* Create a new sale for the current card
|
229 |
+
*
|
230 |
+
* @param string $token belonging to the credit card
|
231 |
+
* @param array $transactionAttribs containing request parameters
|
232 |
*
|
|
|
|
|
233 |
* @return Result\Successful|Result\Error
|
|
|
234 |
*/
|
235 |
public function sale($token, $transactionAttribs)
|
236 |
{
|
244 |
}
|
245 |
|
246 |
/**
|
247 |
+
* Create a new sale using this card, assuming validations will pass
|
248 |
*
|
249 |
+
* Returns a Transaction object on success
|
250 |
+
*
|
251 |
+
* @param string $token belonging to the credit card
|
252 |
+
* @param array $transactionAttribs containing request parameters
|
253 |
*
|
|
|
|
|
|
|
|
|
254 |
* @throws Exception\ValidationsFailed
|
255 |
+
*
|
256 |
+
* @return Transaction
|
257 |
*/
|
258 |
public function saleNoValidate($token, $transactionAttribs)
|
259 |
{
|
262 |
}
|
263 |
|
264 |
/**
|
265 |
+
* Updates the creditcard record
|
266 |
*
|
267 |
+
* If calling this method in context, $token
|
268 |
* is the 2nd attribute. $token is not sent in object context.
|
269 |
*
|
270 |
+
* @param string $token (optional)
|
271 |
+
* @param array $attributes containing request parameters
|
272 |
+
*
|
273 |
* @return Result\Successful|Result\Error
|
274 |
*/
|
275 |
public function update($token, $attributes)
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
+
* Update a creditcard record, assuming validations will pass
|
284 |
*
|
285 |
+
* If calling this method in context, $token
|
286 |
* is the 2nd attribute. $token is not sent in object context.
|
287 |
* returns a CreditCard object on success
|
288 |
*
|
289 |
+
* @param string $token (optional)
|
290 |
+
* @param array $attributes containing request parameters
|
291 |
+
*
|
292 |
* @return CreditCard
|
293 |
+
*
|
294 |
* @throws Exception\ValidationsFailed
|
295 |
*/
|
296 |
public function updateNoValidate($token, $attributes)
|
298 |
$result = $this->update($token, $attributes);
|
299 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
/**
|
303 |
+
* Delete a credit card record
|
304 |
+
*
|
305 |
+
* @param string $token credit card identifier
|
306 |
*
|
307 |
+
* @return Result
|
|
|
|
|
|
|
308 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
public function delete($token)
|
310 |
{
|
311 |
$this->_validateId($token);
|
316 |
|
317 |
private static function baseOptions()
|
318 |
{
|
319 |
+
return [
|
320 |
+
'makeDefault',
|
321 |
+
'skipAdvancedFraudChecking',
|
322 |
+
'venmoSdkSession',
|
323 |
+
'verificationAccountType',
|
324 |
+
'verificationAmount',
|
325 |
+
'verificationMerchantAccountId',
|
326 |
+
'verifyCard',
|
327 |
+
];
|
328 |
}
|
329 |
|
330 |
private static function baseSignature($options)
|
331 |
{
|
332 |
return [
|
333 |
+
'billingAddressId', 'cardholderName', 'cvv', 'number',
|
334 |
'expirationDate', 'expirationMonth', 'expirationYear', 'token', 'venmoSdkPaymentMethodCode',
|
335 |
+
'deviceData', 'paymentMethodNonce',
|
336 |
['options' => $options],
|
337 |
[
|
338 |
'billingAddress' => self::billingAddressSignature()
|
340 |
];
|
341 |
}
|
342 |
|
343 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
344 |
public static function billingAddressSignature()
|
345 |
{
|
346 |
return [
|
359 |
];
|
360 |
}
|
361 |
|
362 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
363 |
public static function createSignature()
|
364 |
{
|
365 |
$options = self::baseOptions();
|
366 |
$options[] = "failOnDuplicatePaymentMethod";
|
367 |
$signature = self::baseSignature($options);
|
368 |
$signature[] = 'customerId';
|
369 |
+
$signature[] = self::threeDSecurePassThruSignature();
|
370 |
return $signature;
|
371 |
}
|
372 |
|
373 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
374 |
+
public static function threeDSecurePassThruSignature()
|
375 |
+
{
|
376 |
+
return [
|
377 |
+
'threeDSecurePassThru' => [
|
378 |
+
'eciFlag',
|
379 |
+
'cavv',
|
380 |
+
'xid',
|
381 |
+
'threeDSecureVersion',
|
382 |
+
'authenticationResponse',
|
383 |
+
'directoryResponse',
|
384 |
+
'cavvAlgorithm',
|
385 |
+
'dsTransactionId',
|
386 |
+
]
|
387 |
+
];
|
388 |
+
}
|
389 |
+
|
390 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
391 |
public static function updateSignature()
|
392 |
{
|
393 |
$options = self::baseOptions();
|
394 |
$options[] = "failOnDuplicatePaymentMethod";
|
395 |
$signature = self::baseSignature($options);
|
396 |
+
$signature[] = self::threeDSecurePassThruSignature();
|
397 |
|
398 |
$updateExistingBillingSignature = [
|
399 |
[
|
403 |
]
|
404 |
];
|
405 |
|
406 |
+
foreach ($signature as $key => $value) {
|
407 |
+
if (is_array($value) and array_key_exists('billingAddress', $value)) {
|
408 |
+
// phpcs:ignore
|
409 |
$signature[$key]['billingAddress'] = array_merge_recursive($value['billingAddress'], $updateExistingBillingSignature);
|
410 |
}
|
411 |
}
|
413 |
return $signature;
|
414 |
}
|
415 |
|
416 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
public function _doCreate($subPath, $params)
|
418 |
{
|
419 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
422 |
return $this->_verifyGatewayResponse($response);
|
423 |
}
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
private function _validateId($identifier = null, $identifierType = "token")
|
426 |
{
|
427 |
if (empty($identifier)) {
|
428 |
+
throw new InvalidArgumentException(
|
429 |
+
'expected credit card id to be set'
|
430 |
+
);
|
431 |
}
|
432 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
433 |
throw new InvalidArgumentException(
|
434 |
+
$identifier . ' is an invalid credit card ' . $identifierType . '.'
|
435 |
+
);
|
436 |
}
|
437 |
}
|
438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
private function _doUpdate($httpVerb, $subPath, $params)
|
440 |
{
|
441 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
444 |
}
|
445 |
|
446 |
/**
|
447 |
+
* Generic method for validating incoming gateway responses
|
448 |
*
|
449 |
+
* Creates a new CreditCard object and encapsulates
|
450 |
* it inside a Result\Successful object, or
|
451 |
* encapsulates a Errors object inside a Result\Error
|
452 |
* alternatively, throws an Unexpected exception if the response is invalid
|
|
|
|
|
|
|
|
|
|
|
453 |
*/
|
454 |
private function _verifyGatewayResponse($response)
|
455 |
{
|
456 |
if (isset($response['creditCard'])) {
|
457 |
// return a populated instance of Address
|
458 |
return new Result\Successful(
|
459 |
+
CreditCard::factory($response['creditCard'])
|
460 |
);
|
461 |
} elseif (isset($response['apiErrorResponse'])) {
|
462 |
return new Result\Error($response['apiErrorResponse']);
|
463 |
} else {
|
464 |
throw new Exception\Unexpected(
|
465 |
+
"Expected address or apiErrorResponse"
|
466 |
);
|
467 |
}
|
468 |
}
|
469 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CreditCardVerification.php
CHANGED
@@ -1,36 +1,78 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class CreditCardVerification extends Result\CreditCardVerification
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self($attributes);
|
9 |
return $instance;
|
10 |
}
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
public static function create($attributes)
|
15 |
{
|
16 |
Util::verifyKeys(self::createSignature(), $attributes);
|
17 |
return Configuration::gateway()->creditCardVerification()->create($attributes);
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public static function fetch($query, $ids)
|
21 |
{
|
22 |
return Configuration::gateway()->creditCardVerification()->fetch($query, $ids);
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
public static function search($query)
|
26 |
{
|
27 |
return Configuration::gateway()->creditCardVerification()->search($query);
|
28 |
}
|
29 |
|
|
|
|
|
|
|
30 |
public static function createSignature()
|
31 |
{
|
32 |
return [
|
33 |
-
['options' => ['amount', 'merchantAccountId']],
|
34 |
['creditCard' =>
|
35 |
[
|
36 |
'cardholderName', 'cvv', 'number',
|
@@ -40,4 +82,3 @@ class CreditCardVerification extends Result\CreditCardVerification
|
|
40 |
]];
|
41 |
}
|
42 |
}
|
43 |
-
class_alias('Braintree\CreditCardVerification', 'Braintree_CreditCardVerification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card-verification developer docs} for information on attributes
|
9 |
+
*/
|
10 |
class CreditCardVerification extends Result\CreditCardVerification
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Creates an instance of a CreditCardVerification from given attributes
|
14 |
+
*
|
15 |
+
* @param array $attributes response object attributes
|
16 |
+
*
|
17 |
+
* @return CreditCardVerification
|
18 |
+
*/
|
19 |
public static function factory($attributes)
|
20 |
{
|
21 |
$instance = new self($attributes);
|
22 |
return $instance;
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Static method redirecting to gateway class
|
27 |
+
*
|
28 |
+
* @param array $attributes containing request parameters
|
29 |
+
*
|
30 |
+
* @see CreditCardVerificationGateway::create()
|
31 |
+
*
|
32 |
+
* @return Result\Successful|Result\Error
|
33 |
+
*/
|
34 |
public static function create($attributes)
|
35 |
{
|
36 |
Util::verifyKeys(self::createSignature(), $attributes);
|
37 |
return Configuration::gateway()->creditCardVerification()->create($attributes);
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Static method redirecting to gateway class
|
42 |
+
*
|
43 |
+
* @param array $query search parameters
|
44 |
+
* @param array $ids of verifications to search
|
45 |
+
*
|
46 |
+
* @see CreditCardVerificationGateway::fetch()
|
47 |
+
*
|
48 |
+
* @return Array of CreditCardVerification objects
|
49 |
+
*/
|
50 |
public static function fetch($query, $ids)
|
51 |
{
|
52 |
return Configuration::gateway()->creditCardVerification()->fetch($query, $ids);
|
53 |
}
|
54 |
|
55 |
+
/**
|
56 |
+
* Static method redirecting to gateway class
|
57 |
+
*
|
58 |
+
* @param mixed $query search query
|
59 |
+
*
|
60 |
+
* @see CreditCardVerificationGateway::search()
|
61 |
+
*
|
62 |
+
* @return ResourceCollection
|
63 |
+
*/
|
64 |
public static function search($query)
|
65 |
{
|
66 |
return Configuration::gateway()->creditCardVerification()->search($query);
|
67 |
}
|
68 |
|
69 |
+
/*
|
70 |
+
* Returns keys that are acceptable for create requests
|
71 |
+
*/
|
72 |
public static function createSignature()
|
73 |
{
|
74 |
return [
|
75 |
+
['options' => ['amount', 'merchantAccountId', 'accountType']],
|
76 |
['creditCard' =>
|
77 |
[
|
78 |
'cardholderName', 'cvv', 'number',
|
82 |
]];
|
83 |
}
|
84 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CreditCardVerificationGateway.php
CHANGED
@@ -1,12 +1,18 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class CreditCardVerificationGateway
|
5 |
{
|
6 |
private $_gateway;
|
7 |
private $_config;
|
8 |
private $_http;
|
9 |
|
|
|
10 |
public function __construct($gateway)
|
11 |
{
|
12 |
$this->_gateway = $gateway;
|
@@ -15,20 +21,28 @@ class CreditCardVerificationGateway
|
|
15 |
$this->_http = new Http($gateway->config);
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function create($attributes)
|
19 |
{
|
20 |
-
$
|
|
|
21 |
return $this->_verifyGatewayResponse($response);
|
22 |
}
|
23 |
|
24 |
private function _verifyGatewayResponse($response)
|
25 |
{
|
26 |
|
27 |
-
if(isset($response['verification'])){
|
28 |
return new Result\Successful(
|
29 |
CreditCardVerification::factory($response['verification'])
|
30 |
);
|
31 |
-
}
|
32 |
return new Result\Error($response['apiErrorResponse']);
|
33 |
} else {
|
34 |
throw new Exception\Unexpected(
|
@@ -37,6 +51,14 @@ class CreditCardVerificationGateway
|
|
37 |
}
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
public function fetch($query, $ids)
|
41 |
{
|
42 |
$criteria = [];
|
@@ -53,6 +75,13 @@ class CreditCardVerificationGateway
|
|
53 |
);
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
public function search($query)
|
57 |
{
|
58 |
$criteria = [];
|
@@ -71,4 +100,3 @@ class CreditCardVerificationGateway
|
|
71 |
return new ResourceCollection($response, $pager);
|
72 |
}
|
73 |
}
|
74 |
-
class_alias('Braintree\CreditCardVerificationGateway', 'Braintree_CreditCardVerificationGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree CreditCardVerificationGateway module
|
7 |
+
* Creates and manages CreditCardVerifications
|
8 |
+
*/
|
9 |
class CreditCardVerificationGateway
|
10 |
{
|
11 |
private $_gateway;
|
12 |
private $_config;
|
13 |
private $_http;
|
14 |
|
15 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
16 |
public function __construct($gateway)
|
17 |
{
|
18 |
$this->_gateway = $gateway;
|
21 |
$this->_http = new Http($gateway->config);
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Creates a credit card verification using the given +attributes+.
|
26 |
+
*
|
27 |
+
* @param array $attributes containing request parameters
|
28 |
+
*
|
29 |
+
* @return Result\Successful|Result\Error
|
30 |
+
*/
|
31 |
public function create($attributes)
|
32 |
{
|
33 |
+
$queryPath = $this->_config->merchantPath() . "/verifications";
|
34 |
+
$response = $this->_http->post($queryPath, ['verification' => $attributes]);
|
35 |
return $this->_verifyGatewayResponse($response);
|
36 |
}
|
37 |
|
38 |
private function _verifyGatewayResponse($response)
|
39 |
{
|
40 |
|
41 |
+
if (isset($response['verification'])) {
|
42 |
return new Result\Successful(
|
43 |
CreditCardVerification::factory($response['verification'])
|
44 |
);
|
45 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
46 |
return new Result\Error($response['apiErrorResponse']);
|
47 |
} else {
|
48 |
throw new Exception\Unexpected(
|
51 |
}
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Retrieve a credit card verification
|
56 |
+
*
|
57 |
+
* @param array $query search parameters
|
58 |
+
* @param array $ids of verifications to search
|
59 |
+
*
|
60 |
+
* @return Array of CreditCardVerification objects
|
61 |
+
*/
|
62 |
public function fetch($query, $ids)
|
63 |
{
|
64 |
$criteria = [];
|
75 |
);
|
76 |
}
|
77 |
|
78 |
+
/**
|
79 |
+
* Returns a ResourceCollection of customers matching the search query.
|
80 |
+
*
|
81 |
+
* @param mixed $query search query
|
82 |
+
*
|
83 |
+
* @return ResourceCollection
|
84 |
+
*/
|
85 |
public function search($query)
|
86 |
{
|
87 |
$criteria = [];
|
100 |
return new ResourceCollection($response, $pager);
|
101 |
}
|
102 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CreditCardVerificationSearch.php
CHANGED
@@ -1,56 +1,131 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class CreditCardVerificationSearch
|
5 |
{
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return new TextNode('billing_address_details_postal_code');
|
16 |
}
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
return new TextNode('customer_email');
|
20 |
}
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
return new TextNode('customer_id');
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
return new TextNode('payment_method_token');
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return new MultipleValueNode('ids');
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
public static function creditCardCardType()
|
47 |
{
|
48 |
return new MultipleValueNode("credit_card_card_type", CreditCard::allCardTypes());
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
51 |
public static function status()
|
52 |
{
|
53 |
return new MultipleValueNode("status", Result\CreditCardVerification::allStatuses());
|
54 |
}
|
55 |
}
|
56 |
-
class_alias('Braintree\CreditCardVerificationSearch', 'Braintree_CreditCardVerificationSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class for setting credit card verification search queries
|
7 |
+
*/
|
8 |
class CreditCardVerificationSearch
|
9 |
{
|
10 |
+
/*
|
11 |
+
* Create a new text node for id
|
12 |
+
*
|
13 |
+
* @return TextNode
|
14 |
+
*/
|
15 |
+
public static function id()
|
16 |
+
{
|
17 |
+
return new TextNode('id');
|
18 |
}
|
19 |
|
20 |
+
// NEXT_MAJOR_VERSION can this just be cardholder name?
|
21 |
+
/*
|
22 |
+
* Create a new text node for credit card cardholder name
|
23 |
+
*
|
24 |
+
* @return TextNode
|
25 |
+
*/
|
26 |
+
public static function creditCardCardholderName()
|
27 |
+
{
|
28 |
+
return new TextNode('credit_card_cardholder_name');
|
29 |
}
|
30 |
|
31 |
+
/*
|
32 |
+
* Create a new text node for billing address details postal code
|
33 |
+
*
|
34 |
+
* @return TextNode
|
35 |
+
*/
|
36 |
+
public static function billingAddressDetailsPostalCode()
|
37 |
+
{
|
38 |
return new TextNode('billing_address_details_postal_code');
|
39 |
}
|
40 |
|
41 |
+
/*
|
42 |
+
* Create a new text node for customer email
|
43 |
+
*
|
44 |
+
* @return TextNode
|
45 |
+
*/
|
46 |
+
public static function customerEmail()
|
47 |
+
{
|
48 |
return new TextNode('customer_email');
|
49 |
}
|
50 |
|
51 |
+
/*
|
52 |
+
* Create a new text node for customer id
|
53 |
+
*
|
54 |
+
* @return TextNode
|
55 |
+
*/
|
56 |
+
public static function customerId()
|
57 |
+
{
|
58 |
return new TextNode('customer_id');
|
59 |
}
|
60 |
|
61 |
+
/*
|
62 |
+
* Create a new text node for payment method token
|
63 |
+
*
|
64 |
+
* @return TextNode
|
65 |
+
*/
|
66 |
+
public static function paymentMethodToken()
|
67 |
+
{
|
68 |
return new TextNode('payment_method_token');
|
69 |
}
|
70 |
|
71 |
+
/*
|
72 |
+
* Create a new equality node for credit card expiration date
|
73 |
+
*
|
74 |
+
* @return EqualityNode
|
75 |
+
*/
|
76 |
+
public static function creditCardExpirationDate()
|
77 |
+
{
|
78 |
+
return new EqualityNode('credit_card_expiration_date');
|
79 |
}
|
80 |
|
81 |
+
/*
|
82 |
+
* Create a new partial match node for credit card number
|
83 |
+
*
|
84 |
+
* @return PartialMatchNode
|
85 |
+
*/
|
86 |
+
public static function creditCardNumber()
|
87 |
+
{
|
88 |
+
return new PartialMatchNode('credit_card_number');
|
89 |
}
|
90 |
|
91 |
+
/*
|
92 |
+
* Create a new multiple value node for ids
|
93 |
+
*
|
94 |
+
* @return MultipleValueNode
|
95 |
+
*/
|
96 |
+
public static function ids()
|
97 |
+
{
|
98 |
return new MultipleValueNode('ids');
|
99 |
}
|
100 |
|
101 |
+
/*
|
102 |
+
* Create a new range node for created at
|
103 |
+
*
|
104 |
+
* @return RangeNode
|
105 |
+
*/
|
106 |
+
public static function createdAt()
|
107 |
+
{
|
108 |
+
return new RangeNode("created_at");
|
109 |
}
|
110 |
|
111 |
+
//NEXT_MAJOR_VERSION can this just be card type?
|
112 |
+
/*
|
113 |
+
* Create a new multiple value node for credit card card type
|
114 |
+
*
|
115 |
+
* @return MultipleValueNode
|
116 |
+
*/
|
117 |
public static function creditCardCardType()
|
118 |
{
|
119 |
return new MultipleValueNode("credit_card_card_type", CreditCard::allCardTypes());
|
120 |
}
|
121 |
|
122 |
+
/*
|
123 |
+
* Create a new multiple value node for status
|
124 |
+
*
|
125 |
+
* @return MultipleValueNode
|
126 |
+
*/
|
127 |
public static function status()
|
128 |
{
|
129 |
return new MultipleValueNode("status", Result\CreditCardVerification::allStatuses());
|
130 |
}
|
131 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Customer.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
@@ -7,39 +8,16 @@ namespace Braintree;
|
|
7 |
*
|
8 |
* <b>== More information ==</b>
|
9 |
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read array $addresses
|
16 |
-
* @property-read array $paymentMethods
|
17 |
-
* @property-read string $company
|
18 |
-
* @property-read string $createdAt
|
19 |
-
* @property-read array $creditCards
|
20 |
-
* @property-read array $paypalAccounts
|
21 |
-
* @property-read array $applePayCards
|
22 |
-
* @property-read array $androidPayCards
|
23 |
-
* @property-read array $amexExpressCheckoutCards
|
24 |
-
* @property-read array $venmoAccounts
|
25 |
-
* @property-read array $visaCheckoutCards
|
26 |
-
* @property-read array $masterpassCards
|
27 |
-
* @property-read array $coinbaseAccounts
|
28 |
-
* @property-read array $customFields custom fields passed with the request
|
29 |
-
* @property-read string $email
|
30 |
-
* @property-read string $fax
|
31 |
-
* @property-read string $firstName
|
32 |
-
* @property-read string $id
|
33 |
-
* @property-read string $lastName
|
34 |
-
* @property-read string $phone
|
35 |
-
* @property-read string $updatedAt
|
36 |
-
* @property-read string $website
|
37 |
*/
|
38 |
class Customer extends Base
|
39 |
{
|
40 |
-
|
|
|
|
|
|
|
41 |
*
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function all()
|
45 |
{
|
@@ -47,9 +25,13 @@ class Customer extends Base
|
|
47 |
}
|
48 |
|
49 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
*
|
51 |
-
* @param string $query
|
52 |
-
* @param int[] $ids
|
53 |
* @return Customer|Customer[]
|
54 |
*/
|
55 |
public static function fetch($query, $ids)
|
@@ -58,8 +40,12 @@ class Customer extends Base
|
|
58 |
}
|
59 |
|
60 |
/**
|
|
|
|
|
|
|
|
|
|
|
61 |
*
|
62 |
-
* @param array $attribs
|
63 |
* @return Result\Successful|Result\Error
|
64 |
*/
|
65 |
public static function create($attribs = [])
|
@@ -68,8 +54,14 @@ class Customer extends Base
|
|
68 |
}
|
69 |
|
70 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
*
|
72 |
-
* @param array $attribs
|
73 |
* @return Customer
|
74 |
*/
|
75 |
public static function createNoValidate($attribs = [])
|
@@ -78,29 +70,16 @@ class Customer extends Base
|
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
-
*
|
82 |
-
*
|
83 |
-
* @
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
return Configuration::gateway()->customer()->createFromTransparentRedirect($queryString);
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* @deprecated since version 2.3.0
|
92 |
-
* @return string
|
93 |
-
*/
|
94 |
-
public static function createCustomerUrl()
|
95 |
-
{
|
96 |
-
return Configuration::gateway()->customer()->createCustomerUrl();
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
*
|
101 |
* @throws Exception\NotFound
|
102 |
-
*
|
103 |
-
* @return Customer
|
104 |
*/
|
105 |
public static function find($id, $associationFilterId = null)
|
106 |
{
|
@@ -108,9 +87,13 @@ class Customer extends Base
|
|
108 |
}
|
109 |
|
110 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
*
|
112 |
-
* @param int $customerId
|
113 |
-
* @param array $transactionAttribs
|
114 |
* @return Result\Successful|Result\Error
|
115 |
*/
|
116 |
public static function credit($customerId, $transactionAttribs)
|
@@ -119,10 +102,15 @@ class Customer extends Base
|
|
119 |
}
|
120 |
|
121 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
*
|
123 |
* @throws Exception\ValidationError
|
124 |
-
*
|
125 |
-
* @param type $transactionAttribs
|
126 |
* @return Transaction
|
127 |
*/
|
128 |
public static function creditNoValidate($customerId, $transactionAttribs)
|
@@ -131,9 +119,12 @@ class Customer extends Base
|
|
131 |
}
|
132 |
|
133 |
/**
|
|
|
|
|
|
|
|
|
|
|
134 |
*
|
135 |
-
* @throws Exception on invalid id or non-200 http response code
|
136 |
-
* @param int $customerId
|
137 |
* @return Result\Successful
|
138 |
*/
|
139 |
public static function delete($customerId)
|
@@ -142,10 +133,14 @@ class Customer extends Base
|
|
142 |
}
|
143 |
|
144 |
/**
|
|
|
145 |
*
|
146 |
-
* @param
|
147 |
-
* @param array
|
148 |
-
*
|
|
|
|
|
|
|
149 |
*/
|
150 |
public static function sale($customerId, $transactionAttribs)
|
151 |
{
|
@@ -153,9 +148,15 @@ class Customer extends Base
|
|
153 |
}
|
154 |
|
155 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
*
|
157 |
-
* @param int $customerId
|
158 |
-
* @param array $transactionAttribs
|
159 |
* @return Transaction
|
160 |
*/
|
161 |
public static function saleNoValidate($customerId, $transactionAttribs)
|
@@ -164,9 +165,14 @@ class Customer extends Base
|
|
164 |
}
|
165 |
|
166 |
/**
|
|
|
|
|
|
|
|
|
|
|
167 |
*
|
168 |
* @throws InvalidArgumentException
|
169 |
-
*
|
170 |
* @return ResourceCollection
|
171 |
*/
|
172 |
public static function search($query)
|
@@ -175,10 +181,13 @@ class Customer extends Base
|
|
175 |
}
|
176 |
|
177 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
*
|
179 |
-
* @throws Exception\Unexpected
|
180 |
-
* @param int $customerId
|
181 |
-
* @param array $attributes
|
182 |
* @return Result\Successful|Result\Error
|
183 |
*/
|
184 |
public static function update($customerId, $attributes)
|
@@ -187,55 +196,33 @@ class Customer extends Base
|
|
187 |
}
|
188 |
|
189 |
/**
|
|
|
190 |
*
|
191 |
-
*
|
192 |
-
*
|
193 |
-
*
|
194 |
-
* @return CustomerGateway
|
195 |
-
*/
|
196 |
-
public static function updateNoValidate($customerId, $attributes)
|
197 |
-
{
|
198 |
-
return Configuration::gateway()->customer()->updateNoValidate($customerId, $attributes);
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
*
|
203 |
-
* @
|
204 |
-
* @
|
205 |
-
*/
|
206 |
-
public static function updateCustomerUrl()
|
207 |
-
{
|
208 |
-
return Configuration::gateway()->customer()->updateCustomerUrl();
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
*
|
213 |
-
* @
|
214 |
-
*
|
215 |
-
* @
|
|
|
|
|
216 |
*/
|
217 |
-
public static function
|
218 |
{
|
219 |
-
return Configuration::gateway()->customer()->
|
220 |
}
|
221 |
|
222 |
-
/* instance methods */
|
223 |
-
|
224 |
-
/**
|
225 |
-
* sets instance properties from an array of values
|
226 |
-
*
|
227 |
-
* @ignore
|
228 |
-
* @access protected
|
229 |
-
* @param array $customerAttribs array of customer data
|
230 |
-
*/
|
231 |
protected function _initialize($customerAttribs)
|
232 |
{
|
233 |
$this->_attributes = $customerAttribs;
|
234 |
|
235 |
$addressArray = [];
|
236 |
if (isset($customerAttribs['addresses'])) {
|
237 |
-
|
238 |
-
foreach ($customerAttribs['addresses'] AS $address) {
|
239 |
$addressArray[] = Address::factory($address);
|
240 |
}
|
241 |
}
|
@@ -243,23 +230,15 @@ class Customer extends Base
|
|
243 |
|
244 |
$creditCardArray = [];
|
245 |
if (isset($customerAttribs['creditCards'])) {
|
246 |
-
foreach ($customerAttribs['creditCards']
|
247 |
$creditCardArray[] = CreditCard::factory($creditCard);
|
248 |
}
|
249 |
}
|
250 |
$this->_set('creditCards', $creditCardArray);
|
251 |
|
252 |
-
$coinbaseAccountArray = [];
|
253 |
-
if (isset($customerAttribs['coinbaseAccounts'])) {
|
254 |
-
foreach ($customerAttribs['coinbaseAccounts'] AS $coinbaseAccount) {
|
255 |
-
$coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
|
256 |
-
}
|
257 |
-
}
|
258 |
-
$this->_set('coinbaseAccounts', $coinbaseAccountArray);
|
259 |
-
|
260 |
$paypalAccountArray = [];
|
261 |
if (isset($customerAttribs['paypalAccounts'])) {
|
262 |
-
foreach ($customerAttribs['paypalAccounts']
|
263 |
$paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
|
264 |
}
|
265 |
}
|
@@ -267,31 +246,23 @@ class Customer extends Base
|
|
267 |
|
268 |
$applePayCardArray = [];
|
269 |
if (isset($customerAttribs['applePayCards'])) {
|
270 |
-
foreach ($customerAttribs['applePayCards']
|
271 |
$applePayCardArray[] = ApplePayCard::factory($applePayCard);
|
272 |
}
|
273 |
}
|
274 |
$this->_set('applePayCards', $applePayCardArray);
|
275 |
|
276 |
-
$
|
277 |
if (isset($customerAttribs['androidPayCards'])) {
|
278 |
-
foreach ($customerAttribs['androidPayCards']
|
279 |
-
$
|
280 |
-
}
|
281 |
-
}
|
282 |
-
$this->_set('androidPayCards', $androidPayCardArray);
|
283 |
-
|
284 |
-
$amexExpressCheckoutCardArray = [];
|
285 |
-
if (isset($customerAttribs['amexExpressCheckoutCards'])) {
|
286 |
-
foreach ($customerAttribs['amexExpressCheckoutCards'] AS $amexExpressCheckoutCard) {
|
287 |
-
$amexExpressCheckoutCardArray[] = AmexExpressCheckoutCard::factory($amexExpressCheckoutCard);
|
288 |
}
|
289 |
}
|
290 |
-
$this->_set('
|
291 |
|
292 |
$venmoAccountArray = array();
|
293 |
if (isset($customerAttribs['venmoAccounts'])) {
|
294 |
-
foreach ($customerAttribs['venmoAccounts']
|
295 |
$venmoAccountArray[] = VenmoAccount::factory($venmoAccount);
|
296 |
}
|
297 |
}
|
@@ -299,23 +270,23 @@ class Customer extends Base
|
|
299 |
|
300 |
$visaCheckoutCardArray = [];
|
301 |
if (isset($customerAttribs['visaCheckoutCards'])) {
|
302 |
-
foreach ($customerAttribs['visaCheckoutCards']
|
303 |
$visaCheckoutCardArray[] = VisaCheckoutCard::factory($visaCheckoutCard);
|
304 |
}
|
305 |
}
|
306 |
$this->_set('visaCheckoutCards', $visaCheckoutCardArray);
|
307 |
|
308 |
-
$
|
309 |
-
if (isset($customerAttribs['
|
310 |
-
foreach ($customerAttribs['
|
311 |
-
$
|
312 |
}
|
313 |
}
|
314 |
-
$this->_set('
|
315 |
|
316 |
$usBankAccountArray = array();
|
317 |
if (isset($customerAttribs['usBankAccounts'])) {
|
318 |
-
foreach ($customerAttribs['usBankAccounts']
|
319 |
$usBankAccountArray[] = UsBankAccount::factory($usBankAccount);
|
320 |
}
|
321 |
}
|
@@ -325,24 +296,25 @@ class Customer extends Base
|
|
325 |
$this->creditCards,
|
326 |
$this->paypalAccounts,
|
327 |
$this->applePayCards,
|
328 |
-
$this->
|
329 |
-
$this->androidPayCards,
|
330 |
-
$this->amexExpressCheckoutCards,
|
331 |
$this->venmoAccounts,
|
332 |
$this->visaCheckoutCards,
|
333 |
-
$this->
|
334 |
$this->usBankAccounts
|
335 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
-
|
339 |
-
|
340 |
-
* @return string
|
341 |
-
*/
|
342 |
-
public function __toString()
|
343 |
{
|
344 |
return __CLASS__ . '[' .
|
345 |
-
Util::attributesToString($this->_attributes) .']';
|
346 |
}
|
347 |
|
348 |
/**
|
@@ -350,6 +322,7 @@ class Customer extends Base
|
|
350 |
* or is a Customer with a different id
|
351 |
*
|
352 |
* @param object $otherCust customer to compare against
|
|
|
353 |
* @return boolean
|
354 |
*/
|
355 |
public function isEqual($otherCust)
|
@@ -357,18 +330,6 @@ class Customer extends Base
|
|
357 |
return !($otherCust instanceof Customer) ? false : $this->id === $otherCust->id;
|
358 |
}
|
359 |
|
360 |
-
/**
|
361 |
-
* returns an array containt all of the customer's payment methods
|
362 |
-
*
|
363 |
-
* @deprecated since version 3.1.0 - use the paymentMethods property directly
|
364 |
-
*
|
365 |
-
* @return array
|
366 |
-
*/
|
367 |
-
public function paymentMethods()
|
368 |
-
{
|
369 |
-
return $this->paymentMethods;
|
370 |
-
}
|
371 |
-
|
372 |
/**
|
373 |
* returns the customer's default payment method
|
374 |
*
|
@@ -380,38 +341,33 @@ class Customer extends Base
|
|
380 |
return current($defaultPaymentMethods);
|
381 |
}
|
382 |
|
|
|
383 |
public static function _defaultPaymentMethodFilter($paymentMethod)
|
384 |
{
|
385 |
return $paymentMethod->isDefault();
|
386 |
}
|
387 |
|
388 |
-
/* private class properties */
|
389 |
-
|
390 |
-
/**
|
391 |
-
* @access protected
|
392 |
-
* @var array registry of customer data
|
393 |
-
*/
|
394 |
protected $_attributes = [
|
395 |
-
'addresses'
|
396 |
-
'company'
|
397 |
-
'creditCards'
|
398 |
-
'email'
|
399 |
-
'fax'
|
400 |
-
'firstName'
|
401 |
-
'id'
|
402 |
-
'lastName'
|
403 |
-
'phone'
|
404 |
-
'
|
405 |
-
'
|
406 |
-
'
|
|
|
407 |
];
|
408 |
|
409 |
/**
|
410 |
-
*
|
411 |
-
*
|
|
|
412 |
*
|
413 |
-
* @ignore
|
414 |
-
* @param array $attributes
|
415 |
* @return Customer
|
416 |
*/
|
417 |
public static function factory($attributes)
|
@@ -421,4 +377,3 @@ class Customer extends Base
|
|
421 |
return $instance;
|
422 |
}
|
423 |
}
|
424 |
-
class_alias('Braintree\Customer', 'Braintree_Customer');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
8 |
*
|
9 |
* <b>== More information ==</b>
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/customer developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class Customer extends Base
|
14 |
{
|
15 |
+
/*
|
16 |
+
* Static method redirecting to gateway class
|
17 |
+
*
|
18 |
+
* @see CustomerGateway::all()
|
19 |
*
|
20 |
+
* @return ResourceCollection
|
21 |
*/
|
22 |
public static function all()
|
23 |
{
|
25 |
}
|
26 |
|
27 |
/**
|
28 |
+
* Static method redirecting to gateway class
|
29 |
+
*
|
30 |
+
* @param array $query containing request params
|
31 |
+
* @param int[] $ids containing customer IDs
|
32 |
+
*
|
33 |
+
* @see CustomerGateway::fetch()
|
34 |
*
|
|
|
|
|
35 |
* @return Customer|Customer[]
|
36 |
*/
|
37 |
public static function fetch($query, $ids)
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
+
* Static method redirecting to gateway class
|
44 |
+
*
|
45 |
+
* @param array $attribs containing request parameters
|
46 |
+
*
|
47 |
+
* @see CustomerGateway::create()
|
48 |
*
|
|
|
49 |
* @return Result\Successful|Result\Error
|
50 |
*/
|
51 |
public static function create($attribs = [])
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
+
* Static method redirecting to gateway class
|
58 |
+
*
|
59 |
+
* @param array $attribs of request parameters
|
60 |
+
*
|
61 |
+
* @see CustomerGateway::createNoValidate()
|
62 |
+
*
|
63 |
+
* @throws Exception\ValidationError
|
64 |
*
|
|
|
65 |
* @return Customer
|
66 |
*/
|
67 |
public static function createNoValidate($attribs = [])
|
70 |
}
|
71 |
|
72 |
/**
|
73 |
+
* Static method redirecting to gateway class
|
74 |
+
*
|
75 |
+
* @param string $id customer Id
|
76 |
+
* @param string $associationFilterId association filter Id
|
77 |
+
*
|
78 |
+
* @see CustomerGateway::find()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
*
|
80 |
* @throws Exception\NotFound
|
81 |
+
*
|
82 |
+
* @return Customer|boolean The customer object or false if the request fails.
|
83 |
*/
|
84 |
public static function find($id, $associationFilterId = null)
|
85 |
{
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
+
* Static method redirecting to gateway class
|
91 |
+
*
|
92 |
+
* @param integer $customerId unique identifier
|
93 |
+
* @param array $transactionAttribs containing request parameters
|
94 |
+
*
|
95 |
+
* @see CustomerGateway::credit()
|
96 |
*
|
|
|
|
|
97 |
* @return Result\Successful|Result\Error
|
98 |
*/
|
99 |
public static function credit($customerId, $transactionAttribs)
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
+
* Static method redirecting to gateway class
|
106 |
+
*
|
107 |
+
* @param integer $customerId unique identifier
|
108 |
+
* @param array $transactionAttribs containing request parameters
|
109 |
+
*
|
110 |
+
* @see CustomerGateway::creditNoValidate()
|
111 |
*
|
112 |
* @throws Exception\ValidationError
|
113 |
+
*
|
|
|
114 |
* @return Transaction
|
115 |
*/
|
116 |
public static function creditNoValidate($customerId, $transactionAttribs)
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
+
* Static method redirecting to gateway class
|
123 |
+
*
|
124 |
+
* @param string $customerId unique identifier
|
125 |
+
*
|
126 |
+
* @see CustomerGateway::delete()
|
127 |
*
|
|
|
|
|
128 |
* @return Result\Successful
|
129 |
*/
|
130 |
public static function delete($customerId)
|
133 |
}
|
134 |
|
135 |
/**
|
136 |
+
* Static method redirecting to gateway class
|
137 |
*
|
138 |
+
* @param string $customerId unique identifier
|
139 |
+
* @param array $transactionAttribs containing request parameters
|
140 |
+
*
|
141 |
+
* @see CustomerGateway::sale()
|
142 |
+
*
|
143 |
+
* @return Result\Successful|Result\Error
|
144 |
*/
|
145 |
public static function sale($customerId, $transactionAttribs)
|
146 |
{
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
+
* Static method redirecting to gateway class
|
152 |
+
*
|
153 |
+
* @param string $customerId unique identifier
|
154 |
+
* @param array $transactionAttribs containing request parameters
|
155 |
+
*
|
156 |
+
* @see CustomerGateway::saleNoValidate()
|
157 |
+
*
|
158 |
+
* @throws Exception\ValidationsFailed
|
159 |
*
|
|
|
|
|
160 |
* @return Transaction
|
161 |
*/
|
162 |
public static function saleNoValidate($customerId, $transactionAttribs)
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
+
* Static method redirecting to gateway class
|
169 |
+
*
|
170 |
+
* @param mixed $query search query
|
171 |
+
*
|
172 |
+
* @see CustomerGateway::search()
|
173 |
*
|
174 |
* @throws InvalidArgumentException
|
175 |
+
*
|
176 |
* @return ResourceCollection
|
177 |
*/
|
178 |
public static function search($query)
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
+
* Static method redirecting to gateway class
|
185 |
+
*
|
186 |
+
* @param string $customerId to be updated
|
187 |
+
* @param array $attributes containing request params
|
188 |
+
*
|
189 |
+
* @see CustomerGateway::update()
|
190 |
*
|
|
|
|
|
|
|
191 |
* @return Result\Successful|Result\Error
|
192 |
*/
|
193 |
public static function update($customerId, $attributes)
|
196 |
}
|
197 |
|
198 |
/**
|
199 |
+
* update a customer record, assuming validations will pass
|
200 |
*
|
201 |
+
* if calling this method in static context, customerId
|
202 |
+
* is the 2nd attribute. customerId is not sent in object context.
|
203 |
+
* returns a Customer object on success
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
*
|
205 |
+
* @param string $customerId unique identifier
|
206 |
+
* @param array $attributes request parameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
*
|
208 |
+
* @see CustomerGateway::updateNoValidate()
|
209 |
+
*
|
210 |
+
* @throws Exception\ValidationsFailed
|
211 |
+
*
|
212 |
+
* @return Customer
|
213 |
*/
|
214 |
+
public static function updateNoValidate($customerId, $attributes)
|
215 |
{
|
216 |
+
return Configuration::gateway()->customer()->updateNoValidate($customerId, $attributes);
|
217 |
}
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
protected function _initialize($customerAttribs)
|
220 |
{
|
221 |
$this->_attributes = $customerAttribs;
|
222 |
|
223 |
$addressArray = [];
|
224 |
if (isset($customerAttribs['addresses'])) {
|
225 |
+
foreach ($customerAttribs['addresses'] as $address) {
|
|
|
226 |
$addressArray[] = Address::factory($address);
|
227 |
}
|
228 |
}
|
230 |
|
231 |
$creditCardArray = [];
|
232 |
if (isset($customerAttribs['creditCards'])) {
|
233 |
+
foreach ($customerAttribs['creditCards'] as $creditCard) {
|
234 |
$creditCardArray[] = CreditCard::factory($creditCard);
|
235 |
}
|
236 |
}
|
237 |
$this->_set('creditCards', $creditCardArray);
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
$paypalAccountArray = [];
|
240 |
if (isset($customerAttribs['paypalAccounts'])) {
|
241 |
+
foreach ($customerAttribs['paypalAccounts'] as $paypalAccount) {
|
242 |
$paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
|
243 |
}
|
244 |
}
|
246 |
|
247 |
$applePayCardArray = [];
|
248 |
if (isset($customerAttribs['applePayCards'])) {
|
249 |
+
foreach ($customerAttribs['applePayCards'] as $applePayCard) {
|
250 |
$applePayCardArray[] = ApplePayCard::factory($applePayCard);
|
251 |
}
|
252 |
}
|
253 |
$this->_set('applePayCards', $applePayCardArray);
|
254 |
|
255 |
+
$googlePayCardArray = [];
|
256 |
if (isset($customerAttribs['androidPayCards'])) {
|
257 |
+
foreach ($customerAttribs['androidPayCards'] as $googlePayCard) {
|
258 |
+
$googlePayCardArray[] = GooglePayCard::factory($googlePayCard);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
}
|
261 |
+
$this->_set('googlePayCards', $googlePayCardArray);
|
262 |
|
263 |
$venmoAccountArray = array();
|
264 |
if (isset($customerAttribs['venmoAccounts'])) {
|
265 |
+
foreach ($customerAttribs['venmoAccounts'] as $venmoAccount) {
|
266 |
$venmoAccountArray[] = VenmoAccount::factory($venmoAccount);
|
267 |
}
|
268 |
}
|
270 |
|
271 |
$visaCheckoutCardArray = [];
|
272 |
if (isset($customerAttribs['visaCheckoutCards'])) {
|
273 |
+
foreach ($customerAttribs['visaCheckoutCards'] as $visaCheckoutCard) {
|
274 |
$visaCheckoutCardArray[] = VisaCheckoutCard::factory($visaCheckoutCard);
|
275 |
}
|
276 |
}
|
277 |
$this->_set('visaCheckoutCards', $visaCheckoutCardArray);
|
278 |
|
279 |
+
$samsungPayCardArray = [];
|
280 |
+
if (isset($customerAttribs['samsungPayCards'])) {
|
281 |
+
foreach ($customerAttribs['samsungPayCards'] as $samsungPayCard) {
|
282 |
+
$samsungPayCardArray[] = SamsungPayCard::factory($samsungPayCard);
|
283 |
}
|
284 |
}
|
285 |
+
$this->_set('samsungPayCards', $samsungPayCardArray);
|
286 |
|
287 |
$usBankAccountArray = array();
|
288 |
if (isset($customerAttribs['usBankAccounts'])) {
|
289 |
+
foreach ($customerAttribs['usBankAccounts'] as $usBankAccount) {
|
290 |
$usBankAccountArray[] = UsBankAccount::factory($usBankAccount);
|
291 |
}
|
292 |
}
|
296 |
$this->creditCards,
|
297 |
$this->paypalAccounts,
|
298 |
$this->applePayCards,
|
299 |
+
$this->googlePayCards,
|
|
|
|
|
300 |
$this->venmoAccounts,
|
301 |
$this->visaCheckoutCards,
|
302 |
+
$this->samsungPayCards,
|
303 |
$this->usBankAccounts
|
304 |
));
|
305 |
+
|
306 |
+
$customFields = [];
|
307 |
+
if (isset($customerAttribs['customFields'])) {
|
308 |
+
$customFields = $customerAttribs['customFields'];
|
309 |
+
}
|
310 |
+
$this->_set('customFields', $customFields);
|
311 |
}
|
312 |
|
313 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
314 |
+
public function __toString()
|
|
|
|
|
|
|
315 |
{
|
316 |
return __CLASS__ . '[' .
|
317 |
+
Util::attributesToString($this->_attributes) . ']';
|
318 |
}
|
319 |
|
320 |
/**
|
322 |
* or is a Customer with a different id
|
323 |
*
|
324 |
* @param object $otherCust customer to compare against
|
325 |
+
*
|
326 |
* @return boolean
|
327 |
*/
|
328 |
public function isEqual($otherCust)
|
330 |
return !($otherCust instanceof Customer) ? false : $this->id === $otherCust->id;
|
331 |
}
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
/**
|
334 |
* returns the customer's default payment method
|
335 |
*
|
341 |
return current($defaultPaymentMethods);
|
342 |
}
|
343 |
|
344 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
345 |
public static function _defaultPaymentMethodFilter($paymentMethod)
|
346 |
{
|
347 |
return $paymentMethod->isDefault();
|
348 |
}
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
protected $_attributes = [
|
351 |
+
'addresses' => '',
|
352 |
+
'company' => '',
|
353 |
+
'creditCards' => '',
|
354 |
+
'email' => '',
|
355 |
+
'fax' => '',
|
356 |
+
'firstName' => '',
|
357 |
+
'id' => '',
|
358 |
+
'lastName' => '',
|
359 |
+
'phone' => '',
|
360 |
+
'taxIdentifiers' => '',
|
361 |
+
'createdAt' => '',
|
362 |
+
'updatedAt' => '',
|
363 |
+
'website' => '',
|
364 |
];
|
365 |
|
366 |
/**
|
367 |
+
* Creates an instance of a Customer from given attributes
|
368 |
+
*
|
369 |
+
* @param array $attributes response object attributes
|
370 |
*
|
|
|
|
|
371 |
* @return Customer
|
372 |
*/
|
373 |
public static function factory($attributes)
|
377 |
return $instance;
|
378 |
}
|
379 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CustomerGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -7,12 +8,8 @@ use InvalidArgumentException;
|
|
7 |
* Braintree CustomerGateway module
|
8 |
* Creates and manages Customers
|
9 |
*
|
10 |
-
|
11 |
-
*
|
12 |
-
* For more detailed information on Customers, see {@link https://developers.braintreepayments.com/reference/response/customer/php https://developers.braintreepayments.com/reference/response/customer/php}
|
13 |
-
*
|
14 |
-
* @package Braintree
|
15 |
-
* @category Resources
|
16 |
*/
|
17 |
class CustomerGateway
|
18 |
{
|
@@ -20,6 +17,7 @@ class CustomerGateway
|
|
20 |
private $_config;
|
21 |
private $_http;
|
22 |
|
|
|
23 |
public function __construct($gateway)
|
24 |
{
|
25 |
$this->_gateway = $gateway;
|
@@ -28,6 +26,11 @@ class CustomerGateway
|
|
28 |
$this->_http = new Http($gateway->config);
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
public function all()
|
32 |
{
|
33 |
$path = $this->_config->merchantPath() . '/customers/advanced_search_ids';
|
@@ -41,6 +44,14 @@ class CustomerGateway
|
|
41 |
return new ResourceCollection($response, $pager);
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
public function fetch($query, $ids)
|
45 |
{
|
46 |
$criteria = [];
|
@@ -78,9 +89,9 @@ class CustomerGateway
|
|
78 |
* }
|
79 |
* </code>
|
80 |
*
|
81 |
-
* @
|
82 |
-
*
|
83 |
-
* @return
|
84 |
*/
|
85 |
public function create($attribs = [])
|
86 |
{
|
@@ -92,69 +103,38 @@ class CustomerGateway
|
|
92 |
* attempts the create operation assuming all data will validate
|
93 |
* returns a Customer object instead of a Result
|
94 |
*
|
95 |
-
* @
|
96 |
-
*
|
97 |
-
* @return Customer
|
98 |
* @throws Exception\ValidationError
|
|
|
|
|
99 |
*/
|
100 |
public function createNoValidate($attribs = [])
|
101 |
{
|
102 |
$result = $this->create($attribs);
|
103 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
104 |
}
|
105 |
-
/**
|
106 |
-
* create a customer from a TransparentRedirect operation
|
107 |
-
*
|
108 |
-
* @deprecated since version 2.3.0
|
109 |
-
* @access public
|
110 |
-
* @param array $attribs
|
111 |
-
* @return Customer
|
112 |
-
*/
|
113 |
-
public function createFromTransparentRedirect($queryString)
|
114 |
-
{
|
115 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
|
116 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
117 |
-
$queryString
|
118 |
-
);
|
119 |
-
return $this->_doCreate(
|
120 |
-
'/customers/all/confirm_transparent_redirect_request',
|
121 |
-
['id' => $params['id']]
|
122 |
-
);
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
*
|
127 |
-
* @deprecated since version 2.3.0
|
128 |
-
* @access public
|
129 |
-
* @param none
|
130 |
-
* @return string
|
131 |
-
*/
|
132 |
-
public function createCustomerUrl()
|
133 |
-
{
|
134 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
|
135 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath() .
|
136 |
-
'/customers/all/create_via_transparent_redirect_request';
|
137 |
-
}
|
138 |
-
|
139 |
|
140 |
/**
|
141 |
* creates a full array signature of a valid create request
|
|
|
142 |
* @return array gateway create request format
|
143 |
*/
|
144 |
public static function createSignature()
|
145 |
{
|
146 |
$creditCardSignature = CreditCardGateway::createSignature();
|
147 |
unset($creditCardSignature[array_search('customerId', $creditCardSignature)]);
|
148 |
-
|
149 |
$signature = [
|
150 |
'id', 'company', 'email', 'fax', 'firstName',
|
151 |
-
'lastName', 'phone', 'website', 'deviceData',
|
152 |
-
'deviceSessionId', 'fraudMerchantId', 'paymentMethodNonce',
|
153 |
['riskData' =>
|
154 |
-
['customerBrowser', 'customerIp'
|
155 |
],
|
156 |
['creditCard' => $creditCardSignature],
|
157 |
['customFields' => ['_anyKey_']],
|
|
|
|
|
|
|
158 |
['options' => [
|
159 |
['paypal' => [
|
160 |
'payee_email',
|
@@ -180,14 +160,15 @@ class CustomerGateway
|
|
180 |
|
181 |
/**
|
182 |
* creates a full array signature of a valid update request
|
|
|
183 |
* @return array update request format
|
184 |
*/
|
185 |
public static function updateSignature()
|
186 |
{
|
187 |
$creditCardSignature = CreditCardGateway::updateSignature();
|
188 |
|
189 |
-
foreach($creditCardSignature
|
190 |
-
if(is_array($value) and array_key_exists('options', $value)) {
|
191 |
array_push($creditCardSignature[$key]['options'], 'updateExistingToken');
|
192 |
}
|
193 |
}
|
@@ -195,13 +176,22 @@ class CustomerGateway
|
|
195 |
$signature = [
|
196 |
'id', 'company', 'email', 'fax', 'firstName',
|
197 |
'lastName', 'phone', 'website', 'deviceData',
|
198 |
-
'
|
199 |
['creditCard' => $creditCardSignature],
|
200 |
['customFields' => ['_anyKey_']],
|
|
|
|
|
|
|
201 |
['options' => [
|
202 |
['paypal' => [
|
203 |
'payee_email',
|
204 |
'payeeEmail',
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
['shipping' =>
|
206 |
[
|
207 |
'firstName', 'lastName', 'company', 'countryName',
|
@@ -219,11 +209,12 @@ class CustomerGateway
|
|
219 |
/**
|
220 |
* find a customer by id
|
221 |
*
|
222 |
-
* @
|
223 |
-
* @param string
|
224 |
-
*
|
225 |
-
* @return Customer|boolean The customer object or false if the request fails.
|
226 |
* @throws Exception\NotFound
|
|
|
|
|
227 |
*/
|
228 |
public function find($id, $associationFilterId = null)
|
229 |
{
|
@@ -238,7 +229,7 @@ class CustomerGateway
|
|
238 |
return Customer::factory($response['customer']);
|
239 |
} catch (Exception\NotFound $e) {
|
240 |
throw new Exception\NotFound(
|
241 |
-
|
242 |
);
|
243 |
}
|
244 |
}
|
@@ -246,19 +237,20 @@ class CustomerGateway
|
|
246 |
/**
|
247 |
* credit a customer for the passed transaction
|
248 |
*
|
249 |
-
* @
|
250 |
-
* @param
|
251 |
-
*
|
252 |
* @return Result\Successful|Result\Error
|
253 |
*/
|
254 |
public function credit($customerId, $transactionAttribs)
|
255 |
{
|
256 |
$this->_validateId($customerId);
|
257 |
return Transaction::credit(
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
262 |
}
|
263 |
|
264 |
/**
|
@@ -266,11 +258,12 @@ class CustomerGateway
|
|
266 |
*
|
267 |
* returns a Transaction object on success
|
268 |
*
|
269 |
-
* @
|
270 |
-
* @param
|
271 |
-
*
|
272 |
-
* @return Transaction
|
273 |
* @throws Exception\ValidationError
|
|
|
|
|
274 |
*/
|
275 |
public function creditNoValidate($customerId, $transactionAttribs)
|
276 |
{
|
@@ -281,7 +274,9 @@ class CustomerGateway
|
|
281 |
/**
|
282 |
* delete a customer by id
|
283 |
*
|
284 |
-
* @param string $customerId
|
|
|
|
|
285 |
*/
|
286 |
public function delete($customerId)
|
287 |
{
|
@@ -294,31 +289,33 @@ class CustomerGateway
|
|
294 |
/**
|
295 |
* create a new sale for a customer
|
296 |
*
|
297 |
-
* @param string $customerId
|
298 |
-
* @param array
|
|
|
299 |
* @return Result\Successful|Result\Error
|
300 |
-
* @see Transaction::sale()
|
301 |
*/
|
302 |
public function sale($customerId, $transactionAttribs)
|
303 |
{
|
304 |
$this->_validateId($customerId);
|
305 |
return Transaction::sale(
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
310 |
}
|
311 |
|
312 |
/**
|
313 |
* create a new sale for a customer, assuming validations will pass
|
314 |
*
|
315 |
* returns a Transaction object on success
|
316 |
-
*
|
317 |
-
* @param string $customerId
|
318 |
-
* @param array
|
319 |
-
*
|
320 |
* @throws Exception\ValidationsFailed
|
321 |
-
*
|
|
|
322 |
*/
|
323 |
public function saleNoValidate($customerId, $transactionAttribs)
|
324 |
{
|
@@ -331,18 +328,21 @@ class CustomerGateway
|
|
331 |
*
|
332 |
* If <b>query</b> is a string, the search will be a basic search.
|
333 |
* If <b>query</b> is a hash, the search will be an advanced search.
|
334 |
-
|
|
|
335 |
*
|
336 |
* @param mixed $query search query
|
337 |
-
*
|
338 |
* @throws InvalidArgumentException
|
|
|
|
|
339 |
*/
|
340 |
public function search($query)
|
341 |
{
|
342 |
$criteria = [];
|
343 |
foreach ($query as $term) {
|
344 |
$result = $term->toparam();
|
345 |
-
if(is_null($result) || empty($result)) {
|
346 |
throw new InvalidArgumentException('Operator must be provided');
|
347 |
}
|
348 |
|
@@ -366,9 +366,9 @@ class CustomerGateway
|
|
366 |
* if calling this method in static context, customerId
|
367 |
* is the 2nd attribute. customerId is not sent in object context.
|
368 |
*
|
369 |
-
* @
|
370 |
-
* @param
|
371 |
-
*
|
372 |
* @return Result\Successful|Result\Error
|
373 |
*/
|
374 |
public function update($customerId, $attributes)
|
@@ -389,61 +389,19 @@ class CustomerGateway
|
|
389 |
* is the 2nd attribute. customerId is not sent in object context.
|
390 |
* returns a Customer object on success
|
391 |
*
|
392 |
-
* @
|
393 |
-
* @param
|
394 |
-
*
|
395 |
-
* @return Customer
|
396 |
* @throws Exception\ValidationsFailed
|
|
|
|
|
397 |
*/
|
398 |
public function updateNoValidate($customerId, $attributes)
|
399 |
{
|
400 |
$result = $this->update($customerId, $attributes);
|
401 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
402 |
}
|
403 |
-
/**
|
404 |
-
*
|
405 |
-
* @deprecated since version 2.3.0
|
406 |
-
* @access public
|
407 |
-
* @return string
|
408 |
-
*/
|
409 |
-
public function updateCustomerUrl()
|
410 |
-
{
|
411 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
|
412 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath() .
|
413 |
-
'/customers/all/update_via_transparent_redirect_request';
|
414 |
-
}
|
415 |
-
|
416 |
-
/**
|
417 |
-
* update a customer from a TransparentRedirect operation
|
418 |
-
*
|
419 |
-
* @deprecated since version 2.3.0
|
420 |
-
* @access public
|
421 |
-
* @param string $queryString
|
422 |
-
* @return object
|
423 |
-
*/
|
424 |
-
public function updateFromTransparentRedirect($queryString)
|
425 |
-
{
|
426 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
|
427 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
428 |
-
$queryString
|
429 |
-
);
|
430 |
-
return $this->_doUpdate(
|
431 |
-
'post',
|
432 |
-
'/customers/all/confirm_transparent_redirect_request',
|
433 |
-
['id' => $params['id']]
|
434 |
-
);
|
435 |
-
}
|
436 |
-
|
437 |
-
/* instance methods */
|
438 |
|
439 |
-
/**
|
440 |
-
* sets instance properties from an array of values
|
441 |
-
*
|
442 |
-
* @ignore
|
443 |
-
* @access protected
|
444 |
-
* @param array $customerAttribs array of customer data
|
445 |
-
* @return void
|
446 |
-
*/
|
447 |
protected function _initialize($customerAttribs)
|
448 |
{
|
449 |
// set the attributes
|
@@ -452,8 +410,7 @@ class CustomerGateway
|
|
452 |
// map each address into its own object
|
453 |
$addressArray = [];
|
454 |
if (isset($customerAttribs['addresses'])) {
|
455 |
-
|
456 |
-
foreach ($customerAttribs['addresses'] AS $address) {
|
457 |
$addressArray[] = Address::factory($address);
|
458 |
}
|
459 |
}
|
@@ -462,25 +419,16 @@ class CustomerGateway
|
|
462 |
// map each creditCard into its own object
|
463 |
$creditCardArray = [];
|
464 |
if (isset($customerAttribs['creditCards'])) {
|
465 |
-
foreach ($customerAttribs['creditCards']
|
466 |
$creditCardArray[] = CreditCard::factory($creditCard);
|
467 |
}
|
468 |
}
|
469 |
$this->_set('creditCards', $creditCardArray);
|
470 |
|
471 |
-
// map each coinbaseAccount into its own object
|
472 |
-
$coinbaseAccountArray = [];
|
473 |
-
if (isset($customerAttribs['coinbaseAccounts'])) {
|
474 |
-
foreach ($customerAttribs['coinbaseAccounts'] AS $coinbaseAccount) {
|
475 |
-
$coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
|
476 |
-
}
|
477 |
-
}
|
478 |
-
$this->_set('coinbaseAccounts', $coinbaseAccountArray);
|
479 |
-
|
480 |
// map each paypalAccount into its own object
|
481 |
$paypalAccountArray = [];
|
482 |
if (isset($customerAttribs['paypalAccounts'])) {
|
483 |
-
foreach ($customerAttribs['paypalAccounts']
|
484 |
$paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
|
485 |
}
|
486 |
}
|
@@ -489,32 +437,35 @@ class CustomerGateway
|
|
489 |
// map each applePayCard into its own object
|
490 |
$applePayCardArray = [];
|
491 |
if (isset($customerAttribs['applePayCards'])) {
|
492 |
-
foreach ($customerAttribs['applePayCards']
|
493 |
$applePayCardArray[] = ApplePayCard::factory($applePayCard);
|
494 |
}
|
495 |
}
|
496 |
$this->_set('applePayCards', $applePayCardArray);
|
497 |
|
498 |
-
// map each androidPayCard
|
499 |
-
$
|
500 |
if (isset($customerAttribs['androidPayCards'])) {
|
501 |
-
foreach ($customerAttribs['androidPayCards']
|
502 |
-
$
|
503 |
}
|
504 |
}
|
505 |
-
$this->_set('
|
506 |
|
507 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
}
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
* @return string
|
513 |
-
*/
|
514 |
-
public function __toString()
|
515 |
{
|
516 |
return __CLASS__ . '[' .
|
517 |
-
Util::attributesToString($this->_attributes) .']';
|
518 |
}
|
519 |
|
520 |
/**
|
@@ -522,6 +473,7 @@ class CustomerGateway
|
|
522 |
* or is a Customer with a different id
|
523 |
*
|
524 |
* @param object $otherCust customer to compare against
|
|
|
525 |
* @return boolean
|
526 |
*/
|
527 |
public function isEqual($otherCust)
|
@@ -542,25 +494,21 @@ class CustomerGateway
|
|
542 |
/**
|
543 |
* returns the customer's default payment method
|
544 |
*
|
545 |
-
* @return CreditCard|PayPalAccount|ApplePayCard|
|
546 |
*/
|
547 |
public function defaultPaymentMethod()
|
548 |
{
|
|
|
549 |
$defaultPaymentMethods = array_filter($this->paymentMethods, 'Braintree\\Customer::_defaultPaymentMethodFilter');
|
550 |
return current($defaultPaymentMethods);
|
551 |
}
|
552 |
|
|
|
553 |
public static function _defaultPaymentMethodFilter($paymentMethod)
|
554 |
{
|
555 |
return $paymentMethod->isDefault();
|
556 |
}
|
557 |
|
558 |
-
/* private class properties */
|
559 |
-
|
560 |
-
/**
|
561 |
-
* @access protected
|
562 |
-
* @var array registry of customer data
|
563 |
-
*/
|
564 |
protected $_attributes = [
|
565 |
'addresses' => '',
|
566 |
'company' => '',
|
@@ -576,14 +524,7 @@ class CustomerGateway
|
|
576 |
'website' => '',
|
577 |
];
|
578 |
|
579 |
-
|
580 |
-
* sends the create request to the gateway
|
581 |
-
*
|
582 |
-
* @ignore
|
583 |
-
* @param string $subPath
|
584 |
-
* @param array $params
|
585 |
-
* @return mixed
|
586 |
-
*/
|
587 |
public function _doCreate($subPath, $params)
|
588 |
{
|
589 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -592,13 +533,8 @@ class CustomerGateway
|
|
592 |
return $this->_verifyGatewayResponse($response);
|
593 |
}
|
594 |
|
595 |
-
|
596 |
-
|
597 |
-
* @ignore
|
598 |
-
* @param string customer id
|
599 |
-
* @throws InvalidArgumentException
|
600 |
-
*/
|
601 |
-
private function _validateId($id = null) {
|
602 |
if (is_null($id)) {
|
603 |
throw new InvalidArgumentException(
|
604 |
'expected customer id to be set'
|
@@ -611,17 +547,6 @@ class CustomerGateway
|
|
611 |
}
|
612 |
}
|
613 |
|
614 |
-
|
615 |
-
/* private class methods */
|
616 |
-
|
617 |
-
/**
|
618 |
-
* sends the update request to the gateway
|
619 |
-
*
|
620 |
-
* @ignore
|
621 |
-
* @param string $subPath
|
622 |
-
* @param array $params
|
623 |
-
* @return mixed
|
624 |
-
*/
|
625 |
private function _doUpdate($httpVerb, $subPath, $params)
|
626 |
{
|
627 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -630,33 +555,19 @@ class CustomerGateway
|
|
630 |
return $this->_verifyGatewayResponse($response);
|
631 |
}
|
632 |
|
633 |
-
/**
|
634 |
-
* generic method for validating incoming gateway responses
|
635 |
-
*
|
636 |
-
* creates a new Customer object and encapsulates
|
637 |
-
* it inside a Result\Successful object, or
|
638 |
-
* encapsulates a Errors object inside a Result\Error
|
639 |
-
* alternatively, throws an Unexpected exception if the response is invalid.
|
640 |
-
*
|
641 |
-
* @ignore
|
642 |
-
* @param array $response gateway response values
|
643 |
-
* @return Result\Successful|Result\Error
|
644 |
-
* @throws Exception\Unexpected
|
645 |
-
*/
|
646 |
private function _verifyGatewayResponse($response)
|
647 |
{
|
648 |
if (isset($response['customer'])) {
|
649 |
// return a populated instance of Customer
|
650 |
return new Result\Successful(
|
651 |
-
|
652 |
);
|
653 |
-
}
|
654 |
return new Result\Error($response['apiErrorResponse']);
|
655 |
} else {
|
656 |
throw new Exception\Unexpected(
|
657 |
-
|
658 |
);
|
659 |
}
|
660 |
}
|
661 |
}
|
662 |
-
class_alias('Braintree\CustomerGateway', 'Braintree_CustomerGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
8 |
* Braintree CustomerGateway module
|
9 |
* Creates and manages Customers
|
10 |
*
|
11 |
+
// phpcs:ignore Generic.Files.LineLength
|
12 |
+
* For more detailed information on Customers, see {@link https://developer.paypal.com/braintree/docs/reference/response/customer/php our developer docs}
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class CustomerGateway
|
15 |
{
|
17 |
private $_config;
|
18 |
private $_http;
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
public function __construct($gateway)
|
22 |
{
|
23 |
$this->_gateway = $gateway;
|
26 |
$this->_http = new Http($gateway->config);
|
27 |
}
|
28 |
|
29 |
+
/*
|
30 |
+
* Return all customers
|
31 |
+
*
|
32 |
+
* @return ResourceCollection
|
33 |
+
*/
|
34 |
public function all()
|
35 |
{
|
36 |
$path = $this->_config->merchantPath() . '/customers/advanced_search_ids';
|
44 |
return new ResourceCollection($response, $pager);
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* Retrieve a customer
|
49 |
+
*
|
50 |
+
* @param array $query containing request params
|
51 |
+
* @param int[] $ids containing customer IDs
|
52 |
+
*
|
53 |
+
* @return Customer|Customer[]
|
54 |
+
*/
|
55 |
public function fetch($query, $ids)
|
56 |
{
|
57 |
$criteria = [];
|
89 |
* }
|
90 |
* </code>
|
91 |
*
|
92 |
+
* @param array $attribs containing request parameters
|
93 |
+
*
|
94 |
+
* @return Result\Successful|Result\Error
|
95 |
*/
|
96 |
public function create($attribs = [])
|
97 |
{
|
103 |
* attempts the create operation assuming all data will validate
|
104 |
* returns a Customer object instead of a Result
|
105 |
*
|
106 |
+
* @param array $attribs of request parameters
|
107 |
+
*
|
|
|
108 |
* @throws Exception\ValidationError
|
109 |
+
*
|
110 |
+
* @return Customer
|
111 |
*/
|
112 |
public function createNoValidate($attribs = [])
|
113 |
{
|
114 |
$result = $this->create($attribs);
|
115 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
/**
|
119 |
* creates a full array signature of a valid create request
|
120 |
+
*
|
121 |
* @return array gateway create request format
|
122 |
*/
|
123 |
public static function createSignature()
|
124 |
{
|
125 |
$creditCardSignature = CreditCardGateway::createSignature();
|
126 |
unset($creditCardSignature[array_search('customerId', $creditCardSignature)]);
|
|
|
127 |
$signature = [
|
128 |
'id', 'company', 'email', 'fax', 'firstName',
|
129 |
+
'lastName', 'phone', 'website', 'deviceData', 'paymentMethodNonce',
|
|
|
130 |
['riskData' =>
|
131 |
+
['customerBrowser', 'customerIp']
|
132 |
],
|
133 |
['creditCard' => $creditCardSignature],
|
134 |
['customFields' => ['_anyKey_']],
|
135 |
+
['taxIdentifiers' =>
|
136 |
+
['countryCode', 'identifier']
|
137 |
+
],
|
138 |
['options' => [
|
139 |
['paypal' => [
|
140 |
'payee_email',
|
160 |
|
161 |
/**
|
162 |
* creates a full array signature of a valid update request
|
163 |
+
*
|
164 |
* @return array update request format
|
165 |
*/
|
166 |
public static function updateSignature()
|
167 |
{
|
168 |
$creditCardSignature = CreditCardGateway::updateSignature();
|
169 |
|
170 |
+
foreach ($creditCardSignature as $key => $value) {
|
171 |
+
if (is_array($value) and array_key_exists('options', $value)) {
|
172 |
array_push($creditCardSignature[$key]['options'], 'updateExistingToken');
|
173 |
}
|
174 |
}
|
176 |
$signature = [
|
177 |
'id', 'company', 'email', 'fax', 'firstName',
|
178 |
'lastName', 'phone', 'website', 'deviceData',
|
179 |
+
'paymentMethodNonce', 'defaultPaymentMethodToken',
|
180 |
['creditCard' => $creditCardSignature],
|
181 |
['customFields' => ['_anyKey_']],
|
182 |
+
['taxIdentifiers' =>
|
183 |
+
['countryCode', 'identifier']
|
184 |
+
],
|
185 |
['options' => [
|
186 |
['paypal' => [
|
187 |
'payee_email',
|
188 |
'payeeEmail',
|
189 |
+
'order_id',
|
190 |
+
'orderId',
|
191 |
+
'custom_field',
|
192 |
+
'customField',
|
193 |
+
'description',
|
194 |
+
'amount',
|
195 |
['shipping' =>
|
196 |
[
|
197 |
'firstName', 'lastName', 'company', 'countryName',
|
209 |
/**
|
210 |
* find a customer by id
|
211 |
*
|
212 |
+
* @param string $id customer Id
|
213 |
+
* @param string $associationFilterId association filter Id
|
214 |
+
*
|
|
|
215 |
* @throws Exception\NotFound
|
216 |
+
*
|
217 |
+
* @return Customer|boolean The customer object or false if the request fails.
|
218 |
*/
|
219 |
public function find($id, $associationFilterId = null)
|
220 |
{
|
229 |
return Customer::factory($response['customer']);
|
230 |
} catch (Exception\NotFound $e) {
|
231 |
throw new Exception\NotFound(
|
232 |
+
'customer with id ' . $id . ' not found'
|
233 |
);
|
234 |
}
|
235 |
}
|
237 |
/**
|
238 |
* credit a customer for the passed transaction
|
239 |
*
|
240 |
+
* @param integer $customerId unique identifier
|
241 |
+
* @param array $transactionAttribs containing request parameters
|
242 |
+
*
|
243 |
* @return Result\Successful|Result\Error
|
244 |
*/
|
245 |
public function credit($customerId, $transactionAttribs)
|
246 |
{
|
247 |
$this->_validateId($customerId);
|
248 |
return Transaction::credit(
|
249 |
+
array_merge(
|
250 |
+
$transactionAttribs,
|
251 |
+
['customerId' => $customerId]
|
252 |
+
)
|
253 |
+
);
|
254 |
}
|
255 |
|
256 |
/**
|
258 |
*
|
259 |
* returns a Transaction object on success
|
260 |
*
|
261 |
+
* @param integer $customerId unique identifier
|
262 |
+
* @param array $transactionAttribs containing request parameters
|
263 |
+
*
|
|
|
264 |
* @throws Exception\ValidationError
|
265 |
+
*
|
266 |
+
* @return Transaction
|
267 |
*/
|
268 |
public function creditNoValidate($customerId, $transactionAttribs)
|
269 |
{
|
274 |
/**
|
275 |
* delete a customer by id
|
276 |
*
|
277 |
+
* @param string $customerId unique identifier
|
278 |
+
*
|
279 |
+
* @return Result\Successful
|
280 |
*/
|
281 |
public function delete($customerId)
|
282 |
{
|
289 |
/**
|
290 |
* create a new sale for a customer
|
291 |
*
|
292 |
+
* @param string $customerId unique identifier
|
293 |
+
* @param array $transactionAttribs containing request parameters
|
294 |
+
*
|
295 |
* @return Result\Successful|Result\Error
|
|
|
296 |
*/
|
297 |
public function sale($customerId, $transactionAttribs)
|
298 |
{
|
299 |
$this->_validateId($customerId);
|
300 |
return Transaction::sale(
|
301 |
+
array_merge(
|
302 |
+
$transactionAttribs,
|
303 |
+
['customerId' => $customerId]
|
304 |
+
)
|
305 |
+
);
|
306 |
}
|
307 |
|
308 |
/**
|
309 |
* create a new sale for a customer, assuming validations will pass
|
310 |
*
|
311 |
* returns a Transaction object on success
|
312 |
+
*
|
313 |
+
* @param string $customerId unique identifier
|
314 |
+
* @param array $transactionAttribs containing request parameters
|
315 |
+
*
|
316 |
* @throws Exception\ValidationsFailed
|
317 |
+
*
|
318 |
+
* @return Transaction
|
319 |
*/
|
320 |
public function saleNoValidate($customerId, $transactionAttribs)
|
321 |
{
|
328 |
*
|
329 |
* If <b>query</b> is a string, the search will be a basic search.
|
330 |
* If <b>query</b> is a hash, the search will be an advanced search.
|
331 |
+
// phpcs:ignore Generic.Files.LineLength
|
332 |
+
* For more detailed information and examples, see {@link https://developer.paypal.com/braintree/docs/reference/request/customer/search/php our developer docs}
|
333 |
*
|
334 |
* @param mixed $query search query
|
335 |
+
*
|
336 |
* @throws InvalidArgumentException
|
337 |
+
*
|
338 |
+
* @return ResourceCollection
|
339 |
*/
|
340 |
public function search($query)
|
341 |
{
|
342 |
$criteria = [];
|
343 |
foreach ($query as $term) {
|
344 |
$result = $term->toparam();
|
345 |
+
if (is_null($result) || empty($result)) {
|
346 |
throw new InvalidArgumentException('Operator must be provided');
|
347 |
}
|
348 |
|
366 |
* if calling this method in static context, customerId
|
367 |
* is the 2nd attribute. customerId is not sent in object context.
|
368 |
*
|
369 |
+
* @param string $customerId to be updated
|
370 |
+
* @param array $attributes containing request params
|
371 |
+
*
|
372 |
* @return Result\Successful|Result\Error
|
373 |
*/
|
374 |
public function update($customerId, $attributes)
|
389 |
* is the 2nd attribute. customerId is not sent in object context.
|
390 |
* returns a Customer object on success
|
391 |
*
|
392 |
+
* @param string $customerId unique identifier
|
393 |
+
* @param array $attributes request parameters
|
394 |
+
*
|
|
|
395 |
* @throws Exception\ValidationsFailed
|
396 |
+
*
|
397 |
+
* @return Customer
|
398 |
*/
|
399 |
public function updateNoValidate($customerId, $attributes)
|
400 |
{
|
401 |
$result = $this->update($customerId, $attributes);
|
402 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
403 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
protected function _initialize($customerAttribs)
|
406 |
{
|
407 |
// set the attributes
|
410 |
// map each address into its own object
|
411 |
$addressArray = [];
|
412 |
if (isset($customerAttribs['addresses'])) {
|
413 |
+
foreach ($customerAttribs['addresses'] as $address) {
|
|
|
414 |
$addressArray[] = Address::factory($address);
|
415 |
}
|
416 |
}
|
419 |
// map each creditCard into its own object
|
420 |
$creditCardArray = [];
|
421 |
if (isset($customerAttribs['creditCards'])) {
|
422 |
+
foreach ($customerAttribs['creditCards'] as $creditCard) {
|
423 |
$creditCardArray[] = CreditCard::factory($creditCard);
|
424 |
}
|
425 |
}
|
426 |
$this->_set('creditCards', $creditCardArray);
|
427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
// map each paypalAccount into its own object
|
429 |
$paypalAccountArray = [];
|
430 |
if (isset($customerAttribs['paypalAccounts'])) {
|
431 |
+
foreach ($customerAttribs['paypalAccounts'] as $paypalAccount) {
|
432 |
$paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
|
433 |
}
|
434 |
}
|
437 |
// map each applePayCard into its own object
|
438 |
$applePayCardArray = [];
|
439 |
if (isset($customerAttribs['applePayCards'])) {
|
440 |
+
foreach ($customerAttribs['applePayCards'] as $applePayCard) {
|
441 |
$applePayCardArray[] = ApplePayCard::factory($applePayCard);
|
442 |
}
|
443 |
}
|
444 |
$this->_set('applePayCards', $applePayCardArray);
|
445 |
|
446 |
+
// map each androidPayCard from gateway response to googlePayCard objects
|
447 |
+
$googlePayCardArray = [];
|
448 |
if (isset($customerAttribs['androidPayCards'])) {
|
449 |
+
foreach ($customerAttribs['androidPayCards'] as $googlePayCard) {
|
450 |
+
$googlePayCardArray[] = GooglePayCard::factory($googlePayCard);
|
451 |
}
|
452 |
}
|
453 |
+
$this->_set('googlePayCards', $googlePayCardArray);
|
454 |
|
455 |
+
$paymentMethodsArray = array_merge(
|
456 |
+
$this->creditCards,
|
457 |
+
$this->paypalAccounts,
|
458 |
+
$this->applePayCards,
|
459 |
+
$this->googlePayCards
|
460 |
+
);
|
461 |
+
$this->_set('paymentMethods', $paymentMethodsArray);
|
462 |
}
|
463 |
|
464 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
465 |
+
public function __toString()
|
|
|
|
|
|
|
466 |
{
|
467 |
return __CLASS__ . '[' .
|
468 |
+
Util::attributesToString($this->_attributes) . ']';
|
469 |
}
|
470 |
|
471 |
/**
|
473 |
* or is a Customer with a different id
|
474 |
*
|
475 |
* @param object $otherCust customer to compare against
|
476 |
+
*
|
477 |
* @return boolean
|
478 |
*/
|
479 |
public function isEqual($otherCust)
|
494 |
/**
|
495 |
* returns the customer's default payment method
|
496 |
*
|
497 |
+
* @return CreditCard|PayPalAccount|ApplePayCard|GooglePayCard
|
498 |
*/
|
499 |
public function defaultPaymentMethod()
|
500 |
{
|
501 |
+
// phpcs:ignore Generic.Files.LineLength
|
502 |
$defaultPaymentMethods = array_filter($this->paymentMethods, 'Braintree\\Customer::_defaultPaymentMethodFilter');
|
503 |
return current($defaultPaymentMethods);
|
504 |
}
|
505 |
|
506 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
507 |
public static function _defaultPaymentMethodFilter($paymentMethod)
|
508 |
{
|
509 |
return $paymentMethod->isDefault();
|
510 |
}
|
511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
protected $_attributes = [
|
513 |
'addresses' => '',
|
514 |
'company' => '',
|
524 |
'website' => '',
|
525 |
];
|
526 |
|
527 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
public function _doCreate($subPath, $params)
|
529 |
{
|
530 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
533 |
return $this->_verifyGatewayResponse($response);
|
534 |
}
|
535 |
|
536 |
+
private function _validateId($id = null)
|
537 |
+
{
|
|
|
|
|
|
|
|
|
|
|
538 |
if (is_null($id)) {
|
539 |
throw new InvalidArgumentException(
|
540 |
'expected customer id to be set'
|
547 |
}
|
548 |
}
|
549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
private function _doUpdate($httpVerb, $subPath, $params)
|
551 |
{
|
552 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
555 |
return $this->_verifyGatewayResponse($response);
|
556 |
}
|
557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
private function _verifyGatewayResponse($response)
|
559 |
{
|
560 |
if (isset($response['customer'])) {
|
561 |
// return a populated instance of Customer
|
562 |
return new Result\Successful(
|
563 |
+
Customer::factory($response['customer'])
|
564 |
);
|
565 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
566 |
return new Result\Error($response['apiErrorResponse']);
|
567 |
} else {
|
568 |
throw new Exception\Unexpected(
|
569 |
+
"Expected customer or apiErrorResponse"
|
570 |
);
|
571 |
}
|
572 |
}
|
573 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/CustomerSearch.php
CHANGED
@@ -1,34 +1,253 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class CustomerSearch
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
public static function
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
public static function
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
public static function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
-
class_alias('Braintree\CustomerSearch', 'Braintree_CustomerSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class for running customer searches
|
7 |
+
*/
|
8 |
class CustomerSearch
|
9 |
{
|
10 |
+
/*
|
11 |
+
* Create a new text node for address country name
|
12 |
+
*
|
13 |
+
* @return TextNode
|
14 |
+
*/
|
15 |
+
public static function addressCountryName()
|
16 |
+
{
|
17 |
+
return new TextNode('address_country_name');
|
18 |
+
}
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Create a new text node for address extended address
|
22 |
+
*
|
23 |
+
* @return TextNode
|
24 |
+
*/
|
25 |
+
public static function addressExtendedAddress()
|
26 |
+
{
|
27 |
+
return new TextNode('address_extended_address');
|
28 |
+
}
|
29 |
+
|
30 |
+
// NEXT_MAJOR_VERSION this should be changed to Given name. First name is US ethnocentric
|
31 |
+
/*
|
32 |
+
* Create a new text node for address first or given name
|
33 |
+
*
|
34 |
+
* @return TextNode
|
35 |
+
*/
|
36 |
+
public static function addressFirstName()
|
37 |
+
{
|
38 |
+
return new TextNode('address_first_name');
|
39 |
+
}
|
40 |
+
|
41 |
+
// NEXT_MAJOR_VERSION this should be changed to Surname. Last name is US ethnocentric
|
42 |
+
/*
|
43 |
+
* Create a new text node for address last or surname
|
44 |
+
*
|
45 |
+
* @return TextNode
|
46 |
+
*/
|
47 |
+
public static function addressLastName()
|
48 |
+
{
|
49 |
+
return new TextNode('address_last_name');
|
50 |
+
}
|
51 |
+
|
52 |
+
/*
|
53 |
+
* Create a new text node for address locality or city
|
54 |
+
*
|
55 |
+
* @return TextNode
|
56 |
+
*/
|
57 |
+
public static function addressLocality()
|
58 |
+
{
|
59 |
+
return new TextNode('address_locality');
|
60 |
+
}
|
61 |
+
|
62 |
+
/*
|
63 |
+
* Create a new text node for address postal code
|
64 |
+
*
|
65 |
+
* @return TextNode
|
66 |
+
*/
|
67 |
+
public static function addressPostalCode()
|
68 |
+
{
|
69 |
+
return new TextNode('address_postal_code');
|
70 |
+
}
|
71 |
+
|
72 |
+
/*
|
73 |
+
* Create a new text node for address region or state
|
74 |
+
*
|
75 |
+
* @return TextNode
|
76 |
+
*/
|
77 |
+
public static function addressRegion()
|
78 |
+
{
|
79 |
+
return new TextNode('address_region');
|
80 |
+
}
|
81 |
+
|
82 |
+
/*
|
83 |
+
* Create a new text node for address street address
|
84 |
+
*
|
85 |
+
* @return TextNode
|
86 |
+
*/
|
87 |
+
public static function addressStreetAddress()
|
88 |
+
{
|
89 |
+
return new TextNode('address_street_address');
|
90 |
+
}
|
91 |
+
|
92 |
+
/*
|
93 |
+
* Create a new text node for cardholder name
|
94 |
+
*
|
95 |
+
* @return TextNode
|
96 |
+
*/
|
97 |
+
public static function cardholderName()
|
98 |
+
{
|
99 |
+
return new TextNode('cardholder_name');
|
100 |
+
}
|
101 |
+
|
102 |
+
/*
|
103 |
+
* Create a new text node for company
|
104 |
+
*
|
105 |
+
* @return TextNode
|
106 |
+
*/
|
107 |
+
public static function company()
|
108 |
+
{
|
109 |
+
return new TextNode('company');
|
110 |
+
}
|
111 |
+
|
112 |
+
/*
|
113 |
+
* Create a new text node for email
|
114 |
+
*
|
115 |
+
* @return TextNode
|
116 |
+
*/
|
117 |
+
public static function email()
|
118 |
+
{
|
119 |
+
return new TextNode('email');
|
120 |
+
}
|
121 |
+
|
122 |
+
/*
|
123 |
+
* Create a new text node for fax
|
124 |
+
*
|
125 |
+
* @return TextNode
|
126 |
+
*/
|
127 |
+
public static function fax()
|
128 |
+
{
|
129 |
+
return new TextNode('fax');
|
130 |
+
}
|
131 |
+
|
132 |
+
// NEXT_MAJOR_VERSION this should be changed to Given name. First name is US ethnocentric
|
133 |
+
/*
|
134 |
+
* Create a new text node for customer first or given name
|
135 |
+
*
|
136 |
+
* @return TextNode
|
137 |
+
*/
|
138 |
+
public static function firstName()
|
139 |
+
{
|
140 |
+
return new TextNode('first_name');
|
141 |
+
}
|
142 |
+
|
143 |
+
/*
|
144 |
+
* Create a new text node for id
|
145 |
+
*
|
146 |
+
* @return TextNode
|
147 |
+
*/
|
148 |
+
public static function id()
|
149 |
+
{
|
150 |
+
return new TextNode('id');
|
151 |
+
}
|
152 |
+
|
153 |
+
// NEXT_MAJOR_VERSION this should be changed to Surname. Last name is US ethnocentric
|
154 |
+
/*
|
155 |
+
* Create a new text node for customer last or Surname
|
156 |
+
*
|
157 |
+
* @return TextNode
|
158 |
+
*/
|
159 |
+
public static function lastName()
|
160 |
+
{
|
161 |
+
return new TextNode('last_name');
|
162 |
+
}
|
163 |
+
|
164 |
+
/*
|
165 |
+
* Create a new text node for payment method token
|
166 |
+
*
|
167 |
+
* @return TextNode
|
168 |
+
*/
|
169 |
+
public static function paymentMethodToken()
|
170 |
+
{
|
171 |
+
return new TextNode('payment_method_token');
|
172 |
+
}
|
173 |
+
|
174 |
+
/*
|
175 |
+
* Create a new is node for payment method token with duplicate
|
176 |
+
*
|
177 |
+
* @return IsNode
|
178 |
+
*/
|
179 |
+
public static function paymentMethodTokenWithDuplicates()
|
180 |
+
{
|
181 |
+
return new IsNode('payment_method_token_with_duplicates');
|
182 |
+
}
|
183 |
+
|
184 |
+
/*
|
185 |
+
* Create a new is node for paypal account email
|
186 |
+
*
|
187 |
+
* @return IsNode
|
188 |
+
*/
|
189 |
+
public static function paypalAccountEmail()
|
190 |
+
{
|
191 |
+
return new IsNode('paypal_account_email');
|
192 |
+
}
|
193 |
+
|
194 |
+
/*
|
195 |
+
* Create a new text node for phone
|
196 |
+
*
|
197 |
+
* @return TextNode
|
198 |
+
*/
|
199 |
+
public static function phone()
|
200 |
+
{
|
201 |
+
return new TextNode('phone');
|
202 |
+
}
|
203 |
+
|
204 |
+
/*
|
205 |
+
* Create a new text node for website
|
206 |
+
*
|
207 |
+
* @return TextNode
|
208 |
+
*/
|
209 |
+
public static function website()
|
210 |
+
{
|
211 |
+
return new TextNode('website');
|
212 |
+
}
|
213 |
+
|
214 |
+
/*
|
215 |
+
* Create a new equality node for credit card expiration date
|
216 |
+
*
|
217 |
+
* @return EqualityNode
|
218 |
+
*/
|
219 |
+
public static function creditCardExpirationDate()
|
220 |
+
{
|
221 |
+
return new EqualityNode('credit_card_expiration_date');
|
222 |
+
}
|
223 |
+
|
224 |
+
/*
|
225 |
+
* Create a new equality node for credit card number
|
226 |
+
*
|
227 |
+
* @return EqualityNode
|
228 |
+
*/
|
229 |
+
public static function creditCardNumber()
|
230 |
+
{
|
231 |
+
return new PartialMatchNode('credit_card_number');
|
232 |
+
}
|
233 |
+
|
234 |
+
/*
|
235 |
+
* Create a new multiple value node for ids
|
236 |
+
*
|
237 |
+
* @return MultipleValueNode
|
238 |
+
*/
|
239 |
+
public static function ids()
|
240 |
+
{
|
241 |
+
return new MultipleValueNode('ids');
|
242 |
+
}
|
243 |
+
|
244 |
+
/*
|
245 |
+
* Create a new range node for created at
|
246 |
+
*
|
247 |
+
* @return RangeNode
|
248 |
+
*/
|
249 |
+
public static function createdAt()
|
250 |
+
{
|
251 |
+
return new RangeNode("created_at");
|
252 |
+
}
|
253 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Descriptor.php
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class Descriptor extends Instance
|
5 |
{
|
6 |
}
|
7 |
-
class_alias('Braintree\Descriptor', 'Braintree_Descriptor');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* The descriptive value on bank statements. For detailed reference information on properties, see the {@link developer docs https://developer.paypal.com/braintree/docs/reference/response/subscription#descriptor}.
|
7 |
+
*/
|
8 |
class Descriptor extends Instance
|
9 |
{
|
10 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Digest.php
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
@@ -9,7 +12,7 @@ class Digest
|
|
9 |
{
|
10 |
public static function hexDigestSha1($key, $string)
|
11 |
{
|
12 |
-
if(function_exists('hash_hmac')) {
|
13 |
return self::_builtInHmacSha1($string, $key);
|
14 |
} else {
|
15 |
return self::_hmacSha1($string, $key);
|
@@ -45,16 +48,16 @@ class Digest
|
|
45 |
public static function _hmacSha1($message, $key)
|
46 |
{
|
47 |
$pack = 'H40';
|
48 |
-
$keyDigest = sha1($key,true);
|
49 |
$innerPad = str_repeat(chr(0x36), 64);
|
50 |
$outerPad = str_repeat(chr(0x5C), 64);
|
51 |
|
52 |
for ($i = 0; $i < 20; $i++) {
|
53 |
-
$innerPad
|
54 |
-
$outerPad
|
55 |
}
|
56 |
|
57 |
-
return sha1($outerPad.pack($pack, sha1($innerPad
|
58 |
}
|
59 |
}
|
60 |
-
|
1 |
<?php
|
2 |
+
|
3 |
+
// phpcs:disable
|
4 |
+
|
5 |
namespace Braintree;
|
6 |
|
7 |
/**
|
12 |
{
|
13 |
public static function hexDigestSha1($key, $string)
|
14 |
{
|
15 |
+
if (function_exists('hash_hmac')) {
|
16 |
return self::_builtInHmacSha1($string, $key);
|
17 |
} else {
|
18 |
return self::_hmacSha1($string, $key);
|
48 |
public static function _hmacSha1($message, $key)
|
49 |
{
|
50 |
$pack = 'H40';
|
51 |
+
$keyDigest = sha1($key, true);
|
52 |
$innerPad = str_repeat(chr(0x36), 64);
|
53 |
$outerPad = str_repeat(chr(0x5C), 64);
|
54 |
|
55 |
for ($i = 0; $i < 20; $i++) {
|
56 |
+
$innerPad[$i] = $keyDigest[$i] ^ $innerPad[$i];
|
57 |
+
$outerPad[$i] = $keyDigest[$i] ^ $outerPad[$i];
|
58 |
}
|
59 |
|
60 |
+
return sha1($outerPad . pack($pack, sha1($innerPad . $message)));
|
61 |
}
|
62 |
}
|
63 |
+
// phpcs:enable
|
vendor/braintree/braintree_php/lib/Braintree/Disbursement.php
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class Disbursement extends Base
|
5 |
{
|
6 |
-
|
7 |
const TYPE_CREDIT = "credit";
|
8 |
const TYPE_DEBIT = "debit";
|
9 |
|
@@ -15,12 +19,18 @@ class Disbursement extends Base
|
|
15 |
$this->merchantAccountDetails = $disbursementAttribs['merchantAccount'];
|
16 |
|
17 |
if (isset($disbursementAttribs['merchantAccount'])) {
|
18 |
-
$this->_set(
|
|
|
19 |
MerchantAccount::factory($disbursementAttribs['merchantAccount'])
|
20 |
);
|
21 |
}
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
public function transactions()
|
25 |
{
|
26 |
$collection = Transaction::search([
|
@@ -30,6 +40,13 @@ class Disbursement extends Base
|
|
30 |
return $collection;
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public static function factory($attributes)
|
34 |
{
|
35 |
$instance = new self();
|
@@ -37,7 +54,8 @@ class Disbursement extends Base
|
|
37 |
return $instance;
|
38 |
}
|
39 |
|
40 |
-
|
|
|
41 |
{
|
42 |
$display = [
|
43 |
'id', 'merchantAccountDetails', 'exceptionMessage', 'amount',
|
@@ -46,21 +64,30 @@ class Disbursement extends Base
|
|
46 |
];
|
47 |
|
48 |
$displayAttributes = [];
|
49 |
-
foreach ($display
|
50 |
$displayAttributes[$attrib] = $this->$attrib;
|
51 |
}
|
52 |
return __CLASS__ . '[' .
|
53 |
-
Util::attributesToString($displayAttributes) .']';
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
public function isDebit()
|
57 |
{
|
58 |
return $this->disbursementType == Disbursement::TYPE_DEBIT;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
61 |
public function isCredit()
|
62 |
{
|
63 |
return $this->disbursementType == Disbursement::TYPE_CREDIT;
|
64 |
}
|
65 |
}
|
66 |
-
class_alias('Braintree\Disbursement', 'Braintree_Disbursement');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Disbursement class
|
7 |
+
* Module used in parsing Webhooks
|
8 |
+
*/
|
9 |
class Disbursement extends Base
|
10 |
{
|
|
|
11 |
const TYPE_CREDIT = "credit";
|
12 |
const TYPE_DEBIT = "debit";
|
13 |
|
19 |
$this->merchantAccountDetails = $disbursementAttribs['merchantAccount'];
|
20 |
|
21 |
if (isset($disbursementAttribs['merchantAccount'])) {
|
22 |
+
$this->_set(
|
23 |
+
'merchantAccount',
|
24 |
MerchantAccount::factory($disbursementAttribs['merchantAccount'])
|
25 |
);
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
/*
|
30 |
+
* Retrieve the transactions associated with a disbursement
|
31 |
+
*
|
32 |
+
* @return ResourceCollection
|
33 |
+
*/
|
34 |
public function transactions()
|
35 |
{
|
36 |
$collection = Transaction::search([
|
40 |
return $collection;
|
41 |
}
|
42 |
|
43 |
+
/**
|
44 |
+
* Creates an instance of a Disbursement from given attributes
|
45 |
+
*
|
46 |
+
* @param array $attributes response object attributes
|
47 |
+
*
|
48 |
+
* @return Disbursement
|
49 |
+
*/
|
50 |
public static function factory($attributes)
|
51 |
{
|
52 |
$instance = new self();
|
54 |
return $instance;
|
55 |
}
|
56 |
|
57 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
58 |
+
public function __toString()
|
59 |
{
|
60 |
$display = [
|
61 |
'id', 'merchantAccountDetails', 'exceptionMessage', 'amount',
|
64 |
];
|
65 |
|
66 |
$displayAttributes = [];
|
67 |
+
foreach ($display as $attrib) {
|
68 |
$displayAttributes[$attrib] = $this->$attrib;
|
69 |
}
|
70 |
return __CLASS__ . '[' .
|
71 |
+
Util::attributesToString($displayAttributes) . ']';
|
72 |
}
|
73 |
|
74 |
+
/*
|
75 |
+
* Determines if a Disbursement is a debit
|
76 |
+
*
|
77 |
+
* @return bool
|
78 |
+
*/
|
79 |
public function isDebit()
|
80 |
{
|
81 |
return $this->disbursementType == Disbursement::TYPE_DEBIT;
|
82 |
}
|
83 |
|
84 |
+
/*
|
85 |
+
* Determines if a Disbursement is a credit
|
86 |
+
*
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
public function isCredit()
|
90 |
{
|
91 |
return $this->disbursementType == Disbursement::TYPE_CREDIT;
|
92 |
}
|
93 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/DisbursementDetails.php
CHANGED
@@ -1,24 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Disbursement details from a transaction
|
6 |
-
* Creates an instance of DisbursementDetails as returned from a transaction
|
7 |
-
*
|
8 |
*
|
9 |
-
*
|
10 |
*
|
11 |
-
* @
|
12 |
-
* @property-read string $settlementCurrencyIsoCode
|
13 |
-
* @property-read string $settlementCurrencyExchangeRate
|
14 |
-
* @property-read string $fundsHeld
|
15 |
-
* @property-read string $success
|
16 |
-
* @property-read string $disbursementDate
|
17 |
*/
|
18 |
class DisbursementDetails extends Instance
|
19 |
{
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
return !is_null($this->disbursementDate);
|
22 |
}
|
23 |
}
|
24 |
-
class_alias('Braintree\DisbursementDetails', 'Braintree_DisbursementDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Disbursement details from a transaction
|
|
|
|
|
7 |
*
|
8 |
+
* Contains information about how and when the transaction was disbursed, including timing and currency information. This detail is only available if you have an eligible merchant account.
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction/php#disbursement_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class DisbursementDetails extends Instance
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Checks whether a Disbursement date is valid
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function isValid()
|
20 |
+
{
|
21 |
return !is_null($this->disbursementDate);
|
22 |
}
|
23 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Discount.php
CHANGED
@@ -1,8 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class Discount extends Modification
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -10,12 +25,15 @@ class Discount extends Modification
|
|
10 |
return $instance;
|
11 |
}
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
public static function all()
|
17 |
{
|
18 |
return Configuration::gateway()->discount()->all();
|
19 |
}
|
20 |
}
|
21 |
-
class_alias('Braintree\Discount', 'Braintree_Discount');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Discount class
|
7 |
+
*
|
8 |
+
* Object containing information on Discountss of a subscription
|
9 |
+
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/discount developer docs} for information on attributes
|
11 |
+
*/
|
12 |
class Discount extends Modification
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Creates an instance of a Discount from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return Discount
|
20 |
+
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
23 |
$instance = new self();
|
25 |
return $instance;
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* static methods redirecting to gateway class
|
30 |
+
*
|
31 |
+
* @see DiscountGateway::all()
|
32 |
+
*
|
33 |
+
* @return Discount[]
|
34 |
+
*/
|
35 |
public static function all()
|
36 |
{
|
37 |
return Configuration::gateway()->discount()->all();
|
38 |
}
|
39 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/DiscountGateway.php
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class DiscountGateway
|
5 |
{
|
6 |
private $_gateway;
|
7 |
private $_config;
|
8 |
private $_http;
|
9 |
|
|
|
10 |
public function __construct($gateway)
|
11 |
{
|
12 |
$this->_gateway = $gateway;
|
@@ -15,6 +22,11 @@ class DiscountGateway
|
|
15 |
$this->_http = new Http($gateway->config);
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function all()
|
19 |
{
|
20 |
$path = $this->_config->merchantPath() . '/discounts';
|
@@ -28,4 +40,3 @@ class DiscountGateway
|
|
28 |
);
|
29 |
}
|
30 |
}
|
31 |
-
class_alias('Braintree\DiscountGateway', 'Braintree_DiscountGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree DiscountGateway module
|
7 |
+
*
|
8 |
+
* Manages subscription discounts
|
9 |
+
*/
|
10 |
class DiscountGateway
|
11 |
{
|
12 |
private $_gateway;
|
13 |
private $_config;
|
14 |
private $_http;
|
15 |
|
16 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
17 |
public function __construct($gateway)
|
18 |
{
|
19 |
$this->_gateway = $gateway;
|
22 |
$this->_http = new Http($gateway->config);
|
23 |
}
|
24 |
|
25 |
+
/*
|
26 |
+
* Get all discounts
|
27 |
+
*
|
28 |
+
* @return array of discount objects
|
29 |
+
*/
|
30 |
public function all()
|
31 |
{
|
32 |
$path = $this->_config->merchantPath() . '/discounts';
|
40 |
);
|
41 |
}
|
42 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Dispute.php
CHANGED
@@ -1,19 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Creates an instance of Dispute as returned from a transaction
|
6 |
*
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
*
|
10 |
-
* @property-read string $amount
|
11 |
-
* @property-read string $currencyIsoCode
|
12 |
-
* @property-read date $receivedDate
|
13 |
-
* @property-read string $reason
|
14 |
-
* @property-read string $status
|
15 |
-
* @property-read string $disbursementDate
|
16 |
-
* @property-read object $transactionDetails
|
17 |
*/
|
18 |
class Dispute extends Base
|
19 |
{
|
@@ -27,9 +19,6 @@ class Dispute extends Base
|
|
27 |
const WON = 'won';
|
28 |
const LOST = 'lost';
|
29 |
|
30 |
-
/* deprecated; for backwards compatibilty */
|
31 |
-
const Open = 'open';
|
32 |
-
|
33 |
/* Dispute Reason */
|
34 |
const CANCELLED_RECURRING_TRANSACTION = "cancelled_recurring_transaction";
|
35 |
const CREDIT_NOT_PROCESSED = "credit_not_processed";
|
@@ -43,6 +32,11 @@ class Dispute extends Base
|
|
43 |
const TRANSACTION_AMOUNT_DIFFERS = "transaction_amount_differs";
|
44 |
const RETRIEVAL = "retrieval";
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
/* Dispute Kind */
|
47 |
const CHARGEBACK = 'chargeback';
|
48 |
const PRE_ARBITRATION = 'pre_arbitration';
|
@@ -59,26 +53,34 @@ class Dispute extends Base
|
|
59 |
}
|
60 |
|
61 |
if (isset($disputeAttribs['evidence'])) {
|
62 |
-
$evidenceArray = array_map(function($evidence) {
|
63 |
return new Dispute\EvidenceDetails($evidence);
|
64 |
}, $disputeAttribs['evidence']);
|
65 |
$this->_set('evidence', $evidenceArray);
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
if (isset($disputeAttribs['statusHistory'])) {
|
69 |
-
$statusHistoryArray = array_map(function($statusHistory) {
|
70 |
return new Dispute\StatusHistoryDetails($statusHistory);
|
71 |
}, $disputeAttribs['statusHistory']);
|
72 |
$this->_set('statusHistory', $statusHistoryArray);
|
73 |
}
|
74 |
-
|
75 |
-
if (isset($disputeAttribs['transaction'])) {
|
76 |
-
$this->_set('transaction',
|
77 |
-
new Dispute\TransactionDetails($disputeAttribs['transaction'])
|
78 |
-
);
|
79 |
-
}
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
public static function factory($attributes)
|
83 |
{
|
84 |
$instance = new self();
|
@@ -86,7 +88,8 @@ class Dispute extends Base
|
|
86 |
return $instance;
|
87 |
}
|
88 |
|
89 |
-
|
|
|
90 |
{
|
91 |
$display = [
|
92 |
'amount', 'reason', 'status',
|
@@ -94,17 +97,21 @@ class Dispute extends Base
|
|
94 |
];
|
95 |
|
96 |
$displayAttributes = [];
|
97 |
-
foreach ($display
|
98 |
$displayAttributes[$attrib] = $this->$attrib;
|
99 |
}
|
100 |
return __CLASS__ . '[' .
|
101 |
-
Util::attributesToString($displayAttributes) .']';
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
-
*
|
|
|
|
|
106 |
*
|
107 |
-
* @
|
|
|
|
|
108 |
*/
|
109 |
public static function accept($id)
|
110 |
{
|
@@ -112,10 +119,14 @@ class Dispute extends Base
|
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
-
*
|
|
|
|
|
|
|
116 |
*
|
117 |
-
* @
|
118 |
-
*
|
|
|
119 |
*/
|
120 |
public static function addFileEvidence($disputeId, $documentIdOrRequest)
|
121 |
{
|
@@ -123,10 +134,19 @@ class Dispute extends Base
|
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
*
|
128 |
-
* @
|
129 |
-
* @param string $contentOrRequest
|
130 |
*/
|
131 |
public static function addTextEvidence($id, $contentOrRequest)
|
132 |
{
|
@@ -134,9 +154,13 @@ class Dispute extends Base
|
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
-
*
|
|
|
|
|
|
|
|
|
138 |
*
|
139 |
-
* @
|
140 |
*/
|
141 |
public static function finalize($id)
|
142 |
{
|
@@ -144,9 +168,13 @@ class Dispute extends Base
|
|
144 |
}
|
145 |
|
146 |
/**
|
147 |
-
*
|
148 |
*
|
149 |
-
* @param string $id
|
|
|
|
|
|
|
|
|
150 |
*/
|
151 |
public static function find($id)
|
152 |
{
|
@@ -154,24 +182,45 @@ class Dispute extends Base
|
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
-
*
|
|
|
|
|
|
|
|
|
|
|
158 |
*
|
159 |
-
* @
|
160 |
-
* @param string $evidenceId
|
161 |
*/
|
162 |
public static function removeEvidence($disputeId, $evidenceId)
|
163 |
{
|
164 |
return Configuration::gateway()->dispute()->removeEvidence($disputeId, $evidenceId);
|
165 |
}
|
166 |
|
167 |
-
|
168 |
-
*
|
169 |
*
|
170 |
* @param DisputeSearch $query
|
|
|
|
|
|
|
|
|
171 |
*/
|
172 |
public static function search($query)
|
173 |
{
|
174 |
return Configuration::gateway()->dispute()->search($query);
|
175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
-
class_alias('Braintree\Dispute', 'Braintree_Dispute');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Creates an instance of Dispute as returned from a transaction
|
7 |
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/dispute developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
class Dispute extends Base
|
11 |
{
|
19 |
const WON = 'won';
|
20 |
const LOST = 'lost';
|
21 |
|
|
|
|
|
|
|
22 |
/* Dispute Reason */
|
23 |
const CANCELLED_RECURRING_TRANSACTION = "cancelled_recurring_transaction";
|
24 |
const CREDIT_NOT_PROCESSED = "credit_not_processed";
|
32 |
const TRANSACTION_AMOUNT_DIFFERS = "transaction_amount_differs";
|
33 |
const RETRIEVAL = "retrieval";
|
34 |
|
35 |
+
/* Dispute ChargebackProtectionLevel */
|
36 |
+
const EFFORTLESS = 'effortless';
|
37 |
+
const STANDARD = 'standard';
|
38 |
+
const NOT_PROTECTED = 'not_protected';
|
39 |
+
|
40 |
/* Dispute Kind */
|
41 |
const CHARGEBACK = 'chargeback';
|
42 |
const PRE_ARBITRATION = 'pre_arbitration';
|
53 |
}
|
54 |
|
55 |
if (isset($disputeAttribs['evidence'])) {
|
56 |
+
$evidenceArray = array_map(function ($evidence) {
|
57 |
return new Dispute\EvidenceDetails($evidence);
|
58 |
}, $disputeAttribs['evidence']);
|
59 |
$this->_set('evidence', $evidenceArray);
|
60 |
}
|
61 |
|
62 |
+
if (isset($disputeAttribs['paypalMessages'])) {
|
63 |
+
$paypalMessagesArray = array_map(function ($paypalMessages) {
|
64 |
+
return new Dispute\PayPalMessageDetails($paypalMessages);
|
65 |
+
}, $disputeAttribs['paypalMessages']);
|
66 |
+
$this->_set('paypalMessages', $paypalMessagesArray);
|
67 |
+
}
|
68 |
+
|
69 |
if (isset($disputeAttribs['statusHistory'])) {
|
70 |
+
$statusHistoryArray = array_map(function ($statusHistory) {
|
71 |
return new Dispute\StatusHistoryDetails($statusHistory);
|
72 |
}, $disputeAttribs['statusHistory']);
|
73 |
$this->_set('statusHistory', $statusHistoryArray);
|
74 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
+
/**
|
78 |
+
* Creates an instance of a Dispute from given attributes
|
79 |
+
*
|
80 |
+
* @param array $attributes response object attributes
|
81 |
+
*
|
82 |
+
* @return Dispute
|
83 |
+
*/
|
84 |
public static function factory($attributes)
|
85 |
{
|
86 |
$instance = new self();
|
88 |
return $instance;
|
89 |
}
|
90 |
|
91 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
92 |
+
public function __toString()
|
93 |
{
|
94 |
$display = [
|
95 |
'amount', 'reason', 'status',
|
97 |
];
|
98 |
|
99 |
$displayAttributes = [];
|
100 |
+
foreach ($display as $attrib) {
|
101 |
$displayAttributes[$attrib] = $this->$attrib;
|
102 |
}
|
103 |
return __CLASS__ . '[' .
|
104 |
+
Util::attributesToString($displayAttributes) . ']';
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
+
* Static methods redirecting to gateway class
|
109 |
+
*
|
110 |
+
* @param string $id unique identifier
|
111 |
*
|
112 |
+
* @see DisputeGateway::accept()
|
113 |
+
*
|
114 |
+
* @return Result\Successful|Result\Error
|
115 |
*/
|
116 |
public static function accept($id)
|
117 |
{
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
+
* Static methods redirecting to gateway class
|
123 |
+
*
|
124 |
+
* @param string $disputeId unique identifier
|
125 |
+
* @param string|object $documentIdOrRequest either a unique identifier string or request object
|
126 |
*
|
127 |
+
* @see DisputeGateway::addFileEvidence()
|
128 |
+
*
|
129 |
+
* @return Result\Successful|Result\Error
|
130 |
*/
|
131 |
public static function addFileEvidence($disputeId, $documentIdOrRequest)
|
132 |
{
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
+
* Static methods redirecting to gateway class
|
138 |
+
*
|
139 |
+
* @param string $id unique identifier
|
140 |
+
* @param string|mixed $contentOrRequest If a string, $contentOrRequest is the text-based content
|
141 |
+
* for the dispute evidence.
|
142 |
+
* Alternatively, the second argument can also be an array containing:
|
143 |
+
* - string $content The text-based content for the dispute evidence, and
|
144 |
+
* - string $category The category for this piece of evidence
|
145 |
+
* Note: (optional) string $tag parameter is deprecated, use $category instead.
|
146 |
+
*
|
147 |
+
* @see DisputeGateway::addTextEvidence()
|
148 |
*
|
149 |
+
* @return Result\Successful|Result\Error
|
|
|
150 |
*/
|
151 |
public static function addTextEvidence($id, $contentOrRequest)
|
152 |
{
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
+
* Static methods redirecting to gateway class
|
158 |
+
*
|
159 |
+
* @param string $id unique identifier
|
160 |
+
*
|
161 |
+
* @see DisputeGateway::finalize()
|
162 |
*
|
163 |
+
* @return Result\Successful|Result\Error
|
164 |
*/
|
165 |
public static function finalize($id)
|
166 |
{
|
168 |
}
|
169 |
|
170 |
/**
|
171 |
+
* Static methods redirecting to gateway class
|
172 |
*
|
173 |
+
* @param string $id unique identifier
|
174 |
+
*
|
175 |
+
* @see DisputeGateway::find()
|
176 |
+
*
|
177 |
+
* @return Result\Successful|Result\Error
|
178 |
*/
|
179 |
public static function find($id)
|
180 |
{
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
+
* Static methods redirecting to gateway class
|
186 |
+
*
|
187 |
+
* @param string $disputeId unique identifier
|
188 |
+
* @param string $evidenceId unique identifier
|
189 |
+
*
|
190 |
+
* @see DisputeGateway::removeEvidence()
|
191 |
*
|
192 |
+
* @return Result\Successful|Result\Error
|
|
|
193 |
*/
|
194 |
public static function removeEvidence($disputeId, $evidenceId)
|
195 |
{
|
196 |
return Configuration::gateway()->dispute()->removeEvidence($disputeId, $evidenceId);
|
197 |
}
|
198 |
|
199 |
+
/*
|
200 |
+
* Static methods redirecting to gateway class
|
201 |
*
|
202 |
* @param DisputeSearch $query
|
203 |
+
*
|
204 |
+
* @see DisputeGateway::search()
|
205 |
+
*
|
206 |
+
* @return ResourceCollection|Result\Error
|
207 |
*/
|
208 |
public static function search($query)
|
209 |
{
|
210 |
return Configuration::gateway()->dispute()->search($query);
|
211 |
}
|
212 |
+
|
213 |
+
/*
|
214 |
+
* Retrive all types of chargeback protection level types
|
215 |
+
*
|
216 |
+
* @return array
|
217 |
+
*/
|
218 |
+
public static function allChargebackProtectionLevelTypes()
|
219 |
+
{
|
220 |
+
return [
|
221 |
+
Dispute::EFFORTLESS,
|
222 |
+
Dispute::STANDARD,
|
223 |
+
Dispute::NOT_PROTECTED
|
224 |
+
];
|
225 |
+
}
|
226 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Dispute/EvidenceDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Dispute;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -6,19 +7,11 @@ use Braintree\Instance;
|
|
6 |
/**
|
7 |
* Evidence details for a dispute
|
8 |
*
|
9 |
-
* @
|
10 |
-
*
|
11 |
-
* @property-read string $category
|
12 |
-
* @property-read string $comment
|
13 |
-
* @property-read date $created_at
|
14 |
-
* @property-read string $id
|
15 |
-
* @property-read string $sent_to_processor_at
|
16 |
-
* @property-read string $url
|
17 |
-
* @property-read string $tag
|
18 |
-
* @property-read string $sequenceNumber
|
19 |
*/
|
20 |
class EvidenceDetails extends Instance
|
21 |
{
|
|
|
22 |
public function __construct($attributes)
|
23 |
{
|
24 |
if (array_key_exists('category', $attributes)) {
|
@@ -27,5 +20,3 @@ class EvidenceDetails extends Instance
|
|
27 |
parent::__construct($attributes);
|
28 |
}
|
29 |
}
|
30 |
-
|
31 |
-
class_alias('Braintree\Dispute\EvidenceDetails', 'Braintree_Dispute_EvidenceDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Dispute;
|
4 |
|
5 |
use Braintree\Instance;
|
7 |
/**
|
8 |
* Evidence details for a dispute
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/dispute#evidence developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class EvidenceDetails extends Instance
|
13 |
{
|
14 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
15 |
public function __construct($attributes)
|
16 |
{
|
17 |
if (array_key_exists('category', $attributes)) {
|
20 |
parent::__construct($attributes);
|
21 |
}
|
22 |
}
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Dispute/PayPalMessageDetails.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Dispute;
|
4 |
+
|
5 |
+
use Braintree\Instance;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* PayPal Message for a dispute
|
9 |
+
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/dispute#paypal_messages developer docs} for information on attributes
|
11 |
+
*/
|
12 |
+
class PayPalMessageDetails extends Instance
|
13 |
+
{
|
14 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Dispute/StatusHistoryDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Dispute;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -6,15 +7,8 @@ use Braintree\Instance;
|
|
6 |
/**
|
7 |
* Status History for a dispute
|
8 |
*
|
9 |
-
* @
|
10 |
-
*
|
11 |
-
* @property-read string $effective_date
|
12 |
-
* @property-read string $disbursement_date
|
13 |
-
* @property-read string $status
|
14 |
-
* @property-read date $timestamp
|
15 |
*/
|
16 |
class StatusHistoryDetails extends Instance
|
17 |
{
|
18 |
}
|
19 |
-
|
20 |
-
class_alias('Braintree\Dispute\StatusHistoryDetails', 'Braintree_Dispute_StatusHistoryDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Dispute;
|
4 |
|
5 |
use Braintree\Instance;
|
7 |
/**
|
8 |
* Status History for a dispute
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/dispute#status_history developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class StatusHistoryDetails extends Instance
|
13 |
{
|
14 |
}
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Dispute/TransactionDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Dispute;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -6,20 +7,8 @@ use Braintree\Instance;
|
|
6 |
/**
|
7 |
* Transaction details for a dispute
|
8 |
*
|
9 |
-
* @
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Creates an instance of DisbursementDetails as returned from a transaction
|
14 |
-
*
|
15 |
-
*
|
16 |
-
* @package Braintree
|
17 |
-
*
|
18 |
-
* @property-read string $amount
|
19 |
-
* @property-read string $id
|
20 |
*/
|
21 |
class TransactionDetails extends Instance
|
22 |
{
|
23 |
}
|
24 |
-
|
25 |
-
class_alias('Braintree\Dispute\TransactionDetails', 'Braintree_Dispute_TransactionDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Dispute;
|
4 |
|
5 |
use Braintree\Instance;
|
7 |
/**
|
8 |
* Transaction details for a dispute
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/dispute#transaction developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class TransactionDetails extends Instance
|
13 |
{
|
14 |
}
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/DisputeGateway.php
CHANGED
@@ -1,35 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
6 |
/**
|
7 |
* Braintree DisputeGateway module
|
8 |
-
* PHP Version 5
|
9 |
* Creates and manages Braintree Disputes
|
10 |
-
*
|
11 |
-
* @package Braintree
|
12 |
*/
|
13 |
class DisputeGateway
|
14 |
{
|
15 |
-
/**
|
16 |
-
* @var Gateway
|
17 |
-
*/
|
18 |
private $_gateway;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var Configuration
|
22 |
-
*/
|
23 |
private $_config;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var Http
|
27 |
-
*/
|
28 |
private $_http;
|
29 |
|
30 |
-
|
31 |
-
* @param Gateway $gateway
|
32 |
-
*/
|
33 |
public function __construct($gateway)
|
34 |
{
|
35 |
$this->_gateway = $gateway;
|
@@ -38,17 +23,17 @@ class DisputeGateway
|
|
38 |
$this->_http = new Http($gateway->config);
|
39 |
}
|
40 |
|
41 |
-
/* public class methods */
|
42 |
-
|
43 |
/**
|
44 |
* Accepts a dispute, given a dispute ID
|
45 |
*
|
46 |
-
* @param string $id
|
|
|
|
|
47 |
*/
|
48 |
public function accept($id)
|
49 |
{
|
50 |
try {
|
51 |
-
if (trim($id) == "") {
|
52 |
throw new Exception\NotFound();
|
53 |
}
|
54 |
|
@@ -68,18 +53,20 @@ class DisputeGateway
|
|
68 |
/**
|
69 |
* Adds file evidence to a dispute, given a dispute ID and a document ID
|
70 |
*
|
71 |
-
* @param string $disputeId
|
72 |
-
* @param string $documentIdOrRequest
|
|
|
|
|
73 |
*/
|
74 |
public function addFileEvidence($disputeId, $documentIdOrRequest)
|
75 |
{
|
76 |
$request = is_array($documentIdOrRequest) ? $documentIdOrRequest : ['documentId' => $documentIdOrRequest];
|
77 |
|
78 |
-
if (trim($disputeId) == "") {
|
79 |
throw new Exception\NotFound('dispute with id "' . $disputeId . '" not found');
|
80 |
}
|
81 |
|
82 |
-
if (trim($request['documentId']) == "") {
|
83 |
throw new Exception\NotFound('document with id "' . $request['documentId'] . '" not found');
|
84 |
}
|
85 |
|
@@ -112,13 +99,15 @@ class DisputeGateway
|
|
112 |
/**
|
113 |
* Adds text evidence to a dispute, given a dispute ID and content
|
114 |
*
|
115 |
-
* @param string $id
|
116 |
-
* @param
|
|
|
|
|
117 |
*/
|
118 |
public function addTextEvidence($id, $contentOrRequest)
|
119 |
{
|
120 |
$request = is_array($contentOrRequest) ? $contentOrRequest : ['content' => $contentOrRequest];
|
121 |
-
if (trim($request['content']) == "") {
|
122 |
throw new InvalidArgumentException('content cannot be blank');
|
123 |
}
|
124 |
|
@@ -127,11 +116,12 @@ class DisputeGateway
|
|
127 |
'comments' => $request['content'],
|
128 |
];
|
129 |
|
130 |
-
if (trim($id) == "") {
|
131 |
throw new Exception\NotFound();
|
132 |
}
|
133 |
|
134 |
if (array_key_exists('tag', $request)) {
|
|
|
135 |
$evidence['category'] = $request['tag'];
|
136 |
}
|
137 |
|
@@ -145,7 +135,7 @@ class DisputeGateway
|
|
145 |
if (array_key_exists('sequenceNumber', $request)) {
|
146 |
if (trim($request['sequenceNumber']) == "") {
|
147 |
throw new InvalidArgumentException('sequenceNumber cannot be blank');
|
148 |
-
}
|
149 |
throw new InvalidArgumentException('sequenceNumber must be an integer');
|
150 |
}
|
151 |
$evidence['sequenceNumber'] = (int)$request['sequenceNumber'];
|
@@ -172,12 +162,14 @@ class DisputeGateway
|
|
172 |
/**
|
173 |
* Finalize a dispute, given a dispute ID
|
174 |
*
|
175 |
-
* @param string $id
|
|
|
|
|
176 |
*/
|
177 |
public function finalize($id)
|
178 |
{
|
179 |
try {
|
180 |
-
if (trim($id) == "") {
|
181 |
throw new Exception\NotFound();
|
182 |
}
|
183 |
|
@@ -197,11 +189,13 @@ class DisputeGateway
|
|
197 |
/**
|
198 |
* Find a dispute, given a dispute ID
|
199 |
*
|
200 |
-
* @param string $id
|
|
|
|
|
201 |
*/
|
202 |
public function find($id)
|
203 |
{
|
204 |
-
if (trim($id) == "") {
|
205 |
throw new Exception\NotFound('dispute with id "' . $id . '" not found');
|
206 |
}
|
207 |
|
@@ -217,13 +211,15 @@ class DisputeGateway
|
|
217 |
/**
|
218 |
* Remove evidence from a dispute, given a dispute ID and evidence ID
|
219 |
*
|
220 |
-
* @param string $disputeId
|
221 |
-
* @param string $evidenceId
|
|
|
|
|
222 |
*/
|
223 |
public function removeEvidence($disputeId, $evidenceId)
|
224 |
{
|
225 |
try {
|
226 |
-
if (trim($disputeId) == "" || trim($evidenceId) == "") {
|
227 |
throw new Exception\NotFound();
|
228 |
}
|
229 |
|
@@ -236,14 +232,17 @@ class DisputeGateway
|
|
236 |
|
237 |
return new Result\Successful();
|
238 |
} catch (Exception\NotFound $e) {
|
239 |
-
|
|
|
240 |
}
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
* Search for Disputes, given a DisputeSearch query
|
245 |
*
|
246 |
-
* @param
|
|
|
|
|
247 |
*/
|
248 |
public function search($query)
|
249 |
{
|
@@ -259,6 +258,14 @@ class DisputeGateway
|
|
259 |
return new PaginatedCollection($pager);
|
260 |
}
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
public function fetchDisputes($query, $page)
|
263 |
{
|
264 |
$response = $this->_http->post($this->_config->merchantPath() . '/disputes/advanced_search?page=' . $page, [
|
@@ -271,4 +278,3 @@ class DisputeGateway
|
|
271 |
return new PaginatedResult($totalItems, $pageSize, $disputes);
|
272 |
}
|
273 |
}
|
274 |
-
class_alias('Braintree\DisputeGateway', 'Braintree_DisputeGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
/**
|
8 |
* Braintree DisputeGateway module
|
|
|
9 |
* Creates and manages Braintree Disputes
|
|
|
|
|
10 |
*/
|
11 |
class DisputeGateway
|
12 |
{
|
|
|
|
|
|
|
13 |
private $_gateway;
|
|
|
|
|
|
|
|
|
14 |
private $_config;
|
|
|
|
|
|
|
|
|
15 |
private $_http;
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
18 |
public function __construct($gateway)
|
19 |
{
|
20 |
$this->_gateway = $gateway;
|
23 |
$this->_http = new Http($gateway->config);
|
24 |
}
|
25 |
|
|
|
|
|
26 |
/**
|
27 |
* Accepts a dispute, given a dispute ID
|
28 |
*
|
29 |
+
* @param string $id of the dispute to be accepted
|
30 |
+
*
|
31 |
+
* @return Dispute|Exception\NotFound|Result\Error
|
32 |
*/
|
33 |
public function accept($id)
|
34 |
{
|
35 |
try {
|
36 |
+
if (is_null($id) || trim($id) == "") {
|
37 |
throw new Exception\NotFound();
|
38 |
}
|
39 |
|
53 |
/**
|
54 |
* Adds file evidence to a dispute, given a dispute ID and a document ID
|
55 |
*
|
56 |
+
* @param string $disputeId to have evidence added
|
57 |
+
* @param string $documentIdOrRequest either a string of the unique identifier for a DocumentUpload object or a set of request params including the DocumentUpload ID
|
58 |
+
*
|
59 |
+
* @return EvidenceDetails|Exception\NotFound
|
60 |
*/
|
61 |
public function addFileEvidence($disputeId, $documentIdOrRequest)
|
62 |
{
|
63 |
$request = is_array($documentIdOrRequest) ? $documentIdOrRequest : ['documentId' => $documentIdOrRequest];
|
64 |
|
65 |
+
if (is_null($disputeId) || trim($disputeId) == "") {
|
66 |
throw new Exception\NotFound('dispute with id "' . $disputeId . '" not found');
|
67 |
}
|
68 |
|
69 |
+
if (is_null($request['documentId']) || trim($request['documentId']) == "") {
|
70 |
throw new Exception\NotFound('document with id "' . $request['documentId'] . '" not found');
|
71 |
}
|
72 |
|
99 |
/**
|
100 |
* Adds text evidence to a dispute, given a dispute ID and content
|
101 |
*
|
102 |
+
* @param string $id of the dispute
|
103 |
+
* @param mixed $contentOrRequest text-based content for the dispute evidence
|
104 |
+
*
|
105 |
+
* @return EvidenceDetails|Exception\NotFound
|
106 |
*/
|
107 |
public function addTextEvidence($id, $contentOrRequest)
|
108 |
{
|
109 |
$request = is_array($contentOrRequest) ? $contentOrRequest : ['content' => $contentOrRequest];
|
110 |
+
if (is_null($request['content']) || trim($request['content']) == "") {
|
111 |
throw new InvalidArgumentException('content cannot be blank');
|
112 |
}
|
113 |
|
116 |
'comments' => $request['content'],
|
117 |
];
|
118 |
|
119 |
+
if (is_null($id) || trim($id) == "") {
|
120 |
throw new Exception\NotFound();
|
121 |
}
|
122 |
|
123 |
if (array_key_exists('tag', $request)) {
|
124 |
+
trigger_error('$tag is deprecated, use $category instead', E_USER_DEPRECATED);
|
125 |
$evidence['category'] = $request['tag'];
|
126 |
}
|
127 |
|
135 |
if (array_key_exists('sequenceNumber', $request)) {
|
136 |
if (trim($request['sequenceNumber']) == "") {
|
137 |
throw new InvalidArgumentException('sequenceNumber cannot be blank');
|
138 |
+
} elseif ((string)(int)($request['sequenceNumber']) != $request['sequenceNumber']) {
|
139 |
throw new InvalidArgumentException('sequenceNumber must be an integer');
|
140 |
}
|
141 |
$evidence['sequenceNumber'] = (int)$request['sequenceNumber'];
|
162 |
/**
|
163 |
* Finalize a dispute, given a dispute ID
|
164 |
*
|
165 |
+
* @param string $id of the dispute
|
166 |
+
*
|
167 |
+
* @return Dispute|Result\Error
|
168 |
*/
|
169 |
public function finalize($id)
|
170 |
{
|
171 |
try {
|
172 |
+
if (is_null($id) || trim($id) == "") {
|
173 |
throw new Exception\NotFound();
|
174 |
}
|
175 |
|
189 |
/**
|
190 |
* Find a dispute, given a dispute ID
|
191 |
*
|
192 |
+
* @param string $id of the dispute
|
193 |
+
*
|
194 |
+
* @return Dispute|Exception\NotFound
|
195 |
*/
|
196 |
public function find($id)
|
197 |
{
|
198 |
+
if (is_null($id) || trim($id) == "") {
|
199 |
throw new Exception\NotFound('dispute with id "' . $id . '" not found');
|
200 |
}
|
201 |
|
211 |
/**
|
212 |
* Remove evidence from a dispute, given a dispute ID and evidence ID
|
213 |
*
|
214 |
+
* @param string $disputeId unique dispute identifier
|
215 |
+
* @param string $evidenceId uniqye evidence identifier
|
216 |
+
*
|
217 |
+
* @return true|Result\Error|Exception\NotFound
|
218 |
*/
|
219 |
public function removeEvidence($disputeId, $evidenceId)
|
220 |
{
|
221 |
try {
|
222 |
+
if (is_null($disputeId) || trim($disputeId) == "" || is_null($evidenceId) || trim($evidenceId) == "") {
|
223 |
throw new Exception\NotFound();
|
224 |
}
|
225 |
|
232 |
|
233 |
return new Result\Successful();
|
234 |
} catch (Exception\NotFound $e) {
|
235 |
+
$message = 'evidence with id "' . $evidenceId . '" for dispute with id "' . $disputeId . '" not found';
|
236 |
+
throw new Exception\NotFound($message);
|
237 |
}
|
238 |
}
|
239 |
|
240 |
/**
|
241 |
* Search for Disputes, given a DisputeSearch query
|
242 |
*
|
243 |
+
* @param array $query containing search fields
|
244 |
+
*
|
245 |
+
* @return ResourceCollection of Dispute objects
|
246 |
*/
|
247 |
public function search($query)
|
248 |
{
|
258 |
return new PaginatedCollection($pager);
|
259 |
}
|
260 |
|
261 |
+
/**
|
262 |
+
* Similar to search, with a paging object
|
263 |
+
*
|
264 |
+
* @param array $query containing search fields
|
265 |
+
* @param object $page to iterate over results
|
266 |
+
*
|
267 |
+
* @return PaginatedResults
|
268 |
+
*/
|
269 |
public function fetchDisputes($query, $page)
|
270 |
{
|
271 |
$response = $this->_http->post($this->_config->merchantPath() . '/disputes/advanced_search?page=' . $page, [
|
278 |
return new PaginatedResult($totalItems, $pageSize, $disputes);
|
279 |
}
|
280 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/DisputeSearch.php
CHANGED
@@ -1,90 +1,189 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class DisputeSearch
|
5 |
{
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
return new RangeNode("amount_disputed");
|
8 |
}
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
public static function amountWon()
|
11 |
{
|
12 |
return new RangeNode("amount_won");
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
public static function caseNumber()
|
16 |
{
|
17 |
return new TextNode("case_number");
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
public static function id()
|
21 |
{
|
22 |
return new TextNode("id");
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
public static function customerId()
|
26 |
{
|
27 |
return new TextNode("customer_id");
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
public static function kind()
|
31 |
{
|
32 |
return new MultipleValueNode("kind");
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
public static function merchantAccountId()
|
36 |
{
|
37 |
return new MultipleValueNode("merchant_account_id");
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
public static function reason()
|
41 |
{
|
42 |
return new MultipleValueNode("reason");
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
public static function reasonCode()
|
46 |
{
|
47 |
return new MultipleValueNode("reason_code");
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
public static function receivedDate()
|
51 |
{
|
52 |
return new RangeNode("received_date");
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
public static function disbursementDate()
|
56 |
{
|
57 |
return new RangeNode("disbursement_date");
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
60 |
public static function effectiveDate()
|
61 |
{
|
62 |
return new RangeNode("effective_date");
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
public static function referenceNumber()
|
66 |
{
|
67 |
return new TextNode("reference_number");
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
public static function replyByDate()
|
71 |
{
|
72 |
return new RangeNode("reply_by_date");
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
public static function status()
|
76 |
{
|
77 |
return new MultipleValueNode("status");
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
public static function transactionId()
|
81 |
{
|
82 |
return new TextNode("transaction_id");
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
public static function transactionSource()
|
86 |
{
|
87 |
return new MultipleValueNode("transaction_source");
|
88 |
}
|
89 |
}
|
90 |
-
class_alias('Braintree\DisputeSearch', 'Braintree_DisputeSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class for running dispute searches
|
7 |
+
*/
|
8 |
class DisputeSearch
|
9 |
{
|
10 |
+
/*
|
11 |
+
* Create a new range node for amount disputed
|
12 |
+
*
|
13 |
+
* @return RangeNode
|
14 |
+
*/
|
15 |
+
public static function amountDisputed()
|
16 |
+
{
|
17 |
return new RangeNode("amount_disputed");
|
18 |
}
|
19 |
|
20 |
+
/*
|
21 |
+
* Create a new range node for amount won
|
22 |
+
*
|
23 |
+
* @return RangeNode
|
24 |
+
*/
|
25 |
public static function amountWon()
|
26 |
{
|
27 |
return new RangeNode("amount_won");
|
28 |
}
|
29 |
|
30 |
+
/*
|
31 |
+
* Create a new text node for case number
|
32 |
+
*
|
33 |
+
* @return TextNode
|
34 |
+
*/
|
35 |
public static function caseNumber()
|
36 |
{
|
37 |
return new TextNode("case_number");
|
38 |
}
|
39 |
|
40 |
+
/*
|
41 |
+
* Create a new text node for id
|
42 |
+
*
|
43 |
+
* @return TextNode
|
44 |
+
*/
|
45 |
public static function id()
|
46 |
{
|
47 |
return new TextNode("id");
|
48 |
}
|
49 |
|
50 |
+
/*
|
51 |
+
* Create a new text node for customer id
|
52 |
+
*
|
53 |
+
* @return TextNode
|
54 |
+
*/
|
55 |
public static function customerId()
|
56 |
{
|
57 |
return new TextNode("customer_id");
|
58 |
}
|
59 |
|
60 |
+
/*
|
61 |
+
* Create a new multiple value node for kind
|
62 |
+
*
|
63 |
+
* @return MultipleValueNode
|
64 |
+
*/
|
65 |
public static function kind()
|
66 |
{
|
67 |
return new MultipleValueNode("kind");
|
68 |
}
|
69 |
|
70 |
+
/*
|
71 |
+
* Create a new multiple value node for merchant account id
|
72 |
+
*
|
73 |
+
* @return MultipleValueNode
|
74 |
+
*/
|
75 |
public static function merchantAccountId()
|
76 |
{
|
77 |
return new MultipleValueNode("merchant_account_id");
|
78 |
}
|
79 |
|
80 |
+
/*
|
81 |
+
* Create a new multiple value node for reason
|
82 |
+
*
|
83 |
+
* @return MultipleValueNode
|
84 |
+
*/
|
85 |
public static function reason()
|
86 |
{
|
87 |
return new MultipleValueNode("reason");
|
88 |
}
|
89 |
|
90 |
+
/*
|
91 |
+
* Create a new multiple value node for reason code
|
92 |
+
*
|
93 |
+
* @return MultipleValueNode
|
94 |
+
*/
|
95 |
public static function reasonCode()
|
96 |
{
|
97 |
return new MultipleValueNode("reason_code");
|
98 |
}
|
99 |
|
100 |
+
/*
|
101 |
+
* Create a new range node for received date
|
102 |
+
*
|
103 |
+
* @return RangeNode
|
104 |
+
*/
|
105 |
public static function receivedDate()
|
106 |
{
|
107 |
return new RangeNode("received_date");
|
108 |
}
|
109 |
|
110 |
+
/*
|
111 |
+
* Create a new range node for disbursement date
|
112 |
+
*
|
113 |
+
* @return RangeNode
|
114 |
+
*/
|
115 |
public static function disbursementDate()
|
116 |
{
|
117 |
return new RangeNode("disbursement_date");
|
118 |
}
|
119 |
|
120 |
+
/*
|
121 |
+
* Create a new range node for effective date
|
122 |
+
*
|
123 |
+
* @return RangeNode
|
124 |
+
*/
|
125 |
public static function effectiveDate()
|
126 |
{
|
127 |
return new RangeNode("effective_date");
|
128 |
}
|
129 |
|
130 |
+
/*
|
131 |
+
* Create a new text node for reference number
|
132 |
+
*
|
133 |
+
* @return TextNode
|
134 |
+
*/
|
135 |
public static function referenceNumber()
|
136 |
{
|
137 |
return new TextNode("reference_number");
|
138 |
}
|
139 |
|
140 |
+
/*
|
141 |
+
* Create a new range node for reply by date
|
142 |
+
*
|
143 |
+
* @return RangeNode
|
144 |
+
*/
|
145 |
public static function replyByDate()
|
146 |
{
|
147 |
return new RangeNode("reply_by_date");
|
148 |
}
|
149 |
|
150 |
+
/*
|
151 |
+
* Create a new multiple value node for status
|
152 |
+
*
|
153 |
+
* @return MultipleValueNode
|
154 |
+
*/
|
155 |
public static function status()
|
156 |
{
|
157 |
return new MultipleValueNode("status");
|
158 |
}
|
159 |
|
160 |
+
/*
|
161 |
+
* Create a new multiple value node for chargeback protection level
|
162 |
+
*
|
163 |
+
* @return MultipleValueNode
|
164 |
+
*/
|
165 |
+
public static function chargebackProtectionLevel()
|
166 |
+
{
|
167 |
+
return new MultipleValueNode("chargeback_protection_level", Dispute::allChargebackProtectionLevelTypes());
|
168 |
+
}
|
169 |
+
|
170 |
+
/*
|
171 |
+
* Create a new text node for transaction id
|
172 |
+
*
|
173 |
+
* @return TextNode
|
174 |
+
*/
|
175 |
public static function transactionId()
|
176 |
{
|
177 |
return new TextNode("transaction_id");
|
178 |
}
|
179 |
|
180 |
+
/*
|
181 |
+
* Create a new multiple value node for transaction source
|
182 |
+
*
|
183 |
+
* @return MultipleValueNode
|
184 |
+
*/
|
185 |
public static function transactionSource()
|
186 |
{
|
187 |
return new MultipleValueNode("transaction_source");
|
188 |
}
|
189 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/DocumentUpload.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -12,7 +13,7 @@ use InvalidArgumentException;
|
|
12 |
* "file" => $pngFile
|
13 |
* ]);
|
14 |
*
|
15 |
-
*
|
16 |
*/
|
17 |
class DocumentUpload extends Base
|
18 |
{
|
@@ -26,15 +27,27 @@ class DocumentUpload extends Base
|
|
26 |
|
27 |
/**
|
28 |
* Creates a DocumentUpload object
|
29 |
-
*
|
30 |
-
* @param
|
|
|
|
|
|
|
31 |
* @throws InvalidArgumentException if the params are not expected
|
|
|
|
|
32 |
*/
|
33 |
public static function create($params)
|
34 |
{
|
35 |
return Configuration::gateway()->documentUpload()->create($params);
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
public static function factory($attributes)
|
39 |
{
|
40 |
$instance = new self();
|
@@ -42,4 +55,3 @@ class DocumentUpload extends Base
|
|
42 |
return $instance;
|
43 |
}
|
44 |
}
|
45 |
-
class_alias('Braintree\DocumentUpload', 'Braintree_DocumentUpload');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
13 |
* "file" => $pngFile
|
14 |
* ]);
|
15 |
*
|
16 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/document-upload developer docs} for information on attributes
|
17 |
*/
|
18 |
class DocumentUpload extends Base
|
19 |
{
|
27 |
|
28 |
/**
|
29 |
* Creates a DocumentUpload object
|
30 |
+
*
|
31 |
+
* @param mixed $params containing:
|
32 |
+
* kind - The kind of document
|
33 |
+
* file - The open file to upload
|
34 |
+
*
|
35 |
* @throws InvalidArgumentException if the params are not expected
|
36 |
+
*
|
37 |
+
* @return Result\Successful|Result\Error
|
38 |
*/
|
39 |
public static function create($params)
|
40 |
{
|
41 |
return Configuration::gateway()->documentUpload()->create($params);
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Creates an instance of a DocumentUpload from given attributes
|
46 |
+
*
|
47 |
+
* @param array $attributes response object attributes
|
48 |
+
*
|
49 |
+
* @return DocumentUpload
|
50 |
+
*/
|
51 |
public static function factory($attributes)
|
52 |
{
|
53 |
$instance = new self();
|
55 |
return $instance;
|
56 |
}
|
57 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/DocumentUploadGateway.php
CHANGED
@@ -1,35 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
6 |
/**
|
7 |
* Braintree DisputeGateway module
|
8 |
-
* PHP Version 5
|
9 |
* Creates and manages Braintree Disputes
|
10 |
-
*
|
11 |
-
* @package Braintree
|
12 |
*/
|
13 |
class DocumentUploadGateway
|
14 |
{
|
15 |
-
/**
|
16 |
-
* @var Gateway
|
17 |
-
*/
|
18 |
private $_gateway;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var Configuration
|
22 |
-
*/
|
23 |
private $_config;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var Http
|
27 |
-
*/
|
28 |
private $_http;
|
29 |
|
30 |
-
|
31 |
-
* @param Gateway $gateway
|
32 |
-
*/
|
33 |
public function __construct($gateway)
|
34 |
{
|
35 |
$this->_gateway = $gateway;
|
@@ -38,12 +23,16 @@ class DocumentUploadGateway
|
|
38 |
$this->_http = new Http($gateway->config);
|
39 |
}
|
40 |
|
41 |
-
/* public class methods */
|
42 |
-
|
43 |
/**
|
44 |
* Accepts a dispute, given a dispute ID
|
45 |
*
|
46 |
-
* @param
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
*/
|
48 |
public function create($params)
|
49 |
{
|
@@ -71,6 +60,11 @@ class DocumentUploadGateway
|
|
71 |
}
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
public static function createSignature()
|
75 |
{
|
76 |
return [
|
@@ -78,4 +72,3 @@ class DocumentUploadGateway
|
|
78 |
];
|
79 |
}
|
80 |
}
|
81 |
-
class_alias('Braintree\DocumentUploadGateway', 'Braintree_DocumentUploadGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
/**
|
8 |
* Braintree DisputeGateway module
|
|
|
9 |
* Creates and manages Braintree Disputes
|
|
|
|
|
10 |
*/
|
11 |
class DocumentUploadGateway
|
12 |
{
|
|
|
|
|
|
|
13 |
private $_gateway;
|
|
|
|
|
|
|
|
|
14 |
private $_config;
|
|
|
|
|
|
|
|
|
15 |
private $_http;
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
18 |
public function __construct($gateway)
|
19 |
{
|
20 |
$this->_gateway = $gateway;
|
23 |
$this->_http = new Http($gateway->config);
|
24 |
}
|
25 |
|
|
|
|
|
26 |
/**
|
27 |
* Accepts a dispute, given a dispute ID
|
28 |
*
|
29 |
+
* @param mixed $params containing:
|
30 |
+
* kind - The kind of document
|
31 |
+
* file - The open file to upload
|
32 |
+
*
|
33 |
+
* @throws InvalidArgumentException if the params are not expected
|
34 |
+
*
|
35 |
+
* @return Result\Successful|Result\Error
|
36 |
*/
|
37 |
public function create($params)
|
38 |
{
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
/*
|
64 |
+
* Returns keys that are acceptable for create requests
|
65 |
+
*
|
66 |
+
* @see create
|
67 |
+
*/
|
68 |
public static function createSignature()
|
69 |
{
|
70 |
return [
|
72 |
];
|
73 |
}
|
74 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/EndsWithNode.php
CHANGED
@@ -1,23 +1,40 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class EndsWithNode
|
5 |
{
|
|
|
6 |
public function __construct($name)
|
7 |
{
|
8 |
$this->name = $name;
|
9 |
$this->searchTerms = [];
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function endsWith($value)
|
13 |
{
|
14 |
$this->searchTerms["ends_with"] = strval($value);
|
15 |
return $this;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function toParam()
|
19 |
{
|
20 |
return $this->searchTerms;
|
21 |
}
|
22 |
}
|
23 |
-
class_alias('Braintree\EndsWithNode', 'Braintree_EndsWithNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree EndsWithNode
|
7 |
+
* EndsWithNode is an object for search elements to the Braintree API
|
8 |
+
*/
|
9 |
class EndsWithNode
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($name)
|
13 |
{
|
14 |
$this->name = $name;
|
15 |
$this->searchTerms = [];
|
16 |
}
|
17 |
|
18 |
+
/*
|
19 |
+
* sets search terms to include the value for key "ends_with"
|
20 |
+
*
|
21 |
+
* @param string $value to be sent
|
22 |
+
*
|
23 |
+
* @return self
|
24 |
+
*/
|
25 |
public function endsWith($value)
|
26 |
{
|
27 |
$this->searchTerms["ends_with"] = strval($value);
|
28 |
return $this;
|
29 |
}
|
30 |
|
31 |
+
/*
|
32 |
+
* Returns params
|
33 |
+
*
|
34 |
+
* @return object
|
35 |
+
*/
|
36 |
public function toParam()
|
37 |
{
|
38 |
return $this->searchTerms;
|
39 |
}
|
40 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/EnrichedCustomerData.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree EnrichedCustomerData module
|
7 |
+
*/
|
8 |
+
class EnrichedCustomerData extends Base
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* factory method: returns an instance of EnrichedCustomerData
|
12 |
+
* to the requesting method, with populated properties
|
13 |
+
*
|
14 |
+
* @param array $attributes used to create the object
|
15 |
+
*
|
16 |
+
* @return EnrichedCustomerData
|
17 |
+
*/
|
18 |
+
public static function factory($attributes)
|
19 |
+
{
|
20 |
+
$instance = new self();
|
21 |
+
$instance->_initialize($attributes);
|
22 |
+
return $instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _initialize($enrichedCustomerDataAttribs)
|
26 |
+
{
|
27 |
+
// set the attributes
|
28 |
+
$this->_attributes = $enrichedCustomerDataAttribs;
|
29 |
+
|
30 |
+
if (isset($enrichedCustomerDataAttribs['profileData'])) {
|
31 |
+
$this->_set(
|
32 |
+
'profileData',
|
33 |
+
VenmoProfileData::factory(
|
34 |
+
$enrichedCustomerDataAttribs['profileData']
|
35 |
+
)
|
36 |
+
);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
41 |
+
public function __toString()
|
42 |
+
{
|
43 |
+
return __CLASS__ . '[' .
|
44 |
+
Util::attributesToString($this->_attributes) . ']';
|
45 |
+
}
|
46 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/EqualityNode.php
CHANGED
@@ -1,12 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class EqualityNode extends IsNode
|
5 |
{
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
{
|
8 |
$this->searchTerms['is_not'] = strval($value);
|
9 |
return $this;
|
10 |
}
|
11 |
}
|
12 |
-
class_alias('Braintree\EqualityNode', 'Braintree_EqualityNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree IsNode
|
7 |
+
* IsNode is an object for search elements to the Braintree API
|
8 |
+
*/
|
9 |
class EqualityNode extends IsNode
|
10 |
{
|
11 |
+
/**
|
12 |
+
* Sets the value of the object's "is_not" key to a string of $value
|
13 |
+
*
|
14 |
+
* @param object $value to have its string value set in $this
|
15 |
+
*
|
16 |
+
* @return object
|
17 |
+
*/
|
18 |
+
public function isNot($value)
|
19 |
{
|
20 |
$this->searchTerms['is_not'] = strval($value);
|
21 |
return $this;
|
22 |
}
|
23 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Error/Codes.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Error;
|
3 |
|
4 |
/**
|
5 |
-
*
|
6 |
* Validation Error codes and messages
|
7 |
*
|
8 |
* ErrorCodes class provides constants for validation errors.
|
@@ -10,40 +10,40 @@ namespace Braintree\Error;
|
|
10 |
* error in a ValidationErrorCollection.
|
11 |
* The error messages returned from the server may change;
|
12 |
* but the codes will remain the same.
|
13 |
-
*
|
14 |
-
* @package Braintree
|
15 |
-
* @subpackage Errors
|
16 |
-
* @category Validation
|
17 |
*/
|
18 |
class Codes
|
19 |
{
|
20 |
-
|
21 |
-
const
|
22 |
-
const
|
23 |
-
const
|
24 |
-
const
|
25 |
-
const
|
26 |
-
const
|
27 |
-
const
|
28 |
-
const
|
29 |
-
const
|
30 |
-
const
|
31 |
-
const
|
32 |
-
const
|
33 |
-
const
|
34 |
-
const
|
35 |
-
const
|
36 |
-
const
|
37 |
-
const
|
38 |
-
const
|
39 |
-
const
|
40 |
-
const
|
41 |
-
const
|
42 |
-
const
|
43 |
-
const
|
44 |
-
const
|
45 |
-
const
|
46 |
-
const
|
|
|
|
|
|
|
|
|
47 |
|
48 |
const APPLE_PAY_CARDS_ARE_NOT_ACCEPTED = '83501';
|
49 |
const APPLE_PAY_CUSTOMER_ID_IS_REQUIRED_FOR_VAULTING = '83502';
|
@@ -121,6 +121,8 @@ class Codes
|
|
121 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_FORBIDDEN = '91743';
|
122 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91742';
|
123 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '91755';
|
|
|
|
|
124 |
const CREDIT_CARD_PAYMENT_METHOD_CONFLICT = '81725';
|
125 |
const CREDIT_CARD_PAYMENT_METHOD_IS_NOT_A_CREDIT_CARD = '91738';
|
126 |
const CREDIT_CARD_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91734';
|
@@ -195,30 +197,89 @@ class Codes
|
|
195 |
const DOCUMENT_UPLOAD_FILE_IS_TOO_LARGE = '84902';
|
196 |
const DOCUMENT_UPLOAD_FILE_TYPE_IS_INVALID = '84903';
|
197 |
const DOCUMENT_UPLOAD_FILE_IS_MALFORMED_OR_ENCRYPTED = '84904';
|
|
|
|
|
|
|
|
|
198 |
|
199 |
const FAILED_AUTH_ADJUSTMENT_ALLOW_RETRY = '95603';
|
200 |
const FAILED_AUTH_ADJUSTMENT_HARD_DECLINE = '95602';
|
201 |
const FINAL_AUTH_SUBMIT_FOR_SETTLEMENT_FOR_DIFFERENT_AMOUNT = '95601';
|
202 |
|
203 |
-
const
|
204 |
-
const
|
205 |
-
const
|
206 |
-
const
|
207 |
-
const
|
208 |
-
const
|
209 |
-
const
|
210 |
-
const
|
211 |
-
const
|
212 |
-
const
|
213 |
-
const
|
214 |
-
const
|
215 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
const TRANSACTION_LINE_ITEM_COMMODITY_CODE_IS_TOO_LONG = '95801';
|
218 |
const TRANSACTION_LINE_ITEM_DESCRIPTION_IS_TOO_LONG = '95803';
|
219 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_FORMAT_IS_INVALID = '95804';
|
220 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_IS_TOO_LARGE = '95805';
|
221 |
-
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '95806'; // Deprecated as the amount may be zero. Use TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_CANNOT_BE_ZERO.
|
222 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_CANNOT_BE_NEGATIVE = '95806';
|
223 |
const TRANSACTION_LINE_ITEM_KIND_IS_INVALID = '95807';
|
224 |
const TRANSACTION_LINE_ITEM_KIND_IS_REQUIRED = '95808';
|
@@ -239,12 +300,15 @@ class Codes
|
|
239 |
const TRANSACTION_LINE_ITEM_UNIT_OF_MEASURE_IS_TOO_LONG = '95821';
|
240 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_FORMAT_IS_INVALID = '95824';
|
241 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_IS_TOO_LARGE = '95825';
|
242 |
-
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '95826'; // Deprecated as the amount may be zero. Use TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_CANNOT_BE_ZERO.
|
243 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '95826';
|
244 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_FORMAT_IS_INVALID = '95827';
|
245 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_IS_TOO_LARGE = '95828';
|
246 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '95829';
|
247 |
|
|
|
|
|
|
|
|
|
248 |
const MERCHANT_COUNTRY_CANNOT_BE_BLANK = '83603';
|
249 |
const MERCHANT_COUNTRY_CODE_ALPHA2_IS_INVALID = '93607';
|
250 |
const MERCHANT_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = '93606';
|
@@ -359,6 +423,8 @@ class Codes
|
|
359 |
const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_REQUIRED = '82682';
|
360 |
const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_INVALID = '82683';
|
361 |
|
|
|
|
|
362 |
const OAUTH_INVALID_GRANT = '93801';
|
363 |
const OAUTH_INVALID_CREDENTIALS = '93802';
|
364 |
const OAUTH_INVALID_SCOPE = '93803';
|
@@ -393,68 +459,54 @@ class Codes
|
|
393 |
const PAYPAL_ACCOUNT_PAYPAL_COMMUNICATION_ERROR = '92910';
|
394 |
const PAYPAL_ACCOUNT_TOKEN_IS_IN_USE = '92906';
|
395 |
|
396 |
-
const
|
397 |
-
const
|
398 |
-
const
|
399 |
-
|
400 |
-
const SEPA_MANDATE_ACCOUNT_HOLDER_NAME_IS_REQUIRED = '83301';
|
401 |
-
const SEPA_MANDATE_BIC_INVALID_CHARACTER = '83306';
|
402 |
-
const SEPA_MANDATE_BIC_IS_REQUIRED = '83302';
|
403 |
-
const SEPA_MANDATE_BIC_LENGTH_IS_INVALID = '83307';
|
404 |
-
const SEPA_MANDATE_BIC_UNSUPPORTED_COUNTRY = '83308';
|
405 |
-
const SEPA_MANDATE_BILLING_ADDRESS_CONFLICT = '93311';
|
406 |
-
const SEPA_MANDATE_BILLING_ADDRESS_ID_IS_INVALID = '93312';
|
407 |
-
const SEPA_MANDATE_IBAN_INVALID_CHARACTER = '83305';
|
408 |
-
const SEPA_MANDATE_IBAN_INVALID_FORMAT = '83310';
|
409 |
-
const SEPA_MANDATE_IBAN_IS_REQUIRED = '83303';
|
410 |
-
const SEPA_MANDATE_IBAN_UNSUPPORTED_COUNTRY = '83309';
|
411 |
-
const SEPA_MANDATE_TYPE_IS_REQUIRED = '93304';
|
412 |
-
const SEPA_MANDATE_TYPE_IS_INVALID = '93313';
|
413 |
|
414 |
const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_INVALID = '82302';
|
415 |
const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_REQUIRED = '82301';
|
416 |
const SETTLEMENT_BATCH_SUMMARY_CUSTOM_FIELD_IS_INVALID = '82303';
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
|
459 |
const SUBSCRIPTION_MODIFICATION_AMOUNT_CANNOT_BE_BLANK = '92003';
|
460 |
const SUBSCRIPTION_MODIFICATION_AMOUNT_IS_INVALID = '92002';
|
@@ -480,13 +532,14 @@ class Codes
|
|
480 |
|
481 |
const TRANSACTION_AMOUNT_CANNOT_BE_NEGATIVE = '81501';
|
482 |
const TRANSACTION_AMOUNT_DOES_NOT_MATCH3_D_SECURE_AMOUNT = '91585';
|
483 |
-
const TRANSACTION_AMOUNT_DOES_NOT_MATCH_IDEAL_PAYMENT_AMOUNT = '915144';
|
484 |
const TRANSACTION_AMOUNT_FORMAT_IS_INVALID = '81503';
|
485 |
const TRANSACTION_AMOUNT_IS_INVALID = '81503';
|
486 |
const TRANSACTION_AMOUNT_IS_REQUIRED = '81502';
|
487 |
const TRANSACTION_AMOUNT_IS_TOO_LARGE = '81528';
|
488 |
const TRANSACTION_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '81531';
|
|
|
489 |
const TRANSACTION_BILLING_ADDRESS_CONFLICT = '91530';
|
|
|
490 |
const TRANSACTION_CANNOT_BE_VOIDED = '91504';
|
491 |
const TRANSACTION_CANNOT_CANCEL_RELEASE = '91562';
|
492 |
const TRANSACTION_CANNOT_CLONE_CREDIT = '91543';
|
@@ -514,9 +567,9 @@ class Codes
|
|
514 |
const TRANSACTION_CUSTOMER_ID_IS_INVALID = '91510';
|
515 |
const TRANSACTION_CUSTOM_FIELD_IS_INVALID = '91526';
|
516 |
const TRANSACTION_CUSTOM_FIELD_IS_TOO_LONG = '81527';
|
|
|
517 |
const TRANSACTION_HAS_ALREADY_BEEN_REFUNDED = '91512';
|
518 |
-
const
|
519 |
-
const TRANSACTION_IDEAL_PAYMENTS_CANNOT_BE_VAULTED = '915150';
|
520 |
const TRANSACTION_LINE_ITEMS_EXPECTED = '915158';
|
521 |
const TRANSACTION_TOO_MANY_LINE_ITEMS = '915157';
|
522 |
const TRANSACTION_DISCOUNT_AMOUNT_FORMAT_IS_INVALID = '915159';
|
@@ -525,23 +578,27 @@ class Codes
|
|
525 |
const TRANSACTION_SHIPPING_AMOUNT_FORMAT_IS_INVALID = '915162';
|
526 |
const TRANSACTION_SHIPPING_AMOUNT_CANNOT_BE_NEGATIVE = '915163';
|
527 |
const TRANSACTION_SHIPPING_AMOUNT_IS_TOO_LARGE = '915164';
|
|
|
|
|
528 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_TOO_LONG = '915165';
|
529 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_INVALID = '915166';
|
530 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_INVALID_CHARACTERS = '915167';
|
531 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_MATCH3_D_SECURE_MERCHANT_ACCOUNT = '91584';
|
532 |
-
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_MATCH_IDEAL_PAYMENT_MERCHANT_ACCOUNT = '915143';
|
533 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_MOTO = '91558';
|
534 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_REFUNDS = '91547';
|
|
|
535 |
const TRANSACTION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91513';
|
536 |
const TRANSACTION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91514';
|
537 |
const TRANSACTION_MERCHANT_ACCOUNT_NAME_IS_INVALID = '91513'; //Deprecated
|
|
|
538 |
const TRANSACTION_OPTIONS_PAY_PAL_CUSTOM_FIELD_TOO_LONG = '91580';
|
539 |
const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_CLONING = '91544';
|
540 |
const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_PAYPAL_UNILATERAL = '91582';
|
541 |
const TRANSACTION_OPTIONS_USE_BILLING_FOR_SHIPPING_DISABLED = '91572';
|
542 |
const TRANSACTION_OPTIONS_VAULT_IS_DISABLED = '91525';
|
543 |
-
const
|
544 |
-
const
|
|
|
545 |
const TRANSACTION_ORDER_ID_IS_TOO_LONG = '91501';
|
546 |
const TRANSACTION_PAYMENT_INSTRUMENT_NOT_SUPPORTED_BY_MERCHANT_ACCOUNT = '91577';
|
547 |
const TRANSACTION_PAYMENT_INSTRUMENT_TYPE_IS_NOT_ACCEPTED = '915101';
|
@@ -563,14 +620,19 @@ class Codes
|
|
563 |
const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_IS_INVALID = '81520';
|
564 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_AUTHS = '915104';
|
565 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_CREDITS = '91546';
|
|
|
566 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_PARTIAL_SETTLEMENT = '915102';
|
567 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_ORDER_ID = '915107';
|
568 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DESCRIPTOR = '915108';
|
569 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DETAILS = '915130';
|
570 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_VOICE_AUTHORIZATIONS = '91545';
|
|
|
571 |
const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_INVALID = '91548';
|
572 |
const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG = '91537';
|
573 |
const TRANSACTION_REFUND_AMOUNT_IS_TOO_LARGE = '91521';
|
|
|
|
|
|
|
574 |
const TRANSACTION_SERVICE_FEE_AMOUNT_CANNOT_BE_NEGATIVE = '91554';
|
575 |
const TRANSACTION_SERVICE_FEE_AMOUNT_FORMAT_IS_INVALID = '91555';
|
576 |
const TRANSACTION_SERVICE_FEE_AMOUNT_IS_TOO_LARGE = '91556';
|
@@ -586,16 +648,21 @@ class Codes
|
|
586 |
const TRANSACTION_SUB_MERCHANT_ACCOUNT_REQUIRES_SERVICE_FEE_AMOUNT = '91553';
|
587 |
const TRANSACTION_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '81534';
|
588 |
const TRANSACTION_TAX_AMOUNT_FORMAT_IS_INVALID = '81535';
|
|
|
589 |
const TRANSACTION_TAX_AMOUNT_IS_TOO_LARGE = '81536';
|
590 |
|
591 |
const TRANSACTION_THREE_D_SECURE_AUTHENTICATION_FAILED = '81571';
|
592 |
-
const
|
593 |
-
const
|
594 |
-
const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_REQUIRED = '915113';
|
595 |
const TRANSACTION_THREE_D_SECURE_CAVV_IS_REQUIRED = '915116';
|
596 |
-
const
|
597 |
const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_INVALID = '915114';
|
|
|
598 |
const TRANSACTION_THREE_D_SECURE_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_CARD_TYPE = '915131';
|
|
|
|
|
|
|
|
|
599 |
const TRANSACTION_TYPE_IS_INVALID = '91523';
|
600 |
const TRANSACTION_TYPE_IS_REQUIRED = '91524';
|
601 |
const TRANSACTION_UNSUPPORTED_VOICE_AUTHORIZATION = '91539';
|
@@ -619,5 +686,32 @@ class Codes
|
|
619 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_SUSPENDED = '94205';
|
620 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_FORBIDDEN = '94206';
|
621 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '94208';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
}
|
623 |
-
class_alias('Braintree\Error\Codes', 'Braintree_Error_Codes');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Error;
|
4 |
|
5 |
/**
|
|
|
6 |
* Validation Error codes and messages
|
7 |
*
|
8 |
* ErrorCodes class provides constants for validation errors.
|
10 |
* error in a ValidationErrorCollection.
|
11 |
* The error messages returned from the server may change;
|
12 |
* but the codes will remain the same.
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class Codes
|
15 |
{
|
16 |
+
// phpcs:disable Generic.Files.LineLength
|
17 |
+
const ADDRESS_CANNOT_BE_BLANK = '81801';
|
18 |
+
const ADDRESS_COMPANY_IS_INVALID = '91821';
|
19 |
+
const ADDRESS_COMPANY_IS_TOO_LONG = '81802';
|
20 |
+
const ADDRESS_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = '91814';
|
21 |
+
const ADDRESS_COUNTRY_CODE_ALPHA3_IS_NOT_ACCEPTED = '91816';
|
22 |
+
const ADDRESS_COUNTRY_CODE_NUMERIC_IS_NOT_ACCEPTED = '91817';
|
23 |
+
const ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED = '91803';
|
24 |
+
const ADDRESS_EXTENDED_ADDRESS_IS_INVALID = '91823';
|
25 |
+
const ADDRESS_EXTENDED_ADDRESS_IS_TOO_LONG = '81804';
|
26 |
+
const ADDRESS_FIRST_NAME_IS_INVALID = '91819';
|
27 |
+
const ADDRESS_FIRST_NAME_IS_TOO_LONG = '81805';
|
28 |
+
const ADDRESS_INCONSISTENT_COUNTRY = '91815';
|
29 |
+
const ADDRESS_LAST_NAME_IS_INVALID = '91820';
|
30 |
+
const ADDRESS_LAST_NAME_IS_TOO_LONG = '81806';
|
31 |
+
const ADDRESS_LOCALITY_IS_INVALID = '91824';
|
32 |
+
const ADDRESS_LOCALITY_IS_TOO_LONG = '81807';
|
33 |
+
const ADDRESS_POSTAL_CODE_INVALID_CHARACTERS = '81813';
|
34 |
+
const ADDRESS_POSTAL_CODE_IS_INVALID = '91826';
|
35 |
+
const ADDRESS_POSTAL_CODE_IS_REQUIRED = '81808';
|
36 |
+
const ADDRESS_POSTAL_CODE_IS_REQUIRED_FOR_CARD_BRAND_AND_PROCESSOR = '81828';
|
37 |
+
const ADDRESS_POSTAL_CODE_IS_TOO_LONG = '81809';
|
38 |
+
const ADDRESS_REGION_IS_INVALID = '91825';
|
39 |
+
const ADDRESS_REGION_IS_TOO_LONG = '81810';
|
40 |
+
const ADDRESS_STATE_IS_INVALID_FOR_SELLER_PROTECTION = '81827';
|
41 |
+
const ADDRESS_STREET_ADDRESS_IS_INVALID = '91822';
|
42 |
+
const ADDRESS_STREET_ADDRESS_IS_REQUIRED = '81811';
|
43 |
+
const ADDRESS_STREET_ADDRESS_IS_TOO_LONG = '81812';
|
44 |
+
const ADDRESS_TOO_MANY_ADDRESSES_PER_CUSTOMER = '91818';
|
45 |
+
|
46 |
+
const ADJUSTMENT_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '95605';
|
47 |
|
48 |
const APPLE_PAY_CARDS_ARE_NOT_ACCEPTED = '83501';
|
49 |
const APPLE_PAY_CUSTOMER_ID_IS_REQUIRED_FOR_VAULTING = '83502';
|
121 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_FORBIDDEN = '91743';
|
122 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91742';
|
123 |
const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '91755';
|
124 |
+
const CREDIT_CARD_OPTIONS_VERIFICATION_ACCOUNT_TYPE_IS_INVALID = '91757';
|
125 |
+
const CREDIT_CARD_OPTIONS_VERIFICATION_ACCOUNT_TYPE_NOT_SUPPORTED = '91758';
|
126 |
const CREDIT_CARD_PAYMENT_METHOD_CONFLICT = '81725';
|
127 |
const CREDIT_CARD_PAYMENT_METHOD_IS_NOT_A_CREDIT_CARD = '91738';
|
128 |
const CREDIT_CARD_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91734';
|
197 |
const DOCUMENT_UPLOAD_FILE_IS_TOO_LARGE = '84902';
|
198 |
const DOCUMENT_UPLOAD_FILE_TYPE_IS_INVALID = '84903';
|
199 |
const DOCUMENT_UPLOAD_FILE_IS_MALFORMED_OR_ENCRYPTED = '84904';
|
200 |
+
const DOCUMENT_UPLOAD_FILE_IS_TOO_LONG = '84905';
|
201 |
+
const DOCUMENT_UPLOAD_FILE_IS_EMPTY = '84906';
|
202 |
+
|
203 |
+
const EXCHANGE_RATE_QUOTE_ID_IS_TOO_LONG = '915229';
|
204 |
|
205 |
const FAILED_AUTH_ADJUSTMENT_ALLOW_RETRY = '95603';
|
206 |
const FAILED_AUTH_ADJUSTMENT_HARD_DECLINE = '95602';
|
207 |
const FINAL_AUTH_SUBMIT_FOR_SETTLEMENT_FOR_DIFFERENT_AMOUNT = '95601';
|
208 |
|
209 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_ARRIVAL_AIRPORT_CODE_IS_TOO_LONG = '96301';
|
210 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_ARRIVAL_TIME_FORMAT_IS_INVALID = '96302';
|
211 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_CARRIER_CODE_IS_TOO_LONG = '96303';
|
212 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_CONJUNCTION_TICKET_IS_TOO_LONG = '96304';
|
213 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_COUPON_NUMBER_IS_TOO_LONG = '96305';
|
214 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_DEPARTURE_AIRPORT_CODE_IS_TOO_LONG = '96306';
|
215 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_DEPARTURE_TIME_FORMAT_IS_INVALID = '96307';
|
216 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_EXCHANGE_TICKET_IS_TOO_LONG = '96308';
|
217 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FARE_AMOUNT_CANNOT_BE_NEGATIVE = '96309';
|
218 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FARE_AMOUNT_FORMAT_IS_INVALID = '96310';
|
219 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FARE_AMOUNT_IS_TOO_LARGE = '96311';
|
220 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FARE_BASIS_CODE_IS_TOO_LONG = '96312';
|
221 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FEE_AMOUNT_CANNOT_BE_NEGATIVE = '96313';
|
222 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FEE_AMOUNT_FORMAT_IS_INVALID = '96314';
|
223 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_FEE_AMOUNT_IS_TOO_LARGE = '96315';
|
224 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_SERVICE_CLASS_IS_TOO_LONG = '96316';
|
225 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '96317';
|
226 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_TAX_AMOUNT_FORMAT_IS_INVALID = '96318';
|
227 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_TAX_AMOUNT_IS_TOO_LARGE = '96319';
|
228 |
+
const INDUSTRY_DATA_LEG_TRAVEL_FLIGHT_TICKET_NUMBER_IS_TOO_LONG = '96320';
|
229 |
+
|
230 |
+
const INDUSTRY_DATA_INDUSTRY_TYPE_IS_INVALID = '93401';
|
231 |
+
const INDUSTRY_DATA_LODGING_EMPTY_DATA = '93402';
|
232 |
+
const INDUSTRY_DATA_LODGING_FOLIO_NUMBER_IS_INVALID = '93403';
|
233 |
+
const INDUSTRY_DATA_LODGING_CHECK_IN_DATE_IS_INVALID = '93404';
|
234 |
+
const INDUSTRY_DATA_LODGING_CHECK_OUT_DATE_IS_INVALID = '93405';
|
235 |
+
const INDUSTRY_DATA_LODGING_CHECK_OUT_DATE_MUST_FOLLOW_CHECK_IN_DATE = '93406';
|
236 |
+
const INDUSTRY_DATA_LODGING_UNKNOWN_DATA_FIELD = '93407';
|
237 |
+
const INDUSTRY_DATA_LODGING_ROOM_RATE_MUST_BE_GREATER_THAN_ZERO = '93433';
|
238 |
+
const INDUSTRY_DATA_LODGING_ROOM_RATE_FORMAT_IS_INVALID = '93434';
|
239 |
+
const INDUSTRY_DATA_LODGING_ROOM_RATE_IS_TOO_LARGE = '93435';
|
240 |
+
const INDUSTRY_DATA_LODGING_ROOM_TAX_MUST_BE_GREATER_THAN_ZERO = '93436';
|
241 |
+
const INDUSTRY_DATA_LODGING_ROOM_TAX_FORMAT_IS_INVALID = '93437';
|
242 |
+
const INDUSTRY_DATA_LODGING_ROOM_TAX_IS_TOO_LARGE = '93438';
|
243 |
+
const INDUSTRY_DATA_LODGING_NO_SHOW_INDICATOR_IS_INVALID = '93439';
|
244 |
+
const INDUSTRY_DATA_LODGING_ADVANCED_DEPOSIT_INDICATOR_IS_INVALID = '93440';
|
245 |
+
const INDUSTRY_DATA_LODGING_FIRE_SAFETY_INDICATOR_IS_INVALID = '93441';
|
246 |
+
const INDUSTRY_DATA_LODGING_PROPERTY_PHONE_IS_INVALID = '93442';
|
247 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_EMPTY_DATA = '93408';
|
248 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_UNKNOWN_DATA_FIELD = '93409';
|
249 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_TRAVEL_PACKAGE_IS_INVALID = '93410';
|
250 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_DEPARTURE_DATE_IS_INVALID = '93411';
|
251 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_LODGING_CHECK_IN_DATE_IS_INVALID = '93412';
|
252 |
+
const INDUSTRY_DATA_TRAVEL_CRUISE_LODGING_CHECK_OUT_DATE_IS_INVALID = '93413';
|
253 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_EMPTY_DATA = '93414';
|
254 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_UNKNOWN_DATA_FIELD = '93415';
|
255 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_CUSTOMER_CODE_IS_TOO_LONG = '93416';
|
256 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FARE_AMOUNT_CANNOT_BE_NEGATIVE = '93417';
|
257 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FARE_AMOUNT_FORMAT_IS_INVALID = '93418';
|
258 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FARE_AMOUNT_IS_TOO_LARGE = '93419';
|
259 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FEE_AMOUNT_CANNOT_BE_NEGATIVE = '93420';
|
260 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FEE_AMOUNT_FORMAT_IS_INVALID = '93421';
|
261 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_FEE_AMOUNT_IS_TOO_LARGE = '93422';
|
262 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_ISSUED_DATE_FORMAT_IS_INVALID = '93423';
|
263 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_ISSUING_CARRIER_CODE_IS_TOO_LONG = '93424';
|
264 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_PASSENGER_MIDDLE_INITIAL_IS_TOO_LONG = '93425';
|
265 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_RESTRICTED_TICKET_IS_REQUIRED = '93426';
|
266 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '93427';
|
267 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_TAX_AMOUNT_FORMAT_IS_INVALID = '93428';
|
268 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_TAX_AMOUNT_IS_TOO_LARGE = '93429';
|
269 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_TICKET_NUMBER_IS_TOO_LONG = '93430';
|
270 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_LEGS_EXPECTED = '93431';
|
271 |
+
const INDUSTRY_DATA_TRAVEL_FLIGHT_TOO_MANY_LEGS = '93432';
|
272 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_KIND_IS_INVALID = '96601';
|
273 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_KIND_MUST_BE_UNIQUE = '96602';
|
274 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '96603';
|
275 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_AMOUNT_FORMAT_IS_INVALID = '96604';
|
276 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_AMOUNT_IS_TOO_LARGE = '96605';
|
277 |
+
const INDUSTRY_DATA_ADDITIONAL_CHARGE_AMOUNT_IS_REQUIRED = '96606';
|
278 |
|
279 |
const TRANSACTION_LINE_ITEM_COMMODITY_CODE_IS_TOO_LONG = '95801';
|
280 |
const TRANSACTION_LINE_ITEM_DESCRIPTION_IS_TOO_LONG = '95803';
|
281 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_FORMAT_IS_INVALID = '95804';
|
282 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_IS_TOO_LARGE = '95805';
|
|
|
283 |
const TRANSACTION_LINE_ITEM_DISCOUNT_AMOUNT_CANNOT_BE_NEGATIVE = '95806';
|
284 |
const TRANSACTION_LINE_ITEM_KIND_IS_INVALID = '95807';
|
285 |
const TRANSACTION_LINE_ITEM_KIND_IS_REQUIRED = '95808';
|
300 |
const TRANSACTION_LINE_ITEM_UNIT_OF_MEASURE_IS_TOO_LONG = '95821';
|
301 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_FORMAT_IS_INVALID = '95824';
|
302 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_IS_TOO_LARGE = '95825';
|
|
|
303 |
const TRANSACTION_LINE_ITEM_UNIT_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '95826';
|
304 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_FORMAT_IS_INVALID = '95827';
|
305 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_IS_TOO_LARGE = '95828';
|
306 |
const TRANSACTION_LINE_ITEM_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '95829';
|
307 |
|
308 |
+
const TRANSACTION_EXTERNAL_VAULT_STATUS_IS_INVALID = '915175';
|
309 |
+
const TRANSACTION_EXTERNAL_VAULT_STATUS_WITH_PREVIOUS_NETWORK_TRANSACTION_ID_IS_INVALID = '915177';
|
310 |
+
const TRANSACTION_EXTERNAL_VAULT_PREVIOUS_NETWORK_TRANSACTION_ID_IS_INVALID = '915179';
|
311 |
+
|
312 |
const MERCHANT_COUNTRY_CANNOT_BE_BLANK = '83603';
|
313 |
const MERCHANT_COUNTRY_CODE_ALPHA2_IS_INVALID = '93607';
|
314 |
const MERCHANT_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = '93606';
|
423 |
const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_REQUIRED = '82682';
|
424 |
const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_INVALID = '82683';
|
425 |
|
426 |
+
const NO_NET_AMOUNT_TO_PERFORM_AUTH_ADJUSTMENT = '95606';
|
427 |
+
|
428 |
const OAUTH_INVALID_GRANT = '93801';
|
429 |
const OAUTH_INVALID_CREDENTIALS = '93802';
|
430 |
const OAUTH_INVALID_SCOPE = '93803';
|
459 |
const PAYPAL_ACCOUNT_PAYPAL_COMMUNICATION_ERROR = '92910';
|
460 |
const PAYPAL_ACCOUNT_TOKEN_IS_IN_USE = '92906';
|
461 |
|
462 |
+
const PROCESSOR_DOES_NOT_SUPPORT_AUTH_ADJUSTMENT = '915222';
|
463 |
+
const PROCESSOR_DOES_NOT_SUPPORT_INCREMENTAL_AUTH = '915220';
|
464 |
+
const PROCESSOR_DOES_NOT_SUPPORT_PARTIAL_AUTH_REVERSAL = '915221';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
|
466 |
const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_INVALID = '82302';
|
467 |
const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_REQUIRED = '82301';
|
468 |
const SETTLEMENT_BATCH_SUMMARY_CUSTOM_FIELD_IS_INVALID = '82303';
|
469 |
|
470 |
+
const SUBSCRIPTION_BILLING_DAY_OF_MONTH_CANNOT_BE_UPDATED = '91918';
|
471 |
+
const SUBSCRIPTION_BILLING_DAY_OF_MONTH_IS_INVALID = '91914';
|
472 |
+
const SUBSCRIPTION_BILLING_DAY_OF_MONTH_MUST_BE_NUMERIC = '91913';
|
473 |
+
const SUBSCRIPTION_CANNOT_ADD_DUPLICATE_ADDON_OR_DISCOUNT = '91911';
|
474 |
+
const SUBSCRIPTION_CANNOT_EDIT_CANCELED_SUBSCRIPTION = '81901';
|
475 |
+
const SUBSCRIPTION_CANNOT_EDIT_EXPIRED_SUBSCRIPTION = '81910';
|
476 |
+
const SUBSCRIPTION_CANNOT_EDIT_PRICE_CHANGING_FIELDS_ON_PAST_DUE_SUBSCRIPTION = '91920';
|
477 |
+
const SUBSCRIPTION_FIRST_BILLING_DATE_CANNOT_BE_IN_THE_PAST = '91916';
|
478 |
+
const SUBSCRIPTION_FIRST_BILLING_DATE_CANNOT_BE_UPDATED = '91919';
|
479 |
+
const SUBSCRIPTION_FIRST_BILLING_DATE_IS_INVALID = '91915';
|
480 |
+
const SUBSCRIPTION_ID_IS_IN_USE = '81902';
|
481 |
+
const SUBSCRIPTION_INCONSISTENT_NUMBER_OF_BILLING_CYCLES = '91908';
|
482 |
+
const SUBSCRIPTION_INCONSISTENT_START_DATE = '91917';
|
483 |
+
const SUBSCRIPTION_INVALID_REQUEST_FORMAT = '91921';
|
484 |
+
const SUBSCRIPTION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91901';
|
485 |
+
const SUBSCRIPTION_MISMATCH_CURRENCY_ISO_CODE = '91923';
|
486 |
+
const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_CANNOT_BE_BLANK = '91912';
|
487 |
+
const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_IS_TOO_SMALL = '91909';
|
488 |
+
const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_MUST_BE_GREATER_THAN_ZERO = '91907';
|
489 |
+
const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_MUST_BE_NUMERIC = '91906';
|
490 |
+
const SUBSCRIPTION_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91924';
|
491 |
+
const SUBSCRIPTION_PAYMENT_METHOD_NONCE_IS_INVALID = '91925';
|
492 |
+
const SUBSCRIPTION_PAYMENT_METHOD_NONCE_NOT_ASSOCIATED_WITH_CUSTOMER = '91926';
|
493 |
+
const SUBSCRIPTION_PAYMENT_METHOD_NONCE_UNVAULTED_CARD_IS_NOT_ACCEPTED = '91927';
|
494 |
+
const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_CARD_TYPE_IS_NOT_ACCEPTED = '91902';
|
495 |
+
const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_IS_INVALID = '91903';
|
496 |
+
const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_NOT_ASSOCIATED_WITH_CUSTOMER = '91905';
|
497 |
+
const SUBSCRIPTION_PLAN_BILLING_FREQUENCY_CANNOT_BE_UPDATED = '91922';
|
498 |
+
const SUBSCRIPTION_PLAN_ID_IS_INVALID = '91904';
|
499 |
+
const SUBSCRIPTION_PRICE_CANNOT_BE_BLANK = '81903';
|
500 |
+
const SUBSCRIPTION_PRICE_FORMAT_IS_INVALID = '81904';
|
501 |
+
const SUBSCRIPTION_PRICE_IS_TOO_LARGE = '81923';
|
502 |
+
const SUBSCRIPTION_STATUS_IS_CANCELED = '81905';
|
503 |
+
const SUBSCRIPTION_TOKEN_FORMAT_IS_INVALID = '81906';
|
504 |
+
const SUBSCRIPTION_TRIAL_DURATION_FORMAT_IS_INVALID = '81907';
|
505 |
+
const SUBSCRIPTION_TRIAL_DURATION_IS_REQUIRED = '81908';
|
506 |
+
const SUBSCRIPTION_TRIAL_DURATION_UNIT_IS_INVALID = '81909';
|
507 |
+
const SUBSCRIPTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_INSTRUMENT_TYPE = '91930';
|
508 |
+
const SUBSCRIPTION_PAYMENT_METHOD_NONCE_INSTRUMENT_TYPE_DOES_NOT_SUPPORT_SUBSCRIPTIONS = '91929';
|
509 |
+
const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_INSTRUMENT_TYPE_DOES_NOT_SUPPORT_SUBSCRIPTIONS = '91928';
|
510 |
|
511 |
const SUBSCRIPTION_MODIFICATION_AMOUNT_CANNOT_BE_BLANK = '92003';
|
512 |
const SUBSCRIPTION_MODIFICATION_AMOUNT_IS_INVALID = '92002';
|
532 |
|
533 |
const TRANSACTION_AMOUNT_CANNOT_BE_NEGATIVE = '81501';
|
534 |
const TRANSACTION_AMOUNT_DOES_NOT_MATCH3_D_SECURE_AMOUNT = '91585';
|
|
|
535 |
const TRANSACTION_AMOUNT_FORMAT_IS_INVALID = '81503';
|
536 |
const TRANSACTION_AMOUNT_IS_INVALID = '81503';
|
537 |
const TRANSACTION_AMOUNT_IS_REQUIRED = '81502';
|
538 |
const TRANSACTION_AMOUNT_IS_TOO_LARGE = '81528';
|
539 |
const TRANSACTION_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '81531';
|
540 |
+
const TRANSACTION_AMOUNT_NOT_SUPPORTED_BY_PROCESSOR = '815193';
|
541 |
const TRANSACTION_BILLING_ADDRESS_CONFLICT = '91530';
|
542 |
+
const TRANSACTION_BILLING_PHONE_NUMBER_IS_INVALID = '915206';
|
543 |
const TRANSACTION_CANNOT_BE_VOIDED = '91504';
|
544 |
const TRANSACTION_CANNOT_CANCEL_RELEASE = '91562';
|
545 |
const TRANSACTION_CANNOT_CLONE_CREDIT = '91543';
|
567 |
const TRANSACTION_CUSTOMER_ID_IS_INVALID = '91510';
|
568 |
const TRANSACTION_CUSTOM_FIELD_IS_INVALID = '91526';
|
569 |
const TRANSACTION_CUSTOM_FIELD_IS_TOO_LONG = '81527';
|
570 |
+
const TRANSACTION_PAYMENT_INSTRUMENT_WITH_EXTERNAL_VAULT_IS_INVALID = '915176';
|
571 |
const TRANSACTION_HAS_ALREADY_BEEN_REFUNDED = '91512';
|
572 |
+
const TRANSACTION_IS_NOT_ELIGIBLE_FOR_ADJUSTMENT = '915219';
|
|
|
573 |
const TRANSACTION_LINE_ITEMS_EXPECTED = '915158';
|
574 |
const TRANSACTION_TOO_MANY_LINE_ITEMS = '915157';
|
575 |
const TRANSACTION_DISCOUNT_AMOUNT_FORMAT_IS_INVALID = '915159';
|
578 |
const TRANSACTION_SHIPPING_AMOUNT_FORMAT_IS_INVALID = '915162';
|
579 |
const TRANSACTION_SHIPPING_AMOUNT_CANNOT_BE_NEGATIVE = '915163';
|
580 |
const TRANSACTION_SHIPPING_AMOUNT_IS_TOO_LARGE = '915164';
|
581 |
+
const TRANSACTION_SHIPPING_METHOD_IS_INVALID = '915203';
|
582 |
+
const TRANSACTION_SHIPPING_PHONE_NUMBER_IS_INVALID = '915204';
|
583 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_TOO_LONG = '915165';
|
584 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_INVALID = '915166';
|
585 |
const TRANSACTION_SHIPS_FROM_POSTAL_CODE_INVALID_CHARACTERS = '915167';
|
586 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_MATCH3_D_SECURE_MERCHANT_ACCOUNT = '91584';
|
|
|
587 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_MOTO = '91558';
|
588 |
const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_REFUNDS = '91547';
|
589 |
+
const TRANSACTION_MERCHANT_ACCOUNT_ID_DOES_NOT_MATCH_SUBSCRIPTION = '915180';
|
590 |
const TRANSACTION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91513';
|
591 |
const TRANSACTION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91514';
|
592 |
const TRANSACTION_MERCHANT_ACCOUNT_NAME_IS_INVALID = '91513'; //Deprecated
|
593 |
+
const TRANSACTION_MUST_BE_IN_STATE_AUTHORIZED = '915218';
|
594 |
const TRANSACTION_OPTIONS_PAY_PAL_CUSTOM_FIELD_TOO_LONG = '91580';
|
595 |
const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_CLONING = '91544';
|
596 |
const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_PAYPAL_UNILATERAL = '91582';
|
597 |
const TRANSACTION_OPTIONS_USE_BILLING_FOR_SHIPPING_DISABLED = '91572';
|
598 |
const TRANSACTION_OPTIONS_VAULT_IS_DISABLED = '91525';
|
599 |
+
const TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_IS_INVALID = '915184';
|
600 |
+
const TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_NOT_SUPPORTED = '915185';
|
601 |
+
const TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_DEBIT_DOES_NOT_SUPPORT_AUTHS = '915186';
|
602 |
const TRANSACTION_ORDER_ID_IS_TOO_LONG = '91501';
|
603 |
const TRANSACTION_PAYMENT_INSTRUMENT_NOT_SUPPORTED_BY_MERCHANT_ACCOUNT = '91577';
|
604 |
const TRANSACTION_PAYMENT_INSTRUMENT_TYPE_IS_NOT_ACCEPTED = '915101';
|
620 |
const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_IS_INVALID = '81520';
|
621 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_AUTHS = '915104';
|
622 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_CREDITS = '91546';
|
623 |
+
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_MOTO_FOR_CARD_TYPE = '915195';
|
624 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_PARTIAL_SETTLEMENT = '915102';
|
625 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_ORDER_ID = '915107';
|
626 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DESCRIPTOR = '915108';
|
627 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DETAILS = '915130';
|
628 |
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_VOICE_AUTHORIZATIONS = '91545';
|
629 |
+
const TRANSACTION_PRODUCT_SKU_IS_INVALID = '915202';
|
630 |
const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_INVALID = '91548';
|
631 |
const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG = '91537';
|
632 |
const TRANSACTION_REFUND_AMOUNT_IS_TOO_LARGE = '91521';
|
633 |
+
const TRANSACTION_REFUND_AUTH_HARD_DECLINED = '915200';
|
634 |
+
const TRANSACTION_REFUND_AUTH_SOFT_DECLINED = '915201';
|
635 |
+
const TRANSACTION_SCA_EXEMPTION_INVALID = '915213';
|
636 |
const TRANSACTION_SERVICE_FEE_AMOUNT_CANNOT_BE_NEGATIVE = '91554';
|
637 |
const TRANSACTION_SERVICE_FEE_AMOUNT_FORMAT_IS_INVALID = '91555';
|
638 |
const TRANSACTION_SERVICE_FEE_AMOUNT_IS_TOO_LARGE = '91556';
|
648 |
const TRANSACTION_SUB_MERCHANT_ACCOUNT_REQUIRES_SERVICE_FEE_AMOUNT = '91553';
|
649 |
const TRANSACTION_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '81534';
|
650 |
const TRANSACTION_TAX_AMOUNT_FORMAT_IS_INVALID = '81535';
|
651 |
+
const TRANSACTION_TAX_AMOUNT_IS_REQUIRED_FOR_AIB_SWEDISH = '815224';
|
652 |
const TRANSACTION_TAX_AMOUNT_IS_TOO_LARGE = '81536';
|
653 |
|
654 |
const TRANSACTION_THREE_D_SECURE_AUTHENTICATION_FAILED = '81571';
|
655 |
+
const TRANSACTION_THREE_D_SECURE_AUTHENTICATION_RESPONSE_IS_INVALID = '915120';
|
656 |
+
const TRANSACTION_THREE_D_SECURE_CAVV_ALGORITHM_IS_INVALID = '915122';
|
|
|
657 |
const TRANSACTION_THREE_D_SECURE_CAVV_IS_REQUIRED = '915116';
|
658 |
+
const TRANSACTION_THREE_D_SECURE_DIRECTORY_RESPONSE_IS_INVALID = '915121';
|
659 |
const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_INVALID = '915114';
|
660 |
+
const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_REQUIRED = '915113';
|
661 |
const TRANSACTION_THREE_D_SECURE_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_CARD_TYPE = '915131';
|
662 |
+
const TRANSACTION_THREE_D_SECURE_THREE_D_SECURE_VERSION_IS_INVALID = '915119';
|
663 |
+
const TRANSACTION_THREE_D_SECURE_TOKEN_IS_INVALID = '91568';
|
664 |
+
const TRANSACTION_THREE_D_SECURE_TRANSACTION_DATA_DOESNT_MATCH_VERIFY = '91570';
|
665 |
+
const TRANSACTION_THREE_D_SECURE_XID_IS_REQUIRED = '915115';
|
666 |
const TRANSACTION_TYPE_IS_INVALID = '91523';
|
667 |
const TRANSACTION_TYPE_IS_REQUIRED = '91524';
|
668 |
const TRANSACTION_UNSUPPORTED_VOICE_AUTHORIZATION = '91539';
|
686 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_SUSPENDED = '94205';
|
687 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_FORBIDDEN = '94206';
|
688 |
const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '94208';
|
689 |
+
const VERIFICATION_OPTIONS_ACCOUNT_TYPE_IS_INVALID = '942184';
|
690 |
+
const VERIFICATION_OPTIONS_ACCOUNT_TYPE_NOT_SUPPORTED = '942185';
|
691 |
+
|
692 |
+
const VERIFICATION_THREE_D_SECURE_ECI_FLAG_IS_REQUIRED = "942113";
|
693 |
+
const VERIFICATION_THREE_D_SECURE_ECI_FLAG_IS_INVALID = "942114";
|
694 |
+
const VERIFICATION_THREE_D_SECURE_CAVV_IS_REQUIRED = "942116";
|
695 |
+
const VERIFICATION_THREE_D_SECURE_THREE_D_SECURE_VERSION_IS_REQUIRED = '942117';
|
696 |
+
const VERIFICATION_THREE_D_SECURE_THREE_D_SECURE_VERSION_IS_INVALID = "942119";
|
697 |
+
const VERIFICATION_THREE_D_SECURE_AUTHENTICATION_RESPONSE_IS_INVALID = "942120";
|
698 |
+
const VERIFICATION_THREE_D_SECURE_DIRECTORY_RESPONSE_IS_INVALID = "942121";
|
699 |
+
const VERIFICATION_THREE_D_SECURE_CAVV_ALGORITHM_IS_INVALID = "942122";
|
700 |
+
const THREE_D_SECURE_AUTHENTICATION_ID_IS_INVALID = "942196";
|
701 |
+
const THREE_D_SECURE_AUTHENTICATION_ID_DOESNT_MATCH_NONCE_THREE_D_SECURE_AUTHENTICATION = "942198";
|
702 |
+
const THREE_D_SECURE_TRANSACTION_PAYMENT_METHOD_DOESNT_MATCH_THREE_D_SECURE_AUTHENTICATION_PAYMENT_METHOD = "942197";
|
703 |
+
const THREE_D_SECURE_AUTHENTICATION_ID_WITH_THREE_D_SECURE_PASS_THRU_IS_INVALID = "942199";
|
704 |
+
const THREE_D_SECURE_AUTHENTICATION_FAILED = "94271";
|
705 |
+
const THREE_D_SECURE_TOKEN_IS_INVALID = "94268";
|
706 |
+
const THREE_D_SECURE_VERIFICATION_DATA_DOESNT_MATCH_VERIFY = "94270";
|
707 |
+
const MERCHANT_ACCOUNT_DOES_NOT_SUPPORT3_D_SECURE = "942169";
|
708 |
+
const MERCHANT_ACOUNT_DOES_NOT_MATCH3_D_SECURE_MERCHANT_ACCOUNT = "94284";
|
709 |
+
const AMOUNT_DOES_NOT_MATCH3_D_SECURE_AMOUNT = "94285";
|
710 |
+
const RISK_DATA_CUSTOMER_DEVICE_ID_IS_TOO_LONG = "94702";
|
711 |
+
const RISK_DATA_CUSTOMER_LOCATION_ZIP_INVALID_CHARACTERS = "94703";
|
712 |
+
const RISK_DATA_CUSTOMER_LOCATION_ZIP_IS_INVALID = "94704";
|
713 |
+
const RISK_DATA_CUSTOMER_LOCATION_ZIP_IS_TOO_LONG = "94705";
|
714 |
+
const RISK_DATA_CUSTOMER_TENURE_IS_TOO_LONG = "94706";
|
715 |
+
const RISK_DATA_CUSTOMER_TENURE_IS_INVALID = "94707";
|
716 |
+
// phpcs:enable Generic.Files.LineLength
|
717 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Error/ErrorCollection.php
CHANGED
@@ -1,25 +1,24 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Error;
|
3 |
|
4 |
use Braintree\Util;
|
|
|
|
|
5 |
|
6 |
/**
|
7 |
-
*
|
8 |
* Error handler
|
9 |
* Handles validation errors
|
10 |
*
|
11 |
* Contains a read-only property $error which is a ValidationErrorCollection
|
12 |
*
|
13 |
-
* @
|
14 |
-
* @subpackage Errors
|
15 |
-
* @category Errors
|
16 |
-
*
|
17 |
-
* @property-read object $errors
|
18 |
*/
|
19 |
-
class ErrorCollection implements
|
20 |
{
|
21 |
private $_errors;
|
22 |
|
|
|
23 |
public function __construct($errorData)
|
24 |
{
|
25 |
$this->_errors =
|
@@ -32,6 +31,7 @@ class ErrorCollection implements \Countable
|
|
32 |
*
|
33 |
* @return integer
|
34 |
*/
|
|
|
35 |
public function count()
|
36 |
{
|
37 |
return $this->deepSize();
|
@@ -39,6 +39,8 @@ class ErrorCollection implements \Countable
|
|
39 |
|
40 |
/**
|
41 |
* Returns all of the validation errors at all levels of nesting in a single, flat array.
|
|
|
|
|
42 |
*/
|
43 |
public function deepAll()
|
44 |
{
|
@@ -50,7 +52,7 @@ class ErrorCollection implements \Countable
|
|
50 |
*if creating a customer with a credit card and a billing address, and each of the customer,
|
51 |
* credit card, and billing address has 1 error, this method will return 3.
|
52 |
*
|
53 |
-
* @return
|
54 |
*/
|
55 |
public function deepSize()
|
56 |
{
|
@@ -61,7 +63,8 @@ class ErrorCollection implements \Countable
|
|
61 |
/**
|
62 |
* return errors for the passed key name
|
63 |
*
|
64 |
-
* @param string $key
|
|
|
65 |
* @return mixed
|
66 |
*/
|
67 |
public function forKey($key)
|
@@ -73,16 +76,19 @@ class ErrorCollection implements \Countable
|
|
73 |
* return errors for the passed html field.
|
74 |
* For example, $result->errors->onHtmlField("transaction[customer][last_name]")
|
75 |
*
|
76 |
-
* @param string $field
|
|
|
77 |
* @return array
|
78 |
*/
|
79 |
public function onHtmlField($field)
|
80 |
{
|
81 |
$pieces = preg_split("/[\[\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
|
82 |
$errors = $this;
|
83 |
-
foreach(array_slice($pieces, 0, -1) as $key) {
|
84 |
$errors = $errors->forKey(Util::delimiterToCamelCase($key));
|
85 |
-
if (!isset($errors)) {
|
|
|
|
|
86 |
}
|
87 |
$finalKey = Util::delimiterToCamelCase(end($pieces));
|
88 |
return $errors->onAttribute($finalKey);
|
@@ -95,29 +101,35 @@ class ErrorCollection implements \Countable
|
|
95 |
* $result = Customer::create(...);
|
96 |
* $customerErrors = $result->errors->forKey('customer')->shallowAll();
|
97 |
* </code>
|
|
|
|
|
98 |
*/
|
99 |
public function shallowAll()
|
100 |
{
|
101 |
return $this->_errors->shallowAll();
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
* @ignore
|
107 |
-
*/
|
108 |
-
public function __get($name)
|
109 |
{
|
110 |
$varName = "_$name";
|
111 |
return isset($this->$varName) ? $this->$varName : null;
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
/**
|
|
|
115 |
*
|
116 |
-
* @
|
117 |
*/
|
118 |
-
|
|
|
119 |
{
|
120 |
-
return
|
121 |
}
|
122 |
}
|
123 |
-
class_alias('Braintree\Error\ErrorCollection', 'Braintree_Error_ErrorCollection');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Error;
|
4 |
|
5 |
use Braintree\Util;
|
6 |
+
use Countable;
|
7 |
+
use JsonSerializable;
|
8 |
|
9 |
/**
|
|
|
10 |
* Error handler
|
11 |
* Handles validation errors
|
12 |
*
|
13 |
* Contains a read-only property $error which is a ValidationErrorCollection
|
14 |
*
|
15 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/result-objects#error-results developer docs} for more information
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
+
class ErrorCollection implements Countable, JsonSerializable
|
18 |
{
|
19 |
private $_errors;
|
20 |
|
21 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
22 |
public function __construct($errorData)
|
23 |
{
|
24 |
$this->_errors =
|
31 |
*
|
32 |
* @return integer
|
33 |
*/
|
34 |
+
#[\ReturnTypeWillChange]
|
35 |
public function count()
|
36 |
{
|
37 |
return $this->deepSize();
|
39 |
|
40 |
/**
|
41 |
* Returns all of the validation errors at all levels of nesting in a single, flat array.
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
*/
|
45 |
public function deepAll()
|
46 |
{
|
52 |
*if creating a customer with a credit card and a billing address, and each of the customer,
|
53 |
* credit card, and billing address has 1 error, this method will return 3.
|
54 |
*
|
55 |
+
* @return integer size
|
56 |
*/
|
57 |
public function deepSize()
|
58 |
{
|
63 |
/**
|
64 |
* return errors for the passed key name
|
65 |
*
|
66 |
+
* @param string $key name
|
67 |
+
*
|
68 |
* @return mixed
|
69 |
*/
|
70 |
public function forKey($key)
|
76 |
* return errors for the passed html field.
|
77 |
* For example, $result->errors->onHtmlField("transaction[customer][last_name]")
|
78 |
*
|
79 |
+
* @param string $field html element
|
80 |
+
*
|
81 |
* @return array
|
82 |
*/
|
83 |
public function onHtmlField($field)
|
84 |
{
|
85 |
$pieces = preg_split("/[\[\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
|
86 |
$errors = $this;
|
87 |
+
foreach (array_slice($pieces, 0, -1) as $key) {
|
88 |
$errors = $errors->forKey(Util::delimiterToCamelCase($key));
|
89 |
+
if (!isset($errors)) {
|
90 |
+
return [];
|
91 |
+
}
|
92 |
}
|
93 |
$finalKey = Util::delimiterToCamelCase(end($pieces));
|
94 |
return $errors->onAttribute($finalKey);
|
101 |
* $result = Customer::create(...);
|
102 |
* $customerErrors = $result->errors->forKey('customer')->shallowAll();
|
103 |
* </code>
|
104 |
+
*
|
105 |
+
* @return array
|
106 |
*/
|
107 |
public function shallowAll()
|
108 |
{
|
109 |
return $this->_errors->shallowAll();
|
110 |
}
|
111 |
|
112 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
113 |
+
public function __get($name)
|
|
|
|
|
|
|
114 |
{
|
115 |
$varName = "_$name";
|
116 |
return isset($this->$varName) ? $this->$varName : null;
|
117 |
}
|
118 |
|
119 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
120 |
+
public function __toString()
|
121 |
+
{
|
122 |
+
return sprintf('%s', $this->_errors);
|
123 |
+
}
|
124 |
+
|
125 |
/**
|
126 |
+
* Implementation of JsonSerializable
|
127 |
*
|
128 |
+
* @return array
|
129 |
*/
|
130 |
+
#[\ReturnTypeWillChange]
|
131 |
+
public function jsonSerialize()
|
132 |
{
|
133 |
+
return $this->_errors->deepAll();
|
134 |
}
|
135 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Error/Validation.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Error;
|
3 |
|
4 |
use Braintree\Util;
|
@@ -9,14 +10,8 @@ use Braintree\Util;
|
|
9 |
*
|
10 |
* <b>== More information ==</b>
|
11 |
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
* @package Braintree
|
15 |
-
* @subpackage Error
|
16 |
-
*
|
17 |
-
* @property-read string $attribute
|
18 |
-
* @property-read string $code
|
19 |
-
* @property-read string $message
|
20 |
*/
|
21 |
class Validation
|
22 |
{
|
@@ -24,37 +19,25 @@ class Validation
|
|
24 |
private $_code;
|
25 |
private $_message;
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
* @param array $attributes
|
30 |
-
*/
|
31 |
-
public function __construct($attributes)
|
32 |
{
|
33 |
$this->_initializeFromArray($attributes);
|
34 |
}
|
35 |
-
|
36 |
-
|
37 |
-
* @ignore
|
38 |
-
* @access protected
|
39 |
-
* @param array $attributes array of properties to set - single level
|
40 |
-
* @return void
|
41 |
-
*/
|
42 |
private function _initializeFromArray($attributes)
|
43 |
{
|
44 |
-
foreach($attributes
|
45 |
$varName = "_$name";
|
46 |
$this->$varName = Util::delimiterToCamelCase($value, '_');
|
47 |
}
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
* @ignore
|
53 |
-
*/
|
54 |
-
public function __get($name)
|
55 |
{
|
56 |
$varName = "_$name";
|
57 |
return isset($this->$varName) ? $this->$varName : null;
|
58 |
}
|
59 |
}
|
60 |
-
class_alias('Braintree\Error\Validation', 'Braintree_Error_Validation');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Error;
|
4 |
|
5 |
use Braintree\Util;
|
10 |
*
|
11 |
* <b>== More information ==</b>
|
12 |
*
|
13 |
+
* // phpcs:ignore Generic.Files.LineLength
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/result-objects#error-results developer docs} for more information
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class Validation
|
17 |
{
|
19 |
private $_code;
|
20 |
private $_message;
|
21 |
|
22 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
23 |
+
public function __construct($attributes)
|
|
|
|
|
|
|
24 |
{
|
25 |
$this->_initializeFromArray($attributes);
|
26 |
}
|
27 |
+
|
28 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
29 |
private function _initializeFromArray($attributes)
|
30 |
{
|
31 |
+
foreach ($attributes as $name => $value) {
|
32 |
$varName = "_$name";
|
33 |
$this->$varName = Util::delimiterToCamelCase($value, '_');
|
34 |
}
|
35 |
}
|
36 |
|
37 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
38 |
+
public function __get($name)
|
|
|
|
|
|
|
39 |
{
|
40 |
$varName = "_$name";
|
41 |
return isset($this->$varName) ? $this->$varName : null;
|
42 |
}
|
43 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Error/ValidationErrorCollection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Error;
|
3 |
|
4 |
use Braintree\Collection;
|
@@ -8,124 +9,139 @@ use Braintree\Collection;
|
|
8 |
*
|
9 |
* <b>== More information ==</b>
|
10 |
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
* @package Braintree
|
14 |
-
* @subpackage Error
|
15 |
-
*
|
16 |
-
* @property-read array $errors
|
17 |
-
* @property-read array $nested
|
18 |
*/
|
19 |
class ValidationErrorCollection extends Collection
|
20 |
{
|
21 |
private $_errors = [];
|
22 |
private $_nested = [];
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
*/
|
27 |
-
public function __construct($data)
|
28 |
{
|
29 |
-
foreach($data
|
30 |
// map errors to new collections recursively
|
31 |
if ($key == 'errors') {
|
32 |
-
foreach ($errorData
|
33 |
$this->_errors[] = new Validation($error);
|
34 |
}
|
35 |
} else {
|
36 |
$this->_nested[$key] = new ValidationErrorCollection($errorData);
|
37 |
}
|
38 |
-
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
public function deepAll()
|
42 |
{
|
43 |
$validationErrors = array_merge([], $this->_errors);
|
44 |
-
foreach($this->_nested as $nestedErrors)
|
45 |
-
{
|
46 |
$validationErrors = array_merge($validationErrors, $nestedErrors->deepAll());
|
47 |
}
|
48 |
return $validationErrors;
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
51 |
public function deepSize()
|
52 |
{
|
53 |
$total = sizeof($this->_errors);
|
54 |
-
foreach($this->_nested as $_nestedErrors)
|
55 |
-
{
|
56 |
$total = $total + $_nestedErrors->deepSize();
|
57 |
}
|
58 |
return $total;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
61 |
public function forIndex($index)
|
62 |
{
|
63 |
return $this->forKey("index" . $index);
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
public function forKey($key)
|
67 |
{
|
68 |
return isset($this->_nested[$key]) ? $this->_nested[$key] : null;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
public function onAttribute($attribute)
|
72 |
{
|
73 |
$matches = [];
|
74 |
-
foreach ($this->_errors
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
}
|
79 |
return $matches;
|
80 |
}
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
public function shallowAll()
|
84 |
{
|
85 |
return $this->_errors;
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
* @ignore
|
91 |
-
*/
|
92 |
-
public function __get($name)
|
93 |
{
|
94 |
$varName = "_$name";
|
95 |
return isset($this->$varName) ? $this->$varName : null;
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
* @ignore
|
100 |
-
*/
|
101 |
public function __toString()
|
102 |
{
|
103 |
$output = [];
|
104 |
|
105 |
-
// TODO: implement scope
|
106 |
if (!empty($this->_errors)) {
|
107 |
$output[] = $this->_inspect($this->_errors);
|
108 |
}
|
109 |
if (!empty($this->_nested)) {
|
110 |
-
foreach ($this->_nested
|
111 |
$output[] = $this->_inspect($this->_nested);
|
112 |
}
|
113 |
}
|
114 |
return join(', ', $output);
|
115 |
}
|
116 |
|
117 |
-
/**
|
118 |
-
* @ignore
|
119 |
-
*/
|
120 |
private function _inspect($errors, $scope = null)
|
121 |
{
|
122 |
$eOutput = '[' . __CLASS__ . '/errors:[';
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
125 |
}
|
126 |
$eOutput .= join(', ', $outputErrs) . ']]';
|
127 |
|
128 |
return $eOutput;
|
129 |
}
|
130 |
}
|
131 |
-
class_alias('Braintree\Error\ValidationErrorCollection', 'Braintree_Error_ValidationErrorCollection');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Error;
|
4 |
|
5 |
use Braintree\Collection;
|
9 |
*
|
10 |
* <b>== More information ==</b>
|
11 |
*
|
12 |
+
* // phpcs:ignore Generic.Files.LineLength
|
13 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/result-objects#error-results developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
14 |
*/
|
15 |
class ValidationErrorCollection extends Collection
|
16 |
{
|
17 |
private $_errors = [];
|
18 |
private $_nested = [];
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
+
public function __construct($data)
|
|
|
|
|
22 |
{
|
23 |
+
foreach ($data as $key => $errorData) {
|
24 |
// map errors to new collections recursively
|
25 |
if ($key == 'errors') {
|
26 |
+
foreach ($errorData as $error) {
|
27 |
$this->_errors[] = new Validation($error);
|
28 |
}
|
29 |
} else {
|
30 |
$this->_nested[$key] = new ValidationErrorCollection($errorData);
|
31 |
}
|
32 |
+
}
|
33 |
}
|
34 |
|
35 |
+
/*
|
36 |
+
* Deeply retrieve all validation errors
|
37 |
+
*
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
public function deepAll()
|
41 |
{
|
42 |
$validationErrors = array_merge([], $this->_errors);
|
43 |
+
foreach ($this->_nested as $nestedErrors) {
|
|
|
44 |
$validationErrors = array_merge($validationErrors, $nestedErrors->deepAll());
|
45 |
}
|
46 |
return $validationErrors;
|
47 |
}
|
48 |
|
49 |
+
/*
|
50 |
+
* Deeply retrieve a count of errors
|
51 |
+
*
|
52 |
+
* @return int
|
53 |
+
*/
|
54 |
public function deepSize()
|
55 |
{
|
56 |
$total = sizeof($this->_errors);
|
57 |
+
foreach ($this->_nested as $_nestedErrors) {
|
|
|
58 |
$total = $total + $_nestedErrors->deepSize();
|
59 |
}
|
60 |
return $total;
|
61 |
}
|
62 |
|
63 |
+
/*
|
64 |
+
* Checks if index if a set variable
|
65 |
+
*
|
66 |
+
* @return bool
|
67 |
+
*/
|
68 |
public function forIndex($index)
|
69 |
{
|
70 |
return $this->forKey("index" . $index);
|
71 |
}
|
72 |
|
73 |
+
/*
|
74 |
+
* Checks if the value for a given key is a set variable
|
75 |
+
*
|
76 |
+
* @return bool
|
77 |
+
*/
|
78 |
public function forKey($key)
|
79 |
{
|
80 |
return isset($this->_nested[$key]) ? $this->_nested[$key] : null;
|
81 |
}
|
82 |
|
83 |
+
/*
|
84 |
+
* Returns any errors that match on a given attribute
|
85 |
+
*
|
86 |
+
* @param string $attribute to be checked for matching errors
|
87 |
+
*
|
88 |
+
* @return array
|
89 |
+
*/
|
90 |
public function onAttribute($attribute)
|
91 |
{
|
92 |
$matches = [];
|
93 |
+
foreach ($this->_errors as $key => $error) {
|
94 |
+
if ($error->attribute == $attribute) {
|
95 |
+
$matches[] = $error;
|
96 |
+
}
|
97 |
}
|
98 |
return $matches;
|
99 |
}
|
100 |
|
101 |
+
/*
|
102 |
+
* Get all errors
|
103 |
+
*
|
104 |
+
* @return object
|
105 |
+
*/
|
106 |
public function shallowAll()
|
107 |
{
|
108 |
return $this->_errors;
|
109 |
}
|
110 |
|
111 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
112 |
+
public function __get($name)
|
|
|
|
|
|
|
113 |
{
|
114 |
$varName = "_$name";
|
115 |
return isset($this->$varName) ? $this->$varName : null;
|
116 |
}
|
117 |
|
118 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
119 |
public function __toString()
|
120 |
{
|
121 |
$output = [];
|
122 |
|
|
|
123 |
if (!empty($this->_errors)) {
|
124 |
$output[] = $this->_inspect($this->_errors);
|
125 |
}
|
126 |
if (!empty($this->_nested)) {
|
127 |
+
foreach ($this->_nested as $key => $values) {
|
128 |
$output[] = $this->_inspect($this->_nested);
|
129 |
}
|
130 |
}
|
131 |
return join(', ', $output);
|
132 |
}
|
133 |
|
|
|
|
|
|
|
134 |
private function _inspect($errors, $scope = null)
|
135 |
{
|
136 |
$eOutput = '[' . __CLASS__ . '/errors:[';
|
137 |
+
$outputErrs = [];
|
138 |
+
foreach ($errors as $error => $errorObj) {
|
139 |
+
if (is_array($errorObj->error)) {
|
140 |
+
$outputErrs[] = "({$errorObj->error['code']} {$errorObj->error['message']})";
|
141 |
+
}
|
142 |
}
|
143 |
$eOutput .= join(', ', $outputErrs) . ']]';
|
144 |
|
145 |
return $eOutput;
|
146 |
}
|
147 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/EuropeBankAccount.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree EuropeBankAccount module
|
6 |
-
* Creates and manages Braintree Europe Bank Accounts
|
7 |
-
*
|
8 |
-
* <b>== More information ==</b>
|
9 |
-
*
|
10 |
-
* See {@link https://developers.braintreepayments.com/javascript+php}<br />
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $account-holder-name
|
16 |
-
* @property-read string $bic
|
17 |
-
* @property-read string $customerId
|
18 |
-
* @property-read string $default
|
19 |
-
* @property-read string $image-url
|
20 |
-
* @property-read string $mandate-reference-number
|
21 |
-
* @property-read string $masked-iban
|
22 |
-
* @property-read string $token
|
23 |
-
*/
|
24 |
-
class EuropeBankAccount extends Base
|
25 |
-
{
|
26 |
-
|
27 |
-
/* instance methods */
|
28 |
-
/**
|
29 |
-
* returns false if default is null or false
|
30 |
-
*
|
31 |
-
* @return boolean
|
32 |
-
*/
|
33 |
-
public function isDefault()
|
34 |
-
{
|
35 |
-
return $this->default;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* factory method: returns an instance of EuropeBankAccount
|
40 |
-
* to the requesting method, with populated properties
|
41 |
-
*
|
42 |
-
* @ignore
|
43 |
-
* @return EuropeBankAccount
|
44 |
-
*/
|
45 |
-
public static function factory($attributes)
|
46 |
-
{
|
47 |
-
$defaultAttributes = [
|
48 |
-
];
|
49 |
-
|
50 |
-
$instance = new self();
|
51 |
-
$instance->_initialize(array_merge($defaultAttributes, $attributes));
|
52 |
-
return $instance;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* sets instance properties from an array of values
|
57 |
-
*
|
58 |
-
* @access protected
|
59 |
-
* @param array $europeBankAccountAttribs array of EuropeBankAccount properties
|
60 |
-
* @return void
|
61 |
-
*/
|
62 |
-
protected function _initialize($europeBankAccountAttribs)
|
63 |
-
{
|
64 |
-
$this->_attributes = $europeBankAccountAttribs;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
class_alias('Braintree\EuropeBankAccount', 'Braintree_EuropeBankAccount');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception.php
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* super class for all Braintree exceptions
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @subpackage Exception
|
9 |
*/
|
10 |
class Exception extends \Exception
|
11 |
{
|
12 |
}
|
13 |
-
class_alias('Braintree\Exception', 'Braintree_Exception');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* super class for all Braintree exceptions
|
|
|
|
|
|
|
7 |
*/
|
8 |
class Exception extends \Exception
|
9 |
{
|
10 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Authentication.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
@@ -6,12 +7,7 @@ use Braintree\Exception;
|
|
6 |
/**
|
7 |
* Raised when authentication fails.
|
8 |
* This may be caused by an incorrect Configuration
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Exception
|
12 |
*/
|
13 |
class Authentication extends Exception
|
14 |
{
|
15 |
-
|
16 |
}
|
17 |
-
class_alias('Braintree\Exception\Authentication', 'Braintree_Exception_Authentication');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
7 |
/**
|
8 |
* Raised when authentication fails.
|
9 |
* This may be caused by an incorrect Configuration
|
|
|
|
|
|
|
10 |
*/
|
11 |
class Authentication extends Exception
|
12 |
{
|
|
|
13 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Authorization.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
@@ -8,12 +9,7 @@ use Braintree\Exception;
|
|
8 |
* Raised when the API key being used is not authorized to perform
|
9 |
* the attempted action according to the roles assigned to the user
|
10 |
* who owns the API key.
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @subpackage Exception
|
14 |
*/
|
15 |
class Authorization extends Exception
|
16 |
{
|
17 |
-
|
18 |
}
|
19 |
-
class_alias('Braintree\Exception\Authorization', 'Braintree_Exception_Authorization');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
9 |
* Raised when the API key being used is not authorized to perform
|
10 |
* the attempted action according to the roles assigned to the user
|
11 |
* who owns the API key.
|
|
|
|
|
|
|
12 |
*/
|
13 |
class Authorization extends Exception
|
14 |
{
|
|
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Configuration.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
@@ -6,12 +7,8 @@ use Braintree\Exception;
|
|
6 |
/**
|
7 |
* Raised when the Braintree library is not completely configured.
|
8 |
*
|
9 |
-
* @
|
10 |
-
* @subpackage Exception
|
11 |
-
* @see Configuration
|
12 |
*/
|
13 |
class Configuration extends Exception
|
14 |
{
|
15 |
-
|
16 |
}
|
17 |
-
class_alias('Braintree\Exception\Configuration', 'Braintree_Exception_Configuration');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
7 |
/**
|
8 |
* Raised when the Braintree library is not completely configured.
|
9 |
*
|
10 |
+
* @see Configuration
|
|
|
|
|
11 |
*/
|
12 |
class Configuration extends Exception
|
13 |
{
|
|
|
14 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Connection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
@@ -6,12 +7,8 @@ use Braintree\Exception;
|
|
6 |
/**
|
7 |
* Raised when the connection fails
|
8 |
*
|
9 |
-
* @
|
10 |
-
* @subpackage Exception
|
11 |
-
* @copyright 2015 Braintree, a division of PayPal, Inc.
|
12 |
*/
|
13 |
class Connection extends Exception
|
14 |
{
|
15 |
-
|
16 |
}
|
17 |
-
class_alias('Braintree\Exception\Connection', 'Braintree_Exception_Connection');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
7 |
/**
|
8 |
* Raised when the connection fails
|
9 |
*
|
10 |
+
* @copyright 2015 Braintree, a division of PayPal, Inc.
|
|
|
|
|
11 |
*/
|
12 |
class Connection extends Exception
|
13 |
{
|
|
|
14 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/DownForMaintenance.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Exception;
|
3 |
-
|
4 |
-
use Braintree\Exception;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Raised when the gateway is down for maintenance.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
-
*/
|
12 |
-
class DownForMaintenance extends Exception
|
13 |
-
{
|
14 |
-
|
15 |
-
}
|
16 |
-
class_alias('Braintree\Exception\DownForMaintenance', 'Braintree_Exception_DownForMaintenance');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/ForgedQueryString.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Exception;
|
3 |
-
|
4 |
-
use Braintree\Exception;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Raised when a suspected forged query string is present
|
8 |
-
* Raised from methods that confirm transparent redirect requests
|
9 |
-
* when the given query string cannot be verified. This may indicate
|
10 |
-
* an attempted hack on the merchant's transparent redirect
|
11 |
-
* confirmation URL.
|
12 |
-
*
|
13 |
-
* @package Braintree
|
14 |
-
* @subpackage Exception
|
15 |
-
*/
|
16 |
-
class ForgedQueryString extends Exception
|
17 |
-
{
|
18 |
-
|
19 |
-
}
|
20 |
-
class_alias('Braintree\Exception\ForgedQueryString', 'Braintree_Exception_ForgedQueryString');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/GatewayTimeout.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Exception;
|
4 |
+
|
5 |
+
use Braintree\Exception;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Raised when a gateway response timeout occurs.
|
9 |
+
*/
|
10 |
+
class GatewayTimeout extends Exception
|
11 |
+
{
|
12 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Exception/InvalidChallenge.php
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
class InvalidChallenge extends Exception
|
7 |
{
|
8 |
}
|
9 |
-
class_alias('Braintree\Exception\InvalidChallenge', 'Braintree_Exception_InvalidChallenge');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
+
/**
|
8 |
+
* Raised when the webhook challenge you attempt to verify is in an invalid format.
|
9 |
+
*
|
10 |
+
* @link https://developer.paypal.com/braintree/docs/reference/general/exceptions/php#invalid-challenge
|
11 |
+
*/
|
12 |
class InvalidChallenge extends Exception
|
13 |
{
|
14 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/InvalidSignature.php
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
class InvalidSignature extends Exception
|
7 |
{
|
8 |
}
|
9 |
-
class_alias('Braintree\Exception\InvalidSignature', 'Braintree_Exception_InvalidSignature');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
+
/**
|
8 |
+
* Raised when the webhook notification you attempt to parse has an invalid signature.
|
9 |
+
*
|
10 |
+
* @link https://developer.paypal.com/braintree/docs/reference/general/exceptions/php#invalid-signature
|
11 |
+
*/
|
12 |
class InvalidSignature extends Exception
|
13 |
{
|
14 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/NotFound.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when a record could not be found.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class NotFound extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\NotFound', 'Braintree_Exception_NotFound');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when a record could not be found.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class NotFound extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/RequestTimeout.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Exception;
|
4 |
+
|
5 |
+
use Braintree\Exception;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Raised when a client request timeout occurs.
|
9 |
+
*/
|
10 |
+
class RequestTimeout extends Exception
|
11 |
+
{
|
12 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Exception/SSLCaFileNotFound.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when the SSL CaFile is not found.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class SSLCaFileNotFound extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\SSLCaFileNotFound', 'Braintree_Exception_SSLCaFileNotFound');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when the SSL CaFile is not found.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class SSLCaFileNotFound extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/SSLCertificate.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when the SSL certificate fails verification.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class SSLCertificate extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\SSLCertificate', 'Braintree_Exception_SSLCertificate');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when the SSL certificate fails verification.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class SSLCertificate extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/ServerError.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when an unexpected server error occurs.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class ServerError extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\ServerError', 'Braintree_Exception_ServerError');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when an unexpected server error occurs.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class ServerError extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/ServiceUnavailable.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Exception;
|
4 |
+
|
5 |
+
use Braintree\Exception;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Raised when the gateway service is unavailable.
|
9 |
+
*/
|
10 |
+
class ServiceUnavailable extends Exception
|
11 |
+
{
|
12 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Exception/TestOperationPerformedInProduction.php
CHANGED
@@ -1,15 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when a test method is used in production.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class TestOperationPerformedInProduction extends Exception
|
13 |
{
|
14 |
}
|
15 |
-
class_alias('Braintree\Exception\TestOperationPerformedInProduction', 'Braintree_Exception_TestOperationPerformedInProduction');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when a test method is used in production.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class TestOperationPerformedInProduction extends Exception
|
11 |
{
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Timeout.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when a Timeout occurs
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class Timeout extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\Timeout', 'Braintree_Exception_Timeout');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when a Timeout occurs
|
|
|
|
|
|
|
9 |
*/
|
10 |
class Timeout extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/TooManyRequests.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when the gateway request rate-limit is exceeded.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class TooManyRequests extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\TooManyRequests', 'Braintree_Exception_TooManyRequests');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when the gateway request rate-limit is exceeded.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class TooManyRequests extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/Unexpected.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
@@ -6,12 +7,7 @@ use Braintree\Exception;
|
|
6 |
/**
|
7 |
* Raised when an error occurs that the client library is not built to handle.
|
8 |
* This shouldn't happen.
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Exception
|
12 |
*/
|
13 |
class Unexpected extends Exception
|
14 |
{
|
15 |
-
|
16 |
}
|
17 |
-
class_alias('Braintree\Exception\Unexpected', 'Braintree_Exception_Unexpected');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
7 |
/**
|
8 |
* Raised when an error occurs that the client library is not built to handle.
|
9 |
* This shouldn't happen.
|
|
|
|
|
|
|
10 |
*/
|
11 |
class Unexpected extends Exception
|
12 |
{
|
|
|
13 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/UpgradeRequired.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised when a client library must be upgraded.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class UpgradeRequired extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\UpgradeRequired', 'Braintree_Exception_UpgradeRequired');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised when a client library must be upgraded.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class UpgradeRequired extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Exception/ValidationsFailed.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Exception;
|
3 |
|
4 |
use Braintree\Exception;
|
5 |
|
6 |
/**
|
7 |
* Raised from non-validating methods when gateway validations fail.
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Exception
|
11 |
*/
|
12 |
class ValidationsFailed extends Exception
|
13 |
{
|
14 |
-
|
15 |
}
|
16 |
-
class_alias('Braintree\Exception\ValidationsFailed', 'Braintree_Exception_ValidationsFailed');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Exception;
|
4 |
|
5 |
use Braintree\Exception;
|
6 |
|
7 |
/**
|
8 |
* Raised from non-validating methods when gateway validations fail.
|
|
|
|
|
|
|
9 |
*/
|
10 |
class ValidationsFailed extends Exception
|
11 |
{
|
|
|
12 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/FacilitatedDetails.php
CHANGED
@@ -1,8 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class FacilitatedDetails extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -15,15 +30,10 @@ class FacilitatedDetails extends Base
|
|
15 |
$this->_attributes = $attributes;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
* @return string
|
21 |
-
*/
|
22 |
-
public function __toString()
|
23 |
{
|
24 |
return __CLASS__ . '[' .
|
25 |
-
Util::attributesToString($this->_attributes) .']';
|
26 |
}
|
27 |
-
|
28 |
}
|
29 |
-
class_alias('Braintree\FacilitatedDetails', 'Braintree_FacilitatedDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree FacilitatedDetails class
|
7 |
+
*
|
8 |
+
* If the transaction request was performed using payment information from a third party via the Grant API or Shared Vault, these fields will capture information about the merchant of record. These fields are primarily useful for the third party.
|
9 |
+
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction/php#facilitated_details developer docs} for information on attributes
|
11 |
+
*/
|
12 |
class FacilitatedDetails extends Base
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Creates an instance of a FacilitatedDetails from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return FacilitatedDetails
|
20 |
+
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
23 |
$instance = new self();
|
30 |
$this->_attributes = $attributes;
|
31 |
}
|
32 |
|
33 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
34 |
+
public function __toString()
|
|
|
|
|
|
|
35 |
{
|
36 |
return __CLASS__ . '[' .
|
37 |
+
Util::attributesToString($this->_attributes) . ']';
|
38 |
}
|
|
|
39 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/FacilitatorDetails.php
CHANGED
@@ -1,8 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class FacilitatorDetails extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -16,15 +31,10 @@ class FacilitatorDetails extends Base
|
|
16 |
$this->_attributes = $attributes;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
public function __toString()
|
24 |
{
|
25 |
return __CLASS__ . '[' .
|
26 |
-
Util::attributesToString($this->_attributes) .']';
|
27 |
}
|
28 |
-
|
29 |
}
|
30 |
-
class_alias('Braintree\FacilitatorDetails', 'Braintree_FacilitatorDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree FacilitatorDetails class
|
7 |
+
*
|
8 |
+
* If a transaction request was performed using payment information from a third party via the Grant API, Shared Vault or Google Pay, thise object will have information about the third party. These fields are primarily useful for the merchant of record.
|
9 |
+
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction/#facilitator_details developer docs} for information on attributes
|
11 |
+
*/
|
12 |
class FacilitatorDetails extends Base
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Creates an instance of an FacilitatorDetails from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return FacilitatorDetails
|
20 |
+
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
23 |
$instance = new self();
|
31 |
$this->_attributes = $attributes;
|
32 |
}
|
33 |
|
34 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
35 |
+
public function __toString()
|
|
|
|
|
|
|
36 |
{
|
37 |
return __CLASS__ . '[' .
|
38 |
+
Util::attributesToString($this->_attributes) . ']';
|
39 |
}
|
|
|
40 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Gateway.php
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree Gateway module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
class Gateway
|
11 |
{
|
@@ -15,12 +13,20 @@ class Gateway
|
|
15 |
*/
|
16 |
public $config;
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function __construct($config)
|
19 |
{
|
20 |
if (is_array($config)) {
|
21 |
$config = new Configuration($config);
|
22 |
}
|
23 |
$this->config = $config;
|
|
|
24 |
}
|
25 |
|
26 |
/**
|
@@ -221,15 +227,6 @@ class Gateway
|
|
221 |
return new TransactionLineItemGateway($this);
|
222 |
}
|
223 |
|
224 |
-
/**
|
225 |
-
*
|
226 |
-
* @return TransparentRedirectGateway
|
227 |
-
*/
|
228 |
-
public function transparentRedirect()
|
229 |
-
{
|
230 |
-
return new TransparentRedirectGateway($this);
|
231 |
-
}
|
232 |
-
|
233 |
/**
|
234 |
*
|
235 |
* @return UsBankAccountGateway
|
@@ -248,15 +245,6 @@ class Gateway
|
|
248 |
return new UsBankAccountVerificationGateway($this);
|
249 |
}
|
250 |
|
251 |
-
/**
|
252 |
-
*
|
253 |
-
* @return IdealPaymentGateway
|
254 |
-
*/
|
255 |
-
public function idealPayment()
|
256 |
-
{
|
257 |
-
return new IdealPaymentGateway($this);
|
258 |
-
}
|
259 |
-
|
260 |
/**
|
261 |
*
|
262 |
* @return WebhookNotificationGateway
|
@@ -275,4 +263,3 @@ class Gateway
|
|
275 |
return new WebhookTestingGateway($this);
|
276 |
}
|
277 |
}
|
278 |
-
class_alias('Braintree\Gateway', 'Braintree_Gateway');
|
1 |
+
<?php // phpcs:disable Generic.Commenting.DocComment.MissingShort
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree Gateway module
|
|
|
|
|
|
|
7 |
*/
|
8 |
class Gateway
|
9 |
{
|
13 |
*/
|
14 |
public $config;
|
15 |
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
* @var GraphQLClient
|
19 |
+
*/
|
20 |
+
public $graphQLClient;
|
21 |
+
|
22 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
23 |
public function __construct($config)
|
24 |
{
|
25 |
if (is_array($config)) {
|
26 |
$config = new Configuration($config);
|
27 |
}
|
28 |
$this->config = $config;
|
29 |
+
$this->graphQLClient = new GraphQLClient($config);
|
30 |
}
|
31 |
|
32 |
/**
|
227 |
return new TransactionLineItemGateway($this);
|
228 |
}
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
/**
|
231 |
*
|
232 |
* @return UsBankAccountGateway
|
245 |
return new UsBankAccountVerificationGateway($this);
|
246 |
}
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
/**
|
249 |
*
|
250 |
* @return WebhookNotificationGateway
|
263 |
return new WebhookTestingGateway($this);
|
264 |
}
|
265 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/GooglePayCard.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree GooglePayCard module
|
7 |
+
* Creates and manages Braintree Google Pay cards
|
8 |
+
*
|
9 |
+
* <b>== More information ==</b>
|
10 |
+
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/google-pay-card developer docs} for information on attributes
|
12 |
+
*/
|
13 |
+
class GooglePayCard extends Base
|
14 |
+
{
|
15 |
+
/* instance methods */
|
16 |
+
/**
|
17 |
+
* returns false if default is null or false
|
18 |
+
*
|
19 |
+
* @return boolean
|
20 |
+
*/
|
21 |
+
public function isDefault()
|
22 |
+
{
|
23 |
+
return $this->default;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Creates an instance of a GooglePayCard from given attributes
|
28 |
+
*
|
29 |
+
* @param array $attributes response object attributes
|
30 |
+
*
|
31 |
+
* @return GooglePayCard
|
32 |
+
*/
|
33 |
+
public static function factory($attributes)
|
34 |
+
{
|
35 |
+
$defaultAttributes = [
|
36 |
+
'expirationMonth' => '',
|
37 |
+
'expirationYear' => '',
|
38 |
+
'last4' => $attributes['virtualCardLast4'],
|
39 |
+
'cardType' => $attributes['virtualCardType'],
|
40 |
+
];
|
41 |
+
|
42 |
+
$instance = new self();
|
43 |
+
$instance->_initialize(array_merge($defaultAttributes, $attributes));
|
44 |
+
return $instance;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* sets instance properties from an array of values
|
49 |
+
*
|
50 |
+
* @param array $googlePayCardAttribs array of Google Pay card properties
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
protected function _initialize($googlePayCardAttribs)
|
55 |
+
{
|
56 |
+
// set the attributes
|
57 |
+
$this->_attributes = $googlePayCardAttribs;
|
58 |
+
|
59 |
+
$subscriptionArray = [];
|
60 |
+
if (isset($googlePayCardAttribs['subscriptions'])) {
|
61 |
+
foreach ($googlePayCardAttribs['subscriptions'] as $subscription) {
|
62 |
+
$subscriptionArray[] = Subscription::factory($subscription);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->_set('subscriptions', $subscriptionArray);
|
67 |
+
}
|
68 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/GrantedPaymentInstrumentUpdate.php
CHANGED
@@ -1,35 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree GrantedPaymentInstrumentUpdate module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
-
* Manages Braintree GrantedPaymentInstrumentUpdate
|
13 |
-
*
|
14 |
-
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
*
|
20 |
-
* @
|
21 |
-
* @property-read string $grantRecipientMerchantId
|
22 |
-
* @property-read string $paymentMethodNonce
|
23 |
-
* @property-read string $token
|
24 |
-
* @property-read string $updatedFields
|
25 |
*/
|
26 |
class GrantedPaymentInstrumentUpdate extends Base
|
27 |
{
|
28 |
/**
|
29 |
-
*
|
30 |
-
*
|
|
|
31 |
*
|
32 |
-
* @ignore
|
33 |
* @return GrantedPaymentInstrumentUpdate
|
34 |
*/
|
35 |
public static function factory($attributes)
|
@@ -44,8 +32,8 @@ class GrantedPaymentInstrumentUpdate extends Base
|
|
44 |
/**
|
45 |
* sets instance properties from an array of values
|
46 |
*
|
47 |
-
* @access protected
|
48 |
* @param array $GrantedPaymentInstrumentAttribs array of grantedPaymentInstrumentUpdate data
|
|
|
49 |
* @return void
|
50 |
*/
|
51 |
protected function _initialize($grantedPaymentInstrumentUpdateAttribs)
|
@@ -59,15 +47,10 @@ class GrantedPaymentInstrumentUpdate extends Base
|
|
59 |
$this->_set('paymentMethodNonce', $paymentMethodNonce);
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
* ClassName[property=value, property=value]
|
65 |
-
* @return string
|
66 |
-
*/
|
67 |
-
public function __toString()
|
68 |
{
|
69 |
return __CLASS__ . '[' .
|
70 |
Util::attributesToString($this->_attributes) . ']';
|
71 |
}
|
72 |
}
|
73 |
-
class_alias('Braintree\GrantedPaymentInstrumentUpdate', 'Braintree_GrantedPaymentInstrumentUpdate');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree GrantedPaymentInstrumentUpdate module
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
10 |
+
* Manages Braintree GrantedPaymentInstrumentUpdate
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/guides/extend/grant-api/webhooks developer docs} for more information
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class GrantedPaymentInstrumentUpdate extends Base
|
15 |
{
|
16 |
/**
|
17 |
+
* Creates an instance from given attributes
|
18 |
+
*
|
19 |
+
* @param array $attributes response object attributes
|
20 |
*
|
|
|
21 |
* @return GrantedPaymentInstrumentUpdate
|
22 |
*/
|
23 |
public static function factory($attributes)
|
32 |
/**
|
33 |
* sets instance properties from an array of values
|
34 |
*
|
|
|
35 |
* @param array $GrantedPaymentInstrumentAttribs array of grantedPaymentInstrumentUpdate data
|
36 |
+
*
|
37 |
* @return void
|
38 |
*/
|
39 |
protected function _initialize($grantedPaymentInstrumentUpdateAttribs)
|
47 |
$this->_set('paymentMethodNonce', $paymentMethodNonce);
|
48 |
}
|
49 |
|
50 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
51 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
52 |
{
|
53 |
return __CLASS__ . '[' .
|
54 |
Util::attributesToString($this->_attributes) . ']';
|
55 |
}
|
56 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/GraphQL.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
use finfo;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Braintree GraphQL service
|
9 |
+
* process GraphQL requests using curl
|
10 |
+
*/
|
11 |
+
class GraphQL extends Http
|
12 |
+
{
|
13 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
14 |
+
public function __construct($config)
|
15 |
+
{
|
16 |
+
parent::__construct($config);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Sets headers for requests via GraphQL
|
21 |
+
*
|
22 |
+
* @return array request headers
|
23 |
+
*/
|
24 |
+
public function graphQLHeaders()
|
25 |
+
{
|
26 |
+
return [
|
27 |
+
'Accept: application/json',
|
28 |
+
'Braintree-Version: ' . Configuration::GRAPHQL_API_VERSION,
|
29 |
+
'Content-Type: application/json',
|
30 |
+
'User-Agent: Braintree PHP Library ' . Version::get(),
|
31 |
+
'X-ApiVersion: ' . Configuration::API_VERSION
|
32 |
+
];
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Makes the API request to GraphQL API
|
37 |
+
*
|
38 |
+
* @param mixed $definition containing GraphQL query
|
39 |
+
* @param mixed $variables optional, any variables to be included in GraphQL request
|
40 |
+
*
|
41 |
+
* @return object result
|
42 |
+
*/
|
43 |
+
public function request($definition, $variables = null)
|
44 |
+
{
|
45 |
+
$graphQLRequest = ["query" => $definition];
|
46 |
+
if ($variables) {
|
47 |
+
$graphQLRequest["variables"] = $variables;
|
48 |
+
}
|
49 |
+
|
50 |
+
// phpcs:ignore Generic.Files.LineLength
|
51 |
+
$response = $this->_doUrlRequest('POST', $this->_config->graphQLBaseUrl(), json_encode($graphQLRequest), null, $this->graphQLHeaders());
|
52 |
+
|
53 |
+
$result = json_decode($response["body"], true);
|
54 |
+
Util::throwGraphQLResponseException($result);
|
55 |
+
|
56 |
+
return $result;
|
57 |
+
}
|
58 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/GraphQLClient.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree GraphQL Client
|
7 |
+
* process GraphQL requests using curl
|
8 |
+
*/
|
9 |
+
class GraphQLClient
|
10 |
+
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
+
public function __construct($config)
|
13 |
+
{
|
14 |
+
$this->_service = new GraphQL($config);
|
15 |
+
}
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Make a GraphQL API request
|
19 |
+
*
|
20 |
+
* @param object $definition of the query
|
21 |
+
* @param object $variables optional
|
22 |
+
*
|
23 |
+
* @return object result
|
24 |
+
*/
|
25 |
+
public function query($definition, $variables = null)
|
26 |
+
{
|
27 |
+
return $this->_service->request($definition, $variables);
|
28 |
+
}
|
29 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Http.php
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
-
use
|
|
|
5 |
|
6 |
/**
|
7 |
* Braintree HTTP Client
|
@@ -12,24 +14,40 @@ class Http
|
|
12 |
protected $_config;
|
13 |
private $_useClientCredentials = false;
|
14 |
|
|
|
15 |
public function __construct($config)
|
16 |
{
|
17 |
$this->_config = $config;
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function delete($path, $params = null)
|
21 |
{
|
22 |
$response = $this->_doRequest('DELETE', $path, $this->_buildXml($params));
|
23 |
$responseCode = $response['status'];
|
24 |
if ($responseCode === 200 || $responseCode === 204) {
|
25 |
return true;
|
26 |
-
}
|
27 |
return Xml::buildArrayFromXml($response['body']);
|
28 |
} else {
|
29 |
Util::throwStatusCodeException($response['status']);
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public function get($path)
|
34 |
{
|
35 |
$response = $this->_doRequest('GET', $path);
|
@@ -40,6 +58,14 @@ class Http
|
|
40 |
}
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
public function post($path, $params = null)
|
44 |
{
|
45 |
$response = $this->_doRequest('POST', $path, $this->_buildXml($params));
|
@@ -51,9 +77,22 @@ class Http
|
|
51 |
}
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
public function postMultipart($path, $params, $file)
|
55 |
{
|
56 |
-
$
|
|
|
|
|
|
|
|
|
57 |
$responseCode = $response['status'];
|
58 |
if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode == 400) {
|
59 |
return Xml::buildArrayFromXml($response['body']);
|
@@ -62,6 +101,14 @@ class Http
|
|
62 |
}
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
public function put($path, $params = null)
|
66 |
{
|
67 |
$response = $this->_doRequest('PUT', $path, $this->_buildXml($params));
|
@@ -78,187 +125,24 @@ class Http
|
|
78 |
return empty($params) ? null : Xml::buildXmlFromArray($params);
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
'Accept: application/xml',
|
85 |
-
];
|
86 |
-
}
|
87 |
-
|
88 |
-
private function _getAuthorization()
|
89 |
-
{
|
90 |
-
if ($this->_useClientCredentials) {
|
91 |
-
return [
|
92 |
-
'user' => $this->_config->getClientId(),
|
93 |
-
'password' => $this->_config->getClientSecret(),
|
94 |
-
];
|
95 |
-
} else if ($this->_config->isAccessToken()) {
|
96 |
-
return [
|
97 |
-
'token' => $this->_config->getAccessToken(),
|
98 |
-
];
|
99 |
-
} else {
|
100 |
-
return [
|
101 |
-
'user' => $this->_config->getPublicKey(),
|
102 |
-
'password' => $this->_config->getPrivateKey(),
|
103 |
-
];
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
public function useClientCredentials()
|
108 |
{
|
109 |
$this->_useClientCredentials = true;
|
110 |
}
|
111 |
|
112 |
-
private function _doRequest($httpVerb, $path, $requestBody = null, $file = null)
|
113 |
{
|
114 |
-
return $this->_doUrlRequest($httpVerb, $this->_config->baseUrl() . $path, $requestBody, $file);
|
115 |
-
}
|
116 |
-
|
117 |
-
public function _doUrlRequest($httpVerb, $url, $requestBody = null, $file = null)
|
118 |
-
{
|
119 |
-
$curl = curl_init();
|
120 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, $this->_config->timeout());
|
121 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $httpVerb);
|
122 |
-
curl_setopt($curl, CURLOPT_URL, $url);
|
123 |
-
|
124 |
-
if ($this->_config->acceptGzipEncoding()) {
|
125 |
-
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
|
126 |
-
}
|
127 |
-
if ($this->_config->sslVersion()) {
|
128 |
-
curl_setopt($curl, CURLOPT_SSLVERSION, $this->_config->sslVersion());
|
129 |
-
}
|
130 |
-
|
131 |
-
$headers = $this->_getHeaders($curl);
|
132 |
-
$headers[] = 'User-Agent: Braintree PHP Library ' . Version::get();
|
133 |
-
$headers[] = 'X-ApiVersion: ' . Configuration::API_VERSION;
|
134 |
-
|
135 |
-
$authorization = $this->_getAuthorization();
|
136 |
-
if (isset($authorization['user'])) {
|
137 |
-
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
138 |
-
curl_setopt($curl, CURLOPT_USERPWD, $authorization['user'] . ':' . $authorization['password']);
|
139 |
-
} else if (isset($authorization['token'])) {
|
140 |
-
$headers[] = 'Authorization: Bearer ' . $authorization['token'];
|
141 |
-
}
|
142 |
-
|
143 |
-
if ($this->_config->sslOn()) {
|
144 |
-
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
145 |
-
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
|
146 |
-
curl_setopt($curl, CURLOPT_CAINFO, $this->getCaFile());
|
147 |
-
}
|
148 |
-
|
149 |
-
if (!empty($file)) {
|
150 |
-
$boundary = "---------------------" . md5(mt_rand() . microtime());
|
151 |
-
$headers[] = "Content-Type: multipart/form-data; boundary={$boundary}";
|
152 |
-
$this->prepareMultipart($curl, $requestBody, $file, $boundary);
|
153 |
-
} else if (!empty($requestBody)) {
|
154 |
-
$headers[] = 'Content-Type: application/xml';
|
155 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
|
156 |
-
}
|
157 |
-
|
158 |
-
if ($this->_config->isUsingProxy()) {
|
159 |
-
$proxyHost = $this->_config->getProxyHost();
|
160 |
-
$proxyPort = $this->_config->getProxyPort();
|
161 |
-
$proxyType = $this->_config->getProxyType();
|
162 |
-
$proxyUser = $this->_config->getProxyUser();
|
163 |
-
$proxyPwd= $this->_config->getProxyPassword();
|
164 |
-
curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
|
165 |
-
if (!empty($proxyType)) {
|
166 |
-
curl_setopt($curl, CURLOPT_PROXYTYPE, $proxyType);
|
167 |
-
}
|
168 |
-
if ($this->_config->isAuthenticatedProxy()) {
|
169 |
-
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $proxyPwd);
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
174 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
175 |
-
$response = curl_exec($curl);
|
176 |
-
$httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
177 |
-
$error_code = curl_errno($curl);
|
178 |
-
$error = curl_error($curl);
|
179 |
-
|
180 |
-
if ($error_code == 28 && $httpStatus == 0) {
|
181 |
-
throw new Exception\Timeout();
|
182 |
-
}
|
183 |
-
|
184 |
-
curl_close($curl);
|
185 |
-
if ($this->_config->sslOn()) {
|
186 |
-
if ($httpStatus == 0) {
|
187 |
-
throw new Exception\SSLCertificate($error, $error_code);
|
188 |
-
}
|
189 |
-
} else if ($error_code) {
|
190 |
-
throw new Exception\Connection($error, $error_code);
|
191 |
-
}
|
192 |
-
|
193 |
-
return ['status' => $httpStatus, 'body' => $response];
|
194 |
}
|
195 |
|
196 |
-
|
197 |
-
|
198 |
-
$fileInfo = new finfo(FILEINFO_MIME_TYPE);
|
199 |
-
$filePath = stream_get_meta_data($file)['uri'];
|
200 |
-
$data = file_get_contents($filePath);
|
201 |
-
$mimeType = $fileInfo->buffer($data);
|
202 |
-
|
203 |
-
// build normal parameters
|
204 |
-
foreach ($requestBody as $k => $v) {
|
205 |
-
$k = str_replace($disallow, "_", $k);
|
206 |
-
$body[] = implode("\r\n", [
|
207 |
-
"Content-Disposition: form-data; name=\"{$k}\"",
|
208 |
-
"",
|
209 |
-
filter_var($v),
|
210 |
-
]);
|
211 |
-
}
|
212 |
-
|
213 |
-
// build file parameter
|
214 |
-
$splitFilePath = explode(DIRECTORY_SEPARATOR, $filePath);
|
215 |
-
$filePath = end($splitFilePath);
|
216 |
-
$filePath = str_replace($disallow, "_", $filePath);
|
217 |
-
$body[] = implode("\r\n", [
|
218 |
-
"Content-Disposition: form-data; name=\"file\"; filename=\"{$filePath}\"",
|
219 |
-
"Content-Type: {$mimeType}",
|
220 |
-
"",
|
221 |
-
$data,
|
222 |
-
]);
|
223 |
-
|
224 |
-
// add boundary for each parameters
|
225 |
-
array_walk($body, function (&$part) use ($boundary) {
|
226 |
-
$part = "--{$boundary}\r\n{$part}";
|
227 |
-
});
|
228 |
-
|
229 |
-
// add final boundary
|
230 |
-
$body[] = "--{$boundary}--";
|
231 |
-
$body[] = "";
|
232 |
-
|
233 |
-
// set options
|
234 |
-
return curl_setopt_array($ch, [
|
235 |
-
CURLOPT_POST => true,
|
236 |
-
CURLOPT_POSTFIELDS => implode("\r\n", $body)
|
237 |
-
]);
|
238 |
-
}
|
239 |
-
|
240 |
-
private function getCaFile()
|
241 |
{
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
$caFile = $this->_config->caFile();
|
246 |
-
|
247 |
-
if (substr($caFile, 0, 7) !== 'phar://') {
|
248 |
-
return $caFile;
|
249 |
-
}
|
250 |
-
|
251 |
-
$extractedCaFile = sys_get_temp_dir() . '/api_braintreegateway_com.ca.crt';
|
252 |
-
|
253 |
-
if (!file_exists($extractedCaFile) || sha1_file($extractedCaFile) != sha1_file($caFile)) {
|
254 |
-
if (!copy($caFile, $extractedCaFile)) {
|
255 |
-
throw new Exception\SSLCaFileNotFound();
|
256 |
-
}
|
257 |
-
}
|
258 |
-
$memo = $extractedCaFile;
|
259 |
-
}
|
260 |
-
|
261 |
-
return $memo;
|
262 |
}
|
263 |
}
|
264 |
-
class_alias('Braintree\Http', 'Braintree_Http');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
use Braintree\HttpHelpers\Curl;
|
6 |
+
use Braintree\HttpHelpers\CurlRequest;
|
7 |
|
8 |
/**
|
9 |
* Braintree HTTP Client
|
14 |
protected $_config;
|
15 |
private $_useClientCredentials = false;
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
18 |
public function __construct($config)
|
19 |
{
|
20 |
$this->_config = $config;
|
21 |
}
|
22 |
|
23 |
+
/*
|
24 |
+
* DELETE request
|
25 |
+
*
|
26 |
+
* @param string $path URL path
|
27 |
+
* @param object $params optional any addition request parameters
|
28 |
+
*
|
29 |
+
* @return array|Exception
|
30 |
+
*/
|
31 |
public function delete($path, $params = null)
|
32 |
{
|
33 |
$response = $this->_doRequest('DELETE', $path, $this->_buildXml($params));
|
34 |
$responseCode = $response['status'];
|
35 |
if ($responseCode === 200 || $responseCode === 204) {
|
36 |
return true;
|
37 |
+
} elseif ($responseCode === 422) {
|
38 |
return Xml::buildArrayFromXml($response['body']);
|
39 |
} else {
|
40 |
Util::throwStatusCodeException($response['status']);
|
41 |
}
|
42 |
}
|
43 |
|
44 |
+
/*
|
45 |
+
* GET request
|
46 |
+
*
|
47 |
+
* @param string $path URL path
|
48 |
+
*
|
49 |
+
* @return array|Exception
|
50 |
+
*/
|
51 |
public function get($path)
|
52 |
{
|
53 |
$response = $this->_doRequest('GET', $path);
|
58 |
}
|
59 |
}
|
60 |
|
61 |
+
/*
|
62 |
+
* POST request
|
63 |
+
*
|
64 |
+
* @param string $path URL path
|
65 |
+
* @param object $params optional any addition request parameters
|
66 |
+
*
|
67 |
+
* @return array|Exception
|
68 |
+
*/
|
69 |
public function post($path, $params = null)
|
70 |
{
|
71 |
$response = $this->_doRequest('POST', $path, $this->_buildXml($params));
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
/*
|
81 |
+
* POST request for multi parts to be sent
|
82 |
+
*
|
83 |
+
* @param string $path URL path
|
84 |
+
* @param object $params additional request parameters
|
85 |
+
* @param object $file to be uploaded
|
86 |
+
*
|
87 |
+
* @return array|Exception
|
88 |
+
*/
|
89 |
public function postMultipart($path, $params, $file)
|
90 |
{
|
91 |
+
$headers = [
|
92 |
+
'User-Agent: Braintree PHP Library ' . Version::get(),
|
93 |
+
'X-ApiVersion: ' . Configuration::API_VERSION
|
94 |
+
];
|
95 |
+
$response = $this->_doRequest('POST', $path, $params, $file, $headers);
|
96 |
$responseCode = $response['status'];
|
97 |
if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode == 400) {
|
98 |
return Xml::buildArrayFromXml($response['body']);
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
/*
|
105 |
+
* PUT request
|
106 |
+
*
|
107 |
+
* @param string $path URL path
|
108 |
+
* @param object $params optional any addition request parameters
|
109 |
+
*
|
110 |
+
* @return array|Exception
|
111 |
+
*/
|
112 |
public function put($path, $params = null)
|
113 |
{
|
114 |
$response = $this->_doRequest('PUT', $path, $this->_buildXml($params));
|
125 |
return empty($params) ? null : Xml::buildXmlFromArray($params);
|
126 |
}
|
127 |
|
128 |
+
/*
|
129 |
+
* Sets internal variable to true
|
130 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
public function useClientCredentials()
|
132 |
{
|
133 |
$this->_useClientCredentials = true;
|
134 |
}
|
135 |
|
136 |
+
private function _doRequest($httpVerb, $path, $requestBody = null, $file = null, $headers = null)
|
137 |
{
|
138 |
+
return $this->_doUrlRequest($httpVerb, $this->_config->baseUrl() . $path, $requestBody, $file, $headers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
142 |
+
public function _doUrlRequest($httpVerb, $url, $requestBody = null, $file = null, $customHeaders = null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
{
|
144 |
+
$curlRequest = new CurlRequest($url);
|
145 |
+
// phpcs:ignore Generic.Files.LineLength
|
146 |
+
return Curl::makeRequest($httpVerb, $url, $this->_config, $curlRequest, $requestBody, $file, $customHeaders, $this->_useClientCredentials);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/Curl.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\HttpHelpers;
|
4 |
+
|
5 |
+
use Braintree\Exception;
|
6 |
+
use Braintree\Version;
|
7 |
+
use Braintree\Configuration;
|
8 |
+
use finfo;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Braintree Curl module
|
12 |
+
*
|
13 |
+
* Faciliates curl requests made by the SDK
|
14 |
+
*/
|
15 |
+
class Curl
|
16 |
+
{
|
17 |
+
// phpcs:ignore Generic.Files.LineLength, PEAR.Commenting.FunctionComment.Missing
|
18 |
+
public static function makeRequest($httpVerb, $url, $config, $httpRequest, $requestBody = null, $file = null, $customHeaders = null, $useClientCredentials = false)
|
19 |
+
{
|
20 |
+
$httpRequest->setOption(CURLOPT_TIMEOUT, $config->getTimeout());
|
21 |
+
$httpRequest->setOption(CURLOPT_CUSTOMREQUEST, $httpVerb);
|
22 |
+
$httpRequest->setOption(CURLOPT_URL, $url);
|
23 |
+
|
24 |
+
if ($config->getAcceptGzipEncoding()) {
|
25 |
+
$httpRequest->setOption(CURLOPT_ENCODING, 'gzip');
|
26 |
+
}
|
27 |
+
|
28 |
+
if ($config->getSslVersion()) {
|
29 |
+
$httpRequest->setOption(CURLOPT_SSLVERSION, $config->getSslVersion());
|
30 |
+
}
|
31 |
+
|
32 |
+
$headers = [];
|
33 |
+
if ($customHeaders) {
|
34 |
+
$headers = $customHeaders;
|
35 |
+
} else {
|
36 |
+
$headers[] = 'Accept: application/xml';
|
37 |
+
$headers[] = 'Content-Type: application/xml';
|
38 |
+
$headers[] = 'User-Agent: Braintree PHP Library ' . Version::get();
|
39 |
+
$headers[] = 'X-ApiVersion: ' . Configuration::API_VERSION;
|
40 |
+
}
|
41 |
+
|
42 |
+
$authorization = self::_getAuthorization($config, $useClientCredentials);
|
43 |
+
if (isset($authorization['user'])) {
|
44 |
+
$httpRequest->setOption(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
45 |
+
$httpRequest->setOption(CURLOPT_USERPWD, $authorization['user'] . ':' . $authorization['password']);
|
46 |
+
} elseif (isset($authorization['token'])) {
|
47 |
+
$headers[] = 'Authorization: Bearer ' . $authorization['token'];
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($config->sslOn()) {
|
51 |
+
$httpRequest->setOption(CURLOPT_SSL_VERIFYPEER, true);
|
52 |
+
$httpRequest->setOption(CURLOPT_SSL_VERIFYHOST, 2);
|
53 |
+
$httpRequest->setOption(CURLOPT_CAINFO, self::_getCaFile($config));
|
54 |
+
}
|
55 |
+
|
56 |
+
if (!empty($file)) {
|
57 |
+
$boundary = "---------------------" . md5(mt_rand() . microtime());
|
58 |
+
$headers[] = "Content-Type: multipart/form-data; boundary={$boundary}";
|
59 |
+
self::_prepareMultipart($httpRequest, $requestBody, $file, $boundary);
|
60 |
+
} elseif (!empty($requestBody)) {
|
61 |
+
$httpRequest->setOption(CURLOPT_POSTFIELDS, $requestBody);
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($config->isUsingProxy()) {
|
65 |
+
$proxyHost = $config->getProxyHost();
|
66 |
+
$proxyPort = $config->getProxyPort();
|
67 |
+
$proxyType = $config->getProxyType();
|
68 |
+
$proxyUser = $config->getProxyUser();
|
69 |
+
$proxyPwd = $config->getProxyPassword();
|
70 |
+
$httpRequest->setOption(CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
|
71 |
+
if (!empty($proxyType)) {
|
72 |
+
$httpRequest->setOption(CURLOPT_PROXYTYPE, $proxyType);
|
73 |
+
}
|
74 |
+
if ($config->isAuthenticatedProxy()) {
|
75 |
+
$httpRequest->setOption(CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $proxyPwd);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
$httpRequest->setOption(CURLOPT_HTTPHEADER, $headers);
|
80 |
+
$httpRequest->setOption(CURLOPT_RETURNTRANSFER, true);
|
81 |
+
$response = $httpRequest->execute();
|
82 |
+
$httpStatus = $httpRequest->getInfo(CURLINFO_HTTP_CODE);
|
83 |
+
$errorCode = $httpRequest->getErrorCode();
|
84 |
+
$error = $httpRequest->getError();
|
85 |
+
|
86 |
+
if ($errorCode == 28 && $httpStatus == 0) {
|
87 |
+
throw new Exception\Timeout();
|
88 |
+
}
|
89 |
+
|
90 |
+
$httpRequest->close();
|
91 |
+
if (is_null($error)) {
|
92 |
+
$error = "";
|
93 |
+
}
|
94 |
+
if ($config->sslOn() && $errorCode == 35) {
|
95 |
+
throw new Exception\SSLCertificate($error, $errorCode);
|
96 |
+
}
|
97 |
+
|
98 |
+
if ($errorCode) {
|
99 |
+
throw new Exception\Connection($error, $errorCode);
|
100 |
+
}
|
101 |
+
|
102 |
+
return ['status' => $httpStatus, 'body' => $response];
|
103 |
+
}
|
104 |
+
|
105 |
+
private static function _getAuthorization($config, $useClientCredentials)
|
106 |
+
{
|
107 |
+
if ($useClientCredentials) {
|
108 |
+
return [
|
109 |
+
'user' => $config->getClientId(),
|
110 |
+
'password' => $config->getClientSecret(),
|
111 |
+
];
|
112 |
+
} elseif ($config->isAccessToken()) {
|
113 |
+
return [
|
114 |
+
'token' => $config->getAccessToken(),
|
115 |
+
];
|
116 |
+
} else {
|
117 |
+
return [
|
118 |
+
'user' => $config->getPublicKey(),
|
119 |
+
'password' => $config->getPrivateKey(),
|
120 |
+
];
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
private static function _getCaFile($config)
|
125 |
+
{
|
126 |
+
static $memo;
|
127 |
+
|
128 |
+
if ($memo === null) {
|
129 |
+
$caFile = $config->caFile();
|
130 |
+
|
131 |
+
if (substr($caFile, 0, 7) !== 'phar://') {
|
132 |
+
return $caFile;
|
133 |
+
}
|
134 |
+
|
135 |
+
$extractedCaFile = sys_get_temp_dir() . '/api_braintreegateway_com.ca.crt';
|
136 |
+
|
137 |
+
if (!file_exists($extractedCaFile) || sha1_file($extractedCaFile) != sha1_file($caFile)) {
|
138 |
+
if (!copy($caFile, $extractedCaFile)) {
|
139 |
+
throw new Exception\SSLCaFileNotFound();
|
140 |
+
}
|
141 |
+
}
|
142 |
+
$memo = $extractedCaFile;
|
143 |
+
}
|
144 |
+
|
145 |
+
return $memo;
|
146 |
+
}
|
147 |
+
|
148 |
+
private static function _prepareMultipart($httpRequest, $requestBody, $file, $boundary)
|
149 |
+
{
|
150 |
+
$disallow = ["\0", "\"", "\r", "\n"];
|
151 |
+
$fileInfo = new finfo(FILEINFO_MIME_TYPE);
|
152 |
+
$filePath = stream_get_meta_data($file)['uri'];
|
153 |
+
$data = file_get_contents($filePath);
|
154 |
+
$mimeType = $fileInfo->buffer($data);
|
155 |
+
|
156 |
+
// build normal parameters
|
157 |
+
foreach ($requestBody as $k => $v) {
|
158 |
+
$k = str_replace($disallow, "_", $k);
|
159 |
+
$body[] = implode("\r\n", [
|
160 |
+
"Content-Disposition: form-data; name=\"{$k}\"",
|
161 |
+
"",
|
162 |
+
filter_var($v),
|
163 |
+
]);
|
164 |
+
}
|
165 |
+
|
166 |
+
// build file parameter
|
167 |
+
$splitFilePath = explode(DIRECTORY_SEPARATOR, $filePath);
|
168 |
+
$filePath = end($splitFilePath);
|
169 |
+
$filePath = str_replace($disallow, "_", $filePath);
|
170 |
+
$body[] = implode("\r\n", [
|
171 |
+
"Content-Disposition: form-data; name=\"file\"; filename=\"{$filePath}\"",
|
172 |
+
"Content-Type: {$mimeType}",
|
173 |
+
"",
|
174 |
+
$data,
|
175 |
+
]);
|
176 |
+
|
177 |
+
// add boundary for each parameters
|
178 |
+
array_walk($body, function (&$part) use ($boundary) {
|
179 |
+
$part = "--{$boundary}\r\n{$part}";
|
180 |
+
});
|
181 |
+
|
182 |
+
// add final boundary
|
183 |
+
$body[] = "--{$boundary}--";
|
184 |
+
$body[] = "";
|
185 |
+
|
186 |
+
// set options
|
187 |
+
$httpRequest->setOption(CURLOPT_POST, true);
|
188 |
+
$httpRequest->setOption(CURLOPT_POSTFIELDS, implode("\r\n", $body));
|
189 |
+
}
|
190 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/CurlRequest.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\HttpHelpers;
|
4 |
+
|
5 |
+
//phpcs:ignore
|
6 |
+
class CurlRequest implements HttpRequest
|
7 |
+
{
|
8 |
+
private $_handle = null;
|
9 |
+
|
10 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
11 |
+
public function __construct($url)
|
12 |
+
{
|
13 |
+
$this->_handle = curl_init($url);
|
14 |
+
}
|
15 |
+
|
16 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
17 |
+
public function setOption($name, $value)
|
18 |
+
{
|
19 |
+
curl_setopt($this->_handle, $name, $value);
|
20 |
+
}
|
21 |
+
|
22 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
23 |
+
public function execute()
|
24 |
+
{
|
25 |
+
return curl_exec($this->_handle);
|
26 |
+
}
|
27 |
+
|
28 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
29 |
+
public function getInfo($name)
|
30 |
+
{
|
31 |
+
return curl_getinfo($this->_handle, $name);
|
32 |
+
}
|
33 |
+
|
34 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
35 |
+
public function getErrorCode()
|
36 |
+
{
|
37 |
+
return curl_errno($this->_handle);
|
38 |
+
}
|
39 |
+
|
40 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
41 |
+
public function getError()
|
42 |
+
{
|
43 |
+
return curl_error($this->_handle);
|
44 |
+
}
|
45 |
+
|
46 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
47 |
+
public function close()
|
48 |
+
{
|
49 |
+
curl_close($this->_handle);
|
50 |
+
}
|
51 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/HttpHelpers/HttpRequest.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\HttpHelpers;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree HttpRequest module
|
7 |
+
*
|
8 |
+
* Facilitates web requests made by the SDK
|
9 |
+
*/
|
10 |
+
interface HttpRequest
|
11 |
+
{
|
12 |
+
// phpcs:disable PEAR.Commenting.FunctionComment.Missing
|
13 |
+
public function setOption($name, $value);
|
14 |
+
public function execute();
|
15 |
+
public function getInfo($name);
|
16 |
+
public function getErrorCode();
|
17 |
+
public function getError();
|
18 |
+
public function close();
|
19 |
+
// phpcs:enable PEAR.Commenting.FunctionComment.Missing
|
20 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/IbanBankAccount.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree IbanBankAccount module
|
6 |
-
* PHP Version 5
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
*
|
10 |
-
* @property-read string $maskedIban
|
11 |
-
* @property-read string $bic
|
12 |
-
* @property-read string $ibanCountry
|
13 |
-
* @property-read string $description
|
14 |
-
* @property-read string $ibanAccountNumberLast4
|
15 |
-
*/
|
16 |
-
class IbanBankAccount extends Base
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* create a printable representation of the object as:
|
20 |
-
* ClassName[property=value, property=value]
|
21 |
-
* @ignore
|
22 |
-
* @return string
|
23 |
-
*/
|
24 |
-
public function __toString()
|
25 |
-
{
|
26 |
-
return __CLASS__ . '[' .
|
27 |
-
Util::attributesToString($this->_attributes) . ']';
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* sets instance properties from an array of values
|
32 |
-
*
|
33 |
-
* @ignore
|
34 |
-
* @access protected
|
35 |
-
* @param array $ibanAttribs array of ibanBankAccount data
|
36 |
-
* @return void
|
37 |
-
*/
|
38 |
-
protected function _initialize($ibanAttribs)
|
39 |
-
{
|
40 |
-
// set the attributes
|
41 |
-
$this->_attributes = $ibanAttribs;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* factory method: returns an instance of IbanBankAccount
|
46 |
-
* to the requesting method, with populated properties
|
47 |
-
* @ignore
|
48 |
-
* @return IbanBankAccount
|
49 |
-
*/
|
50 |
-
public static function factory($attributes)
|
51 |
-
{
|
52 |
-
$instance = new self();
|
53 |
-
$instance->_initialize($attributes);
|
54 |
-
return $instance;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
class_alias('Braintree\IbanBankAccount', 'Braintree_IbanBankAccount');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/IdealPayment.php
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree IdealPayment module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Manages Braintree IdealPayments
|
13 |
-
*
|
14 |
-
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
-
* @property-read string $id
|
21 |
-
* @property-read string $idealTransactionId
|
22 |
-
* @property-read string $currency
|
23 |
-
* @property-read string $amount
|
24 |
-
* @property-read string $status
|
25 |
-
* @property-read string $orderId
|
26 |
-
* @property-read string $issuer
|
27 |
-
* @property-read string $ibanBankAccount
|
28 |
-
*/
|
29 |
-
class IdealPayment extends Base
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* factory method: returns an instance of IdealPayment
|
33 |
-
* to the requesting method, with populated properties
|
34 |
-
*
|
35 |
-
* @ignore
|
36 |
-
* @return IdealPayment
|
37 |
-
*/
|
38 |
-
public static function factory($attributes)
|
39 |
-
{
|
40 |
-
$instance = new self();
|
41 |
-
$instance->_initialize($attributes);
|
42 |
-
return $instance;
|
43 |
-
}
|
44 |
-
|
45 |
-
/* instance methods */
|
46 |
-
|
47 |
-
/**
|
48 |
-
* sets instance properties from an array of values
|
49 |
-
*
|
50 |
-
* @access protected
|
51 |
-
* @param array $idealPaymentAttribs array of idealPayment data
|
52 |
-
* @return void
|
53 |
-
*/
|
54 |
-
protected function _initialize($idealPaymentAttribs)
|
55 |
-
{
|
56 |
-
// set the attributes
|
57 |
-
$this->_attributes = $idealPaymentAttribs;
|
58 |
-
|
59 |
-
$ibanBankAccount = isset($idealPaymentAttribs['ibanBankAccount']) ?
|
60 |
-
IbanBankAccount::factory($idealPaymentAttribs['ibanBankAccount']) :
|
61 |
-
null;
|
62 |
-
$this->_set('ibanBankAccount', $ibanBankAccount);
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* create a printable representation of the object as:
|
67 |
-
* ClassName[property=value, property=value]
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
public function __toString()
|
71 |
-
{
|
72 |
-
return __CLASS__ . '[' .
|
73 |
-
Util::attributesToString($this->_attributes) . ']';
|
74 |
-
}
|
75 |
-
|
76 |
-
|
77 |
-
// static methods redirecting to gateway
|
78 |
-
|
79 |
-
public static function find($idealPaymentId)
|
80 |
-
{
|
81 |
-
return Configuration::gateway()->idealPayment()->find($idealPaymentId);
|
82 |
-
}
|
83 |
-
|
84 |
-
public static function sale($idealPaymentId, $transactionAttribs)
|
85 |
-
{
|
86 |
-
$transactionAttribs['options'] = [
|
87 |
-
'submitForSettlement' => true
|
88 |
-
];
|
89 |
-
return Configuration::gateway()->idealPayment()->sale($idealPaymentId, $transactionAttribs);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
class_alias('Braintree\IdealPayment', 'Braintree_IdealPayment');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/IdealPaymentGateway.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
use InvalidArgumentException;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Braintree IdealPaymentGateway module
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @category Resources
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Manages Braintree IdealPayments
|
15 |
-
*
|
16 |
-
* <b>== More information ==</b>
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @package Braintree
|
20 |
-
* @category Resources
|
21 |
-
*/
|
22 |
-
class IdealPaymentGateway
|
23 |
-
{
|
24 |
-
private $_gateway;
|
25 |
-
private $_config;
|
26 |
-
private $_http;
|
27 |
-
|
28 |
-
public function __construct($gateway)
|
29 |
-
{
|
30 |
-
$this->_gateway = $gateway;
|
31 |
-
$this->_config = $gateway->config;
|
32 |
-
$this->_config->assertHasAccessTokenOrKeys();
|
33 |
-
$this->_http = new Http($gateway->config);
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* find an IdealPayment by id
|
38 |
-
*
|
39 |
-
* @access public
|
40 |
-
* @param string $idealPaymentId
|
41 |
-
* @return IdealPayment
|
42 |
-
* @throws Exception\NotFound
|
43 |
-
*/
|
44 |
-
public function find($idealPaymentId)
|
45 |
-
{
|
46 |
-
try {
|
47 |
-
$path = $this->_config->merchantPath() . '/ideal_payments/' . $idealPaymentId;
|
48 |
-
$response = $this->_http->get($path);
|
49 |
-
return IdealPayment::factory($response['idealPayment']);
|
50 |
-
} catch (Exception\NotFound $e) {
|
51 |
-
throw new Exception\NotFound(
|
52 |
-
'iDEAL Payment with id ' . $idealPaymentId . ' not found'
|
53 |
-
);
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* create a new sale for the current IdealPayment
|
59 |
-
*
|
60 |
-
* @param string $idealPaymentId
|
61 |
-
* @param array $transactionAttribs
|
62 |
-
* @return Result\Successful|Result\Error
|
63 |
-
* @see Transaction::sale()
|
64 |
-
*/
|
65 |
-
public function sale($idealPaymentId, $transactionAttribs)
|
66 |
-
{
|
67 |
-
return Transaction::sale(
|
68 |
-
array_merge(
|
69 |
-
$transactionAttribs,
|
70 |
-
['paymentMethodNonce' => $idealPaymentId]
|
71 |
-
)
|
72 |
-
);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* generic method for validating incoming gateway responses
|
77 |
-
*
|
78 |
-
* creates a new IdealPayment object and encapsulates
|
79 |
-
* it inside a Result\Successful object, or
|
80 |
-
* encapsulates a Errors object inside a Result\Error
|
81 |
-
* alternatively, throws an Unexpected exception if the response is invalid.
|
82 |
-
*
|
83 |
-
* @ignore
|
84 |
-
* @param array $response gateway response values
|
85 |
-
* @return Result\Successful|Result\Error
|
86 |
-
* @throws Exception\Unexpected
|
87 |
-
*/
|
88 |
-
private function _verifyGatewayResponse($response)
|
89 |
-
{
|
90 |
-
if (isset($response['idealPayment'])) {
|
91 |
-
// return a populated instance of IdealPayment
|
92 |
-
return new Result\Successful(
|
93 |
-
IdealPayment::factory($response['idealPayment'])
|
94 |
-
);
|
95 |
-
} else if (isset($response['apiErrorResponse'])) {
|
96 |
-
return new Result\Error($response['apiErrorResponse']);
|
97 |
-
} else {
|
98 |
-
throw new Exception\Unexpected(
|
99 |
-
'Expected Ideal Payment or apiErrorResponse'
|
100 |
-
);
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
class_alias('Braintree\IdealPaymentGateway', 'Braintree_IdealPaymentGateway');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Instance.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
@@ -10,11 +11,8 @@ abstract class Instance
|
|
10 |
{
|
11 |
protected $_attributes = [];
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
* @param array $attributes
|
16 |
-
*/
|
17 |
-
public function __construct($attributes)
|
18 |
{
|
19 |
if (!empty($attributes)) {
|
20 |
$this->_initializeFromArray($attributes);
|
@@ -23,8 +21,9 @@ abstract class Instance
|
|
23 |
|
24 |
/**
|
25 |
* returns private/nonexistent instance properties
|
26 |
-
*
|
27 |
* @param string $name property name
|
|
|
28 |
* @return mixed contents of instance properties
|
29 |
*/
|
30 |
public function __get($name)
|
@@ -39,30 +38,32 @@ abstract class Instance
|
|
39 |
|
40 |
/**
|
41 |
* used by isset() and empty()
|
42 |
-
*
|
43 |
* @param string $name property name
|
|
|
44 |
* @return boolean
|
45 |
*/
|
46 |
public function __isset($name)
|
47 |
{
|
48 |
-
return
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
* create a printable representation of the object as:
|
53 |
* ClassName[property=value, property=value]
|
|
|
54 |
* @return string
|
55 |
*/
|
56 |
-
public function
|
57 |
{
|
58 |
$objOutput = Util::implodeAssociativeArray($this->_attributes);
|
59 |
-
return get_class($this) .'[' . $objOutput . ']';
|
60 |
}
|
61 |
/**
|
62 |
* initializes instance properties from the keys/values of an array
|
63 |
-
*
|
64 |
-
* @access protected
|
65 |
* @param <type> $aAttribs array of properties to set - single level
|
|
|
66 |
* @return void
|
67 |
*/
|
68 |
private function _initializeFromArray($attributes)
|
@@ -70,5 +71,29 @@ abstract class Instance
|
|
70 |
$this->_attributes = $attributes;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
-
class_alias('Braintree\Instance', 'Braintree_Instance');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
11 |
{
|
12 |
protected $_attributes = [];
|
13 |
|
14 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
15 |
+
public function __construct($attributes)
|
|
|
|
|
|
|
16 |
{
|
17 |
if (!empty($attributes)) {
|
18 |
$this->_initializeFromArray($attributes);
|
21 |
|
22 |
/**
|
23 |
* returns private/nonexistent instance properties
|
24 |
+
*
|
25 |
* @param string $name property name
|
26 |
+
*
|
27 |
* @return mixed contents of instance properties
|
28 |
*/
|
29 |
public function __get($name)
|
38 |
|
39 |
/**
|
40 |
* used by isset() and empty()
|
41 |
+
*
|
42 |
* @param string $name property name
|
43 |
+
*
|
44 |
* @return boolean
|
45 |
*/
|
46 |
public function __isset($name)
|
47 |
{
|
48 |
+
return isset($this->_attributes[$name]);
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
* create a printable representation of the object as:
|
53 |
* ClassName[property=value, property=value]
|
54 |
+
*
|
55 |
* @return string
|
56 |
*/
|
57 |
+
public function __toString()
|
58 |
{
|
59 |
$objOutput = Util::implodeAssociativeArray($this->_attributes);
|
60 |
+
return get_class($this) . '[' . $objOutput . ']';
|
61 |
}
|
62 |
/**
|
63 |
* initializes instance properties from the keys/values of an array
|
64 |
+
*
|
|
|
65 |
* @param <type> $aAttribs array of properties to set - single level
|
66 |
+
*
|
67 |
* @return void
|
68 |
*/
|
69 |
private function _initializeFromArray($attributes)
|
71 |
$this->_attributes = $attributes;
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* Implementation of JsonSerializable
|
76 |
+
*
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
public function jsonSerialize()
|
80 |
+
{
|
81 |
+
return $this->_attributes;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Implementation of to an Array
|
86 |
+
*
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function toArray()
|
90 |
+
{
|
91 |
+
return array_map(function ($value) {
|
92 |
+
if (!is_array($value)) {
|
93 |
+
return method_exists($value, 'toArray') ? $value->toArray() : $value;
|
94 |
+
} else {
|
95 |
+
return $value;
|
96 |
+
}
|
97 |
+
}, $this->_attributes);
|
98 |
+
}
|
99 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/IsNode.php
CHANGED
@@ -1,14 +1,27 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class IsNode
|
5 |
{
|
|
|
6 |
public function __construct($name)
|
7 |
{
|
8 |
$this->name = $name;
|
9 |
$this->searchTerms = [];
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function is($value)
|
13 |
{
|
14 |
$this->searchTerms['is'] = strval($value);
|
@@ -16,9 +29,13 @@ class IsNode
|
|
16 |
return $this;
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
public function toParam()
|
20 |
{
|
21 |
return $this->searchTerms;
|
22 |
}
|
23 |
}
|
24 |
-
class_alias('Braintree\IsNode', 'Braintree_IsNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree IsNode
|
7 |
+
* IsNode is an object for search elements sent to the Braintree API
|
8 |
+
*/
|
9 |
class IsNode
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($name)
|
13 |
{
|
14 |
$this->name = $name;
|
15 |
$this->searchTerms = [];
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Sets the value of the object's "is" key to a string of $value
|
20 |
+
*
|
21 |
+
* @param object $value to have its string value set in $this
|
22 |
+
*
|
23 |
+
* @return object
|
24 |
+
*/
|
25 |
public function is($value)
|
26 |
{
|
27 |
$this->searchTerms['is'] = strval($value);
|
29 |
return $this;
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* The searchTerms
|
34 |
+
*
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
public function toParam()
|
38 |
{
|
39 |
return $this->searchTerms;
|
40 |
}
|
41 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/KeyValueNode.php
CHANGED
@@ -1,23 +1,41 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class KeyValueNode
|
5 |
{
|
|
|
6 |
public function __construct($name)
|
7 |
{
|
8 |
$this->name = $name;
|
9 |
-
$this->searchTerm =
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function is($value)
|
13 |
{
|
14 |
$this->searchTerm = $value;
|
15 |
return $this;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function toParam()
|
19 |
{
|
20 |
return $this->searchTerm;
|
21 |
}
|
22 |
}
|
23 |
-
class_alias('Braintree\KeyValueNode', 'Braintree_KeyValueNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* KeyValueNode class
|
7 |
+
*
|
8 |
+
* @see TransactionSearch refund
|
9 |
+
*/
|
10 |
class KeyValueNode
|
11 |
{
|
12 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
13 |
public function __construct($name)
|
14 |
{
|
15 |
$this->name = $name;
|
16 |
+
$this->searchTerm = true;
|
17 |
}
|
18 |
|
19 |
+
/*
|
20 |
+
* Sets search term to a value
|
21 |
+
*
|
22 |
+
* @param string $value to be assigned
|
23 |
+
*
|
24 |
+
* @return object $this
|
25 |
+
*/
|
26 |
public function is($value)
|
27 |
{
|
28 |
$this->searchTerm = $value;
|
29 |
return $this;
|
30 |
}
|
31 |
|
32 |
+
/*
|
33 |
+
* turns a search term into a param
|
34 |
+
*
|
35 |
+
* @return object searchTerm
|
36 |
+
*/
|
37 |
public function toParam()
|
38 |
{
|
39 |
return $this->searchTerm;
|
40 |
}
|
41 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/LocalPaymentCompleted.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree LocalPaymentCompleted module
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Manages Braintree LocalPaymentCompleted
|
11 |
+
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/local-payment-methods developer docs} for more information
|
13 |
+
*/
|
14 |
+
class LocalPaymentCompleted extends Base
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Creates an instance from given attributes
|
18 |
+
*
|
19 |
+
* @param array $attributes response object attributes
|
20 |
+
*
|
21 |
+
* @return LocalPaymentCompleted
|
22 |
+
*/
|
23 |
+
public static function factory($attributes)
|
24 |
+
{
|
25 |
+
$instance = new self();
|
26 |
+
$instance->_initialize($attributes);
|
27 |
+
return $instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
/* instance methods */
|
31 |
+
|
32 |
+
/**
|
33 |
+
* sets instance properties from an array of values
|
34 |
+
*
|
35 |
+
* @param array $LocalPaymentCompletedAttribs array of localPaymentCompleted data
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
protected function _initialize($localPaymentCompletedAttribs)
|
40 |
+
{
|
41 |
+
// set the attributes
|
42 |
+
$this->_attributes = $localPaymentCompletedAttribs;
|
43 |
+
|
44 |
+
if (isset($transactionAttribs['transaction'])) {
|
45 |
+
$this->_set(
|
46 |
+
'transaction',
|
47 |
+
new Transaction(
|
48 |
+
$transactionAttribs['transaction']
|
49 |
+
)
|
50 |
+
);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
55 |
+
public function __toString()
|
56 |
+
{
|
57 |
+
return __CLASS__ . '[' .
|
58 |
+
Util::attributesToString($this->_attributes) . ']';
|
59 |
+
}
|
60 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/LocalPaymentExpired.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree LocalPaymentExpired module
|
7 |
+
*/
|
8 |
+
class LocalPaymentExpired extends Base
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* factory method: returns an instance of LocalPaymentExpired
|
12 |
+
* to the requesting method, with populated properties
|
13 |
+
*
|
14 |
+
* @param array $attributes to be used in creating the object
|
15 |
+
*
|
16 |
+
* @return LocalPaymentExpired
|
17 |
+
*/
|
18 |
+
public static function factory($attributes)
|
19 |
+
{
|
20 |
+
$instance = new self();
|
21 |
+
$instance->_initialize($attributes);
|
22 |
+
return $instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _initialize($localPaymentExpiredAttribs)
|
26 |
+
{
|
27 |
+
$this->_attributes = $localPaymentExpiredAttribs;
|
28 |
+
}
|
29 |
+
|
30 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
31 |
+
public function __toString()
|
32 |
+
{
|
33 |
+
return __CLASS__ . '[' .
|
34 |
+
Util::attributesToString($this->_attributes) . ']';
|
35 |
+
}
|
36 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/LocalPaymentFunded.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree LocalPaymentFunded module
|
7 |
+
*/
|
8 |
+
class LocalPaymentFunded extends Base
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* factory method: returns an instance of LocalPaymentFunded
|
12 |
+
* to the requesting method, with populated properties
|
13 |
+
*
|
14 |
+
* @param array $attributes used to create the object
|
15 |
+
*
|
16 |
+
* @return LocalPaymentFunded
|
17 |
+
*/
|
18 |
+
public static function factory($attributes)
|
19 |
+
{
|
20 |
+
$instance = new self();
|
21 |
+
$instance->_initialize($attributes);
|
22 |
+
return $instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _initialize($localPaymentFundedAttribs)
|
26 |
+
{
|
27 |
+
// set the attributes
|
28 |
+
$this->_attributes = $localPaymentFundedAttribs;
|
29 |
+
|
30 |
+
if (isset($transactionAttribs['transaction'])) {
|
31 |
+
$this->_set(
|
32 |
+
'transaction',
|
33 |
+
new Transaction(
|
34 |
+
$transactionAttribs['transaction']
|
35 |
+
)
|
36 |
+
);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
41 |
+
public function __toString()
|
42 |
+
{
|
43 |
+
return __CLASS__ . '[' .
|
44 |
+
Util::attributesToString($this->_attributes) . ']';
|
45 |
+
}
|
46 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/LocalPaymentReversed.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree LocalPaymentReversed module
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Manages Braintree LocalPaymentReversed
|
11 |
+
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/local-payment-methods developer docs} for more information
|
13 |
+
*/
|
14 |
+
class LocalPaymentReversed extends Base
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Creates an instance from given attributes
|
18 |
+
*
|
19 |
+
* @param array $attributes response object attributes
|
20 |
+
*
|
21 |
+
* @return LocalPaymentReversed
|
22 |
+
*/
|
23 |
+
public static function factory($attributes)
|
24 |
+
{
|
25 |
+
$instance = new self();
|
26 |
+
$instance->_initialize($attributes);
|
27 |
+
return $instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
/* instance methods */
|
31 |
+
|
32 |
+
/**
|
33 |
+
* sets instance properties from an array of values
|
34 |
+
*
|
35 |
+
* @param array $LocalPaymentReversedAttribs array of localPaymentReversed data
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
protected function _initialize($localPaymentReversedAttribs)
|
40 |
+
{
|
41 |
+
// set the attributes
|
42 |
+
$this->_attributes = $localPaymentReversedAttribs;
|
43 |
+
}
|
44 |
+
|
45 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
46 |
+
public function __toString()
|
47 |
+
{
|
48 |
+
return __CLASS__ . '[' .
|
49 |
+
Util::attributesToString($this->_attributes) . ']';
|
50 |
+
}
|
51 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/MasterpassCard.php
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree MasterpassCard module
|
6 |
-
* Creates and manages Braintree MasterpassCards
|
7 |
-
*
|
8 |
-
* <b>== More information ==</b>
|
9 |
-
*
|
10 |
-
* For more detailed information on CreditCard verifications, see {@link https://developers.braintreepayments.com/reference/response/credit-card-verification/php https://developers.braintreepayments.com/reference/response/credit-card-verification/php}
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $billingAddress
|
16 |
-
* @property-read string $bin
|
17 |
-
* @property-read string $cardType
|
18 |
-
* @property-read string $cardholderName
|
19 |
-
* @property-read string $commercial
|
20 |
-
* @property-read string $countryOfIssuance
|
21 |
-
* @property-read string $createdAt
|
22 |
-
* @property-read string $customerId
|
23 |
-
* @property-read string $customerLocation
|
24 |
-
* @property-read string $debit
|
25 |
-
* @property-read string $default
|
26 |
-
* @property-read string $durbinRegulated
|
27 |
-
* @property-read string $expirationDate
|
28 |
-
* @property-read string $expirationMonth
|
29 |
-
* @property-read string $expirationYear
|
30 |
-
* @property-read string $expired
|
31 |
-
* @property-read string $healthcare
|
32 |
-
* @property-read string $imageUrl
|
33 |
-
* @property-read string $issuingBank
|
34 |
-
* @property-read string $last4
|
35 |
-
* @property-read string $maskedNumber
|
36 |
-
* @property-read string $payroll
|
37 |
-
* @property-read string $prepaid
|
38 |
-
* @property-read string $productId
|
39 |
-
* @property-read string $subscriptions
|
40 |
-
* @property-read string $token
|
41 |
-
* @property-read string $uniqueNumberIdentifier
|
42 |
-
* @property-read string $updatedAt
|
43 |
-
*/
|
44 |
-
class MasterpassCard extends Base
|
45 |
-
{
|
46 |
-
/* instance methods */
|
47 |
-
/**
|
48 |
-
* returns false if default is null or false
|
49 |
-
*
|
50 |
-
* @return boolean
|
51 |
-
*/
|
52 |
-
public function isDefault()
|
53 |
-
{
|
54 |
-
return $this->default;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* checks whether the card is expired based on the current date
|
59 |
-
*
|
60 |
-
* @return boolean
|
61 |
-
*/
|
62 |
-
public function isExpired()
|
63 |
-
{
|
64 |
-
return $this->expired;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* sets instance properties from an array of values
|
69 |
-
*
|
70 |
-
* @access protected
|
71 |
-
* @param array $creditCardAttribs array of creditcard data
|
72 |
-
* @return void
|
73 |
-
*/
|
74 |
-
protected function _initialize($creditCardAttribs)
|
75 |
-
{
|
76 |
-
// set the attributes
|
77 |
-
$this->_attributes = $creditCardAttribs;
|
78 |
-
|
79 |
-
// map each address into its own object
|
80 |
-
$billingAddress = isset($creditCardAttribs['billingAddress']) ?
|
81 |
-
Address::factory($creditCardAttribs['billingAddress']) :
|
82 |
-
null;
|
83 |
-
|
84 |
-
$subscriptionArray = [];
|
85 |
-
if (isset($creditCardAttribs['subscriptions'])) {
|
86 |
-
foreach ($creditCardAttribs['subscriptions'] AS $subscription) {
|
87 |
-
$subscriptionArray[] = Subscription::factory($subscription);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
$this->_set('subscriptions', $subscriptionArray);
|
92 |
-
$this->_set('billingAddress', $billingAddress);
|
93 |
-
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
94 |
-
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* returns false if comparing object is not a CreditCard,
|
99 |
-
* or is a CreditCard with a different id
|
100 |
-
*
|
101 |
-
* @param object $otherCreditCard customer to compare against
|
102 |
-
* @return boolean
|
103 |
-
*/
|
104 |
-
public function isEqual($otherMasterpassCard)
|
105 |
-
{
|
106 |
-
return !($otherMasterpassCard instanceof self) ? false : $this->token === $otherMasterpassCard->token;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* create a printable representation of the object as:
|
111 |
-
* ClassName[property=value, property=value]
|
112 |
-
* @return string
|
113 |
-
*/
|
114 |
-
public function __toString()
|
115 |
-
{
|
116 |
-
return __CLASS__ . '[' .
|
117 |
-
Util::attributesToString($this->_attributes) .']';
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* factory method: returns an instance of CreditCard
|
122 |
-
* to the requesting method, with populated properties
|
123 |
-
*
|
124 |
-
* @ignore
|
125 |
-
* @return MasterpassCard
|
126 |
-
*/
|
127 |
-
public static function factory($attributes)
|
128 |
-
{
|
129 |
-
$defaultAttributes = [
|
130 |
-
'bin' => '',
|
131 |
-
'expirationMonth' => '',
|
132 |
-
'expirationYear' => '',
|
133 |
-
'last4' => '',
|
134 |
-
];
|
135 |
-
|
136 |
-
$instance = new self();
|
137 |
-
$instance->_initialize(array_merge($defaultAttributes, $attributes));
|
138 |
-
return $instance;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
class_alias('Braintree\MasterpassCard', 'Braintree_MasterpassCard');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Merchant.php
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class Merchant extends Base
|
5 |
{
|
6 |
protected function _initialize($attribs)
|
@@ -9,13 +13,20 @@ class Merchant extends Base
|
|
9 |
|
10 |
$merchantAccountArray = [];
|
11 |
if (isset($attribs['merchantAccounts'])) {
|
12 |
-
foreach ($attribs['merchantAccounts']
|
13 |
$merchantAccountArray[] = MerchantAccount::factory($merchantAccount);
|
14 |
}
|
15 |
}
|
16 |
$this->_set('merchantAccounts', $merchantAccountArray);
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
public static function factory($attributes)
|
20 |
{
|
21 |
$instance = new self();
|
@@ -23,14 +34,10 @@ class Merchant extends Base
|
|
23 |
return $instance;
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
* @return string
|
29 |
-
*/
|
30 |
-
public function __toString()
|
31 |
{
|
32 |
return __CLASS__ . '[' .
|
33 |
-
Util::attributesToString($this->_attributes) .']';
|
34 |
}
|
35 |
}
|
36 |
-
class_alias('Braintree\Merchant', 'Braintree_Merchant');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Merchant class
|
7 |
+
*/
|
8 |
class Merchant extends Base
|
9 |
{
|
10 |
protected function _initialize($attribs)
|
13 |
|
14 |
$merchantAccountArray = [];
|
15 |
if (isset($attribs['merchantAccounts'])) {
|
16 |
+
foreach ($attribs['merchantAccounts'] as $merchantAccount) {
|
17 |
$merchantAccountArray[] = MerchantAccount::factory($merchantAccount);
|
18 |
}
|
19 |
}
|
20 |
$this->_set('merchantAccounts', $merchantAccountArray);
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Creates an instance from given attributes
|
25 |
+
*
|
26 |
+
* @param array $attributes response object attributes
|
27 |
+
*
|
28 |
+
* @return Merchant
|
29 |
+
*/
|
30 |
public static function factory($attributes)
|
31 |
{
|
32 |
$instance = new self();
|
34 |
return $instance;
|
35 |
}
|
36 |
|
37 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
38 |
+
public function __toString()
|
|
|
|
|
|
|
39 |
{
|
40 |
return __CLASS__ . '[' .
|
41 |
+
Util::attributesToString($this->_attributes) . ']';
|
42 |
}
|
43 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccount.php
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class MerchantAccount extends Base
|
5 |
{
|
6 |
const STATUS_ACTIVE = 'active';
|
@@ -11,6 +15,13 @@ class MerchantAccount extends Base
|
|
11 |
const FUNDING_DESTINATION_EMAIL = 'email';
|
12 |
const FUNDING_DESTINATION_MOBILE_PHONE = 'mobile_phone';
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
public static function factory($attributes)
|
15 |
{
|
16 |
$instance = new self();
|
@@ -61,4 +72,3 @@ class MerchantAccount extends Base
|
|
61 |
return Configuration::gateway()->merchantAccount()->update($merchant_account_id, $attributes);
|
62 |
}
|
63 |
}
|
64 |
-
class_alias('Braintree\MerchantAccount', 'Braintree_MerchantAccount');
|
1 |
+
<?php //phpcs:disable
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/merchant-account developer docs} for information on attributes
|
7 |
+
*/
|
8 |
class MerchantAccount extends Base
|
9 |
{
|
10 |
const STATUS_ACTIVE = 'active';
|
15 |
const FUNDING_DESTINATION_EMAIL = 'email';
|
16 |
const FUNDING_DESTINATION_MOBILE_PHONE = 'mobile_phone';
|
17 |
|
18 |
+
/**
|
19 |
+
* Creates an instance from given attributes
|
20 |
+
*
|
21 |
+
* @param array $attributes response object attributes
|
22 |
+
*
|
23 |
+
* @return MerchantAccount
|
24 |
+
*/
|
25 |
public static function factory($attributes)
|
26 |
{
|
27 |
$instance = new self();
|
72 |
return Configuration::gateway()->merchantAccount()->update($merchant_account_id, $attributes);
|
73 |
}
|
74 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/AddressDetails.php
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\MerchantAccount;
|
3 |
|
4 |
use Braintree\Instance;
|
5 |
|
|
|
|
|
|
|
6 |
class AddressDetails extends Instance
|
7 |
{
|
8 |
protected $_attributes = [];
|
9 |
}
|
10 |
-
class_alias('Braintree\MerchantAccount\AddressDetails', 'Braintree_MerchantAccount_AddressDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\MerchantAccount;
|
4 |
|
5 |
use Braintree\Instance;
|
6 |
|
7 |
+
/**
|
8 |
+
* Creates an instance of AddressDetails as returned from a merchant account
|
9 |
+
*/
|
10 |
class AddressDetails extends Instance
|
11 |
{
|
12 |
protected $_attributes = [];
|
13 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/BusinessDetails.php
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\MerchantAccount;
|
3 |
|
4 |
use Braintree\Base;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
class BusinessDetails extends Base
|
7 |
{
|
8 |
protected function _initialize($businessAttribs)
|
@@ -13,6 +19,13 @@ class BusinessDetails extends Base
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public static function factory($attributes)
|
17 |
{
|
18 |
$instance = new self();
|
@@ -20,4 +33,3 @@ class BusinessDetails extends Base
|
|
20 |
return $instance;
|
21 |
}
|
22 |
}
|
23 |
-
class_alias('Braintree\MerchantAccount\BusinessDetails', 'Braintree_MerchantAccount_BusinessDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\MerchantAccount;
|
4 |
|
5 |
use Braintree\Base;
|
6 |
|
7 |
+
/**
|
8 |
+
* Braintree BusinessDetails class
|
9 |
+
*
|
10 |
+
* Object containing information on business details of a merchant account
|
11 |
+
*/
|
12 |
class BusinessDetails extends Base
|
13 |
{
|
14 |
protected function _initialize($businessAttribs)
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Creates an instance from given attributes
|
24 |
+
*
|
25 |
+
* @param array $attributes response object attributes
|
26 |
+
*
|
27 |
+
* @return BusinessDetails
|
28 |
+
*/
|
29 |
public static function factory($attributes)
|
30 |
{
|
31 |
$instance = new self();
|
33 |
return $instance;
|
34 |
}
|
35 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/FundingDetails.php
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\MerchantAccount;
|
3 |
|
4 |
use Braintree\Instance;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
class FundingDetails extends Instance
|
7 |
{
|
8 |
protected $_attributes = [];
|
9 |
}
|
10 |
-
class_alias('Braintree\MerchantAccount\FundingDetails', 'Braintree_MerchantAccount_FundingDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\MerchantAccount;
|
4 |
|
5 |
use Braintree\Instance;
|
6 |
|
7 |
+
/**
|
8 |
+
* Braintree FundingDetails class
|
9 |
+
*
|
10 |
+
* Object containing information on funding details of a merchant account
|
11 |
+
*/
|
12 |
class FundingDetails extends Instance
|
13 |
{
|
14 |
protected $_attributes = [];
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccount/IndividualDetails.php
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\MerchantAccount;
|
3 |
|
4 |
use Braintree\Base;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
class IndividualDetails extends Base
|
7 |
{
|
8 |
protected function _initialize($individualAttribs)
|
@@ -13,6 +19,13 @@ class IndividualDetails extends Base
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public static function factory($attributes)
|
17 |
{
|
18 |
$instance = new self();
|
@@ -20,4 +33,3 @@ class IndividualDetails extends Base
|
|
20 |
return $instance;
|
21 |
}
|
22 |
}
|
23 |
-
class_alias('Braintree\MerchantAccount\IndividualDetails', 'Braintree_MerchantAccount_IndividualDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\MerchantAccount;
|
4 |
|
5 |
use Braintree\Base;
|
6 |
|
7 |
+
/**
|
8 |
+
* Braintree IndividualDetails class
|
9 |
+
*
|
10 |
+
* Object containing information on individual details of a merchant account
|
11 |
+
*/
|
12 |
class IndividualDetails extends Base
|
13 |
{
|
14 |
protected function _initialize($individualAttribs)
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Creates an instance from given attributes
|
24 |
+
*
|
25 |
+
* @param array $attributes response object attributes
|
26 |
+
*
|
27 |
+
* @return IndividualDetails
|
28 |
+
*/
|
29 |
public static function factory($attributes)
|
30 |
{
|
31 |
$instance = new self();
|
33 |
return $instance;
|
34 |
}
|
35 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantAccountGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
class MerchantAccountGateway
|
@@ -7,6 +8,7 @@ class MerchantAccountGateway
|
|
7 |
private $_config;
|
8 |
private $_http;
|
9 |
|
|
|
10 |
public function __construct($gateway)
|
11 |
{
|
12 |
$this->_gateway = $gateway;
|
@@ -17,7 +19,7 @@ class MerchantAccountGateway
|
|
17 |
|
18 |
public function create($attribs)
|
19 |
{
|
20 |
-
Util::verifyKeys(self::
|
21 |
return $this->_doCreate('/merchant_accounts/create_via_api', ['merchant_account' => $attribs]);
|
22 |
}
|
23 |
|
@@ -35,17 +37,8 @@ class MerchantAccountGateway
|
|
35 |
public function update($merchant_account_id, $attributes)
|
36 |
{
|
37 |
Util::verifyKeys(self::updateSignature(), $attributes);
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
public static function detectSignature($attribs)
|
42 |
-
{
|
43 |
-
if (isset($attribs['applicantDetails'])) {
|
44 |
-
trigger_error("DEPRECATED: Passing applicantDetails to create is deprecated. Please use individual, business, and funding", E_USER_NOTICE);
|
45 |
-
return self::createDeprecatedSignature();
|
46 |
-
} else {
|
47 |
-
return self::createSignature();
|
48 |
-
}
|
49 |
}
|
50 |
|
51 |
public static function updateSignature()
|
@@ -57,7 +50,8 @@ class MerchantAccountGateway
|
|
57 |
|
58 |
public function createForCurrency($attribs)
|
59 |
{
|
60 |
-
$
|
|
|
61 |
return $this->_verifyGatewayResponse($response);
|
62 |
}
|
63 |
|
@@ -119,31 +113,7 @@ class MerchantAccountGateway
|
|
119 |
];
|
120 |
}
|
121 |
|
122 |
-
|
123 |
-
{
|
124 |
-
$applicantDetailsAddressSignature = ['streetAddress', 'postalCode', 'locality', 'region'];
|
125 |
-
$applicantDetailsSignature = [
|
126 |
-
'companyName',
|
127 |
-
'firstName',
|
128 |
-
'lastName',
|
129 |
-
'email',
|
130 |
-
'phone',
|
131 |
-
'dateOfBirth',
|
132 |
-
'ssn',
|
133 |
-
'taxId',
|
134 |
-
'routingNumber',
|
135 |
-
'accountNumber',
|
136 |
-
['address' => $applicantDetailsAddressSignature]
|
137 |
-
];
|
138 |
-
|
139 |
-
return [
|
140 |
-
['applicantDetails' => $applicantDetailsSignature],
|
141 |
-
'id',
|
142 |
-
'tosAccepted',
|
143 |
-
'masterMerchantAccountId'
|
144 |
-
];
|
145 |
-
}
|
146 |
-
|
147 |
public function _doCreate($subPath, $params)
|
148 |
{
|
149 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -168,15 +138,14 @@ class MerchantAccountGateway
|
|
168 |
if (isset($response['merchantAccount'])) {
|
169 |
// return a populated instance of merchantAccount
|
170 |
return new Result\Successful(
|
171 |
-
|
172 |
);
|
173 |
-
}
|
174 |
return new Result\Error($response['apiErrorResponse']);
|
175 |
} else {
|
176 |
throw new Exception\Unexpected(
|
177 |
-
|
178 |
);
|
179 |
}
|
180 |
}
|
181 |
}
|
182 |
-
class_alias('Braintree\MerchantAccountGateway', 'Braintree_MerchantAccountGateway');
|
1 |
+
<?php //phpcs:disable
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
class MerchantAccountGateway
|
8 |
private $_config;
|
9 |
private $_http;
|
10 |
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($gateway)
|
13 |
{
|
14 |
$this->_gateway = $gateway;
|
19 |
|
20 |
public function create($attribs)
|
21 |
{
|
22 |
+
Util::verifyKeys(self::createSignature(), $attribs);
|
23 |
return $this->_doCreate('/merchant_accounts/create_via_api', ['merchant_account' => $attribs]);
|
24 |
}
|
25 |
|
37 |
public function update($merchant_account_id, $attributes)
|
38 |
{
|
39 |
Util::verifyKeys(self::updateSignature(), $attributes);
|
40 |
+
$queryPath = '/merchant_accounts/' . $merchant_account_id . '/update_via_api';
|
41 |
+
return $this->_doUpdate($queryPath, ['merchant_account' => $attributes]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
public static function updateSignature()
|
50 |
|
51 |
public function createForCurrency($attribs)
|
52 |
{
|
53 |
+
$queryPath = $this->_config->merchantPath() . '/merchant_accounts/create_for_currency';
|
54 |
+
$response = $this->_http->post($queryPath, ['merchant_account' => $attribs]);
|
55 |
return $this->_verifyGatewayResponse($response);
|
56 |
}
|
57 |
|
113 |
];
|
114 |
}
|
115 |
|
116 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
public function _doCreate($subPath, $params)
|
118 |
{
|
119 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
138 |
if (isset($response['merchantAccount'])) {
|
139 |
// return a populated instance of merchantAccount
|
140 |
return new Result\Successful(
|
141 |
+
MerchantAccount::factory($response['merchantAccount'])
|
142 |
);
|
143 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
144 |
return new Result\Error($response['apiErrorResponse']);
|
145 |
} else {
|
146 |
throw new Exception\Unexpected(
|
147 |
+
"Expected merchant account or apiErrorResponse"
|
148 |
);
|
149 |
}
|
150 |
}
|
151 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MerchantGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
class MerchantGateway
|
@@ -7,6 +8,7 @@ class MerchantGateway
|
|
7 |
private $_config;
|
8 |
private $_http;
|
9 |
|
|
|
10 |
public function __construct($gateway)
|
11 |
{
|
12 |
$this->_gateway = $gateway;
|
@@ -30,13 +32,12 @@ class MerchantGateway
|
|
30 |
Merchant::factory($response['response']['merchant']),
|
31 |
OAuthCredentials::factory($response['response']['credentials']),
|
32 |
]);
|
33 |
-
}
|
34 |
return new Result\Error($response['apiErrorResponse']);
|
35 |
} else {
|
36 |
throw new Exception\Unexpected(
|
37 |
-
|
38 |
);
|
39 |
}
|
40 |
}
|
41 |
}
|
42 |
-
class_alias('Braintree\MerchantGateway', 'Braintree_MerchantGateway');
|
1 |
+
<?php // phpcs:disable PEAR.Commenting
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
class MerchantGateway
|
8 |
private $_config;
|
9 |
private $_http;
|
10 |
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($gateway)
|
13 |
{
|
14 |
$this->_gateway = $gateway;
|
32 |
Merchant::factory($response['response']['merchant']),
|
33 |
OAuthCredentials::factory($response['response']['credentials']),
|
34 |
]);
|
35 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
36 |
return new Result\Error($response['apiErrorResponse']);
|
37 |
} else {
|
38 |
throw new Exception\Unexpected(
|
39 |
+
"Expected merchant or apiErrorResponse"
|
40 |
);
|
41 |
}
|
42 |
}
|
43 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Modification.php
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class Modification extends Base
|
5 |
{
|
6 |
protected function _initialize($attributes)
|
@@ -8,6 +15,13 @@ class Modification extends Base
|
|
8 |
$this->_attributes = $attributes;
|
9 |
}
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
public static function factory($attributes)
|
12 |
{
|
13 |
$instance = new self();
|
@@ -15,8 +29,9 @@ class Modification extends Base
|
|
15 |
return $instance;
|
16 |
}
|
17 |
|
18 |
-
|
|
|
|
|
19 |
return get_called_class() . '[' . Util::attributesToString($this->_attributes) . ']';
|
20 |
}
|
21 |
}
|
22 |
-
class_alias('Braintree\Modification', 'Braintree_Modification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Modification class
|
7 |
+
* For changes to Subscriptions
|
8 |
+
*
|
9 |
+
* @see AddOn
|
10 |
+
*/
|
11 |
class Modification extends Base
|
12 |
{
|
13 |
protected function _initialize($attributes)
|
15 |
$this->_attributes = $attributes;
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Creates an instance from given attributes
|
20 |
+
*
|
21 |
+
* @param array $attributes response object attributes
|
22 |
+
*
|
23 |
+
* @return Modification
|
24 |
+
*/
|
25 |
public static function factory($attributes)
|
26 |
{
|
27 |
$instance = new self();
|
29 |
return $instance;
|
30 |
}
|
31 |
|
32 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
33 |
+
public function __toString()
|
34 |
+
{
|
35 |
return get_called_class() . '[' . Util::attributesToString($this->_attributes) . ']';
|
36 |
}
|
37 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MultipleValueNode.php
CHANGED
@@ -1,41 +1,67 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
|
|
|
|
|
|
|
|
6 |
class MultipleValueNode
|
7 |
{
|
|
|
8 |
public function __construct($name, $allowedValues = [])
|
9 |
{
|
10 |
$this->name = $name;
|
11 |
$this->items = [];
|
12 |
-
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function in($values)
|
16 |
{
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
$this->items = $values;
|
28 |
return $this;
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public function is($value)
|
32 |
{
|
33 |
return $this->in([$value]);
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
public function toParam()
|
37 |
{
|
38 |
return $this->items;
|
39 |
}
|
40 |
}
|
41 |
-
class_alias('Braintree\MultipleValueNode', 'Braintree_MultipleValueNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
+
/**
|
8 |
+
* Braintree MultipleValueNode
|
9 |
+
* MultipleValueNode is an object for elements with possible values returned from the Braintree API
|
10 |
+
*/
|
11 |
class MultipleValueNode
|
12 |
{
|
13 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
14 |
public function __construct($name, $allowedValues = [])
|
15 |
{
|
16 |
$this->name = $name;
|
17 |
$this->items = [];
|
18 |
+
$this->allowedValues = $allowedValues;
|
19 |
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Sets the value of the object's items key to $values
|
23 |
+
*
|
24 |
+
* @param array $values to be set
|
25 |
+
*
|
26 |
+
* @throws InvalidArgumentException
|
27 |
+
*
|
28 |
+
* @return object
|
29 |
+
*/
|
30 |
public function in($values)
|
31 |
{
|
32 |
+
$bad_values = array_diff($values, $this->allowedValues);
|
33 |
+
if (count($this->allowedValues) > 0 && count($bad_values) > 0) {
|
34 |
+
$message = 'Invalid argument(s) for ' . $this->name . ':';
|
35 |
+
foreach ($bad_values as $bad_value) {
|
36 |
+
$message .= ' ' . $bad_value;
|
37 |
+
}
|
38 |
|
39 |
+
throw new InvalidArgumentException($message);
|
40 |
+
}
|
41 |
|
42 |
$this->items = $values;
|
43 |
return $this;
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* Sets the value of the object's items key to [$value]
|
48 |
+
*
|
49 |
+
* @param object $value to be set
|
50 |
+
*
|
51 |
+
* @return object
|
52 |
+
*/
|
53 |
public function is($value)
|
54 |
{
|
55 |
return $this->in([$value]);
|
56 |
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Retrieves items(params) from the object
|
60 |
+
*
|
61 |
+
* @return object
|
62 |
+
*/
|
63 |
public function toParam()
|
64 |
{
|
65 |
return $this->items;
|
66 |
}
|
67 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/MultipleValueOrTextNode.php
CHANGED
@@ -1,47 +1,92 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class MultipleValueOrTextNode extends MultipleValueNode
|
5 |
{
|
|
|
6 |
public function __construct($name)
|
7 |
{
|
8 |
parent::__construct($name);
|
9 |
$this->textNode = new TextNode($name);
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function contains($value)
|
13 |
{
|
14 |
$this->textNode->contains($value);
|
15 |
return $this;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function endsWith($value)
|
19 |
{
|
20 |
$this->textNode->endsWith($value);
|
21 |
return $this;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
public function is($value)
|
25 |
{
|
26 |
$this->textNode->is($value);
|
27 |
return $this;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
public function isNot($value)
|
31 |
{
|
32 |
$this->textNode->isNot($value);
|
33 |
return $this;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
public function startsWith($value)
|
37 |
{
|
38 |
$this->textNode->startsWith($value);
|
39 |
return $this;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
public function toParam()
|
43 |
{
|
44 |
return array_merge(parent::toParam(), $this->textNode->toParam());
|
45 |
}
|
46 |
}
|
47 |
-
class_alias('Braintree\MultipleValueOrTextNode', 'Braintree_MultipleValueOrTextNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree MultipleValueOrTextNode
|
7 |
+
* MultipleValueOrTextNode is an object that could be multiple values or a single string value returned from the Braintree API
|
8 |
+
*/
|
9 |
class MultipleValueOrTextNode extends MultipleValueNode
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($name)
|
13 |
{
|
14 |
parent::__construct($name);
|
15 |
$this->textNode = new TextNode($name);
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Sets the value of the object's "contains" key to a string of $value
|
20 |
+
*
|
21 |
+
* @param object $value to have its string value set in $this
|
22 |
+
*
|
23 |
+
* @return object
|
24 |
+
*/
|
25 |
public function contains($value)
|
26 |
{
|
27 |
$this->textNode->contains($value);
|
28 |
return $this;
|
29 |
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Sets the value of the object's "ends_width" key to a string of $value
|
33 |
+
*
|
34 |
+
* @param object $value to have its string value set in $this
|
35 |
+
*
|
36 |
+
* @return object
|
37 |
+
*/
|
38 |
public function endsWith($value)
|
39 |
{
|
40 |
$this->textNode->endsWith($value);
|
41 |
return $this;
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Sets the value of the object's "is" key to a string of $value
|
46 |
+
*
|
47 |
+
* @param object $value to have its string value set in $this
|
48 |
+
*
|
49 |
+
* @return object
|
50 |
+
*/
|
51 |
public function is($value)
|
52 |
{
|
53 |
$this->textNode->is($value);
|
54 |
return $this;
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* Sets the value of the object's "is_not" key to a string of $value
|
59 |
+
*
|
60 |
+
* @param object $value to have its string value set in $this
|
61 |
+
*
|
62 |
+
* @return object
|
63 |
+
*/
|
64 |
public function isNot($value)
|
65 |
{
|
66 |
$this->textNode->isNot($value);
|
67 |
return $this;
|
68 |
}
|
69 |
|
70 |
+
/**
|
71 |
+
* Sets the value of the object's "starts_with" key to a string of $value
|
72 |
+
*
|
73 |
+
* @param object $value to have its string value set in $this
|
74 |
+
*
|
75 |
+
* @return object
|
76 |
+
*/
|
77 |
public function startsWith($value)
|
78 |
{
|
79 |
$this->textNode->startsWith($value);
|
80 |
return $this;
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Merges searchTerms into the parent element's params
|
85 |
+
*
|
86 |
+
* @return array
|
87 |
+
*/
|
88 |
public function toParam()
|
89 |
{
|
90 |
return array_merge(parent::toParam(), $this->textNode->toParam());
|
91 |
}
|
92 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/OAuthAccessRevocation.php
CHANGED
@@ -1,17 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree OAuth Revocation module
|
6 |
*
|
7 |
-
*
|
8 |
*
|
9 |
-
* @
|
10 |
*/
|
11 |
class OAuthAccessRevocation extends Base
|
12 |
{
|
13 |
/**
|
14 |
-
*
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
public static function factory($attributes)
|
17 |
{
|
@@ -21,12 +26,9 @@ class OAuthAccessRevocation extends Base
|
|
21 |
return $instance;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
* @ignore
|
26 |
-
*/
|
27 |
protected function _initialize($attributes)
|
28 |
{
|
29 |
$this->_attributes = $attributes;
|
30 |
}
|
31 |
}
|
32 |
-
class_alias('Braintree\OAuthAccessRevocation', 'Braintree_OAuthAccessRevocation');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree OAuth Revocation module
|
7 |
*
|
8 |
+
* A revoked OAuth access token
|
9 |
*
|
10 |
+
* For more information, see {@link https://developer.paypal.com/braintree/docs/guides/extend/oauth/access-tokens/php#managing-access-tokens our developer docs}
|
11 |
*/
|
12 |
class OAuthAccessRevocation extends Base
|
13 |
{
|
14 |
/**
|
15 |
+
* Creates an instance from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return OauthAccessRevocation
|
20 |
*/
|
21 |
public static function factory($attributes)
|
22 |
{
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
30 |
protected function _initialize($attributes)
|
31 |
{
|
32 |
$this->_attributes = $attributes;
|
33 |
}
|
34 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/OAuthCredentials.php
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree OAuthCredentials module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
class OAuthCredentials extends Base
|
11 |
{
|
@@ -14,6 +12,13 @@ class OAuthCredentials extends Base
|
|
14 |
$this->_attributes = $attribs;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public static function factory($attributes)
|
18 |
{
|
19 |
$instance = new self();
|
@@ -21,14 +26,10 @@ class OAuthCredentials extends Base
|
|
21 |
return $instance;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
* returns a string representation of the access token
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
public function __toString()
|
29 |
{
|
30 |
return __CLASS__ . '[' .
|
31 |
-
Util::attributesToString($this->_attributes) .']';
|
32 |
}
|
33 |
}
|
34 |
-
class_alias('Braintree\OAuthCredentials', 'Braintree_OAuthCredentials');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree OAuthCredentials module
|
|
|
|
|
|
|
7 |
*/
|
8 |
class OAuthCredentials extends Base
|
9 |
{
|
12 |
$this->_attributes = $attribs;
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Creates an instance from given attributes
|
17 |
+
*
|
18 |
+
* @param array $attributes response object attributes
|
19 |
+
*
|
20 |
+
* @return OauthCredentials
|
21 |
+
*/
|
22 |
public static function factory($attributes)
|
23 |
{
|
24 |
$instance = new self();
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
30 |
public function __toString()
|
31 |
{
|
32 |
return __CLASS__ . '[' .
|
33 |
+
Util::attributesToString($this->_attributes) . ']';
|
34 |
}
|
35 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/OAuthGateway.php
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree OAuthGateway module
|
6 |
-
* PHP Version 5
|
7 |
* Creates and manages Braintree Addresses
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
*/
|
11 |
class OAuthGateway
|
12 |
{
|
@@ -14,6 +12,7 @@ class OAuthGateway
|
|
14 |
private $_config;
|
15 |
private $_http;
|
16 |
|
|
|
17 |
public function __construct($gateway)
|
18 |
{
|
19 |
$this->_gateway = $gateway;
|
@@ -24,18 +23,36 @@ class OAuthGateway
|
|
24 |
$this->_config->assertHasClientCredentials();
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
public function createTokenFromCode($params)
|
28 |
{
|
29 |
$params['grantType'] = "authorization_code";
|
30 |
return $this->_createToken($params);
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public function createTokenFromRefreshToken($params)
|
34 |
{
|
35 |
$params['grantType'] = "refresh_token";
|
36 |
return $this->_createToken($params);
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
public function revokeAccessToken($accessToken)
|
40 |
{
|
41 |
$params = ['token' => $accessToken];
|
@@ -50,6 +67,7 @@ class OAuthGateway
|
|
50 |
return $this->_verifyGatewayResponse($response);
|
51 |
}
|
52 |
|
|
|
53 |
private function _verifyGatewayResponse($response)
|
54 |
{
|
55 |
if (isset($response['credentials'])) {
|
@@ -57,12 +75,12 @@ class OAuthGateway
|
|
57 |
OAuthCredentials::factory($response['credentials'])
|
58 |
);
|
59 |
return $this->_mapSuccess($result);
|
60 |
-
}
|
61 |
$result = new Result\Successful(
|
62 |
OAuthResult::factory($response['result'])
|
63 |
);
|
64 |
return $this->_mapAccessTokenRevokeSuccess($result);
|
65 |
-
}
|
66 |
$result = new Result\Error($response['apiErrorResponse']);
|
67 |
return $this->_mapError($result);
|
68 |
} else {
|
@@ -72,27 +90,30 @@ class OAuthGateway
|
|
72 |
}
|
73 |
}
|
74 |
|
|
|
75 |
public function _mapError($result)
|
76 |
{
|
77 |
$error = $result->errors->deepAll()[0];
|
78 |
|
79 |
if ($error->code == Error\Codes::OAUTH_INVALID_GRANT) {
|
80 |
$result->error = 'invalid_grant';
|
81 |
-
}
|
82 |
$result->error = 'invalid_credentials';
|
83 |
-
}
|
84 |
$result->error = 'invalid_scope';
|
85 |
}
|
86 |
$result->errorDescription = explode(': ', $error->message)[1];
|
87 |
return $result;
|
88 |
}
|
89 |
|
|
|
90 |
public function _mapAccessTokenRevokeSuccess($result)
|
91 |
{
|
92 |
$result->revocationResult = $result->success;
|
93 |
return $result;
|
94 |
}
|
95 |
|
|
|
96 |
public function _mapSuccess($result)
|
97 |
{
|
98 |
$credentials = $result->credentials;
|
@@ -103,6 +124,13 @@ class OAuthGateway
|
|
103 |
return $result;
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
public function connectUrl($params = [])
|
107 |
{
|
108 |
$query = Util::camelCaseToDelimiterArray($params, '_');
|
@@ -111,14 +139,4 @@ class OAuthGateway
|
|
111 |
|
112 |
return $this->_config->baseUrl() . '/oauth/connect?' . $queryString;
|
113 |
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* @deprecated since version 3.26.1
|
117 |
-
*/
|
118 |
-
public function computeSignature($url)
|
119 |
-
{
|
120 |
-
$key = hash('sha256', $this->_config->getClientSecret(), true);
|
121 |
-
return hash_hmac('sha256', $url, $key);
|
122 |
-
}
|
123 |
}
|
124 |
-
class_alias('Braintree\OAuthGateway', 'Braintree_OAuthGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree OAuthGateway module
|
|
|
7 |
* Creates and manages Braintree Addresses
|
|
|
|
|
8 |
*/
|
9 |
class OAuthGateway
|
10 |
{
|
12 |
private $_config;
|
13 |
private $_http;
|
14 |
|
15 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
16 |
public function __construct($gateway)
|
17 |
{
|
18 |
$this->_gateway = $gateway;
|
23 |
$this->_config->assertHasClientCredentials();
|
24 |
}
|
25 |
|
26 |
+
/* Create an oAuth token from an authorization code
|
27 |
+
*
|
28 |
+
* @param mixed $params of request details
|
29 |
+
*
|
30 |
+
* @return Result\Successful|Result\Error
|
31 |
+
*/
|
32 |
public function createTokenFromCode($params)
|
33 |
{
|
34 |
$params['grantType'] = "authorization_code";
|
35 |
return $this->_createToken($params);
|
36 |
}
|
37 |
|
38 |
+
/* Create an oAuth token from a refresh token
|
39 |
+
*
|
40 |
+
* @param mixed $params of request details
|
41 |
+
*
|
42 |
+
* @return Result\Successful|Result\Error
|
43 |
+
*/
|
44 |
public function createTokenFromRefreshToken($params)
|
45 |
{
|
46 |
$params['grantType'] = "refresh_token";
|
47 |
return $this->_createToken($params);
|
48 |
}
|
49 |
|
50 |
+
/* Revoke an oAuth Access token
|
51 |
+
*
|
52 |
+
* @param mixed $params of request details
|
53 |
+
*
|
54 |
+
* @return Result\Successful|Result\Error
|
55 |
+
*/
|
56 |
public function revokeAccessToken($accessToken)
|
57 |
{
|
58 |
$params = ['token' => $accessToken];
|
67 |
return $this->_verifyGatewayResponse($response);
|
68 |
}
|
69 |
|
70 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
71 |
private function _verifyGatewayResponse($response)
|
72 |
{
|
73 |
if (isset($response['credentials'])) {
|
75 |
OAuthCredentials::factory($response['credentials'])
|
76 |
);
|
77 |
return $this->_mapSuccess($result);
|
78 |
+
} elseif (isset($response['result'])) {
|
79 |
$result = new Result\Successful(
|
80 |
OAuthResult::factory($response['result'])
|
81 |
);
|
82 |
return $this->_mapAccessTokenRevokeSuccess($result);
|
83 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
84 |
$result = new Result\Error($response['apiErrorResponse']);
|
85 |
return $this->_mapError($result);
|
86 |
} else {
|
90 |
}
|
91 |
}
|
92 |
|
93 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
94 |
public function _mapError($result)
|
95 |
{
|
96 |
$error = $result->errors->deepAll()[0];
|
97 |
|
98 |
if ($error->code == Error\Codes::OAUTH_INVALID_GRANT) {
|
99 |
$result->error = 'invalid_grant';
|
100 |
+
} elseif ($error->code == Error\Codes::OAUTH_INVALID_CREDENTIALS) {
|
101 |
$result->error = 'invalid_credentials';
|
102 |
+
} elseif ($error->code == Error\Codes::OAUTH_INVALID_SCOPE) {
|
103 |
$result->error = 'invalid_scope';
|
104 |
}
|
105 |
$result->errorDescription = explode(': ', $error->message)[1];
|
106 |
return $result;
|
107 |
}
|
108 |
|
109 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
110 |
public function _mapAccessTokenRevokeSuccess($result)
|
111 |
{
|
112 |
$result->revocationResult = $result->success;
|
113 |
return $result;
|
114 |
}
|
115 |
|
116 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
117 |
public function _mapSuccess($result)
|
118 |
{
|
119 |
$credentials = $result->credentials;
|
124 |
return $result;
|
125 |
}
|
126 |
|
127 |
+
/*
|
128 |
+
* Create URL for oAuth connection
|
129 |
+
*
|
130 |
+
* @param array $params optional
|
131 |
+
*
|
132 |
+
* @return string
|
133 |
+
*/
|
134 |
public function connectUrl($params = [])
|
135 |
{
|
136 |
$query = Util::camelCaseToDelimiterArray($params, '_');
|
139 |
|
140 |
return $this->_config->baseUrl() . '/oauth/connect?' . $queryString;
|
141 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/OAuthResult.php
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree OAuthCredentials module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
class OAuthResult extends Base
|
11 |
{
|
@@ -14,6 +12,13 @@ class OAuthResult extends Base
|
|
14 |
$this->_attributes = $attribs;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public static function factory($attributes)
|
18 |
{
|
19 |
$instance = new self();
|
@@ -21,14 +26,10 @@ class OAuthResult extends Base
|
|
21 |
return $instance;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
* returns a string representation of the result
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
public function __toString()
|
29 |
{
|
30 |
return __CLASS__ . '[' .
|
31 |
-
Util::attributesToString($this->_attributes) .']';
|
32 |
}
|
33 |
}
|
34 |
-
class_alias('Braintree\OAuthResult', 'Braintree_OAuthResult');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree OAuthCredentials module
|
|
|
|
|
|
|
7 |
*/
|
8 |
class OAuthResult extends Base
|
9 |
{
|
12 |
$this->_attributes = $attribs;
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Creates an instance from given attributes
|
17 |
+
*
|
18 |
+
* @param array $attributes response object attributes
|
19 |
+
*
|
20 |
+
* @return OAuthResult
|
21 |
+
*/
|
22 |
public static function factory($attributes)
|
23 |
{
|
24 |
$instance = new self();
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
30 |
public function __toString()
|
31 |
{
|
32 |
return __CLASS__ . '[' .
|
33 |
+
Util::attributesToString($this->_attributes) . ']';
|
34 |
}
|
35 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaginatedCollection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use Iterator;
|
@@ -7,7 +8,7 @@ use Iterator;
|
|
7 |
* Braintree PaginatedCollection
|
8 |
* PaginatedCollection is a container object for paginated data
|
9 |
*
|
10 |
-
*
|
11 |
*
|
12 |
* example:
|
13 |
* <code>
|
@@ -17,9 +18,6 @@ use Iterator;
|
|
17 |
* print_r($merchantAccount->status);
|
18 |
* }
|
19 |
* </code>
|
20 |
-
*
|
21 |
-
* @package Braintree
|
22 |
-
* @subpackage Utility
|
23 |
*/
|
24 |
class PaginatedCollection implements Iterator
|
25 |
{
|
@@ -30,14 +28,8 @@ class PaginatedCollection implements Iterator
|
|
30 |
private $_totalItems;
|
31 |
private $_items;
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* expects an array of an object and method to call on it
|
37 |
-
*
|
38 |
-
* @param array $pager
|
39 |
-
*/
|
40 |
-
public function __construct($pager)
|
41 |
{
|
42 |
$this->_pager = $pager;
|
43 |
$this->_pageSize = 0;
|
@@ -47,29 +39,44 @@ class PaginatedCollection implements Iterator
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
*
|
|
|
|
|
51 |
*/
|
|
|
52 |
public function current()
|
53 |
{
|
54 |
return $this->_items[($this->_index % $this->_pageSize)];
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
public function key()
|
58 |
{
|
59 |
return null;
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
*
|
|
|
|
|
64 |
*/
|
|
|
65 |
public function next()
|
66 |
{
|
67 |
++$this->_index;
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
-
*
|
|
|
|
|
72 |
*/
|
|
|
73 |
public function rewind()
|
74 |
{
|
75 |
$this->_index = 0;
|
@@ -80,12 +87,14 @@ class PaginatedCollection implements Iterator
|
|
80 |
}
|
81 |
|
82 |
/**
|
83 |
-
*
|
|
|
|
|
84 |
*/
|
|
|
85 |
public function valid()
|
86 |
{
|
87 |
-
if ($this->_currentPage == 0 || $this->_index % $this->_pageSize == 0 && $this->_index < $this->_totalItems)
|
88 |
-
{
|
89 |
$this->_getNextPage();
|
90 |
}
|
91 |
|
@@ -112,9 +121,8 @@ class PaginatedCollection implements Iterator
|
|
112 |
);
|
113 |
}
|
114 |
|
115 |
-
$this->_totalItems= $result->getTotalItems();
|
116 |
$this->_pageSize = $result->getPageSize();
|
117 |
$this->_items = $result->getCurrentPage();
|
118 |
}
|
119 |
}
|
120 |
-
class_alias('Braintree\PaginatedCollection', 'Braintree_PaginatedCollection');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use Iterator;
|
8 |
* Braintree PaginatedCollection
|
9 |
* PaginatedCollection is a container object for paginated data
|
10 |
*
|
11 |
+
* Retrieves and pages through large collections of results
|
12 |
*
|
13 |
* example:
|
14 |
* <code>
|
18 |
* print_r($merchantAccount->status);
|
19 |
* }
|
20 |
* </code>
|
|
|
|
|
|
|
21 |
*/
|
22 |
class PaginatedCollection implements Iterator
|
23 |
{
|
28 |
private $_totalItems;
|
29 |
private $_items;
|
30 |
|
31 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
32 |
+
public function __construct($pager)
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
{
|
34 |
$this->_pager = $pager;
|
35 |
$this->_pageSize = 0;
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* Returns the current item when iterating with foreach
|
43 |
+
*
|
44 |
+
* @return object of the current item
|
45 |
*/
|
46 |
+
#[\ReturnTypeWillChange]
|
47 |
public function current()
|
48 |
{
|
49 |
return $this->_items[($this->_index % $this->_pageSize)];
|
50 |
}
|
51 |
|
52 |
+
/**
|
53 |
+
* Returns null
|
54 |
+
*
|
55 |
+
* @return null
|
56 |
+
*/
|
57 |
+
#[\ReturnTypeWillChange]
|
58 |
public function key()
|
59 |
{
|
60 |
return null;
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
+
* Advances to the next item in the collection when iterating with foreach
|
65 |
+
*
|
66 |
+
* @return object of the next item in the collection
|
67 |
*/
|
68 |
+
#[\ReturnTypeWillChange]
|
69 |
public function next()
|
70 |
{
|
71 |
++$this->_index;
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
+
* Rewinds the collection to the first item when iterating with foreach
|
76 |
+
*
|
77 |
+
* @return mixed collection with index set to 0
|
78 |
*/
|
79 |
+
#[\ReturnTypeWillChange]
|
80 |
public function rewind()
|
81 |
{
|
82 |
$this->_index = 0;
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
+
* Returns whether the current item is valid when iterating with foreach
|
91 |
+
*
|
92 |
+
* @return bool
|
93 |
*/
|
94 |
+
#[\ReturnTypeWillChange]
|
95 |
public function valid()
|
96 |
{
|
97 |
+
if ($this->_currentPage == 0 || $this->_index % $this->_pageSize == 0 && $this->_index < $this->_totalItems) {
|
|
|
98 |
$this->_getNextPage();
|
99 |
}
|
100 |
|
121 |
);
|
122 |
}
|
123 |
|
124 |
+
$this->_totalItems = $result->getTotalItems();
|
125 |
$this->_pageSize = $result->getPageSize();
|
126 |
$this->_items = $result->getCurrentPage();
|
127 |
}
|
128 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaginatedResult.php
CHANGED
@@ -1,12 +1,17 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class PaginatedResult
|
5 |
{
|
6 |
private $_totalItems;
|
7 |
private $_pageSize;
|
8 |
private $_currentPage;
|
9 |
|
|
|
10 |
public function __construct($totalItems, $pageSize, $currentPage)
|
11 |
{
|
12 |
$this->_totalItems = $totalItems;
|
@@ -14,19 +19,33 @@ class PaginatedResult
|
|
14 |
$this->_currentPage = $currentPage;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
public function getTotalItems()
|
18 |
{
|
19 |
return $this->_totalItems;
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
22 |
public function getPageSize()
|
23 |
{
|
24 |
return $this->_pageSize;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function getCurrentPage()
|
28 |
{
|
29 |
return $this->_currentPage;
|
30 |
}
|
31 |
}
|
32 |
-
class_alias('Braintree\PaginatedResult', 'Braintree_PaginatedResult');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Paginated Results class
|
7 |
+
*/
|
8 |
class PaginatedResult
|
9 |
{
|
10 |
private $_totalItems;
|
11 |
private $_pageSize;
|
12 |
private $_currentPage;
|
13 |
|
14 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
15 |
public function __construct($totalItems, $pageSize, $currentPage)
|
16 |
{
|
17 |
$this->_totalItems = $totalItems;
|
19 |
$this->_currentPage = $currentPage;
|
20 |
}
|
21 |
|
22 |
+
/*
|
23 |
+
* Getter method for totalItems
|
24 |
+
*
|
25 |
+
* @return int
|
26 |
+
*/
|
27 |
public function getTotalItems()
|
28 |
{
|
29 |
return $this->_totalItems;
|
30 |
}
|
31 |
|
32 |
+
/*
|
33 |
+
* Getter method for page size
|
34 |
+
*
|
35 |
+
* @return int
|
36 |
+
*/
|
37 |
public function getPageSize()
|
38 |
{
|
39 |
return $this->_pageSize;
|
40 |
}
|
41 |
|
42 |
+
/*
|
43 |
+
* Getter method for the current page index
|
44 |
+
*
|
45 |
+
* @return int
|
46 |
+
*/
|
47 |
public function getCurrentPage()
|
48 |
{
|
49 |
return $this->_currentPage;
|
50 |
}
|
51 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PartialMatchNode.php
CHANGED
@@ -1,18 +1,37 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class PartialMatchNode extends EqualityNode
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public function startsWith($value)
|
7 |
{
|
8 |
$this->searchTerms["starts_with"] = strval($value);
|
9 |
return $this;
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function endsWith($value)
|
13 |
{
|
14 |
$this->searchTerms["ends_with"] = strval($value);
|
15 |
return $this;
|
16 |
}
|
17 |
}
|
18 |
-
class_alias('Braintree\PartialMatchNode', 'Braintree_PartialMatchNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree PartialMatchNode module
|
7 |
+
*
|
8 |
+
* PartialMatchNode is an object for partially matching node elements returned from the Braintree API
|
9 |
+
*/
|
10 |
class PartialMatchNode extends EqualityNode
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Sets the value of the object's "starts_with" key to a string of $value
|
14 |
+
*
|
15 |
+
* @param object $value to have its string value set in $this
|
16 |
+
*
|
17 |
+
* @return object
|
18 |
+
*/
|
19 |
public function startsWith($value)
|
20 |
{
|
21 |
$this->searchTerms["starts_with"] = strval($value);
|
22 |
return $this;
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Sets the value of the object's "ends_width" key to a string of $value
|
27 |
+
*
|
28 |
+
* @param object $value to have its string value set in $this
|
29 |
+
*
|
30 |
+
* @return object
|
31 |
+
*/
|
32 |
public function endsWith($value)
|
33 |
{
|
34 |
$this->searchTerms["ends_with"] = strval($value);
|
35 |
return $this;
|
36 |
}
|
37 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PartnerMerchant.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
@@ -7,8 +8,6 @@ namespace Braintree;
|
|
7 |
*
|
8 |
* Creates an instance of PartnerMerchants
|
9 |
*
|
10 |
-
* @package Braintree
|
11 |
-
*
|
12 |
* @property-read string $merchantPublicId
|
13 |
* @property-read string $publicKey
|
14 |
* @property-read string $privateKey
|
@@ -20,7 +19,11 @@ class PartnerMerchant extends Base
|
|
20 |
protected $_attributes = [];
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
|
|
|
|
|
|
24 |
*/
|
25 |
public static function factory($attributes)
|
26 |
{
|
@@ -30,12 +33,8 @@ class PartnerMerchant extends Base
|
|
30 |
return $instance;
|
31 |
}
|
32 |
|
33 |
-
/**
|
34 |
-
* @ignore
|
35 |
-
*/
|
36 |
protected function _initialize($attributes)
|
37 |
{
|
38 |
$this->_attributes = $attributes;
|
39 |
}
|
40 |
}
|
41 |
-
class_alias('Braintree\PartnerMerchant', 'Braintree_PartnerMerchant');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
8 |
*
|
9 |
* Creates an instance of PartnerMerchants
|
10 |
*
|
|
|
|
|
11 |
* @property-read string $merchantPublicId
|
12 |
* @property-read string $publicKey
|
13 |
* @property-read string $privateKey
|
19 |
protected $_attributes = [];
|
20 |
|
21 |
/**
|
22 |
+
* Creates an instance from given attributes
|
23 |
+
*
|
24 |
+
* @param array $attributes response object attributes
|
25 |
+
*
|
26 |
+
* @return PartnerMerchant
|
27 |
*/
|
28 |
public static function factory($attributes)
|
29 |
{
|
33 |
return $instance;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
36 |
protected function _initialize($attributes)
|
37 |
{
|
38 |
$this->_attributes = $attributes;
|
39 |
}
|
40 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PayPalAccount.php
CHANGED
@@ -1,34 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree PayPalAccount module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
* Manages Braintree PayPalAccounts
|
13 |
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
-
* @property-read string $customerId
|
21 |
-
* @property-read string $email
|
22 |
-
* @property-read string $token
|
23 |
-
* @property-read string $imageUrl
|
24 |
*/
|
25 |
class PayPalAccount extends Base
|
26 |
{
|
27 |
/**
|
28 |
-
*
|
29 |
-
*
|
|
|
30 |
*
|
31 |
-
* @ignore
|
32 |
* @return PayPalAccount
|
33 |
*/
|
34 |
public static function factory($attributes)
|
@@ -53,8 +39,8 @@ class PayPalAccount extends Base
|
|
53 |
/**
|
54 |
* sets instance properties from an array of values
|
55 |
*
|
56 |
-
* @access protected
|
57 |
* @param array $paypalAccountAttribs array of paypalAccount data
|
|
|
58 |
* @return void
|
59 |
*/
|
60 |
protected function _initialize($paypalAccountAttribs)
|
@@ -64,7 +50,7 @@ class PayPalAccount extends Base
|
|
64 |
|
65 |
$subscriptionArray = [];
|
66 |
if (isset($paypalAccountAttribs['subscriptions'])) {
|
67 |
-
foreach ($paypalAccountAttribs['subscriptions']
|
68 |
$subscriptionArray[] = Subscription::factory($subscription);
|
69 |
}
|
70 |
}
|
@@ -72,38 +58,73 @@ class PayPalAccount extends Base
|
|
72 |
$this->_set('subscriptions', $subscriptionArray);
|
73 |
}
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
* ClassName[property=value, property=value]
|
78 |
-
* @return string
|
79 |
-
*/
|
80 |
-
public function __toString()
|
81 |
{
|
82 |
return __CLASS__ . '[' .
|
83 |
Util::attributesToString($this->_attributes) . ']';
|
84 |
}
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
public static function find($token)
|
90 |
{
|
91 |
return Configuration::gateway()->payPalAccount()->find($token);
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
public static function update($token, $attributes)
|
95 |
{
|
96 |
return Configuration::gateway()->payPalAccount()->update($token, $attributes);
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
public static function delete($token)
|
100 |
{
|
101 |
return Configuration::gateway()->payPalAccount()->delete($token);
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
public static function sale($token, $transactionAttribs)
|
105 |
{
|
106 |
return Configuration::gateway()->payPalAccount()->sale($token, $transactionAttribs);
|
107 |
}
|
108 |
}
|
109 |
-
class_alias('Braintree\PayPalAccount', 'Braintree_PayPalAccount');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree PayPalAccount module
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* Manages Braintree PayPalAccounts
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/paypal-account/php developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class PayPalAccount extends Base
|
12 |
{
|
13 |
/**
|
14 |
+
* Creates an instance from given attributes
|
15 |
+
*
|
16 |
+
* @param array $attributes response object attributes
|
17 |
*
|
|
|
18 |
* @return PayPalAccount
|
19 |
*/
|
20 |
public static function factory($attributes)
|
39 |
/**
|
40 |
* sets instance properties from an array of values
|
41 |
*
|
|
|
42 |
* @param array $paypalAccountAttribs array of paypalAccount data
|
43 |
+
*
|
44 |
* @return void
|
45 |
*/
|
46 |
protected function _initialize($paypalAccountAttribs)
|
50 |
|
51 |
$subscriptionArray = [];
|
52 |
if (isset($paypalAccountAttribs['subscriptions'])) {
|
53 |
+
foreach ($paypalAccountAttribs['subscriptions'] as $subscription) {
|
54 |
$subscriptionArray[] = Subscription::factory($subscription);
|
55 |
}
|
56 |
}
|
58 |
$this->_set('subscriptions', $subscriptionArray);
|
59 |
}
|
60 |
|
61 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
62 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
63 |
{
|
64 |
return __CLASS__ . '[' .
|
65 |
Util::attributesToString($this->_attributes) . ']';
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Static methods redirecting to gateway class
|
70 |
+
*
|
71 |
+
* @param string $token paypal accountunique id
|
72 |
+
*
|
73 |
+
* @see PayPalGateway::find()
|
74 |
+
*
|
75 |
+
* @throws Exception\NotFound
|
76 |
+
*
|
77 |
+
* @return PayPalAccount
|
78 |
+
*/
|
79 |
public static function find($token)
|
80 |
{
|
81 |
return Configuration::gateway()->payPalAccount()->find($token);
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Static methods redirecting to gateway class
|
86 |
+
*
|
87 |
+
* if calling this method in context, $token
|
88 |
+
* is the 2nd attribute. $token is not sent in object context.
|
89 |
+
*
|
90 |
+
* @param string $token (optional)
|
91 |
+
* @param array $attributes including request parameters
|
92 |
+
*
|
93 |
+
* @see PayPalGateway::update()
|
94 |
+
*
|
95 |
+
* @return Result\Successful or Result\Error
|
96 |
+
*/
|
97 |
public static function update($token, $attributes)
|
98 |
{
|
99 |
return Configuration::gateway()->payPalAccount()->update($token, $attributes);
|
100 |
}
|
101 |
|
102 |
+
/**
|
103 |
+
* Static methods redirecting to gateway class
|
104 |
+
*
|
105 |
+
* @param string $token paypal account identifier
|
106 |
+
*
|
107 |
+
* @see PayPalGateway::delete()
|
108 |
+
*
|
109 |
+
* @return Result
|
110 |
+
*/
|
111 |
public static function delete($token)
|
112 |
{
|
113 |
return Configuration::gateway()->payPalAccount()->delete($token);
|
114 |
}
|
115 |
|
116 |
+
/**
|
117 |
+
* Static methods redirecting to gateway class
|
118 |
+
*
|
119 |
+
* @param string $token paypal account identifier
|
120 |
+
* @param array $transactionAttribs containing request parameters
|
121 |
+
*
|
122 |
+
* @see PayPalGateway::sale()
|
123 |
+
*
|
124 |
+
* @return Result\Successful|Result\Error
|
125 |
+
*/
|
126 |
public static function sale($token, $transactionAttribs)
|
127 |
{
|
128 |
return Configuration::gateway()->payPalAccount()->sale($token, $transactionAttribs);
|
129 |
}
|
130 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PayPalAccountGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -6,18 +7,9 @@ use InvalidArgumentException;
|
|
6 |
/**
|
7 |
* Braintree PayPalAccountGateway module
|
8 |
*
|
9 |
-
* @package Braintree
|
10 |
-
* @category Resources
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
* Manages Braintree PayPalAccounts
|
15 |
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @package Braintree
|
20 |
-
* @category Resources
|
21 |
*/
|
22 |
class PayPalAccountGateway
|
23 |
{
|
@@ -25,6 +17,7 @@ class PayPalAccountGateway
|
|
25 |
private $_config;
|
26 |
private $_http;
|
27 |
|
|
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -35,12 +28,13 @@ class PayPalAccountGateway
|
|
35 |
|
36 |
|
37 |
/**
|
38 |
-
*
|
39 |
*
|
40 |
-
* @access public
|
41 |
* @param string $token paypal accountunique id
|
42 |
-
*
|
43 |
* @throws Exception\NotFound
|
|
|
|
|
44 |
*/
|
45 |
public function find($token)
|
46 |
{
|
@@ -54,7 +48,6 @@ class PayPalAccountGateway
|
|
54 |
'paypal account with token ' . $token . ' not found'
|
55 |
);
|
56 |
}
|
57 |
-
|
58 |
}
|
59 |
|
60 |
/**
|
@@ -63,9 +56,9 @@ class PayPalAccountGateway
|
|
63 |
* if calling this method in context, $token
|
64 |
* is the 2nd attribute. $token is not sent in object context.
|
65 |
*
|
66 |
-
* @
|
67 |
-
* @param array
|
68 |
-
*
|
69 |
* @return Result\Successful or Result\Error
|
70 |
*/
|
71 |
public function update($token, $attributes)
|
@@ -75,6 +68,13 @@ class PayPalAccountGateway
|
|
75 |
return $this->_doUpdate('put', '/payment_methods/paypal_account/' . $token, ['paypalAccount' => $attributes]);
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
public function delete($token)
|
79 |
{
|
80 |
$this->_validateId($token);
|
@@ -86,10 +86,10 @@ class PayPalAccountGateway
|
|
86 |
/**
|
87 |
* create a new sale for the current PayPal account
|
88 |
*
|
89 |
-
* @param string $token
|
90 |
-
* @param array
|
|
|
91 |
* @return Result\Successful|Result\Error
|
92 |
-
* @see Transaction::sale()
|
93 |
*/
|
94 |
public function sale($token, $transactionAttribs)
|
95 |
{
|
@@ -102,6 +102,7 @@ class PayPalAccountGateway
|
|
102 |
);
|
103 |
}
|
104 |
|
|
|
105 |
public static function updateSignature()
|
106 |
{
|
107 |
return [
|
@@ -110,14 +111,7 @@ class PayPalAccountGateway
|
|
110 |
];
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
* sends the update request to the gateway
|
115 |
-
*
|
116 |
-
* @ignore
|
117 |
-
* @param string $subPath
|
118 |
-
* @param array $params
|
119 |
-
* @return mixed
|
120 |
-
*/
|
121 |
private function _doUpdate($httpVerb, $subPath, $params)
|
122 |
{
|
123 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -133,46 +127,47 @@ class PayPalAccountGateway
|
|
133 |
* encapsulates a Errors object inside a Result\Error
|
134 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
135 |
*
|
136 |
-
* @ignore
|
137 |
* @param array $response gateway response values
|
138 |
-
*
|
139 |
* @throws Exception\Unexpected
|
|
|
|
|
140 |
*/
|
141 |
private function _verifyGatewayResponse($response)
|
142 |
{
|
143 |
if (isset($response['paypalAccount'])) {
|
144 |
// return a populated instance of PayPalAccount
|
145 |
return new Result\Successful(
|
146 |
-
|
147 |
);
|
148 |
-
}
|
149 |
return new Result\Error($response['apiErrorResponse']);
|
150 |
} else {
|
151 |
throw new Exception\Unexpected(
|
152 |
-
|
153 |
);
|
154 |
}
|
155 |
}
|
156 |
|
157 |
/**
|
158 |
* verifies that a valid paypal account identifier is being used
|
159 |
-
*
|
160 |
-
* @param string
|
161 |
-
* @param Optional $string
|
|
|
162 |
* @throws InvalidArgumentException
|
163 |
*/
|
164 |
private function _validateId($identifier = null, $identifierType = 'token')
|
165 |
{
|
166 |
if (empty($identifier)) {
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
}
|
171 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
172 |
throw new InvalidArgumentException(
|
173 |
-
|
174 |
-
|
175 |
}
|
176 |
}
|
177 |
}
|
178 |
-
class_alias('Braintree\PayPalAccountGateway', 'Braintree_PayPalAccountGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
7 |
/**
|
8 |
* Braintree PayPalAccountGateway module
|
9 |
*
|
|
|
|
|
|
|
|
|
|
|
10 |
* Manages Braintree PayPalAccounts
|
11 |
*
|
12 |
+
* For more detailed information on PayPal Accounts, see {@link https://developer.paypal.com/braintree/docs/reference/response/paypal-account our developer docs}<br />
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class PayPalAccountGateway
|
15 |
{
|
17 |
private $_config;
|
18 |
private $_http;
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
public function __construct($gateway)
|
22 |
{
|
23 |
$this->_gateway = $gateway;
|
28 |
|
29 |
|
30 |
/**
|
31 |
+
* Find a paypalAccount by token
|
32 |
*
|
|
|
33 |
* @param string $token paypal accountunique id
|
34 |
+
*
|
35 |
* @throws Exception\NotFound
|
36 |
+
*
|
37 |
+
* @return PayPalAccount
|
38 |
*/
|
39 |
public function find($token)
|
40 |
{
|
48 |
'paypal account with token ' . $token . ' not found'
|
49 |
);
|
50 |
}
|
|
|
51 |
}
|
52 |
|
53 |
/**
|
56 |
* if calling this method in context, $token
|
57 |
* is the 2nd attribute. $token is not sent in object context.
|
58 |
*
|
59 |
+
* @param string $token (optional)
|
60 |
+
* @param array $attributes including request parameters
|
61 |
+
*
|
62 |
* @return Result\Successful or Result\Error
|
63 |
*/
|
64 |
public function update($token, $attributes)
|
68 |
return $this->_doUpdate('put', '/payment_methods/paypal_account/' . $token, ['paypalAccount' => $attributes]);
|
69 |
}
|
70 |
|
71 |
+
/**
|
72 |
+
* Delete a PayPal Account record
|
73 |
+
*
|
74 |
+
* @param string $token paypal account identifier
|
75 |
+
*
|
76 |
+
* @return Result
|
77 |
+
*/
|
78 |
public function delete($token)
|
79 |
{
|
80 |
$this->_validateId($token);
|
86 |
/**
|
87 |
* create a new sale for the current PayPal account
|
88 |
*
|
89 |
+
* @param string $token paypal account identifier
|
90 |
+
* @param array $transactionAttribs containing request parameters
|
91 |
+
*
|
92 |
* @return Result\Successful|Result\Error
|
|
|
93 |
*/
|
94 |
public function sale($token, $transactionAttribs)
|
95 |
{
|
102 |
);
|
103 |
}
|
104 |
|
105 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
106 |
public static function updateSignature()
|
107 |
{
|
108 |
return [
|
111 |
];
|
112 |
}
|
113 |
|
114 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
private function _doUpdate($httpVerb, $subPath, $params)
|
116 |
{
|
117 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
127 |
* encapsulates a Errors object inside a Result\Error
|
128 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
129 |
*
|
|
|
130 |
* @param array $response gateway response values
|
131 |
+
*
|
132 |
* @throws Exception\Unexpected
|
133 |
+
*
|
134 |
+
* @return Result\Successful|Result\Error
|
135 |
*/
|
136 |
private function _verifyGatewayResponse($response)
|
137 |
{
|
138 |
if (isset($response['paypalAccount'])) {
|
139 |
// return a populated instance of PayPalAccount
|
140 |
return new Result\Successful(
|
141 |
+
PayPalAccount::factory($response['paypalAccount'])
|
142 |
);
|
143 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
144 |
return new Result\Error($response['apiErrorResponse']);
|
145 |
} else {
|
146 |
throw new Exception\Unexpected(
|
147 |
+
'Expected paypal account or apiErrorResponse'
|
148 |
);
|
149 |
}
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
* verifies that a valid paypal account identifier is being used
|
154 |
+
*
|
155 |
+
* @param string $identifier
|
156 |
+
* @param Optional $string $identifierType type of identifier supplied, default 'token'
|
157 |
+
*
|
158 |
* @throws InvalidArgumentException
|
159 |
*/
|
160 |
private function _validateId($identifier = null, $identifierType = 'token')
|
161 |
{
|
162 |
if (empty($identifier)) {
|
163 |
+
throw new InvalidArgumentException(
|
164 |
+
'expected paypal account id to be set'
|
165 |
+
);
|
166 |
}
|
167 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
168 |
throw new InvalidArgumentException(
|
169 |
+
$identifier . ' is an invalid paypal account ' . $identifierType . '.'
|
170 |
+
);
|
171 |
}
|
172 |
}
|
173 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentInstrumentType.php
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class PaymentInstrumentType
|
5 |
{
|
6 |
-
const
|
7 |
-
const COINBASE_ACCOUNT = 'coinbase_account';
|
8 |
-
const EUROPE_BANK_ACCOUNT = 'europe_bank_account';
|
9 |
-
const CREDIT_CARD = 'credit_card';
|
10 |
-
const VISA_CHECKOUT_CARD = 'visa_checkout_card';
|
11 |
-
const MASTERPASS_CARD = 'masterpass_card';
|
12 |
const APPLE_PAY_CARD = 'apple_pay_card';
|
13 |
-
const
|
14 |
-
const
|
|
|
|
|
|
|
15 |
const US_BANK_ACCOUNT = 'us_bank_account';
|
16 |
-
const
|
|
|
17 |
}
|
18 |
-
class_alias('Braintree\PaymentInstrumentType', 'Braintree_PaymentInstrumentType');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* PaymentInstrumentType module
|
7 |
+
*
|
8 |
+
* Contains constants for all payment methods that are possible to integrate with Braintree
|
9 |
+
*/
|
10 |
class PaymentInstrumentType
|
11 |
{
|
12 |
+
const GOOGLE_PAY_CARD = 'android_pay_card';
|
|
|
|
|
|
|
|
|
|
|
13 |
const APPLE_PAY_CARD = 'apple_pay_card';
|
14 |
+
const CREDIT_CARD = 'credit_card';
|
15 |
+
const LOCAL_PAYMENT = 'local_payment';
|
16 |
+
const PAYPAL_ACCOUNT = 'paypal_account';
|
17 |
+
const PAYPAL_HERE = 'paypal_here';
|
18 |
+
const SAMSUNG_PAY_CARD = 'samsung_pay_card';
|
19 |
const US_BANK_ACCOUNT = 'us_bank_account';
|
20 |
+
const VENMO_ACCOUNT = 'venmo_account';
|
21 |
+
const VISA_CHECKOUT_CARD = 'visa_checkout_card';
|
22 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethod.php
CHANGED
@@ -1,44 +1,77 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree PaymentMethod module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* Creates and manages Braintree PaymentMethods
|
13 |
*
|
14 |
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
*/
|
20 |
class PaymentMethod extends Base
|
21 |
{
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
public static function create($attribs)
|
25 |
{
|
26 |
return Configuration::gateway()->paymentMethod()->create($attribs);
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
public static function find($token)
|
30 |
{
|
31 |
return Configuration::gateway()->paymentMethod()->find($token);
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public static function update($token, $attribs)
|
35 |
{
|
36 |
return Configuration::gateway()->paymentMethod()->update($token, $attribs);
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
{
|
41 |
return Configuration::gateway()->paymentMethod()->delete($token, $options);
|
42 |
}
|
43 |
}
|
44 |
-
class_alias('Braintree\PaymentMethod', 'Braintree_PaymentMethod');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree PaymentMethod module
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
10 |
* Creates and manages Braintree PaymentMethods
|
11 |
*
|
12 |
* <b>== More information ==</b>
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class PaymentMethod extends Base
|
15 |
{
|
16 |
+
/**
|
17 |
+
* Static method from gateway class
|
18 |
+
*
|
19 |
+
* @param array $attribs containing request parameterss
|
20 |
+
*
|
21 |
+
* @see PaymentMethodGateway::create()
|
22 |
+
*
|
23 |
+
* @throws Exception\ValidationError
|
24 |
+
*
|
25 |
+
* @return Result\Successful|Result\Error
|
26 |
+
*/
|
27 |
public static function create($attribs)
|
28 |
{
|
29 |
return Configuration::gateway()->paymentMethod()->create($attribs);
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Static method from gateway class
|
34 |
+
*
|
35 |
+
* @param string $token payment method unique id
|
36 |
+
*
|
37 |
+
* @see PaymentMethodGateway::find()
|
38 |
+
*
|
39 |
+
* @throws Exception\NotFound
|
40 |
+
*
|
41 |
+
* @return CreditCard|PayPalAccount
|
42 |
+
*/
|
43 |
public static function find($token)
|
44 |
{
|
45 |
return Configuration::gateway()->paymentMethod()->find($token);
|
46 |
}
|
47 |
|
48 |
+
/**
|
49 |
+
* Static method from gateway class
|
50 |
+
*
|
51 |
+
* @param string $token payment method identifier
|
52 |
+
* @param array $attribs containing request parameters
|
53 |
+
*
|
54 |
+
* @see PaymentMethodGateway::update()
|
55 |
+
*
|
56 |
+
* @return Result\Successful|Result\Error
|
57 |
+
*/
|
58 |
public static function update($token, $attribs)
|
59 |
{
|
60 |
return Configuration::gateway()->paymentMethod()->update($token, $attribs);
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Static method from gateway class
|
65 |
+
*
|
66 |
+
* @param string $token payment method identifier
|
67 |
+
* @param mixed $options containing optional parameters
|
68 |
+
*
|
69 |
+
* @see PaymentMethodGateway::delete()
|
70 |
+
*
|
71 |
+
* @return Result
|
72 |
+
*/
|
73 |
+
public static function delete($token, $options = [])
|
74 |
{
|
75 |
return Configuration::gateway()->paymentMethod()->delete($token, $options);
|
76 |
}
|
77 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethodCustomerDataUpdatedMetadata.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree PaymentMethodCustomerDataUpdatedMetadata module
|
7 |
+
*/
|
8 |
+
class PaymentMethodCustomerDataUpdatedMetadata extends Base
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* factory method: returns an instance of PaymentMethodCustomerDataUpdatedMetadata
|
12 |
+
* to the requesting method, with populated properties
|
13 |
+
*
|
14 |
+
* @param array $attributes used to create the object
|
15 |
+
*
|
16 |
+
* @return PaymentMethodCustomerDataUpdatedMetadata
|
17 |
+
*/
|
18 |
+
public static function factory($attributes)
|
19 |
+
{
|
20 |
+
$instance = new self();
|
21 |
+
$instance->_initialize($attributes);
|
22 |
+
return $instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _initialize($metadataAttribs)
|
26 |
+
{
|
27 |
+
// set the attributes
|
28 |
+
$this->_attributes = $metadataAttribs;
|
29 |
+
if (isset($metadataAttribs['paymentMethod'])) {
|
30 |
+
$this->paymentMethod = PaymentMethodParser::parsePaymentMethod($metadataAttribs['paymentMethod']);
|
31 |
+
}
|
32 |
+
|
33 |
+
if (isset($metadataAttribs['enrichedCustomerData'])) {
|
34 |
+
$this->_set(
|
35 |
+
'enrichedCustomerData',
|
36 |
+
EnrichedCustomerData::factory(
|
37 |
+
$metadataAttribs['enrichedCustomerData']
|
38 |
+
)
|
39 |
+
);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
44 |
+
public function __toString()
|
45 |
+
{
|
46 |
+
return __CLASS__ . '[' .
|
47 |
+
Util::attributesToString($this->_attributes) . ']';
|
48 |
+
}
|
49 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethodGateway.php
CHANGED
@@ -1,23 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
6 |
-
/**
|
7 |
-
* Braintree PaymentMethodGateway module
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @category Resources
|
11 |
-
*/
|
12 |
-
|
13 |
/**
|
14 |
* Creates and manages Braintree PaymentMethods
|
15 |
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @package Braintree
|
20 |
-
* @category Resources
|
21 |
*/
|
22 |
class PaymentMethodGateway
|
23 |
{
|
@@ -25,6 +15,7 @@ class PaymentMethodGateway
|
|
25 |
private $_config;
|
26 |
private $_http;
|
27 |
|
|
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -34,6 +25,16 @@ class PaymentMethodGateway
|
|
34 |
}
|
35 |
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
public function create($attribs)
|
38 |
{
|
39 |
Util::verifyKeys(self::createSignature(), $attribs);
|
@@ -41,11 +42,13 @@ class PaymentMethodGateway
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
*
|
45 |
*
|
46 |
* @param string $token payment method unique id
|
47 |
-
*
|
48 |
* @throws Exception\NotFound
|
|
|
|
|
49 |
*/
|
50 |
public function find($token)
|
51 |
{
|
@@ -53,31 +56,7 @@ class PaymentMethodGateway
|
|
53 |
try {
|
54 |
$path = $this->_config->merchantPath() . '/payment_methods/any/' . $token;
|
55 |
$response = $this->_http->get($path);
|
56 |
-
|
57 |
-
return CreditCard::factory($response['creditCard']);
|
58 |
-
} else if (isset($response['paypalAccount'])) {
|
59 |
-
return PayPalAccount::factory($response['paypalAccount']);
|
60 |
-
} else if (isset($response['coinbaseAccount'])) {
|
61 |
-
return CoinbaseAccount::factory($response['coinbaseAccount']);
|
62 |
-
} else if (isset($response['applePayCard'])) {
|
63 |
-
return ApplePayCard::factory($response['applePayCard']);
|
64 |
-
} else if (isset($response['androidPayCard'])) {
|
65 |
-
return AndroidPayCard::factory($response['androidPayCard']);
|
66 |
-
} else if (isset($response['amexExpressCheckoutCard'])) {
|
67 |
-
return AmexExpressCheckoutCard::factory($response['amexExpressCheckoutCard']);
|
68 |
-
} else if (isset($response['europeBankAccount'])) {
|
69 |
-
return EuropeBankAccount::factory($response['europeBankAccount']);
|
70 |
-
} else if (isset($response['usBankAccount'])) {
|
71 |
-
return UsBankAccount::factory($response['usBankAccount']);
|
72 |
-
} else if (isset($response['venmoAccount'])) {
|
73 |
-
return VenmoAccount::factory($response['venmoAccount']);
|
74 |
-
} else if (isset($response['visaCheckoutCard'])) {
|
75 |
-
return VisaCheckoutCard::factory($response['visaCheckoutCard']);
|
76 |
-
} else if (isset($response['masterpassCard'])) {
|
77 |
-
return MasterpassCard::factory($response['masterpassCard']);
|
78 |
-
} else if (is_array($response)) {
|
79 |
-
return UnknownPaymentMethod::factory($response);
|
80 |
-
}
|
81 |
} catch (Exception\NotFound $e) {
|
82 |
throw new Exception\NotFound(
|
83 |
'payment method with token ' . $token . ' not found'
|
@@ -85,13 +64,29 @@ class PaymentMethodGateway
|
|
85 |
}
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public function update($token, $attribs)
|
89 |
{
|
90 |
Util::verifyKeys(self::updateSignature(), $attribs);
|
91 |
return $this->_doUpdate('/payment_methods/any/' . $token, ['payment_method' => $attribs]);
|
92 |
}
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
{
|
96 |
Util::verifyKeys(self::deleteSignature(), $options);
|
97 |
$this->_validateId($token);
|
@@ -102,14 +97,24 @@ class PaymentMethodGateway
|
|
102 |
return $this->_doDelete('/payment_methods/any/' . $token . $queryString);
|
103 |
}
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
{
|
107 |
if (is_bool($attribs) === true) {
|
108 |
$attribs = ['allow_vaulting' => $attribs];
|
109 |
}
|
110 |
$options = [ 'shared_payment_method_token' => $sharedPaymentMethodToken ];
|
111 |
|
112 |
-
return $this->
|
113 |
'/payment_methods/grant',
|
114 |
[
|
115 |
'payment_method' => array_merge($attribs, $options)
|
@@ -117,9 +122,18 @@ class PaymentMethodGateway
|
|
117 |
);
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
public function revoke($sharedPaymentMethodToken)
|
121 |
{
|
122 |
-
return $this->
|
123 |
'/payment_methods/revoke',
|
124 |
[
|
125 |
'payment_method' => [
|
@@ -135,10 +149,12 @@ class PaymentMethodGateway
|
|
135 |
$optionsSignature = [
|
136 |
'failOnDuplicatePaymentMethod',
|
137 |
'makeDefault',
|
|
|
|
|
|
|
|
|
138 |
'verificationMerchantAccountId',
|
139 |
'verifyCard',
|
140 |
-
'verificationAmount',
|
141 |
-
'usBankAccountVerificationMethod',
|
142 |
['paypal' => [
|
143 |
'payee_email',
|
144 |
'payeeEmail',
|
@@ -173,12 +189,18 @@ class PaymentMethodGateway
|
|
173 |
];
|
174 |
}
|
175 |
|
|
|
176 |
public static function createSignature()
|
177 |
{
|
178 |
-
$signature = array_merge(self::baseSignature(), [
|
|
|
|
|
|
|
|
|
179 |
return $signature;
|
180 |
}
|
181 |
|
|
|
182 |
public static function updateSignature()
|
183 |
{
|
184 |
$billingAddressSignature = AddressGateway::updateSignature();
|
@@ -187,11 +209,20 @@ class PaymentMethodGateway
|
|
187 |
'updateExisting'
|
188 |
]
|
189 |
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
$signature = array_merge(self::baseSignature(), [
|
191 |
-
'deviceSessionId',
|
192 |
'venmoSdkPaymentMethodCode',
|
193 |
-
'
|
194 |
-
['
|
195 |
]);
|
196 |
return $signature;
|
197 |
}
|
@@ -201,14 +232,7 @@ class PaymentMethodGateway
|
|
201 |
return ['revokeAllGrants'];
|
202 |
}
|
203 |
|
204 |
-
|
205 |
-
* sends the create request to the gateway
|
206 |
-
*
|
207 |
-
* @ignore
|
208 |
-
* @param string $subPath
|
209 |
-
* @param array $params
|
210 |
-
* @return mixed
|
211 |
-
*/
|
212 |
public function _doCreate($subPath, $params)
|
213 |
{
|
214 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -217,14 +241,25 @@ class PaymentMethodGateway
|
|
217 |
return $this->_verifyGatewayResponse($response);
|
218 |
}
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
public function _doUpdate($subPath, $params)
|
229 |
{
|
230 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -234,13 +269,7 @@ class PaymentMethodGateway
|
|
234 |
}
|
235 |
|
236 |
|
237 |
-
|
238 |
-
* sends the delete request to the gateway
|
239 |
-
*
|
240 |
-
* @ignore
|
241 |
-
* @param string $subPath
|
242 |
-
* @return mixed
|
243 |
-
*/
|
244 |
public function _doDelete($subPath)
|
245 |
{
|
246 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -249,108 +278,72 @@ class PaymentMethodGateway
|
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
-
*
|
253 |
*
|
254 |
-
*
|
255 |
* and encapsulates it inside a Result\Successful object, or
|
256 |
* encapsulates a Errors object inside a Result\Error
|
257 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
258 |
-
*
|
259 |
-
* @ignore
|
260 |
-
* @param array $response gateway response values
|
261 |
-
* @return Result\Successful|Result\Error
|
262 |
-
* @throws Exception\Unexpected
|
263 |
*/
|
264 |
private function _verifyGatewayResponse($response)
|
265 |
{
|
266 |
-
if (isset($response['
|
|
|
|
|
267 |
return new Result\Successful(
|
268 |
-
|
269 |
'paymentMethod'
|
270 |
);
|
271 |
-
} else
|
272 |
-
|
273 |
-
|
274 |
-
"paymentMethod"
|
275 |
-
);
|
276 |
-
} else if (isset($response['coinbaseAccount'])) {
|
277 |
-
return new Result\Successful(
|
278 |
-
CoinbaseAccount::factory($response['coinbaseAccount']),
|
279 |
-
"paymentMethod"
|
280 |
-
);
|
281 |
-
} else if (isset($response['applePayCard'])) {
|
282 |
-
return new Result\Successful(
|
283 |
-
ApplePayCard::factory($response['applePayCard']),
|
284 |
-
"paymentMethod"
|
285 |
-
);
|
286 |
-
} else if (isset($response['androidPayCard'])) {
|
287 |
-
return new Result\Successful(
|
288 |
-
AndroidPayCard::factory($response['androidPayCard']),
|
289 |
-
"paymentMethod"
|
290 |
-
);
|
291 |
-
} else if (isset($response['amexExpressCheckoutCard'])) {
|
292 |
-
return new Result\Successful(
|
293 |
-
AmexExpressCheckoutCard::factory($response['amexExpressCheckoutCard']),
|
294 |
-
"paymentMethod"
|
295 |
-
);
|
296 |
-
} else if (isset($response['usBankAccount'])) {
|
297 |
-
return new Result\Successful(
|
298 |
-
UsBankAccount::factory($response['usBankAccount']),
|
299 |
-
"paymentMethod"
|
300 |
-
);
|
301 |
-
} else if (isset($response['venmoAccount'])) {
|
302 |
-
return new Result\Successful(
|
303 |
-
VenmoAccount::factory($response['venmoAccount']),
|
304 |
-
"paymentMethod"
|
305 |
-
);
|
306 |
-
} else if (isset($response['visaCheckoutCard'])) {
|
307 |
-
return new Result\Successful(
|
308 |
-
VisaCheckoutCard::factory($response['visaCheckoutCard']),
|
309 |
-
"paymentMethod"
|
310 |
-
);
|
311 |
-
} else if (isset($response['masterpassCard'])) {
|
312 |
-
return new Result\Successful(
|
313 |
-
MasterpassCard::factory($response['masterpassCard']),
|
314 |
-
"paymentMethod"
|
315 |
);
|
316 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
return new Result\Successful(
|
318 |
PaymentMethodNonce::factory($response['paymentMethodNonce']),
|
319 |
-
|
320 |
);
|
321 |
-
} else
|
322 |
-
|
323 |
-
|
324 |
-
return new Result\Successful(
|
325 |
-
UnknownPaymentMethod::factory($response),
|
326 |
-
"paymentMethod"
|
327 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
} else {
|
329 |
throw new Exception\Unexpected(
|
330 |
-
|
331 |
);
|
332 |
}
|
333 |
}
|
334 |
|
335 |
/**
|
336 |
-
*
|
337 |
-
* @ignore
|
338 |
-
* @param string $identifier
|
339 |
-
* @param Optional $string $identifierType type of identifier supplied, default 'token'
|
340 |
-
* @throws InvalidArgumentException
|
341 |
*/
|
342 |
private function _validateId($identifier = null, $identifierType = 'token')
|
343 |
{
|
344 |
if (empty($identifier)) {
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
}
|
349 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
350 |
throw new InvalidArgumentException(
|
351 |
-
|
352 |
-
|
353 |
}
|
354 |
}
|
355 |
}
|
356 |
-
class_alias('Braintree\PaymentMethodGateway', 'Braintree_PaymentMethodGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/**
|
8 |
* Creates and manages Braintree PaymentMethods
|
9 |
*
|
10 |
+
* For more detailed information on PaymentMethods, see {@link https://developer.paypal.com/braintree/docs/reference/response/payment-method/php our developer docs}. <br />
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class PaymentMethodGateway
|
13 |
{
|
15 |
private $_config;
|
16 |
private $_http;
|
17 |
|
18 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
19 |
public function __construct($gateway)
|
20 |
{
|
21 |
$this->_gateway = $gateway;
|
25 |
}
|
26 |
|
27 |
|
28 |
+
/**
|
29 |
+
* Attempts the create operation
|
30 |
+
* returns a Result on success or an Error on failure
|
31 |
+
*
|
32 |
+
* @param array $attribs containing request parameterss
|
33 |
+
*
|
34 |
+
* @throws Exception\ValidationError
|
35 |
+
*
|
36 |
+
* @return Result\Successful|Result\Error
|
37 |
+
*/
|
38 |
public function create($attribs)
|
39 |
{
|
40 |
Util::verifyKeys(self::createSignature(), $attribs);
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* Find a PaymentMethod by token
|
46 |
*
|
47 |
* @param string $token payment method unique id
|
48 |
+
*
|
49 |
* @throws Exception\NotFound
|
50 |
+
*
|
51 |
+
* @return CreditCard|PayPalAccount
|
52 |
*/
|
53 |
public function find($token)
|
54 |
{
|
56 |
try {
|
57 |
$path = $this->_config->merchantPath() . '/payment_methods/any/' . $token;
|
58 |
$response = $this->_http->get($path);
|
59 |
+
return PaymentMethodParser::parsePaymentMethod($response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
} catch (Exception\NotFound $e) {
|
61 |
throw new Exception\NotFound(
|
62 |
'payment method with token ' . $token . ' not found'
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* Updates the payment method's record
|
69 |
+
*
|
70 |
+
* @param string $token payment method identifier
|
71 |
+
* @param array $attribs containing request parameters
|
72 |
+
*
|
73 |
+
* @return Result\Successful|Result\Error
|
74 |
+
*/
|
75 |
public function update($token, $attribs)
|
76 |
{
|
77 |
Util::verifyKeys(self::updateSignature(), $attribs);
|
78 |
return $this->_doUpdate('/payment_methods/any/' . $token, ['payment_method' => $attribs]);
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Delete a payment method record
|
83 |
+
*
|
84 |
+
* @param string $token payment method identifier
|
85 |
+
* @param mixed $options containing optional parameters
|
86 |
+
*
|
87 |
+
* @return Result
|
88 |
+
*/
|
89 |
+
public function delete($token, $options = [])
|
90 |
{
|
91 |
Util::verifyKeys(self::deleteSignature(), $options);
|
92 |
$this->_validateId($token);
|
97 |
return $this->_doDelete('/payment_methods/any/' . $token . $queryString);
|
98 |
}
|
99 |
|
100 |
+
/**
|
101 |
+
* Grant a payment method record
|
102 |
+
*
|
103 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/request/payment-method/grant developer docs} for more info on the Grant API.
|
104 |
+
*
|
105 |
+
* @param string $sharedPaymentMethodToken payment method identifier
|
106 |
+
* @param mixed $attribs containing request parameters
|
107 |
+
*
|
108 |
+
* @return Result
|
109 |
+
*/
|
110 |
+
public function grant($sharedPaymentMethodToken, $attribs = [])
|
111 |
{
|
112 |
if (is_bool($attribs) === true) {
|
113 |
$attribs = ['allow_vaulting' => $attribs];
|
114 |
}
|
115 |
$options = [ 'shared_payment_method_token' => $sharedPaymentMethodToken ];
|
116 |
|
117 |
+
return $this->_doGrant(
|
118 |
'/payment_methods/grant',
|
119 |
[
|
120 |
'payment_method' => array_merge($attribs, $options)
|
122 |
);
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Deletes the version of a granted payment method from the receiving merchant's vault.
|
127 |
+
*
|
128 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/request/payment-method/revoke developer docs} for more info on the Grant API.
|
129 |
+
*
|
130 |
+
* @param string $sharedPaymentMethodToken payment method identifier
|
131 |
+
*
|
132 |
+
* @return Result
|
133 |
+
*/
|
134 |
public function revoke($sharedPaymentMethodToken)
|
135 |
{
|
136 |
+
return $this->_doRevoke(
|
137 |
'/payment_methods/revoke',
|
138 |
[
|
139 |
'payment_method' => [
|
149 |
$optionsSignature = [
|
150 |
'failOnDuplicatePaymentMethod',
|
151 |
'makeDefault',
|
152 |
+
'skipAdvancedFraudChecking',
|
153 |
+
'usBankAccountVerificationMethod',
|
154 |
+
'verificationAccountType',
|
155 |
+
'verificationAmount',
|
156 |
'verificationMerchantAccountId',
|
157 |
'verifyCard',
|
|
|
|
|
158 |
['paypal' => [
|
159 |
'payee_email',
|
160 |
'payeeEmail',
|
189 |
];
|
190 |
}
|
191 |
|
192 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
193 |
public static function createSignature()
|
194 |
{
|
195 |
+
$signature = array_merge(self::baseSignature(), [
|
196 |
+
'customerId',
|
197 |
+
'paypalRefreshToken',
|
198 |
+
CreditCardGateway::threeDSecurePassThruSignature()
|
199 |
+
]);
|
200 |
return $signature;
|
201 |
}
|
202 |
|
203 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
204 |
public static function updateSignature()
|
205 |
{
|
206 |
$billingAddressSignature = AddressGateway::updateSignature();
|
209 |
'updateExisting'
|
210 |
]
|
211 |
]);
|
212 |
+
$threeDSPassThruSignature = [
|
213 |
+
'authenticationResponse',
|
214 |
+
'cavv',
|
215 |
+
'cavvAlgorithm',
|
216 |
+
'directoryResponse',
|
217 |
+
'dsTransactionId',
|
218 |
+
'eciFlag',
|
219 |
+
'threeDSecureVersion',
|
220 |
+
'xid'
|
221 |
+
];
|
222 |
$signature = array_merge(self::baseSignature(), [
|
|
|
223 |
'venmoSdkPaymentMethodCode',
|
224 |
+
['billingAddress' => $billingAddressSignature],
|
225 |
+
['threeDSecurePassThru' => $threeDSPassThruSignature]
|
226 |
]);
|
227 |
return $signature;
|
228 |
}
|
232 |
return ['revokeAllGrants'];
|
233 |
}
|
234 |
|
235 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
public function _doCreate($subPath, $params)
|
237 |
{
|
238 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
241 |
return $this->_verifyGatewayResponse($response);
|
242 |
}
|
243 |
|
244 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
245 |
+
public function _doGrant($subPath, $params)
|
246 |
+
{
|
247 |
+
$fullPath = $this->_config->merchantPath() . $subPath;
|
248 |
+
$response = $this->_http->post($fullPath, $params);
|
249 |
+
|
250 |
+
return $this->_verifyGrantResponse($response);
|
251 |
+
}
|
252 |
+
|
253 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
254 |
+
public function _doRevoke($subPath, $params)
|
255 |
+
{
|
256 |
+
$fullPath = $this->_config->merchantPath() . $subPath;
|
257 |
+
$response = $this->_http->post($fullPath, $params);
|
258 |
+
|
259 |
+
return $this->_verifyRevokeResponse($response);
|
260 |
+
}
|
261 |
+
|
262 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
263 |
public function _doUpdate($subPath, $params)
|
264 |
{
|
265 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
269 |
}
|
270 |
|
271 |
|
272 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
public function _doDelete($subPath)
|
274 |
{
|
275 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
278 |
}
|
279 |
|
280 |
/**
|
281 |
+
* Generic method for validating incoming gateway responses
|
282 |
*
|
283 |
+
* Creates a new CreditCard or PayPalAccount object
|
284 |
* and encapsulates it inside a Result\Successful object, or
|
285 |
* encapsulates a Errors object inside a Result\Error
|
286 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
|
|
|
|
|
|
|
|
|
|
287 |
*/
|
288 |
private function _verifyGatewayResponse($response)
|
289 |
{
|
290 |
+
if (isset($response['apiErrorResponse'])) {
|
291 |
+
return new Result\Error($response['apiErrorResponse']);
|
292 |
+
} elseif (($response)) {
|
293 |
return new Result\Successful(
|
294 |
+
PaymentMethodParser::parsePaymentMethod($response),
|
295 |
'paymentMethod'
|
296 |
);
|
297 |
+
} else {
|
298 |
+
throw new Exception\Unexpected(
|
299 |
+
'Expected payment method or apiErrorResponse'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
);
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
private function _verifyGrantResponse($response)
|
305 |
+
{
|
306 |
+
if (isset($response['apiErrorResponse'])) {
|
307 |
+
return new Result\Error($response['apiErrorResponse']);
|
308 |
+
} elseif (isset($response['paymentMethodNonce'])) {
|
309 |
return new Result\Successful(
|
310 |
PaymentMethodNonce::factory($response['paymentMethodNonce']),
|
311 |
+
'paymentMethodNonce'
|
312 |
);
|
313 |
+
} else {
|
314 |
+
throw new Exception\Unexpected(
|
315 |
+
'Expected paymentMethodNonce or apiErrorResponse'
|
|
|
|
|
|
|
316 |
);
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
private function _verifyRevokeResponse($response)
|
321 |
+
{
|
322 |
+
if (isset($response['apiErrorResponse'])) {
|
323 |
+
return new Result\Error($response['apiErrorResponse']);
|
324 |
+
} elseif (isset($response['success'])) {
|
325 |
+
return new Result\Successful();
|
326 |
} else {
|
327 |
throw new Exception\Unexpected(
|
328 |
+
'Expected success or apiErrorResponse'
|
329 |
);
|
330 |
}
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
+
* Verifies that a valid payment method identifier is being used
|
|
|
|
|
|
|
|
|
335 |
*/
|
336 |
private function _validateId($identifier = null, $identifierType = 'token')
|
337 |
{
|
338 |
if (empty($identifier)) {
|
339 |
+
throw new InvalidArgumentException(
|
340 |
+
'expected payment method id to be set'
|
341 |
+
);
|
342 |
}
|
343 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
|
344 |
throw new InvalidArgumentException(
|
345 |
+
$identifier . ' is an invalid payment method ' . $identifierType . '.'
|
346 |
+
);
|
347 |
}
|
348 |
}
|
349 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethodNonce.php
CHANGED
@@ -1,36 +1,54 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree PaymentMethodNonce module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* Creates and manages Braintree PaymentMethodNonces
|
13 |
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
*/
|
20 |
class PaymentMethodNonce extends Base
|
21 |
{
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
-
return Configuration::gateway()->paymentMethodNonce()->create($token);
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
public static function find($nonce)
|
30 |
{
|
31 |
return Configuration::gateway()->paymentMethodNonce()->find($nonce);
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public static function factory($attributes)
|
35 |
{
|
36 |
$instance = new self();
|
@@ -44,13 +62,16 @@ class PaymentMethodNonce extends Base
|
|
44 |
$this->_set('nonce', $nonceAttributes['nonce']);
|
45 |
$this->_set('type', $nonceAttributes['type']);
|
46 |
|
47 |
-
if(isset($nonceAttributes['
|
48 |
-
$this->_set('
|
49 |
}
|
50 |
|
51 |
-
if(isset($nonceAttributes['binData'])) {
|
52 |
$this->_set('binData', BinData::factory($nonceAttributes['binData']));
|
53 |
}
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
-
class_alias('Braintree\PaymentMethodNonce', 'Braintree_PaymentMethodNonce');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree PaymentMethodNonce module
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
10 |
* Creates and manages Braintree PaymentMethodNonces
|
11 |
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/payment-method-nonce developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class PaymentMethodNonce extends Base
|
15 |
{
|
16 |
+
/**
|
17 |
+
* Static method from gateway class
|
18 |
+
*
|
19 |
+
* @param string $token the identifier of the payment method
|
20 |
+
* @param array|null $params additional parameters to be included in the request
|
21 |
+
*
|
22 |
+
* @see PaymentMethodNonceGateway::create()
|
23 |
+
*
|
24 |
+
* @return PaymentMethodNonce|Error
|
25 |
+
*/
|
26 |
+
public static function create($token, $params = [])
|
27 |
{
|
28 |
+
return Configuration::gateway()->paymentMethodNonce()->create($token, $params);
|
29 |
}
|
30 |
|
31 |
+
/*
|
32 |
+
* Static method from gateway class
|
33 |
+
*
|
34 |
+
* @param string $nonce the payment method nonce string to return information about
|
35 |
+
*
|
36 |
+
* @see PaymentMethodNonceGateway::find()
|
37 |
+
*
|
38 |
+
* @return PaymentMethodNonce
|
39 |
+
*/
|
40 |
public static function find($nonce)
|
41 |
{
|
42 |
return Configuration::gateway()->paymentMethodNonce()->find($nonce);
|
43 |
}
|
44 |
|
45 |
+
/**
|
46 |
+
* Creates an instance from given attributes
|
47 |
+
*
|
48 |
+
* @param array $attributes response object attributes
|
49 |
+
*
|
50 |
+
* @return PaymentMethodNonce
|
51 |
+
*/
|
52 |
public static function factory($attributes)
|
53 |
{
|
54 |
$instance = new self();
|
62 |
$this->_set('nonce', $nonceAttributes['nonce']);
|
63 |
$this->_set('type', $nonceAttributes['type']);
|
64 |
|
65 |
+
if (isset($nonceAttributes['authenticationInsight'])) {
|
66 |
+
$this->_set('authenticationInsight', $nonceAttributes['authenticationInsight']);
|
67 |
}
|
68 |
|
69 |
+
if (isset($nonceAttributes['binData'])) {
|
70 |
$this->_set('binData', BinData::factory($nonceAttributes['binData']));
|
71 |
}
|
72 |
+
|
73 |
+
if (isset($nonceAttributes['threeDSecureInfo'])) {
|
74 |
+
$this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($nonceAttributes['threeDSecureInfo']));
|
75 |
+
}
|
76 |
}
|
77 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethodNonceGateway.php
CHANGED
@@ -1,21 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree PaymentMethodNonceGateway module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Creates and manages Braintree PaymentMethodNonces
|
13 |
-
*
|
14 |
-
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
*/
|
20 |
class PaymentMethodNonceGateway
|
21 |
{
|
@@ -23,6 +11,7 @@ class PaymentMethodNonceGateway
|
|
23 |
private $_config;
|
24 |
private $_http;
|
25 |
|
|
|
26 |
public function __construct($gateway)
|
27 |
{
|
28 |
$this->_gateway = $gateway;
|
@@ -30,12 +19,31 @@ class PaymentMethodNonceGateway
|
|
30 |
$this->_http = new Http($gateway->config);
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
{
|
36 |
$subPath = '/payment_methods/' . $token . '/nonces';
|
37 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
38 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
return new Result\Successful(
|
41 |
PaymentMethodNonce::factory($response['paymentMethodNonce']),
|
@@ -44,8 +52,13 @@ class PaymentMethodNonceGateway
|
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
-
*
|
48 |
*
|
|
|
|
|
|
|
|
|
|
|
49 |
*/
|
50 |
public function find($nonce)
|
51 |
{
|
@@ -55,10 +68,8 @@ class PaymentMethodNonceGateway
|
|
55 |
return PaymentMethodNonce::factory($response['paymentMethodNonce']);
|
56 |
} catch (Exception\NotFound $e) {
|
57 |
throw new Exception\NotFound(
|
58 |
-
|
59 |
);
|
60 |
}
|
61 |
-
|
62 |
}
|
63 |
}
|
64 |
-
class_alias('Braintree\PaymentMethodNonceGateway', 'Braintree_PaymentMethodNonceGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree PaymentMethodNonceGateway module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
8 |
class PaymentMethodNonceGateway
|
9 |
{
|
11 |
private $_config;
|
12 |
private $_http;
|
13 |
|
14 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
15 |
public function __construct($gateway)
|
16 |
{
|
17 |
$this->_gateway = $gateway;
|
19 |
$this->_http = new Http($gateway->config);
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Create a payment method nonce from an existing payment method's token
|
24 |
+
*
|
25 |
+
* @param string $token the identifier of the payment method
|
26 |
+
* @param mixed|null $params additional parameters to be included in the request
|
27 |
+
*
|
28 |
+
* @return PaymentMethodNonce|Error
|
29 |
+
*/
|
30 |
+
public function create($token, $params = [])
|
31 |
{
|
32 |
$subPath = '/payment_methods/' . $token . '/nonces';
|
33 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
34 |
+
$schema = [[
|
35 |
+
'paymentMethodNonce' => [
|
36 |
+
'merchantAccountId',
|
37 |
+
'authenticationInsight',
|
38 |
+
['authenticationInsightOptions' => [
|
39 |
+
'amount',
|
40 |
+
'recurringCustomerConsent',
|
41 |
+
'recurringMaxAmount'
|
42 |
+
]
|
43 |
+
]]
|
44 |
+
]];
|
45 |
+
Util::verifyKeys($schema, $params);
|
46 |
+
$response = $this->_http->post($fullPath, $params);
|
47 |
|
48 |
return new Result\Successful(
|
49 |
PaymentMethodNonce::factory($response['paymentMethodNonce']),
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
+
* Find a Payment Method Nonce given the string value
|
56 |
*
|
57 |
+
* @param string $nonce to be found
|
58 |
+
*
|
59 |
+
* @throws NotFound
|
60 |
+
*
|
61 |
+
* @return PaymentMethodNonce
|
62 |
*/
|
63 |
public function find($nonce)
|
64 |
{
|
68 |
return PaymentMethodNonce::factory($response['paymentMethodNonce']);
|
69 |
} catch (Exception\NotFound $e) {
|
70 |
throw new Exception\NotFound(
|
71 |
+
'payment method nonce with id ' . $nonce . ' not found'
|
72 |
);
|
73 |
}
|
|
|
74 |
}
|
75 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PaymentMethodParser.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Manages Braintree PaymentMethodParser module
|
7 |
+
*/
|
8 |
+
class PaymentMethodParser
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Creates instances of the payment method in the response object
|
12 |
+
*
|
13 |
+
* @param mixed $response from Braintree API
|
14 |
+
*
|
15 |
+
* @return mixed|Exception
|
16 |
+
*/
|
17 |
+
public static function parsePaymentMethod($response)
|
18 |
+
{
|
19 |
+
if (isset($response['creditCard'])) {
|
20 |
+
return CreditCard::factory($response['creditCard']);
|
21 |
+
} elseif (isset($response['paypalAccount'])) {
|
22 |
+
return PayPalAccount::factory($response['paypalAccount']);
|
23 |
+
} elseif (isset($response['applePayCard'])) {
|
24 |
+
return ApplePayCard::factory($response['applePayCard']);
|
25 |
+
} elseif (isset($response['androidPayCard'])) {
|
26 |
+
return GooglePayCard::factory($response['androidPayCard']);
|
27 |
+
} elseif (isset($response['usBankAccount'])) {
|
28 |
+
return UsBankAccount::factory($response['usBankAccount']);
|
29 |
+
} elseif (isset($response['venmoAccount'])) {
|
30 |
+
return VenmoAccount::factory($response['venmoAccount']);
|
31 |
+
} elseif (isset($response['visaCheckoutCard'])) {
|
32 |
+
return VisaCheckoutCard::factory($response['visaCheckoutCard']);
|
33 |
+
} elseif (isset($response['samsungPayCard'])) {
|
34 |
+
return SamsungPayCard::factory($response['samsungPayCard']);
|
35 |
+
} elseif (is_array($response)) {
|
36 |
+
return UnknownPaymentMethod::factory($response);
|
37 |
+
} else {
|
38 |
+
throw new Exception\Unexpected(
|
39 |
+
'Expected payment method'
|
40 |
+
);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Plan.php
CHANGED
@@ -1,8 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class Plan extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -17,7 +30,7 @@ class Plan extends Base
|
|
17 |
|
18 |
$addOnArray = [];
|
19 |
if (isset($attributes['addOns'])) {
|
20 |
-
foreach ($attributes['addOns']
|
21 |
$addOnArray[] = AddOn::factory($addOn);
|
22 |
}
|
23 |
}
|
@@ -25,7 +38,7 @@ class Plan extends Base
|
|
25 |
|
26 |
$discountArray = [];
|
27 |
if (isset($attributes['discounts'])) {
|
28 |
-
foreach ($attributes['discounts']
|
29 |
$discountArray[] = Discount::factory($discount);
|
30 |
}
|
31 |
}
|
@@ -33,19 +46,59 @@ class Plan extends Base
|
|
33 |
|
34 |
$planArray = [];
|
35 |
if (isset($attributes['plans'])) {
|
36 |
-
foreach ($attributes['plans']
|
37 |
$planArray[] = self::factory($plan);
|
38 |
}
|
39 |
}
|
40 |
$this->_attributes['plans'] = $planArray;
|
41 |
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
public static function all()
|
47 |
{
|
48 |
return Configuration::gateway()->plan()->all();
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
-
class_alias('Braintree\Plan', 'Braintree_Plan');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Plan class object. A plan is a template for subscriptions.
|
7 |
+
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/plan developer docs} for information on attributes
|
9 |
+
*/
|
10 |
class Plan extends Base
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Creates an instance from given attributes
|
14 |
+
*
|
15 |
+
* @param array $attributes response object attributes
|
16 |
+
*
|
17 |
+
* @return Plan
|
18 |
+
*/
|
19 |
public static function factory($attributes)
|
20 |
{
|
21 |
$instance = new self();
|
30 |
|
31 |
$addOnArray = [];
|
32 |
if (isset($attributes['addOns'])) {
|
33 |
+
foreach ($attributes['addOns'] as $addOn) {
|
34 |
$addOnArray[] = AddOn::factory($addOn);
|
35 |
}
|
36 |
}
|
38 |
|
39 |
$discountArray = [];
|
40 |
if (isset($attributes['discounts'])) {
|
41 |
+
foreach ($attributes['discounts'] as $discount) {
|
42 |
$discountArray[] = Discount::factory($discount);
|
43 |
}
|
44 |
}
|
46 |
|
47 |
$planArray = [];
|
48 |
if (isset($attributes['plans'])) {
|
49 |
+
foreach ($attributes['plans'] as $plan) {
|
50 |
$planArray[] = self::factory($plan);
|
51 |
}
|
52 |
}
|
53 |
$this->_attributes['plans'] = $planArray;
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* static methods redirecting to gateway class
|
58 |
+
*
|
59 |
+
* @see PlanGateway::all()
|
60 |
+
*
|
61 |
+
* @return Plan[]
|
62 |
+
*/
|
63 |
public static function all()
|
64 |
{
|
65 |
return Configuration::gateway()->plan()->all();
|
66 |
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* static methods redirecting to gateway class
|
70 |
+
*
|
71 |
+
* @param array $attributes response object attributes
|
72 |
+
*
|
73 |
+
* @return Plan
|
74 |
+
*/
|
75 |
+
public static function create($attributes)
|
76 |
+
{
|
77 |
+
return Configuration::gateway()->plan()->create($attributes);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* static methods redirecting to gateway class
|
82 |
+
*
|
83 |
+
* @param $id int planId
|
84 |
+
*
|
85 |
+
* @return Plan
|
86 |
+
*/
|
87 |
+
public static function find($id)
|
88 |
+
{
|
89 |
+
return Configuration::gateway()->plan()->find($id);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* static methods redirecting to gateway class
|
94 |
+
*
|
95 |
+
* @param $planId int planId
|
96 |
+
* @param array $attributes response object attributes
|
97 |
+
*
|
98 |
+
* @return Plan
|
99 |
+
*/
|
100 |
+
public static function update($planId, $attributes)
|
101 |
+
{
|
102 |
+
return Configuration::gateway()->plan()->update($planId, $attributes);
|
103 |
+
}
|
104 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/PlanGateway.php
CHANGED
@@ -1,12 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class PlanGateway
|
5 |
{
|
6 |
private $_gateway;
|
7 |
private $_config;
|
8 |
private $_http;
|
9 |
|
|
|
10 |
public function __construct($gateway)
|
11 |
{
|
12 |
$this->_gateway = $gateway;
|
@@ -15,11 +23,16 @@ class PlanGateway
|
|
15 |
$this->_http = new Http($gateway->config);
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function all()
|
19 |
{
|
20 |
$path = $this->_config->merchantPath() . '/plans';
|
21 |
$response = $this->_http->get($path);
|
22 |
-
if (key_exists('plans', $response)){
|
23 |
$plans = ["plan" => $response['plans']];
|
24 |
} else {
|
25 |
$plans = ["plan" => []];
|
@@ -30,5 +43,152 @@ class PlanGateway
|
|
30 |
'plan'
|
31 |
);
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
-
class_alias('Braintree\PlanGateway', 'Braintree_PlanGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
use InvalidArgumentException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Braintree PlanGateway module
|
9 |
+
* Creates and manages Plans
|
10 |
+
*/
|
11 |
class PlanGateway
|
12 |
{
|
13 |
private $_gateway;
|
14 |
private $_config;
|
15 |
private $_http;
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
18 |
public function __construct($gateway)
|
19 |
{
|
20 |
$this->_gateway = $gateway;
|
23 |
$this->_http = new Http($gateway->config);
|
24 |
}
|
25 |
|
26 |
+
/*
|
27 |
+
* Retrieve all plans
|
28 |
+
*
|
29 |
+
* @return array of Plan objects
|
30 |
+
*/
|
31 |
public function all()
|
32 |
{
|
33 |
$path = $this->_config->merchantPath() . '/plans';
|
34 |
$response = $this->_http->get($path);
|
35 |
+
if (key_exists('plans', $response)) {
|
36 |
$plans = ["plan" => $response['plans']];
|
37 |
} else {
|
38 |
$plans = ["plan" => []];
|
43 |
'plan'
|
44 |
);
|
45 |
}
|
46 |
+
|
47 |
+
/*
|
48 |
+
* Request a new plan be created
|
49 |
+
*
|
50 |
+
* @param array $attributes containing request params
|
51 |
+
*
|
52 |
+
* @return Result\Sucessful|Result\Error
|
53 |
+
*/
|
54 |
+
public function create($attributes)
|
55 |
+
{
|
56 |
+
Util::verifyKeys(self::_createSignature(), $attributes);
|
57 |
+
$path = $this->_config->merchantPath() . '/plans';
|
58 |
+
$response = $this->_http->post($path, ['plan' => $attributes]);
|
59 |
+
return $this->_verifyGatewayResponse($response);
|
60 |
+
}
|
61 |
+
|
62 |
+
/*
|
63 |
+
* Look up a single plan
|
64 |
+
*
|
65 |
+
* @param string $id of the plan to find
|
66 |
+
*
|
67 |
+
* @return plan|Exception\NotFound
|
68 |
+
*/
|
69 |
+
public function find($id)
|
70 |
+
{
|
71 |
+
$this->_validateId($id);
|
72 |
+
|
73 |
+
try {
|
74 |
+
$path = $this->_config->merchantPath() . '/plans/' . $id;
|
75 |
+
$response = $this->_http->get($path);
|
76 |
+
return Plan::factory($response['plan']);
|
77 |
+
} catch (Exception\NotFound $e) {
|
78 |
+
throw new Exception\NotFound('plan with id ' . $id . ' not found');
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/*
|
83 |
+
* Updates a specific plan with given details
|
84 |
+
*
|
85 |
+
* @param string $planId the ID of the plan to be updated
|
86 |
+
* @param mixed $attributes
|
87 |
+
*
|
88 |
+
* @return plan|Exception\NotFound
|
89 |
+
*/
|
90 |
+
public function update($planId, $attributes)
|
91 |
+
{
|
92 |
+
Util::verifyKeys(self::_updateSignature(), $attributes);
|
93 |
+
$path = $this->_config->merchantPath() . '/plans/' . $planId;
|
94 |
+
$response = $this->_http->put($path, ['plan' => $attributes]);
|
95 |
+
return $this->_verifyGatewayResponse($response);
|
96 |
+
}
|
97 |
+
|
98 |
+
private static function _createSignature()
|
99 |
+
{
|
100 |
+
return array_merge(
|
101 |
+
[
|
102 |
+
"billingDayOfMonth",
|
103 |
+
"billingFrequency",
|
104 |
+
"currencyIsoCode",
|
105 |
+
"description",
|
106 |
+
"id",
|
107 |
+
"merchantId",
|
108 |
+
"name",
|
109 |
+
"numberOfBillingCycles",
|
110 |
+
"price",
|
111 |
+
"trialDuration",
|
112 |
+
"trialDurationUnit",
|
113 |
+
"trialPeriod"
|
114 |
+
],
|
115 |
+
self::_addOnDiscountSignature()
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
private static function _updateSignature()
|
120 |
+
{
|
121 |
+
return array_merge(
|
122 |
+
[
|
123 |
+
"billingDayOfMonth",
|
124 |
+
"billingFrequency",
|
125 |
+
"currencyIsoCode",
|
126 |
+
"description",
|
127 |
+
"id",
|
128 |
+
"merchantId",
|
129 |
+
"name",
|
130 |
+
"numberOfBillingCycles",
|
131 |
+
"price",
|
132 |
+
"trialDuration",
|
133 |
+
"trialDurationUnit",
|
134 |
+
"trialPeriod"
|
135 |
+
],
|
136 |
+
self::_addOnDiscountSignature()
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
private static function _addOnDiscountSignature()
|
141 |
+
{
|
142 |
+
return [
|
143 |
+
[
|
144 |
+
'addOns' => [
|
145 |
+
['add' => ['amount', 'inheritedFromId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
|
146 |
+
['update' => ['amount', 'existingId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
|
147 |
+
['remove' => ['_anyKey_']],
|
148 |
+
]
|
149 |
+
],
|
150 |
+
[
|
151 |
+
'discounts' => [
|
152 |
+
['add' => ['amount', 'inheritedFromId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
|
153 |
+
['update' => ['amount', 'existingId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
|
154 |
+
['remove' => ['_anyKey_']],
|
155 |
+
]
|
156 |
+
]
|
157 |
+
];
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* * @ignore
|
162 |
+
* */
|
163 |
+
private function _validateId($id = null)
|
164 |
+
{
|
165 |
+
if (empty($id)) {
|
166 |
+
throw new InvalidArgumentException(
|
167 |
+
'expected plan id to be set'
|
168 |
+
);
|
169 |
+
}
|
170 |
+
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
171 |
+
throw new InvalidArgumentException(
|
172 |
+
$id . ' is an invalid plan id.'
|
173 |
+
);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* * @ignore
|
179 |
+
* */
|
180 |
+
private function _verifyGatewayResponse($response)
|
181 |
+
{
|
182 |
+
if (isset($response['plan'])) {
|
183 |
+
return new Result\Successful(
|
184 |
+
Plan::factory($response['plan'])
|
185 |
+
);
|
186 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
187 |
+
return new Result\Error($response['apiErrorResponse']);
|
188 |
+
} else {
|
189 |
+
throw new Exception\Unexpected(
|
190 |
+
"Expected plan, or apiErrorResponse"
|
191 |
+
);
|
192 |
+
}
|
193 |
+
}
|
194 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ProcessorResponseTypes.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Processor response types.
|
7 |
+
*/
|
8 |
+
class ProcessorResponseTypes
|
9 |
+
{
|
10 |
+
const APPROVED = 'approved';
|
11 |
+
const SOFT_DECLINED = 'soft_declined';
|
12 |
+
const HARD_DECLINED = 'hard_declined';
|
13 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/RangeNode.php
CHANGED
@@ -1,40 +1,79 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class RangeNode
|
5 |
{
|
|
|
6 |
public function __construct($name)
|
7 |
{
|
8 |
$this->name = $name;
|
9 |
$this->searchTerms = [];
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function greaterThanOrEqualTo($value)
|
13 |
{
|
14 |
$this->searchTerms['min'] = $value;
|
15 |
return $this;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function lessThanOrEqualTo($value)
|
19 |
{
|
20 |
$this->searchTerms['max'] = $value;
|
21 |
return $this;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
public function is($value)
|
25 |
{
|
26 |
$this->searchTerms['is'] = $value;
|
27 |
return $this;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
public function between($min, $max)
|
31 |
{
|
32 |
-
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
public function toParam()
|
36 |
{
|
37 |
return $this->searchTerms;
|
38 |
}
|
39 |
}
|
40 |
-
class_alias('Braintree\RangeNode', 'Braintree_RangeNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree RangeNode
|
7 |
+
* RangeNode is an object for numerical elements returned from the Braintree API
|
8 |
+
*/
|
9 |
class RangeNode
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($name)
|
13 |
{
|
14 |
$this->name = $name;
|
15 |
$this->searchTerms = [];
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Sets the "min" value for search terms.
|
20 |
+
*
|
21 |
+
* @param string $value to be set for search terms
|
22 |
+
*
|
23 |
+
* @return object
|
24 |
+
*/
|
25 |
public function greaterThanOrEqualTo($value)
|
26 |
{
|
27 |
$this->searchTerms['min'] = $value;
|
28 |
return $this;
|
29 |
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Sets the "mixn" value for search terms.
|
33 |
+
*
|
34 |
+
* @param string $value to be set for search terms
|
35 |
+
*
|
36 |
+
* @return object
|
37 |
+
*/
|
38 |
public function lessThanOrEqualTo($value)
|
39 |
{
|
40 |
$this->searchTerms['max'] = $value;
|
41 |
return $this;
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Sets the "is" value for search terms.
|
46 |
+
*
|
47 |
+
* @param string $value to be set for search terms
|
48 |
+
*
|
49 |
+
* @return object
|
50 |
+
*/
|
51 |
public function is($value)
|
52 |
{
|
53 |
$this->searchTerms['is'] = $value;
|
54 |
return $this;
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* Sets the "min" and "max" value for search terms.
|
59 |
+
*
|
60 |
+
* @param string $min minimum value to be set for search terms
|
61 |
+
* @param string $max maximum value to be set for search terms
|
62 |
+
*
|
63 |
+
* @return object
|
64 |
+
*/
|
65 |
public function between($min, $max)
|
66 |
{
|
67 |
+
return $this->greaterThanOrEqualTo($min)->lessThanOrEqualTo($max);
|
68 |
}
|
69 |
|
70 |
+
/**
|
71 |
+
* To be used as a parameter
|
72 |
+
*
|
73 |
+
* @return object search terms
|
74 |
+
*/
|
75 |
public function toParam()
|
76 |
{
|
77 |
return $this->searchTerms;
|
78 |
}
|
79 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ResourceCollection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use Iterator;
|
@@ -17,9 +18,6 @@ use Iterator;
|
|
17 |
* print_r($transaction->id);
|
18 |
* }
|
19 |
* </code>
|
20 |
-
*
|
21 |
-
* @package Braintree
|
22 |
-
* @subpackage Utility
|
23 |
*/
|
24 |
class ResourceCollection implements Iterator
|
25 |
{
|
@@ -30,15 +28,8 @@ class ResourceCollection implements Iterator
|
|
30 |
private $_pageSize;
|
31 |
private $_pager;
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* expects an array of attributes with literal keys
|
37 |
-
*
|
38 |
-
* @param array $response
|
39 |
-
* @param array $pager
|
40 |
-
*/
|
41 |
-
public function __construct($response, $pager)
|
42 |
{
|
43 |
$this->_pageSize = $response["searchResults"]["pageSize"];
|
44 |
$this->_ids = $response["searchResults"]["ids"];
|
@@ -46,8 +37,11 @@ class ResourceCollection implements Iterator
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
-
* returns the current item when iterating with
|
|
|
|
|
50 |
*/
|
|
|
51 |
public function current()
|
52 |
{
|
53 |
return $this->_items[$this->_index];
|
@@ -65,6 +59,12 @@ class ResourceCollection implements Iterator
|
|
65 |
return $page[0];
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
public function key()
|
69 |
{
|
70 |
return null;
|
@@ -72,7 +72,10 @@ class ResourceCollection implements Iterator
|
|
72 |
|
73 |
/**
|
74 |
* advances to the next item in the collection when iterating with foreach
|
|
|
|
|
75 |
*/
|
|
|
76 |
public function next()
|
77 |
{
|
78 |
++$this->_index;
|
@@ -80,7 +83,10 @@ class ResourceCollection implements Iterator
|
|
80 |
|
81 |
/**
|
82 |
* rewinds the testIterateOverResults collection to the first item when iterating with foreach
|
|
|
|
|
83 |
*/
|
|
|
84 |
public function rewind()
|
85 |
{
|
86 |
$this->_batchIndex = 0;
|
@@ -89,7 +95,10 @@ class ResourceCollection implements Iterator
|
|
89 |
|
90 |
/**
|
91 |
* returns whether the current item is valid when iterating with foreach
|
|
|
|
|
92 |
*/
|
|
|
93 |
public function valid()
|
94 |
{
|
95 |
if ($this->_index == count($this->_items) && $this->_batchIndex < count($this->_ids)) {
|
@@ -103,6 +112,11 @@ class ResourceCollection implements Iterator
|
|
103 |
}
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
|
|
106 |
public function maximumCount()
|
107 |
{
|
108 |
return count($this->_ids);
|
@@ -110,23 +124,15 @@ class ResourceCollection implements Iterator
|
|
110 |
|
111 |
private function _getNextPage()
|
112 |
{
|
113 |
-
if (empty($this->_ids))
|
114 |
-
{
|
115 |
$this->_items = [];
|
116 |
-
}
|
117 |
-
else
|
118 |
-
{
|
119 |
$this->_items = $this->_getPage(array_slice($this->_ids, $this->_batchIndex, $this->_pageSize));
|
120 |
$this->_batchIndex += $this->_pageSize;
|
121 |
$this->_index = 0;
|
122 |
}
|
123 |
}
|
124 |
|
125 |
-
/**
|
126 |
-
* requests the next page of results for the collection
|
127 |
-
*
|
128 |
-
* @return void
|
129 |
-
*/
|
130 |
private function _getPage($ids)
|
131 |
{
|
132 |
$object = $this->_pager['object'];
|
@@ -150,7 +156,6 @@ class ResourceCollection implements Iterator
|
|
150 |
*/
|
151 |
public function getIds()
|
152 |
{
|
153 |
-
|
154 |
}
|
155 |
}
|
156 |
-
class_alias('Braintree\ResourceCollection', 'Braintree_ResourceCollection');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use Iterator;
|
18 |
* print_r($transaction->id);
|
19 |
* }
|
20 |
* </code>
|
|
|
|
|
|
|
21 |
*/
|
22 |
class ResourceCollection implements Iterator
|
23 |
{
|
28 |
private $_pageSize;
|
29 |
private $_pager;
|
30 |
|
31 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
32 |
+
public function __construct($response, $pager)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
{
|
34 |
$this->_pageSize = $response["searchResults"]["pageSize"];
|
35 |
$this->_ids = $response["searchResults"]["ids"];
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
+
* returns the current item when iterating with foreachi
|
41 |
+
*
|
42 |
+
* @return object
|
43 |
*/
|
44 |
+
#[\ReturnTypeWillChange]
|
45 |
public function current()
|
46 |
{
|
47 |
return $this->_items[$this->_index];
|
59 |
return $page[0];
|
60 |
}
|
61 |
|
62 |
+
/*
|
63 |
+
* returns null
|
64 |
+
*
|
65 |
+
* @return null
|
66 |
+
*/
|
67 |
+
#[\ReturnTypeWillChange]
|
68 |
public function key()
|
69 |
{
|
70 |
return null;
|
72 |
|
73 |
/**
|
74 |
* advances to the next item in the collection when iterating with foreach
|
75 |
+
*
|
76 |
+
* @return object
|
77 |
*/
|
78 |
+
#[\ReturnTypeWillChange]
|
79 |
public function next()
|
80 |
{
|
81 |
++$this->_index;
|
83 |
|
84 |
/**
|
85 |
* rewinds the testIterateOverResults collection to the first item when iterating with foreach
|
86 |
+
*
|
87 |
+
* @return object
|
88 |
*/
|
89 |
+
#[\ReturnTypeWillChange]
|
90 |
public function rewind()
|
91 |
{
|
92 |
$this->_batchIndex = 0;
|
95 |
|
96 |
/**
|
97 |
* returns whether the current item is valid when iterating with foreach
|
98 |
+
*
|
99 |
+
* @return bool
|
100 |
*/
|
101 |
+
#[\ReturnTypeWillChange]
|
102 |
public function valid()
|
103 |
{
|
104 |
if ($this->_index == count($this->_items) && $this->_batchIndex < count($this->_ids)) {
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
/*
|
116 |
+
* returns a maximum count
|
117 |
+
*
|
118 |
+
* @return int
|
119 |
+
*/
|
120 |
public function maximumCount()
|
121 |
{
|
122 |
return count($this->_ids);
|
124 |
|
125 |
private function _getNextPage()
|
126 |
{
|
127 |
+
if (empty($this->_ids)) {
|
|
|
128 |
$this->_items = [];
|
129 |
+
} else {
|
|
|
|
|
130 |
$this->_items = $this->_getPage(array_slice($this->_ids, $this->_batchIndex, $this->_pageSize));
|
131 |
$this->_batchIndex += $this->_pageSize;
|
132 |
$this->_index = 0;
|
133 |
}
|
134 |
}
|
135 |
|
|
|
|
|
|
|
|
|
|
|
136 |
private function _getPage($ids)
|
137 |
{
|
138 |
$object = $this->_pager['object'];
|
156 |
*/
|
157 |
public function getIds()
|
158 |
{
|
159 |
+
return $this->_ids;
|
160 |
}
|
161 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Result/CreditCardVerification.php
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Result;
|
3 |
|
4 |
use Braintree\RiskData;
|
|
|
5 |
use Braintree\Util;
|
|
|
6 |
|
7 |
/**
|
8 |
* Braintree Credit Card Verification Result
|
@@ -10,18 +13,9 @@ use Braintree\Util;
|
|
10 |
* This object is returned as part of an Error Result; it provides
|
11 |
* access to the credit card verification data from the gateway
|
12 |
*
|
13 |
-
*
|
14 |
-
* @package Braintree
|
15 |
-
* @subpackage Result
|
16 |
-
*
|
17 |
-
* @property-read string $avsErrorResponseCode
|
18 |
-
* @property-read string $avsPostalCodeResponseCode
|
19 |
-
* @property-read string $avsStreetAddressResponseCode
|
20 |
-
* @property-read string $cvvResponseCode
|
21 |
-
* @property-read string $status
|
22 |
-
*
|
23 |
*/
|
24 |
-
class CreditCardVerification
|
25 |
{
|
26 |
// Status
|
27 |
const FAILED = 'failed';
|
@@ -29,7 +23,6 @@ class CreditCardVerification
|
|
29 |
const PROCESSOR_DECLINED = 'processor_declined';
|
30 |
const VERIFIED = 'verified';
|
31 |
|
32 |
-
private $_attributes;
|
33 |
private $_amount;
|
34 |
private $_avsErrorResponseCode;
|
35 |
private $_avsPostalCodeResponseCode;
|
@@ -39,54 +32,58 @@ class CreditCardVerification
|
|
39 |
private $_gatewayRejectionReason;
|
40 |
private $_status;
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
*/
|
45 |
-
public function __construct($attributes)
|
46 |
{
|
47 |
$this->_initializeFromArray($attributes);
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* initializes instance properties from the keys/values of an array
|
52 |
-
*
|
53 |
-
* @access protected
|
54 |
* @param <type> $aAttribs array of properties to set - single level
|
|
|
55 |
* @return void
|
56 |
*/
|
57 |
private function _initializeFromArray($attributes)
|
58 |
{
|
59 |
-
if(isset($attributes['riskData']))
|
60 |
-
{
|
61 |
$attributes['riskData'] = RiskData::factory($attributes['riskData']);
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
$this->_attributes = $attributes;
|
65 |
-
foreach($attributes
|
66 |
$varName = "_$name";
|
67 |
$this->$varName = $value;
|
68 |
}
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
*/
|
74 |
-
public function __get($name)
|
75 |
{
|
76 |
$varName = "_$name";
|
77 |
return isset($this->$varName) ? $this->$varName : null;
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
* @return string
|
83 |
-
*/
|
84 |
-
public function __toString()
|
85 |
{
|
86 |
return __CLASS__ . '[' .
|
87 |
Util::attributesToString($this->_attributes) . ']';
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
90 |
public static function allStatuses()
|
91 |
{
|
92 |
return [
|
@@ -97,4 +94,3 @@ class CreditCardVerification
|
|
97 |
];
|
98 |
}
|
99 |
}
|
100 |
-
class_alias('Braintree\Result\CreditCardVerification', 'Braintree_Result_CreditCardVerification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Result;
|
4 |
|
5 |
use Braintree\RiskData;
|
6 |
+
use Braintree\ThreeDSecureInfo;
|
7 |
use Braintree\Util;
|
8 |
+
use Braintree\Base;
|
9 |
|
10 |
/**
|
11 |
* Braintree Credit Card Verification Result
|
13 |
* This object is returned as part of an Error Result; it provides
|
14 |
* access to the credit card verification data from the gateway
|
15 |
*
|
16 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/credit-card-verification developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
*/
|
18 |
+
class CreditCardVerification extends Base
|
19 |
{
|
20 |
// Status
|
21 |
const FAILED = 'failed';
|
23 |
const PROCESSOR_DECLINED = 'processor_declined';
|
24 |
const VERIFIED = 'verified';
|
25 |
|
|
|
26 |
private $_amount;
|
27 |
private $_avsErrorResponseCode;
|
28 |
private $_avsPostalCodeResponseCode;
|
32 |
private $_gatewayRejectionReason;
|
33 |
private $_status;
|
34 |
|
35 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
36 |
+
public function __construct($attributes)
|
|
|
|
|
37 |
{
|
38 |
$this->_initializeFromArray($attributes);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* initializes instance properties from the keys/values of an array
|
43 |
+
*
|
|
|
44 |
* @param <type> $aAttribs array of properties to set - single level
|
45 |
+
*
|
46 |
* @return void
|
47 |
*/
|
48 |
private function _initializeFromArray($attributes)
|
49 |
{
|
50 |
+
if (isset($attributes['riskData'])) {
|
|
|
51 |
$attributes['riskData'] = RiskData::factory($attributes['riskData']);
|
52 |
}
|
53 |
|
54 |
+
if (isset($attributes['globalId'])) {
|
55 |
+
$attributes['graphQLId'] = $attributes['globalId'];
|
56 |
+
}
|
57 |
+
|
58 |
+
if (isset($attributes['threeDSecureInfo'])) {
|
59 |
+
$attributes['threeDSecureInfo'] = ThreeDSecureInfo::factory($attributes['threeDSecureInfo']);
|
60 |
+
}
|
61 |
$this->_attributes = $attributes;
|
62 |
+
foreach ($attributes as $name => $value) {
|
63 |
$varName = "_$name";
|
64 |
$this->$varName = $value;
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
69 |
+
public function __get($name)
|
|
|
|
|
70 |
{
|
71 |
$varName = "_$name";
|
72 |
return isset($this->$varName) ? $this->$varName : null;
|
73 |
}
|
74 |
|
75 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
76 |
+
public function __toString()
|
|
|
|
|
|
|
77 |
{
|
78 |
return __CLASS__ . '[' .
|
79 |
Util::attributesToString($this->_attributes) . ']';
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* returns an array of all possible Credit Card Verification statuses
|
84 |
+
*
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
public static function allStatuses()
|
88 |
{
|
89 |
return [
|
94 |
];
|
95 |
}
|
96 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Result/Error.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Result;
|
3 |
|
4 |
use Braintree\Base;
|
@@ -26,98 +27,90 @@ use Braintree\Error\ErrorCollection;
|
|
26 |
* }
|
27 |
* </code>
|
28 |
*
|
29 |
-
* @package Braintree
|
30 |
-
* @subpackage Result
|
31 |
-
*
|
32 |
* @property-read array $params original passed params
|
33 |
* @property-read \Braintree\Error\ErrorCollection $errors
|
34 |
* @property-read \Braintree\Result\CreditCardVerification $creditCardVerification credit card verification data
|
|
|
|
|
35 |
*/
|
36 |
class Error extends Base
|
37 |
{
|
38 |
/**
|
39 |
-
*
|
|
|
|
|
40 |
*/
|
41 |
-
|
42 |
|
43 |
/**
|
44 |
* return original value for a field
|
45 |
* For example, if a user tried to submit 'invalid-email' in the html field transaction[customer][email],
|
46 |
* $result->valueForHtmlField("transaction[customer][email]") would yield "invalid-email"
|
47 |
*
|
48 |
-
* @param string $field
|
|
|
49 |
* @return string
|
50 |
*/
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
public function __construct($response)
|
73 |
-
{
|
74 |
-
$this->_attributes = $response;
|
75 |
-
$this->_set('errors', new ErrorCollection($response['errors']));
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
* ClassName[property=value, property=value]
|
111 |
-
* @ignore
|
112 |
-
* @return string
|
113 |
-
*/
|
114 |
-
public function __toString()
|
115 |
{
|
116 |
$output = Util::attributesToString($this->_attributes);
|
117 |
if (isset($this->_creditCardVerification)) {
|
118 |
$output .= sprintf('%s', $this->_creditCardVerification);
|
119 |
}
|
120 |
-
return __CLASS__ .'[' . $output . ']';
|
121 |
}
|
122 |
}
|
123 |
-
class_alias('Braintree\Result\Error', 'Braintree_Result_Error');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Result;
|
4 |
|
5 |
use Braintree\Base;
|
27 |
* }
|
28 |
* </code>
|
29 |
*
|
|
|
|
|
|
|
30 |
* @property-read array $params original passed params
|
31 |
* @property-read \Braintree\Error\ErrorCollection $errors
|
32 |
* @property-read \Braintree\Result\CreditCardVerification $creditCardVerification credit card verification data
|
33 |
+
*
|
34 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/general/result-objects developer docs} for more information
|
35 |
*/
|
36 |
class Error extends Base
|
37 |
{
|
38 |
/**
|
39 |
+
* used to determine whether an API request was successful or not
|
40 |
+
*
|
41 |
+
* @var boolean always false
|
42 |
*/
|
43 |
+
public $success = false;
|
44 |
|
45 |
/**
|
46 |
* return original value for a field
|
47 |
* For example, if a user tried to submit 'invalid-email' in the html field transaction[customer][email],
|
48 |
* $result->valueForHtmlField("transaction[customer][email]") would yield "invalid-email"
|
49 |
*
|
50 |
+
* @param string $field to check submitted value
|
51 |
+
*
|
52 |
* @return string
|
53 |
*/
|
54 |
+
public function valueForHtmlField($field)
|
55 |
+
{
|
56 |
+
$pieces = preg_split("/[\[\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
|
57 |
+
$params = $this->params;
|
58 |
+
foreach (array_slice($pieces, 0, -1) as $key) {
|
59 |
+
$params = $params[Util::delimiterToCamelCase($key)];
|
60 |
+
}
|
61 |
+
if ($key != 'custom_fields') {
|
62 |
+
$finalKey = Util::delimiterToCamelCase(end($pieces));
|
63 |
+
} else {
|
64 |
+
$finalKey = end($pieces);
|
65 |
+
}
|
66 |
+
$fieldValue = isset($params[$finalKey]) ? $params[$finalKey] : null;
|
67 |
+
return $fieldValue;
|
68 |
+
}
|
69 |
|
70 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
71 |
+
public function __construct($response)
|
72 |
+
{
|
73 |
+
$this->_attributes = $response;
|
74 |
+
$this->_set('errors', new ErrorCollection($response['errors']));
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
if (isset($response['verification'])) {
|
77 |
+
$this->_set('creditCardVerification', new CreditCardVerification($response['verification']));
|
78 |
+
} else {
|
79 |
+
$this->_set('creditCardVerification', null);
|
80 |
+
}
|
81 |
|
82 |
+
if (isset($response['transaction'])) {
|
83 |
+
$this->_set('transaction', Transaction::factory($response['transaction']));
|
84 |
+
} else {
|
85 |
+
$this->_set('transaction', null);
|
86 |
+
}
|
87 |
|
88 |
+
if (isset($response['subscription'])) {
|
89 |
+
$this->_set('subscription', Subscription::factory($response['subscription']));
|
90 |
+
} else {
|
91 |
+
$this->_set('subscription', null);
|
92 |
+
}
|
93 |
|
94 |
+
if (isset($response['merchantAccount'])) {
|
95 |
+
$this->_set('merchantAccount', MerchantAccount::factory($response['merchantAccount']));
|
96 |
+
} else {
|
97 |
+
$this->_set('merchantAccount', null);
|
98 |
+
}
|
99 |
|
100 |
+
if (isset($response['verification'])) {
|
101 |
+
$this->_set('verification', new CreditCardVerification($response['verification']));
|
102 |
+
} else {
|
103 |
+
$this->_set('verification', null);
|
104 |
+
}
|
105 |
+
}
|
106 |
|
107 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
108 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
|
|
109 |
{
|
110 |
$output = Util::attributesToString($this->_attributes);
|
111 |
if (isset($this->_creditCardVerification)) {
|
112 |
$output .= sprintf('%s', $this->_creditCardVerification);
|
113 |
}
|
114 |
+
return __CLASS__ . '[' . $output . ']';
|
115 |
}
|
116 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Result/Successful.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree\Result;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -22,10 +23,6 @@ use Braintree\Util;
|
|
22 |
* // Error
|
23 |
* }
|
24 |
* </code>
|
25 |
-
*
|
26 |
-
*
|
27 |
-
* @package Braintree
|
28 |
-
* @subpackage Result
|
29 |
*/
|
30 |
class Successful extends Instance
|
31 |
{
|
@@ -40,23 +37,22 @@ class Successful extends Instance
|
|
40 |
*/
|
41 |
private $_returnObjectNames;
|
42 |
|
43 |
-
|
44 |
-
* @ignore
|
45 |
-
* @param array|null $objsToReturn
|
46 |
-
* @param array|null $propertyNames
|
47 |
-
*/
|
48 |
public function __construct($objsToReturn = [], $propertyNames = [])
|
49 |
{
|
50 |
// Sanitize arguments (preserves backwards compatibility)
|
51 |
-
if (!is_array($objsToReturn)) {
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
|
54 |
$objects = $this->_mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn);
|
55 |
$this->_attributes = [];
|
56 |
$this->_returnObjectNames = [];
|
57 |
|
58 |
foreach ($objects as $propertyName => $objToReturn) {
|
59 |
-
|
60 |
// save the name for indirect access
|
61 |
array_push($this->_returnObjectNames, $propertyName);
|
62 |
|
@@ -65,28 +61,24 @@ class Successful extends Instance
|
|
65 |
}
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
array_push($objects, $this->$returnObjectName);
|
78 |
-
}
|
79 |
-
return __CLASS__ . '[' . implode(', ', $objects) . ']';
|
80 |
-
}
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
91 |
}
|
92 |
-
class_alias('Braintree\Result\Successful', 'Braintree_Result_Successful');
|
1 |
+
<?php // phpcs:disable Generic.Commenting.DocComment.MissingShort
|
2 |
+
|
3 |
namespace Braintree\Result;
|
4 |
|
5 |
use Braintree\Instance;
|
23 |
* // Error
|
24 |
* }
|
25 |
* </code>
|
|
|
|
|
|
|
|
|
26 |
*/
|
27 |
class Successful extends Instance
|
28 |
{
|
37 |
*/
|
38 |
private $_returnObjectNames;
|
39 |
|
40 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
41 |
public function __construct($objsToReturn = [], $propertyNames = [])
|
42 |
{
|
43 |
// Sanitize arguments (preserves backwards compatibility)
|
44 |
+
if (!is_array($objsToReturn)) {
|
45 |
+
$objsToReturn = [$objsToReturn];
|
46 |
+
}
|
47 |
+
if (!is_array($propertyNames)) {
|
48 |
+
$propertyNames = [$propertyNames];
|
49 |
+
}
|
50 |
|
51 |
$objects = $this->_mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn);
|
52 |
$this->_attributes = [];
|
53 |
$this->_returnObjectNames = [];
|
54 |
|
55 |
foreach ($objects as $propertyName => $objToReturn) {
|
|
|
56 |
// save the name for indirect access
|
57 |
array_push($this->_returnObjectNames, $propertyName);
|
58 |
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
65 |
+
public function __toString()
|
66 |
+
{
|
67 |
+
$objects = [];
|
68 |
+
foreach ($this->_returnObjectNames as $returnObjectName) {
|
69 |
+
array_push($objects, $returnObjectName);
|
70 |
+
}
|
71 |
+
return __CLASS__ . '[' . implode(', ', $objects) . ']';
|
72 |
+
}
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
private function _mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn)
|
75 |
+
{
|
76 |
+
if (count($objsToReturn) != count($propertyNames)) {
|
77 |
+
$propertyNames = [];
|
78 |
+
foreach ($objsToReturn as $obj) {
|
79 |
+
array_push($propertyNames, Util::cleanClassName(get_class($obj)));
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return array_combine($propertyNames, $objsToReturn);
|
83 |
+
}
|
84 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Result/UsBankAccountVerification.php
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Result;
|
3 |
|
4 |
use Braintree\RiskData;
|
5 |
use Braintree\Util;
|
6 |
use Braintree\UsBankAccount;
|
|
|
7 |
|
8 |
/**
|
9 |
* Braintree US Bank Account Verification Result
|
@@ -11,18 +13,9 @@ use Braintree\UsBankAccount;
|
|
11 |
* This object is returned as part of an Error Result; it provides
|
12 |
* access to the credit card verification data from the gateway
|
13 |
*
|
14 |
-
*
|
15 |
-
* @package Braintree
|
16 |
-
* @subpackage Result
|
17 |
-
*
|
18 |
-
* @property-read string $id
|
19 |
-
* @property-read string $status
|
20 |
-
* @property-read string $verificationMethod
|
21 |
-
* @property-read \DateTime $verificationDeterminedAt
|
22 |
-
* @property-read Braintree\UsBankAccount $usBankAccount
|
23 |
-
*
|
24 |
*/
|
25 |
-
class UsBankAccountVerification
|
26 |
{
|
27 |
// Status
|
28 |
const FAILED = 'failed';
|
@@ -36,14 +29,11 @@ class UsBankAccountVerification
|
|
36 |
const INDEPENDENT_CHECK = 'independent_check';
|
37 |
const MICRO_TRANSFERS = 'micro_transfers';
|
38 |
|
39 |
-
private $_attributes;
|
40 |
private $_gatewayRejectionReason;
|
41 |
private $_status;
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
*/
|
46 |
-
public function __construct($attributes)
|
47 |
{
|
48 |
$this->_initializeFromArray($attributes);
|
49 |
|
@@ -55,39 +45,39 @@ class UsBankAccountVerification
|
|
55 |
|
56 |
/**
|
57 |
* initializes instance properties from the keys/values of an array
|
58 |
-
*
|
59 |
-
* @access protected
|
60 |
* @param <type> $aAttribs array of properties to set - single level
|
|
|
61 |
* @return void
|
62 |
*/
|
63 |
private function _initializeFromArray($attributes)
|
64 |
{
|
65 |
$this->_attributes = $attributes;
|
66 |
-
foreach($attributes
|
67 |
$varName = "_$name";
|
68 |
$this->$varName = $value;
|
69 |
}
|
70 |
}
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
*/
|
75 |
-
public function __get($name)
|
76 |
{
|
77 |
$varName = "_$name";
|
78 |
return isset($this->$varName) ? $this->$varName : null;
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
* @return string
|
84 |
-
*/
|
85 |
-
public function __toString()
|
86 |
{
|
87 |
return __CLASS__ . '[' .
|
88 |
Util::attributesToString($this->_attributes) . ']';
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
91 |
public static function allStatuses()
|
92 |
{
|
93 |
return [
|
@@ -99,6 +89,11 @@ class UsBankAccountVerification
|
|
99 |
];
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
102 |
public static function allVerificationMethods()
|
103 |
{
|
104 |
return [
|
@@ -109,4 +104,3 @@ class UsBankAccountVerification
|
|
109 |
];
|
110 |
}
|
111 |
}
|
112 |
-
class_alias('Braintree\Result\UsBankAccountVerification', 'Braintree_Result_UsBankAccountVerification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Result;
|
4 |
|
5 |
use Braintree\RiskData;
|
6 |
use Braintree\Util;
|
7 |
use Braintree\UsBankAccount;
|
8 |
+
use Braintree\Base;
|
9 |
|
10 |
/**
|
11 |
* Braintree US Bank Account Verification Result
|
13 |
* This object is returned as part of an Error Result; it provides
|
14 |
* access to the credit card verification data from the gateway
|
15 |
*
|
16 |
+
* See our {@link https://developer.paypal.com/braintree/docs/guides/acv/server-side developer docs} for more information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
*/
|
18 |
+
class UsBankAccountVerification extends Base
|
19 |
{
|
20 |
// Status
|
21 |
const FAILED = 'failed';
|
29 |
const INDEPENDENT_CHECK = 'independent_check';
|
30 |
const MICRO_TRANSFERS = 'micro_transfers';
|
31 |
|
|
|
32 |
private $_gatewayRejectionReason;
|
33 |
private $_status;
|
34 |
|
35 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
36 |
+
public function __construct($attributes)
|
|
|
|
|
37 |
{
|
38 |
$this->_initializeFromArray($attributes);
|
39 |
|
45 |
|
46 |
/**
|
47 |
* initializes instance properties from the keys/values of an array
|
48 |
+
*
|
|
|
49 |
* @param <type> $aAttribs array of properties to set - single level
|
50 |
+
*
|
51 |
* @return void
|
52 |
*/
|
53 |
private function _initializeFromArray($attributes)
|
54 |
{
|
55 |
$this->_attributes = $attributes;
|
56 |
+
foreach ($attributes as $name => $value) {
|
57 |
$varName = "_$name";
|
58 |
$this->$varName = $value;
|
59 |
}
|
60 |
}
|
61 |
|
62 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
63 |
+
public function __get($name)
|
|
|
|
|
64 |
{
|
65 |
$varName = "_$name";
|
66 |
return isset($this->$varName) ? $this->$varName : null;
|
67 |
}
|
68 |
|
69 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
70 |
+
public function __toString()
|
|
|
|
|
|
|
71 |
{
|
72 |
return __CLASS__ . '[' .
|
73 |
Util::attributesToString($this->_attributes) . ']';
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* returns an array of all possible US Bank Account Verification statuses
|
78 |
+
*
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
public static function allStatuses()
|
82 |
{
|
83 |
return [
|
89 |
];
|
90 |
}
|
91 |
|
92 |
+
/**
|
93 |
+
* returns an array of all possible US Bank Account Verification methods
|
94 |
+
*
|
95 |
+
* @return array
|
96 |
+
*/
|
97 |
public static function allVerificationMethods()
|
98 |
{
|
99 |
return [
|
104 |
];
|
105 |
}
|
106 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/RevokedPaymentMethodMetadata.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree RevokedPaymentMethodMetadata module
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Manages Braintree RevokedPaymentMethodMetadata
|
11 |
+
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/guides/extend/grant-api/revocation developer docs} for more information
|
13 |
+
*/
|
14 |
+
class RevokedPaymentMethodMetadata extends Base
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Creates an instance from given attributes
|
18 |
+
*
|
19 |
+
* @param array $attributes response object attributes
|
20 |
+
*
|
21 |
+
* @return RevokedPaymentMethodMetadata
|
22 |
+
*/
|
23 |
+
public static function factory($attributes)
|
24 |
+
{
|
25 |
+
$instance = new self();
|
26 |
+
$instance->revokedPaymentMethod = PaymentMethodParser::parsePaymentMethod($attributes);
|
27 |
+
$instance->customerId = $instance->revokedPaymentMethod->customerId;
|
28 |
+
$instance->token = $instance->revokedPaymentMethod->token;
|
29 |
+
return $instance;
|
30 |
+
}
|
31 |
+
|
32 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
33 |
+
public function __toString()
|
34 |
+
{
|
35 |
+
return __CLASS__ . '[' .
|
36 |
+
Util::attributesToString($this->_attributes) . ']';
|
37 |
+
}
|
38 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/RiskData.php
CHANGED
@@ -1,8 +1,19 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class RiskData extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -17,14 +28,20 @@ class RiskData extends Base
|
|
17 |
}
|
18 |
|
19 |
/**
|
20 |
-
* returns
|
21 |
-
*
|
|
|
22 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
public function __toString()
|
24 |
{
|
25 |
return __CLASS__ . '[' .
|
26 |
-
Util::attributesToString($this->_attributes) .']';
|
27 |
}
|
28 |
-
|
29 |
}
|
30 |
-
class_alias('Braintree\RiskData', 'Braintree_RiskData');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Any applicable risk data associated with the transaction. For detailed reference information on properties, see the {@link developer docs https://developer.paypal.com/braintree/docs/reference/response/transaction#risk_data}.
|
7 |
+
*/
|
8 |
class RiskData extends Base
|
9 |
{
|
10 |
+
/**
|
11 |
+
* Creates an instance from given attributes
|
12 |
+
*
|
13 |
+
* @param array $attributes response object attributes
|
14 |
+
*
|
15 |
+
* @return RiskData
|
16 |
+
*/
|
17 |
public static function factory($attributes)
|
18 |
{
|
19 |
$instance = new self();
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
+
* returns the rules triggered by the fraud provider when generating the decision.
|
32 |
+
*
|
33 |
+
* @return array of strings
|
34 |
*/
|
35 |
+
public function decisionReasons()
|
36 |
+
{
|
37 |
+
return $this->_attributes['decisionReasons'];
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
42 |
public function __toString()
|
43 |
{
|
44 |
return __CLASS__ . '[' .
|
45 |
+
Util::attributesToString($this->_attributes) . ']';
|
46 |
}
|
|
|
47 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/SamsungPayCard.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree SamsungPayCard module
|
7 |
+
* Creates and manages Braintree SamsungPayCards
|
8 |
+
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/samsung-pay-card developer docs} for information on attributes
|
10 |
+
*/
|
11 |
+
class SamsungPayCard extends Base
|
12 |
+
{
|
13 |
+
/* instance methods */
|
14 |
+
/**
|
15 |
+
* returns false if default is null or false
|
16 |
+
*
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function isDefault()
|
20 |
+
{
|
21 |
+
return $this->default;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* checks whether the card is expired based on the current date
|
26 |
+
*
|
27 |
+
* @return boolean
|
28 |
+
*/
|
29 |
+
public function isExpired()
|
30 |
+
{
|
31 |
+
return $this->expired;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sets instance properties from an array of values
|
36 |
+
*
|
37 |
+
* @param array $creditCardAttribs array of creditcard data
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
protected function _initialize($creditCardAttribs)
|
42 |
+
{
|
43 |
+
// set the attributes
|
44 |
+
$this->_attributes = $creditCardAttribs;
|
45 |
+
|
46 |
+
// map each address into its own object
|
47 |
+
$billingAddress = isset($creditCardAttribs['billingAddress']) ?
|
48 |
+
Address::factory($creditCardAttribs['billingAddress']) :
|
49 |
+
null;
|
50 |
+
|
51 |
+
$subscriptionArray = [];
|
52 |
+
if (isset($creditCardAttribs['subscriptions'])) {
|
53 |
+
foreach ($creditCardAttribs['subscriptions'] as $subscription) {
|
54 |
+
$subscriptionArray[] = Subscription::factory($subscription);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
$this->_set('subscriptions', $subscriptionArray);
|
59 |
+
$this->_set('billingAddress', $billingAddress);
|
60 |
+
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
61 |
+
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* returns false if comparing object is not a SamsungPayCard,
|
66 |
+
* or is a SamsungPayCard with a different id
|
67 |
+
*
|
68 |
+
* @param object $otherSamsungPayCard customer to compare against
|
69 |
+
*
|
70 |
+
* @return boolean
|
71 |
+
*/
|
72 |
+
public function isEqual($otherSamsungPayCard)
|
73 |
+
{
|
74 |
+
return !($otherSamsungPayCard instanceof self) ? false : $this->token === $otherSamsungPayCard->token;
|
75 |
+
}
|
76 |
+
|
77 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
78 |
+
public function __toString()
|
79 |
+
{
|
80 |
+
return __CLASS__ . '[' .
|
81 |
+
Util::attributesToString($this->_attributes) . ']';
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Creates an instance from given attributes
|
86 |
+
*
|
87 |
+
* @param array $attributes response object attributes
|
88 |
+
*
|
89 |
+
* @return SamsungPayCard
|
90 |
+
*/
|
91 |
+
public static function factory($attributes)
|
92 |
+
{
|
93 |
+
$defaultAttributes = [
|
94 |
+
'bin' => '',
|
95 |
+
'expirationMonth' => '',
|
96 |
+
'expirationYear' => '',
|
97 |
+
'last4' => '',
|
98 |
+
];
|
99 |
+
|
100 |
+
$instance = new self();
|
101 |
+
$instance->_initialize(array_merge($defaultAttributes, $attributes));
|
102 |
+
return $instance;
|
103 |
+
}
|
104 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/SettlementBatchSummary.php
CHANGED
@@ -1,11 +1,19 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class SettlementBatchSummary extends Base
|
5 |
{
|
6 |
/**
|
|
|
|
|
|
|
7 |
*
|
8 |
-
* @param array $attributes
|
9 |
* @return SettlementBatchSummary
|
10 |
*/
|
11 |
public static function factory($attributes)
|
@@ -15,15 +23,17 @@ class SettlementBatchSummary extends Base
|
|
15 |
return $instance;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
* @ignore
|
20 |
-
* @param array $attributes
|
21 |
-
*/
|
22 |
protected function _initialize($attributes)
|
23 |
{
|
24 |
$this->_attributes = $attributes;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function records()
|
28 |
{
|
29 |
return $this->_attributes['records'];
|
@@ -33,13 +43,15 @@ class SettlementBatchSummary extends Base
|
|
33 |
/**
|
34 |
* static method redirecting to gateway
|
35 |
*
|
36 |
-
* @param string $settlement_date
|
37 |
-
* @param string $groupByCustomField
|
|
|
|
|
|
|
38 |
* @return Result\Successful|Result\Error
|
39 |
*/
|
40 |
-
public static function generate($settlement_date, $groupByCustomField =
|
41 |
{
|
42 |
return Configuration::gateway()->settlementBatchSummary()->generate($settlement_date, $groupByCustomField);
|
43 |
}
|
44 |
}
|
45 |
-
class_alias('Braintree\SettlementBatchSummary', 'Braintree_SettlementBatchSummary');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* The total sales and credits for each batch for a particular date.
|
7 |
+
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/settlement-batch-summary developer docs} for information on attributes
|
9 |
+
*/
|
10 |
class SettlementBatchSummary extends Base
|
11 |
{
|
12 |
/**
|
13 |
+
* Creates an instance from given attributes
|
14 |
+
*
|
15 |
+
* @param array $attributes response object attributes
|
16 |
*
|
|
|
17 |
* @return SettlementBatchSummary
|
18 |
*/
|
19 |
public static function factory($attributes)
|
23 |
return $instance;
|
24 |
}
|
25 |
|
26 |
+
//phpcs:ignore Generic.Commenting
|
|
|
|
|
|
|
27 |
protected function _initialize($attributes)
|
28 |
{
|
29 |
$this->_attributes = $attributes;
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Returns the value for "records"
|
34 |
+
*
|
35 |
+
* @return mixed records
|
36 |
+
*/
|
37 |
public function records()
|
38 |
{
|
39 |
return $this->_attributes['records'];
|
43 |
/**
|
44 |
* static method redirecting to gateway
|
45 |
*
|
46 |
+
* @param string $settlement_date Date YYYY-MM-DD
|
47 |
+
* @param string $groupByCustomField optional
|
48 |
+
*
|
49 |
+
* @see SettlementBatchSummaryGateway::generate()
|
50 |
+
*
|
51 |
* @return Result\Successful|Result\Error
|
52 |
*/
|
53 |
+
public static function generate($settlement_date, $groupByCustomField = null)
|
54 |
{
|
55 |
return Configuration::gateway()->settlementBatchSummary()->generate($settlement_date, $groupByCustomField);
|
56 |
}
|
57 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/SettlementBatchSummaryGateway.php
CHANGED
@@ -1,30 +1,18 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class SettlementBatchSummaryGateway
|
5 |
{
|
6 |
-
/**
|
7 |
-
*
|
8 |
-
* @var Gateway
|
9 |
-
*/
|
10 |
private $_gateway;
|
11 |
-
|
12 |
-
/**
|
13 |
-
*
|
14 |
-
* @var Configuration
|
15 |
-
*/
|
16 |
private $_config;
|
17 |
-
|
18 |
-
/**
|
19 |
-
*
|
20 |
-
* @var Http
|
21 |
-
*/
|
22 |
private $_http;
|
23 |
|
24 |
-
|
25 |
-
*
|
26 |
-
* @param Gateway $gateway
|
27 |
-
*/
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -34,24 +22,24 @@ class SettlementBatchSummaryGateway
|
|
34 |
}
|
35 |
|
36 |
/**
|
|
|
|
|
|
|
|
|
37 |
*
|
38 |
-
* @param string $settlement_date
|
39 |
-
* @param string $groupByCustomField
|
40 |
* @return SettlementBatchSummary|Result\Error
|
41 |
*/
|
42 |
-
public function generate($settlement_date, $groupByCustomField =
|
43 |
{
|
44 |
$criteria = ['settlement_date' => $settlement_date];
|
45 |
-
if (isset($groupByCustomField))
|
46 |
-
{
|
47 |
$criteria['group_by_custom_field'] = $groupByCustomField;
|
48 |
}
|
49 |
$params = ['settlement_batch_summary' => $criteria];
|
50 |
$path = $this->_config->merchantPath() . '/settlement_batch_summary';
|
51 |
$response = $this->_http->post($path, $params);
|
52 |
|
53 |
-
if (isset($groupByCustomField))
|
54 |
-
{
|
55 |
$response['settlementBatchSummary']['records'] = $this->_underscoreCustomField(
|
56 |
$groupByCustomField,
|
57 |
$response['settlementBatchSummary']['records']
|
@@ -61,18 +49,11 @@ class SettlementBatchSummaryGateway
|
|
61 |
return $this->_verifyGatewayResponse($response);
|
62 |
}
|
63 |
|
64 |
-
/**
|
65 |
-
*
|
66 |
-
* @param string $groupByCustomField
|
67 |
-
* @param array $records
|
68 |
-
* @return array
|
69 |
-
*/
|
70 |
private function _underscoreCustomField($groupByCustomField, $records)
|
71 |
{
|
72 |
$updatedRecords = [];
|
73 |
|
74 |
-
foreach ($records as $record)
|
75 |
-
{
|
76 |
$camelized = Util::delimiterToCamelCase($groupByCustomField);
|
77 |
$record[$groupByCustomField] = $record[$camelized];
|
78 |
unset($record[$camelized]);
|
@@ -82,19 +63,13 @@ class SettlementBatchSummaryGateway
|
|
82 |
return $updatedRecords;
|
83 |
}
|
84 |
|
85 |
-
/**
|
86 |
-
*
|
87 |
-
* @param array $response
|
88 |
-
* @return Result\Successful|Result\Error
|
89 |
-
* @throws Exception\Unexpected
|
90 |
-
*/
|
91 |
private function _verifyGatewayResponse($response)
|
92 |
{
|
93 |
if (isset($response['settlementBatchSummary'])) {
|
94 |
return new Result\Successful(
|
95 |
SettlementBatchSummary::factory($response['settlementBatchSummary'])
|
96 |
);
|
97 |
-
}
|
98 |
return new Result\Error($response['apiErrorResponse']);
|
99 |
} else {
|
100 |
throw new Exception\Unexpected(
|
@@ -103,4 +78,3 @@ class SettlementBatchSummaryGateway
|
|
103 |
}
|
104 |
}
|
105 |
}
|
106 |
-
class_alias('Braintree\SettlementBatchSummaryGateway', 'Braintree_SettlementBatchSummaryGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree SettlementBatchSummaryGateway module
|
7 |
+
* Creates and manages SettlementBatchSummarys
|
8 |
+
*/
|
9 |
class SettlementBatchSummaryGateway
|
10 |
{
|
|
|
|
|
|
|
|
|
11 |
private $_gateway;
|
|
|
|
|
|
|
|
|
|
|
12 |
private $_config;
|
|
|
|
|
|
|
|
|
|
|
13 |
private $_http;
|
14 |
|
15 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
16 |
public function __construct($gateway)
|
17 |
{
|
18 |
$this->_gateway = $gateway;
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
+
* Create a Settlement Batch Summary report.
|
26 |
+
*
|
27 |
+
* @param string $settlement_date A string representing the date of the settlement batch
|
28 |
+
* @param string $groupByCustomField A string representing a transaction's custom field that you wish to group by
|
29 |
*
|
|
|
|
|
30 |
* @return SettlementBatchSummary|Result\Error
|
31 |
*/
|
32 |
+
public function generate($settlement_date, $groupByCustomField = null)
|
33 |
{
|
34 |
$criteria = ['settlement_date' => $settlement_date];
|
35 |
+
if (isset($groupByCustomField)) {
|
|
|
36 |
$criteria['group_by_custom_field'] = $groupByCustomField;
|
37 |
}
|
38 |
$params = ['settlement_batch_summary' => $criteria];
|
39 |
$path = $this->_config->merchantPath() . '/settlement_batch_summary';
|
40 |
$response = $this->_http->post($path, $params);
|
41 |
|
42 |
+
if (isset($groupByCustomField)) {
|
|
|
43 |
$response['settlementBatchSummary']['records'] = $this->_underscoreCustomField(
|
44 |
$groupByCustomField,
|
45 |
$response['settlementBatchSummary']['records']
|
49 |
return $this->_verifyGatewayResponse($response);
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
private function _underscoreCustomField($groupByCustomField, $records)
|
53 |
{
|
54 |
$updatedRecords = [];
|
55 |
|
56 |
+
foreach ($records as $record) {
|
|
|
57 |
$camelized = Util::delimiterToCamelCase($groupByCustomField);
|
58 |
$record[$groupByCustomField] = $record[$camelized];
|
59 |
unset($record[$camelized]);
|
63 |
return $updatedRecords;
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
private function _verifyGatewayResponse($response)
|
67 |
{
|
68 |
if (isset($response['settlementBatchSummary'])) {
|
69 |
return new Result\Successful(
|
70 |
SettlementBatchSummary::factory($response['settlementBatchSummary'])
|
71 |
);
|
72 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
73 |
return new Result\Error($response['apiErrorResponse']);
|
74 |
} else {
|
75 |
throw new Exception\Unexpected(
|
78 |
}
|
79 |
}
|
80 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ShippingMethod.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Shipping methods module
|
7 |
+
* Shipping methods can be assigned to shipping addresses when
|
8 |
+
* creating transactions.
|
9 |
+
*/
|
10 |
+
class ShippingMethod
|
11 |
+
{
|
12 |
+
const SAME_DAY = 'same_day';
|
13 |
+
const NEXT_DAY = 'next_day';
|
14 |
+
const PRIORITY = 'priority';
|
15 |
+
const GROUND = 'ground';
|
16 |
+
const ELECTRONIC = 'electronic';
|
17 |
+
const SHIP_TO_STORE = 'ship_to_store';
|
18 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/SignatureService.php
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
class SignatureService
|
5 |
{
|
6 |
-
|
7 |
public function __construct($key, $digest)
|
8 |
{
|
9 |
$this->key = $key;
|
@@ -19,6 +21,4 @@ class SignatureService
|
|
19 |
{
|
20 |
return call_user_func($this->digest, $this->key, $data);
|
21 |
}
|
22 |
-
|
23 |
}
|
24 |
-
class_alias('Braintree\SignatureService', 'Braintree_SignatureService');
|
1 |
<?php
|
2 |
+
|
3 |
+
//phpcs:disable PEAR.Commenting
|
4 |
namespace Braintree;
|
5 |
|
6 |
class SignatureService
|
7 |
{
|
8 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
9 |
public function __construct($key, $digest)
|
10 |
{
|
11 |
$this->key = $key;
|
21 |
{
|
22 |
return call_user_func($this->digest, $this->key, $data);
|
23 |
}
|
|
|
24 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Subscription.php
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree Subscription module
|
6 |
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
* For more detailed information on Subscriptions, see {@link https://developers.braintreepayments.com/reference/response/subscription/php https://developers.braintreepayments.com/reference/response/subscription/php}
|
10 |
-
*
|
11 |
-
* PHP Version 5
|
12 |
-
*
|
13 |
-
* @package Braintree
|
14 |
*/
|
15 |
class Subscription extends Base
|
16 |
{
|
@@ -26,7 +22,11 @@ class Subscription extends Base
|
|
26 |
const RECURRING = 'recurring';
|
27 |
|
28 |
/**
|
29 |
-
*
|
|
|
|
|
|
|
|
|
30 |
*/
|
31 |
public static function factory($attributes)
|
32 |
{
|
@@ -36,16 +36,13 @@ class Subscription extends Base
|
|
36 |
return $instance;
|
37 |
}
|
38 |
|
39 |
-
/**
|
40 |
-
* @ignore
|
41 |
-
*/
|
42 |
protected function _initialize($attributes)
|
43 |
{
|
44 |
$this->_attributes = $attributes;
|
45 |
|
46 |
$addOnArray = [];
|
47 |
if (isset($attributes['addOns'])) {
|
48 |
-
foreach ($attributes['addOns']
|
49 |
$addOnArray[] = AddOn::factory($addOn);
|
50 |
}
|
51 |
}
|
@@ -53,7 +50,7 @@ class Subscription extends Base
|
|
53 |
|
54 |
$discountArray = [];
|
55 |
if (isset($attributes['discounts'])) {
|
56 |
-
foreach ($attributes['discounts']
|
57 |
$discountArray[] = Discount::factory($discount);
|
58 |
}
|
59 |
}
|
@@ -69,7 +66,7 @@ class Subscription extends Base
|
|
69 |
|
70 |
$statusHistory = [];
|
71 |
if (isset($attributes['statusHistory'])) {
|
72 |
-
foreach ($attributes['statusHistory']
|
73 |
$statusHistory[] = new Subscription\StatusDetails($history);
|
74 |
}
|
75 |
}
|
@@ -77,68 +74,128 @@ class Subscription extends Base
|
|
77 |
|
78 |
$transactionArray = [];
|
79 |
if (isset($attributes['transactions'])) {
|
80 |
-
foreach ($attributes['transactions']
|
81 |
$transactionArray[] = Transaction::factory($transaction);
|
82 |
}
|
83 |
}
|
84 |
$this->_attributes['transactions'] = $transactionArray;
|
85 |
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
* @return string
|
90 |
-
*/
|
91 |
-
public function __toString()
|
92 |
{
|
93 |
$excludedAttributes = ['statusHistory'];
|
94 |
|
95 |
$displayAttributes = [];
|
96 |
-
foreach($this->_attributes as $key => $val) {
|
97 |
if (!in_array($key, $excludedAttributes)) {
|
98 |
$displayAttributes[$key] = $val;
|
99 |
}
|
100 |
}
|
101 |
|
102 |
return __CLASS__ . '[' .
|
103 |
-
Util::attributesToString($displayAttributes) .']';
|
104 |
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
public static function create($attributes)
|
110 |
{
|
111 |
return Configuration::gateway()->subscription()->create($attributes);
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
public static function find($id)
|
115 |
{
|
116 |
return Configuration::gateway()->subscription()->find($id);
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
public static function search($query)
|
120 |
{
|
121 |
return Configuration::gateway()->subscription()->search($query);
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
public static function fetch($query, $ids)
|
125 |
{
|
126 |
return Configuration::gateway()->subscription()->fetch($query, $ids);
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
public static function update($subscriptionId, $attributes)
|
130 |
{
|
131 |
return Configuration::gateway()->subscription()->update($subscriptionId, $attributes);
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
public static function retryCharge($subscriptionId, $amount = null, $submitForSettlement = false)
|
135 |
{
|
136 |
return Configuration::gateway()->subscription()->retryCharge($subscriptionId, $amount, $submitForSettlement);
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
public static function cancel($subscriptionId)
|
140 |
{
|
141 |
return Configuration::gateway()->subscription()->cancel($subscriptionId);
|
142 |
}
|
143 |
}
|
144 |
-
class_alias('Braintree\Subscription', 'Braintree_Subscription');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree Subscription module
|
7 |
*
|
8 |
+
* // phpcs:ignore
|
9 |
+
* For more detailed information on Subscriptions, see {@link https://developer.paypal.com/braintree/docs/reference/response/subscription our developer docs}
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class Subscription extends Base
|
12 |
{
|
22 |
const RECURRING = 'recurring';
|
23 |
|
24 |
/**
|
25 |
+
* Creates an instance from given attributes
|
26 |
+
*
|
27 |
+
* @param array $attributes response object attributes
|
28 |
+
*
|
29 |
+
* @return Subscription
|
30 |
*/
|
31 |
public static function factory($attributes)
|
32 |
{
|
36 |
return $instance;
|
37 |
}
|
38 |
|
|
|
|
|
|
|
39 |
protected function _initialize($attributes)
|
40 |
{
|
41 |
$this->_attributes = $attributes;
|
42 |
|
43 |
$addOnArray = [];
|
44 |
if (isset($attributes['addOns'])) {
|
45 |
+
foreach ($attributes['addOns'] as $addOn) {
|
46 |
$addOnArray[] = AddOn::factory($addOn);
|
47 |
}
|
48 |
}
|
50 |
|
51 |
$discountArray = [];
|
52 |
if (isset($attributes['discounts'])) {
|
53 |
+
foreach ($attributes['discounts'] as $discount) {
|
54 |
$discountArray[] = Discount::factory($discount);
|
55 |
}
|
56 |
}
|
66 |
|
67 |
$statusHistory = [];
|
68 |
if (isset($attributes['statusHistory'])) {
|
69 |
+
foreach ($attributes['statusHistory'] as $history) {
|
70 |
$statusHistory[] = new Subscription\StatusDetails($history);
|
71 |
}
|
72 |
}
|
74 |
|
75 |
$transactionArray = [];
|
76 |
if (isset($attributes['transactions'])) {
|
77 |
+
foreach ($attributes['transactions'] as $transaction) {
|
78 |
$transactionArray[] = Transaction::factory($transaction);
|
79 |
}
|
80 |
}
|
81 |
$this->_attributes['transactions'] = $transactionArray;
|
82 |
}
|
83 |
|
84 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
85 |
+
public function __toString()
|
|
|
|
|
|
|
86 |
{
|
87 |
$excludedAttributes = ['statusHistory'];
|
88 |
|
89 |
$displayAttributes = [];
|
90 |
+
foreach ($this->_attributes as $key => $val) {
|
91 |
if (!in_array($key, $excludedAttributes)) {
|
92 |
$displayAttributes[$key] = $val;
|
93 |
}
|
94 |
}
|
95 |
|
96 |
return __CLASS__ . '[' .
|
97 |
+
Util::attributesToString($displayAttributes) . ']';
|
98 |
}
|
99 |
|
100 |
+
/**
|
101 |
+
* Static methods redirecting to gateway class
|
102 |
+
*
|
103 |
+
* @param array $attributes containing request params
|
104 |
+
*
|
105 |
+
* @see SubscriptionGateway::create()
|
106 |
+
*
|
107 |
+
* @return Result\Successful|Result\Error
|
108 |
+
*/
|
109 |
public static function create($attributes)
|
110 |
{
|
111 |
return Configuration::gateway()->subscription()->create($attributes);
|
112 |
}
|
113 |
|
114 |
+
/*
|
115 |
+
* Static methods redirecting to gateway class
|
116 |
+
*
|
117 |
+
* @param string $id of the subscription to find
|
118 |
+
*
|
119 |
+
* @see SubscriptionGateway::find()
|
120 |
+
*
|
121 |
+
* @return Subscription|Exception\NotFound
|
122 |
+
*/
|
123 |
public static function find($id)
|
124 |
{
|
125 |
return Configuration::gateway()->subscription()->find($id);
|
126 |
}
|
127 |
|
128 |
+
/*
|
129 |
+
* Static methods redirecting to gateway class
|
130 |
+
*
|
131 |
+
* @param mixed $query of search fields
|
132 |
+
*
|
133 |
+
* @see SubscriptionGateway::search()
|
134 |
+
*
|
135 |
+
* @return ResourceCollection of Subscription objects
|
136 |
+
*/
|
137 |
public static function search($query)
|
138 |
{
|
139 |
return Configuration::gateway()->subscription()->search($query);
|
140 |
}
|
141 |
|
142 |
+
/*
|
143 |
+
* Static methods redirecting to gateway class
|
144 |
+
*
|
145 |
+
* @param mixed $query of search fields
|
146 |
+
* @param array $ids to be fetched
|
147 |
+
*
|
148 |
+
* @see SubscriptionGateway::fetch()
|
149 |
+
*
|
150 |
+
* @return ResourceCollection of Subscription objects
|
151 |
+
*/
|
152 |
public static function fetch($query, $ids)
|
153 |
{
|
154 |
return Configuration::gateway()->subscription()->fetch($query, $ids);
|
155 |
}
|
156 |
|
157 |
+
/*
|
158 |
+
* Static methods redirecting to gateway class
|
159 |
+
*
|
160 |
+
* @param string $subscriptionId the ID of the subscription to be updated
|
161 |
+
* @param mixed $attributes
|
162 |
+
*
|
163 |
+
* @see SubscriptionGateway::update()
|
164 |
+
*
|
165 |
+
* @return Subscription|Exception\NotFound
|
166 |
+
*/
|
167 |
public static function update($subscriptionId, $attributes)
|
168 |
{
|
169 |
return Configuration::gateway()->subscription()->update($subscriptionId, $attributes);
|
170 |
}
|
171 |
|
172 |
+
/*
|
173 |
+
* Static methods redirecting to gateway class
|
174 |
+
*
|
175 |
+
* @param string $subscriptionId the ID of the subscription with a charge being retried
|
176 |
+
* @param string $amount optional
|
177 |
+
* @param bool $submitForSettlement defaults to false unless specified true
|
178 |
+
*
|
179 |
+
* @see SubscriptionGateway::retryCharge()
|
180 |
+
*
|
181 |
+
* @return Transaction
|
182 |
+
*/
|
183 |
public static function retryCharge($subscriptionId, $amount = null, $submitForSettlement = false)
|
184 |
{
|
185 |
return Configuration::gateway()->subscription()->retryCharge($subscriptionId, $amount, $submitForSettlement);
|
186 |
}
|
187 |
|
188 |
+
/*
|
189 |
+
* Static methods redirecting to gateway class
|
190 |
+
*
|
191 |
+
* @param string $subscriptionId to be canceled
|
192 |
+
*
|
193 |
+
* @see SubscriptionGateway::cancel()
|
194 |
+
*
|
195 |
+
* @return Subscription|Exception\NotFound
|
196 |
+
*/
|
197 |
public static function cancel($subscriptionId)
|
198 |
{
|
199 |
return Configuration::gateway()->subscription()->cancel($subscriptionId);
|
200 |
}
|
201 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Subscription/StatusDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Subscription;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,18 +8,8 @@ use Braintree\Instance;
|
|
7 |
* Status details from a subscription
|
8 |
* Creates an instance of StatusDetails, as part of a subscription response
|
9 |
*
|
10 |
-
* @
|
11 |
-
*
|
12 |
-
* @property-read string $price
|
13 |
-
* @property-read string $currencyIsoCode
|
14 |
-
* @property-read string $planId
|
15 |
-
* @property-read string $balance
|
16 |
-
* @property-read string $status
|
17 |
-
* @property-read string $timestamp
|
18 |
-
* @property-read string $subscriptionSource
|
19 |
-
* @property-read string $user
|
20 |
*/
|
21 |
class StatusDetails extends Instance
|
22 |
{
|
23 |
}
|
24 |
-
class_alias('Braintree\Subscription\StatusDetails', 'Braintree_Subscription_StatusDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Subscription;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* Status details from a subscription
|
9 |
* Creates an instance of StatusDetails, as part of a subscription response
|
10 |
*
|
11 |
+
* For more detailed information on Subscriptions, see {@link https://developer.paypal.com/braintree/docs/reference/response/subscription#subscription-history our developer docs}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class StatusDetails extends Instance
|
14 |
{
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/SubscriptionGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -6,13 +7,8 @@ use InvalidArgumentException;
|
|
6 |
/**
|
7 |
* Braintree SubscriptionGateway module
|
8 |
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
* For more detailed information on Subscriptions, see {@link https://developers.braintreepayments.com/reference/response/subscription/php https://developers.braintreepayments.com/reference/response/subscription/php}
|
12 |
-
*
|
13 |
-
* PHP Version 5
|
14 |
-
*
|
15 |
-
* @package Braintree
|
16 |
*/
|
17 |
class SubscriptionGateway
|
18 |
{
|
@@ -20,6 +16,7 @@ class SubscriptionGateway
|
|
20 |
private $_config;
|
21 |
private $_http;
|
22 |
|
|
|
23 |
public function __construct($gateway)
|
24 |
{
|
25 |
$this->_gateway = $gateway;
|
@@ -28,6 +25,13 @@ class SubscriptionGateway
|
|
28 |
$this->_http = new Http($gateway->config);
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public function create($attributes)
|
32 |
{
|
33 |
Util::verifyKeys(self::_createSignature(), $attributes);
|
@@ -36,6 +40,13 @@ class SubscriptionGateway
|
|
36 |
return $this->_verifyGatewayResponse($response);
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
public function find($id)
|
40 |
{
|
41 |
$this->_validateId($id);
|
@@ -47,9 +58,15 @@ class SubscriptionGateway
|
|
47 |
} catch (Exception\NotFound $e) {
|
48 |
throw new Exception\NotFound('subscription with id ' . $id . ' not found');
|
49 |
}
|
50 |
-
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
public function search($query)
|
54 |
{
|
55 |
$criteria = [];
|
@@ -69,6 +86,14 @@ class SubscriptionGateway
|
|
69 |
return new ResourceCollection($response, $pager);
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
public function fetch($query, $ids)
|
73 |
{
|
74 |
$criteria = [];
|
@@ -85,6 +110,14 @@ class SubscriptionGateway
|
|
85 |
);
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public function update($subscriptionId, $attributes)
|
89 |
{
|
90 |
Util::verifyKeys(self::_updateSignature(), $attributes);
|
@@ -93,6 +126,15 @@ class SubscriptionGateway
|
|
93 |
return $this->_verifyGatewayResponse($response);
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
public function retryCharge($subscriptionId, $amount = null, $submitForSettlement = false)
|
97 |
{
|
98 |
$transaction_params = ['type' => Transaction::SALE,
|
@@ -109,6 +151,13 @@ class SubscriptionGateway
|
|
109 |
return $this->_verifyGatewayResponse($response);
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
public function cancel($subscriptionId)
|
113 |
{
|
114 |
$path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId . '/cancel';
|
@@ -184,43 +233,37 @@ class SubscriptionGateway
|
|
184 |
];
|
185 |
}
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
*/
|
190 |
-
private function _validateId($id = null) {
|
191 |
if (empty($id)) {
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
}
|
196 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
197 |
throw new InvalidArgumentException(
|
198 |
-
|
199 |
-
|
200 |
}
|
201 |
}
|
202 |
|
203 |
-
/**
|
204 |
-
* @ignore
|
205 |
-
*/
|
206 |
private function _verifyGatewayResponse($response)
|
207 |
{
|
208 |
if (isset($response['subscription'])) {
|
209 |
return new Result\Successful(
|
210 |
Subscription::factory($response['subscription'])
|
211 |
);
|
212 |
-
}
|
213 |
// return a populated instance of Transaction, for subscription retryCharge
|
214 |
return new Result\Successful(
|
215 |
Transaction::factory($response['transaction'])
|
216 |
);
|
217 |
-
}
|
218 |
return new Result\Error($response['apiErrorResponse']);
|
219 |
} else {
|
220 |
throw new Exception\Unexpected(
|
221 |
-
|
222 |
);
|
223 |
}
|
224 |
}
|
225 |
}
|
226 |
-
class_alias('Braintree\SubscriptionGateway', 'Braintree_SubscriptionGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
7 |
/**
|
8 |
* Braintree SubscriptionGateway module
|
9 |
*
|
10 |
+
* // phpcs:ignore Generic.Files.LineLength
|
11 |
+
* For more detailed information on Subscriptions, see {@link https://developer.paypal.com/braintree/docs/reference/response/subscription/php our developer docs}
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class SubscriptionGateway
|
14 |
{
|
16 |
private $_config;
|
17 |
private $_http;
|
18 |
|
19 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
20 |
public function __construct($gateway)
|
21 |
{
|
22 |
$this->_gateway = $gateway;
|
25 |
$this->_http = new Http($gateway->config);
|
26 |
}
|
27 |
|
28 |
+
/*
|
29 |
+
* Request a new subscription be created
|
30 |
+
*
|
31 |
+
* @param array $attributes containing request params
|
32 |
+
*
|
33 |
+
* @return Result\Sucessful|Result\Error
|
34 |
+
*/
|
35 |
public function create($attributes)
|
36 |
{
|
37 |
Util::verifyKeys(self::_createSignature(), $attributes);
|
40 |
return $this->_verifyGatewayResponse($response);
|
41 |
}
|
42 |
|
43 |
+
/*
|
44 |
+
* Look up a single subscription
|
45 |
+
*
|
46 |
+
* @param string $id of the subscription to find
|
47 |
+
*
|
48 |
+
* @return Subscription|Exception\NotFound
|
49 |
+
*/
|
50 |
public function find($id)
|
51 |
{
|
52 |
$this->_validateId($id);
|
58 |
} catch (Exception\NotFound $e) {
|
59 |
throw new Exception\NotFound('subscription with id ' . $id . ' not found');
|
60 |
}
|
|
|
61 |
}
|
62 |
|
63 |
+
/*
|
64 |
+
* Search for subscriptions using a variety of criteria
|
65 |
+
*
|
66 |
+
* @param mixed $query of search fields
|
67 |
+
*
|
68 |
+
* @return ResourceCollection of Subscription objects
|
69 |
+
*/
|
70 |
public function search($query)
|
71 |
{
|
72 |
$criteria = [];
|
86 |
return new ResourceCollection($response, $pager);
|
87 |
}
|
88 |
|
89 |
+
/*
|
90 |
+
* Fetch subscriptions using a variety of criteria
|
91 |
+
*
|
92 |
+
* @param mixed $query of search fields
|
93 |
+
* @param array $ids to be fetched
|
94 |
+
*
|
95 |
+
* @return ResourceCollection of Subscription objects
|
96 |
+
*/
|
97 |
public function fetch($query, $ids)
|
98 |
{
|
99 |
$criteria = [];
|
110 |
);
|
111 |
}
|
112 |
|
113 |
+
/*
|
114 |
+
* Updates a specific subscription with given details
|
115 |
+
*
|
116 |
+
* @param string $subscriptionId the ID of the subscription to be updated
|
117 |
+
* @param mixed $attributes
|
118 |
+
*
|
119 |
+
* @return Subscription|Exception\NotFound
|
120 |
+
*/
|
121 |
public function update($subscriptionId, $attributes)
|
122 |
{
|
123 |
Util::verifyKeys(self::_updateSignature(), $attributes);
|
126 |
return $this->_verifyGatewayResponse($response);
|
127 |
}
|
128 |
|
129 |
+
/*
|
130 |
+
* Manually retry charging a past due subscription
|
131 |
+
*
|
132 |
+
* @param string $subscriptionId the ID of the subscription with a charge being retried
|
133 |
+
* @param string $amount optional
|
134 |
+
* @param bool $submitForSettlement defaults to false unless specified true
|
135 |
+
*
|
136 |
+
* @return Transaction
|
137 |
+
*/
|
138 |
public function retryCharge($subscriptionId, $amount = null, $submitForSettlement = false)
|
139 |
{
|
140 |
$transaction_params = ['type' => Transaction::SALE,
|
151 |
return $this->_verifyGatewayResponse($response);
|
152 |
}
|
153 |
|
154 |
+
/*
|
155 |
+
* Stops billing a payment method for a subscription. Cannot be reactivated
|
156 |
+
*
|
157 |
+
* @param string $subscriptionId to be canceled
|
158 |
+
*
|
159 |
+
* @return Subscription|Exception\NotFound
|
160 |
+
*/
|
161 |
public function cancel($subscriptionId)
|
162 |
{
|
163 |
$path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId . '/cancel';
|
233 |
];
|
234 |
}
|
235 |
|
236 |
+
private function _validateId($id = null)
|
237 |
+
{
|
|
|
|
|
238 |
if (empty($id)) {
|
239 |
+
throw new InvalidArgumentException(
|
240 |
+
'expected subscription id to be set'
|
241 |
+
);
|
242 |
}
|
243 |
if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
|
244 |
throw new InvalidArgumentException(
|
245 |
+
$id . ' is an invalid subscription id.'
|
246 |
+
);
|
247 |
}
|
248 |
}
|
249 |
|
|
|
|
|
|
|
250 |
private function _verifyGatewayResponse($response)
|
251 |
{
|
252 |
if (isset($response['subscription'])) {
|
253 |
return new Result\Successful(
|
254 |
Subscription::factory($response['subscription'])
|
255 |
);
|
256 |
+
} elseif (isset($response['transaction'])) {
|
257 |
// return a populated instance of Transaction, for subscription retryCharge
|
258 |
return new Result\Successful(
|
259 |
Transaction::factory($response['transaction'])
|
260 |
);
|
261 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
262 |
return new Result\Error($response['apiErrorResponse']);
|
263 |
} else {
|
264 |
throw new Exception\Unexpected(
|
265 |
+
"Expected subscription, transaction, or apiErrorResponse"
|
266 |
);
|
267 |
}
|
268 |
}
|
269 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/SubscriptionSearch.php
CHANGED
@@ -1,48 +1,97 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class SubscriptionSearch
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function billingCyclesRemaining()
|
7 |
{
|
8 |
return new RangeNode('billing_cycles_remaining');
|
9 |
}
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
public static function daysPastDue()
|
12 |
{
|
13 |
return new RangeNode('days_past_due');
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
public static function id()
|
17 |
{
|
18 |
return new TextNode('id');
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
public static function inTrialPeriod()
|
22 |
{
|
23 |
return new MultipleValueNode('in_trial_period', [true, false]);
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
public static function merchantAccountId()
|
27 |
{
|
28 |
return new MultipleValueNode('merchant_account_id');
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
public static function nextBillingDate()
|
32 |
{
|
33 |
return new RangeNode('next_billing_date');
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
public static function planId()
|
37 |
{
|
38 |
return new MultipleValueOrTextNode('plan_id');
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
public static function price()
|
42 |
{
|
43 |
return new RangeNode('price');
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
public static function status()
|
47 |
{
|
48 |
return new MultipleValueNode('status', [
|
@@ -54,19 +103,33 @@ class SubscriptionSearch
|
|
54 |
]);
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
57 |
public static function transactionId()
|
58 |
{
|
59 |
return new TextNode('transaction_id');
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
public static function ids()
|
63 |
{
|
64 |
return new MultipleValueNode('ids');
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
public static function createdAt()
|
68 |
{
|
69 |
return new RangeNode('created_at');
|
70 |
}
|
71 |
}
|
72 |
-
class_alias('Braintree\SubscriptionSearch', 'Braintree_SubscriptionSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class for setting subscription search queries
|
7 |
+
*/
|
8 |
class SubscriptionSearch
|
9 |
{
|
10 |
+
/*
|
11 |
+
* Create a new range node for billing cycles remaining
|
12 |
+
*
|
13 |
+
* @return RangeNode
|
14 |
+
*/
|
15 |
public static function billingCyclesRemaining()
|
16 |
{
|
17 |
return new RangeNode('billing_cycles_remaining');
|
18 |
}
|
19 |
|
20 |
+
/*
|
21 |
+
* Create a new range node for days past due
|
22 |
+
*
|
23 |
+
* @return RangeNode
|
24 |
+
*/
|
25 |
public static function daysPastDue()
|
26 |
{
|
27 |
return new RangeNode('days_past_due');
|
28 |
}
|
29 |
|
30 |
+
/*
|
31 |
+
* Create a new text node for id
|
32 |
+
*
|
33 |
+
* @return TextNode
|
34 |
+
*/
|
35 |
public static function id()
|
36 |
{
|
37 |
return new TextNode('id');
|
38 |
}
|
39 |
|
40 |
+
/*
|
41 |
+
* Create a multiple value node for in trial period
|
42 |
+
*
|
43 |
+
* @return MultipleValueNode
|
44 |
+
*/
|
45 |
public static function inTrialPeriod()
|
46 |
{
|
47 |
return new MultipleValueNode('in_trial_period', [true, false]);
|
48 |
}
|
49 |
|
50 |
+
/*
|
51 |
+
* Create a multiple value node for merchant account id
|
52 |
+
*
|
53 |
+
* @return MultipleValueNode
|
54 |
+
*/
|
55 |
public static function merchantAccountId()
|
56 |
{
|
57 |
return new MultipleValueNode('merchant_account_id');
|
58 |
}
|
59 |
|
60 |
+
/*
|
61 |
+
* Create a new range node for next billing date
|
62 |
+
*
|
63 |
+
* @return RangeNode
|
64 |
+
*/
|
65 |
public static function nextBillingDate()
|
66 |
{
|
67 |
return new RangeNode('next_billing_date');
|
68 |
}
|
69 |
|
70 |
+
/*
|
71 |
+
* Create a multiple value node for plan id
|
72 |
+
*
|
73 |
+
* @return MultipleValueNode
|
74 |
+
*/
|
75 |
public static function planId()
|
76 |
{
|
77 |
return new MultipleValueOrTextNode('plan_id');
|
78 |
}
|
79 |
|
80 |
+
/*
|
81 |
+
* Create a new range node for price
|
82 |
+
*
|
83 |
+
* @return RangeNode
|
84 |
+
*/
|
85 |
public static function price()
|
86 |
{
|
87 |
return new RangeNode('price');
|
88 |
}
|
89 |
|
90 |
+
/*
|
91 |
+
* Create a multiple value node for status
|
92 |
+
*
|
93 |
+
* @return MultipleValueNode
|
94 |
+
*/
|
95 |
public static function status()
|
96 |
{
|
97 |
return new MultipleValueNode('status', [
|
103 |
]);
|
104 |
}
|
105 |
|
106 |
+
/*
|
107 |
+
* Create a new text node for transaction id
|
108 |
+
*
|
109 |
+
* @return TextNode
|
110 |
+
*/
|
111 |
public static function transactionId()
|
112 |
{
|
113 |
return new TextNode('transaction_id');
|
114 |
}
|
115 |
|
116 |
+
/*
|
117 |
+
* Create a multiple value node for ids
|
118 |
+
*
|
119 |
+
* @return MultipleValueNode
|
120 |
+
*/
|
121 |
public static function ids()
|
122 |
{
|
123 |
return new MultipleValueNode('ids');
|
124 |
}
|
125 |
|
126 |
+
/*
|
127 |
+
* Create a new range node for created at
|
128 |
+
*
|
129 |
+
* @return RangeNode
|
130 |
+
*/
|
131 |
public static function createdAt()
|
132 |
{
|
133 |
return new RangeNode('created_at');
|
134 |
}
|
135 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/AuthenticationIds.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Test;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Authentication Ids used for testing purposes
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Authentication Ids used for testing purposes
|
11 |
+
*
|
12 |
+
* The constants in this class can be used to perform authentication id operations
|
13 |
+
* with the desired status in the sandbox environment.
|
14 |
+
*/
|
15 |
+
class AuthenticationIds
|
16 |
+
{
|
17 |
+
// phpcs:disable Generic.Files.LineLength
|
18 |
+
public static $threeDSecureVisaFullAuthenticationNonce = "fake-three-d-secure-visa-full-authentication-nonce";
|
19 |
+
public static $threeDSecureVisaLookupTimeout = "fake-three-d-secure-visa-lookup-timeout-nonce";
|
20 |
+
public static $threeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-nonce";
|
21 |
+
public static $threeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-nonce";
|
22 |
+
public static $threeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-nonce";
|
23 |
+
public static $threeDSecureVisaNoteEnrolled = "fake-three-d-secure-visa-not-enrolled-nonce";
|
24 |
+
public static $threeDSecureVisaUnavailable = "fake-three-d-secure-visa-unavailable-nonce";
|
25 |
+
public static $threeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-nonce";
|
26 |
+
public static $threeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-nonce";
|
27 |
+
public static $threeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-nonce";
|
28 |
+
public static $threeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-nonce";
|
29 |
+
public static $threeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce";
|
30 |
+
public static $threeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-nonce";
|
31 |
+
public static $threeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-nonce";
|
32 |
+
public static $threeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-nonce";
|
33 |
+
// phpcs:enable Generic.Files.LineLength
|
34 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Test/CreditCardNumbers.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
/**
|
@@ -7,9 +8,6 @@ namespace Braintree\Test;
|
|
7 |
* The constants contained in the Test\CreditCardNumbers class provide
|
8 |
* credit card numbers that should be used when working in the sandbox environment.
|
9 |
* The sandbox will not accept any credit card numbers other than the ones listed below.
|
10 |
-
*
|
11 |
-
* @package Braintree
|
12 |
-
* @subpackage Test
|
13 |
*/
|
14 |
class CreditCardNumbers
|
15 |
{
|
@@ -24,6 +22,15 @@ class CreditCardNumbers
|
|
24 |
'6011111111111117',
|
25 |
'6011000990139424',
|
26 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
public static $JCBs = [
|
28 |
'3530111333300000',
|
29 |
'3566002020360505',
|
@@ -66,14 +73,19 @@ class CreditCardNumbers
|
|
66 |
'Chargeback' => '4023898493988028',
|
67 |
];
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
public static function getAll()
|
70 |
{
|
71 |
return array_merge(
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
77 |
}
|
78 |
}
|
79 |
-
class_alias('Braintree\Test\CreditCardNumbers', 'Braintree_Test_CreditCardNumbers');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
/**
|
8 |
* The constants contained in the Test\CreditCardNumbers class provide
|
9 |
* credit card numbers that should be used when working in the sandbox environment.
|
10 |
* The sandbox will not accept any credit card numbers other than the ones listed below.
|
|
|
|
|
|
|
11 |
*/
|
12 |
class CreditCardNumbers
|
13 |
{
|
22 |
'6011111111111117',
|
23 |
'6011000990139424',
|
24 |
];
|
25 |
+
|
26 |
+
public static $hiper = '6370950000000005';
|
27 |
+
public static $hiperCard = '6062820524845321';
|
28 |
+
|
29 |
+
public static $elo = '5066991111111118';
|
30 |
+
public static $eloCards = [
|
31 |
+
'5066991111111118'
|
32 |
+
];
|
33 |
+
|
34 |
public static $JCBs = [
|
35 |
'3530111333300000',
|
36 |
'3566002020360505',
|
73 |
'Chargeback' => '4023898493988028',
|
74 |
];
|
75 |
|
76 |
+
/**
|
77 |
+
* Get all test credit cards in one array
|
78 |
+
*
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
public static function getAll()
|
82 |
{
|
83 |
return array_merge(
|
84 |
+
self::$amExes,
|
85 |
+
self::$discoverCards,
|
86 |
+
self::$eloCards,
|
87 |
+
self::$masterCards,
|
88 |
+
self::$visas
|
89 |
+
);
|
90 |
}
|
91 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/MerchantAccount.php
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
/**
|
5 |
* Merchant Account constants used for testing purposes
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @subpackage Test
|
9 |
*/
|
10 |
class MerchantAccount
|
11 |
{
|
@@ -15,7 +13,4 @@ class MerchantAccount
|
|
15 |
public static $accountNotAuthorizedContactUs = "account_not_authorized__contact";
|
16 |
public static $bankRejectedUpdateFundingInformation = "bank_rejected__update";
|
17 |
public static $bankRejectedNone = "bank_rejected__none";
|
18 |
-
|
19 |
-
|
20 |
}
|
21 |
-
class_alias('Braintree\Test\MerchantAccount', 'Braintree_Test_MerchantAccount');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
/**
|
6 |
* Merchant Account constants used for testing purposes
|
|
|
|
|
|
|
7 |
*/
|
8 |
class MerchantAccount
|
9 |
{
|
13 |
public static $accountNotAuthorizedContactUs = "account_not_authorized__contact";
|
14 |
public static $bankRejectedUpdateFundingInformation = "bank_rejected__update";
|
15 |
public static $bankRejectedNone = "bank_rejected__none";
|
|
|
|
|
16 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/Nonces.php
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
/**
|
5 |
* Nonces used for testing purposes
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @subpackage Test
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -13,64 +11,77 @@ namespace Braintree\Test;
|
|
13 |
*
|
14 |
* The constants in this class can be used to perform nonce operations
|
15 |
* with the desired status in the sandbox environment.
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @subpackage Test
|
19 |
*/
|
20 |
class Nonces
|
21 |
{
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
-
class_alias('Braintree\Test\Nonces', 'Braintree_Test_Nonces');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
/**
|
6 |
* Nonces used for testing purposes
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
11 |
*
|
12 |
* The constants in this class can be used to perform nonce operations
|
13 |
* with the desired status in the sandbox environment.
|
|
|
|
|
|
|
14 |
*/
|
15 |
class Nonces
|
16 |
{
|
17 |
+
// phpcs:disable Generic.Files.LineLength
|
18 |
+
public static $transactable = "fake-valid-nonce";
|
19 |
+
public static $consumed = "fake-consumed-nonce";
|
20 |
+
public static $paypalOneTimePayment = "fake-paypal-one-time-nonce";
|
21 |
+
public static $paypalFuturePayment = "fake-paypal-future-nonce";
|
22 |
+
public static $paypalBillingAgreement = "fake-paypal-billing-agreement-nonce";
|
23 |
+
public static $applePayVisa = "fake-apple-pay-visa-nonce";
|
24 |
+
public static $applePayMasterCard = "fake-apple-pay-visa-nonce";
|
25 |
+
public static $applePayAmEx = "fake-apple-pay-amex-nonce";
|
26 |
+
public static $googlePay = "fake-android-pay-nonce";
|
27 |
+
public static $googlePayDiscover = "fake-android-pay-discover-nonce";
|
28 |
+
public static $googlePayVisa = "fake-android-pay-visa-nonce";
|
29 |
+
public static $googlePayMasterCard = "fake-android-pay-mastercard-nonce";
|
30 |
+
public static $googlePayAmEx = "fake-android-pay-amex-nonce";
|
31 |
+
public static $abstractTransactable = "fake-abstract-transactable-nonce";
|
32 |
+
public static $europe = "fake-europe-bank-account-nonce";
|
33 |
+
public static $transactableVisa = "fake-valid-visa-nonce";
|
34 |
+
public static $transactableAmEx = "fake-valid-amex-nonce";
|
35 |
+
public static $transactableMasterCard = "fake-valid-mastercard-nonce";
|
36 |
+
public static $transactableDiscover = "fake-valid-discover-nonce";
|
37 |
+
public static $transactableJCB = "fake-valid-jcb-nonce";
|
38 |
+
public static $transactableMaestro = "fake-valid-maestro-nonce";
|
39 |
+
public static $transactableDinersClub = "fake-valid-dinersclub-nonce";
|
40 |
+
public static $transactablePrepaid = "fake-valid-prepaid-nonce";
|
41 |
+
public static $transactableCommercial = "fake-valid-commercial-nonce";
|
42 |
+
public static $transactableDurbinRegulated = "fake-valid-durbin-regulated-nonce";
|
43 |
+
public static $transactableHealthcare = "fake-valid-healthcare-nonce";
|
44 |
+
public static $transactableDebit = "fake-valid-debit-nonce";
|
45 |
+
public static $transactablePayroll = "fake-valid-payroll-nonce";
|
46 |
+
public static $threeDSecureVisaFullAuthenticationNonce = "fake-three-d-secure-visa-full-authentication-nonce";
|
47 |
+
public static $threeDSecureVisaLookupTimeout = "fake-three-d-secure-visa-lookup-timeout-nonce";
|
48 |
+
public static $threeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-nonce";
|
49 |
+
public static $threeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-nonce";
|
50 |
+
public static $threeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-nonce";
|
51 |
+
public static $threeDSecureVisaNoteEnrolled = "fake-three-d-secure-visa-not-enrolled-nonce";
|
52 |
+
public static $threeDSecureVisaUnavailable = "fake-three-d-secure-visa-unavailable-nonce";
|
53 |
+
public static $threeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-nonce";
|
54 |
+
public static $threeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-nonce";
|
55 |
+
public static $threeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-nonce";
|
56 |
+
public static $threeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-nonce";
|
57 |
+
public static $threeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce";
|
58 |
+
public static $threeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-nonce";
|
59 |
+
public static $threeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-nonce";
|
60 |
+
public static $threeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-nonce";
|
61 |
+
public static $transactableNoIndicators = "fake-valid-no-indicators-nonce";
|
62 |
+
public static $transactableUnknownIndicators = "fake-valid-unknown-indicators-nonce";
|
63 |
+
public static $transactableCountryOfIssuanceUSA = "fake-valid-country-of-issuance-usa-nonce";
|
64 |
+
public static $transactableCountryOfIssuanceCAD = "fake-valid-country-of-issuance-cad-nonce";
|
65 |
+
public static $transactableIssuingBankNetworkOnly = "fake-valid-issuing-bank-network-only-nonce";
|
66 |
+
public static $processorDeclinedVisa = "fake-processor-declined-visa-nonce";
|
67 |
+
public static $processorDeclinedMasterCard = "fake-processor-declined-mastercard-nonce";
|
68 |
+
public static $processorDeclinedAmEx = "fake-processor-declined-amex-nonce";
|
69 |
+
public static $processorDeclinedDiscover = "fake-processor-declined-discover-nonce";
|
70 |
+
public static $processorFailureJCB = "fake-processor-failure-jcb-nonce";
|
71 |
+
public static $luhnInvalid = "fake-luhn-invalid-nonce";
|
72 |
+
public static $localPayment = "fake-local-payment-method-nonce";
|
73 |
+
public static $paypalFuturePaymentRefreshToken = "fake-paypal-future-refresh-token-nonce";
|
74 |
+
public static $sepa = "fake-sepa-bank-account-nonce";
|
75 |
+
public static $gatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce";
|
76 |
+
public static $gatewayRejectedTokenIssuance = "fake-token-issuance-error-venmo-account-nonce";
|
77 |
+
public static $venmoAccount = "fake-venmo-account-nonce";
|
78 |
+
public static $visaCheckoutAmEx = "fake-visa-checkout-amex-nonce";
|
79 |
+
public static $visaCheckoutDiscover = "fake-visa-checkout-discover-nonce";
|
80 |
+
public static $visaCheckoutMasterCard = "fake-visa-checkout-mastercard-nonce";
|
81 |
+
public static $visaCheckoutVisa = "fake-visa-checkout-visa-nonce";
|
82 |
+
public static $samsungPayAmEx = "tokensam_fake_american_express";
|
83 |
+
public static $samsungPayDiscover = "tokensam_fake_discover";
|
84 |
+
public static $samsungPayMasterCard = "tokensam_fake_mastercard";
|
85 |
+
public static $samsungPayVisa = "tokensam_fake_visa";
|
86 |
+
// phpcs:enable Generic.Files.LineLength
|
87 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/Transaction.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
use Braintree\Configuration;
|
@@ -14,8 +15,9 @@ class Transaction
|
|
14 |
/**
|
15 |
* settle a transaction by id in sandbox
|
16 |
*
|
17 |
-
* @param string
|
18 |
* @param Configuration $config gateway config
|
|
|
19 |
* @return Transaction
|
20 |
*/
|
21 |
public static function settle($transactionId)
|
@@ -26,8 +28,9 @@ class Transaction
|
|
26 |
/**
|
27 |
* settlement confirm a transaction by id in sandbox
|
28 |
*
|
29 |
-
* @param string
|
30 |
* @param Configuration $config gateway config
|
|
|
31 |
* @return Transaction
|
32 |
*/
|
33 |
public static function settlementConfirm($transactionId)
|
@@ -38,8 +41,9 @@ class Transaction
|
|
38 |
/**
|
39 |
* settlement decline a transaction by id in sandbox
|
40 |
*
|
41 |
-
* @param string
|
42 |
* @param Configuration $config gateway config
|
|
|
43 |
* @return Transaction
|
44 |
*/
|
45 |
public static function settlementDecline($transactionId)
|
@@ -50,8 +54,9 @@ class Transaction
|
|
50 |
/**
|
51 |
* settlement pending a transaction by id in sandbox
|
52 |
*
|
53 |
-
* @param string
|
54 |
* @param Configuration $config gateway config
|
|
|
55 |
* @return Transaction
|
56 |
*/
|
57 |
public static function settlementPending($transactionId)
|
@@ -59,4 +64,3 @@ class Transaction
|
|
59 |
return Configuration::gateway()->testing()->settlementPending($transactionId);
|
60 |
}
|
61 |
}
|
62 |
-
class_alias('Braintree\Test\Transaction', 'Braintree_Test_Transaction');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
use Braintree\Configuration;
|
15 |
/**
|
16 |
* settle a transaction by id in sandbox
|
17 |
*
|
18 |
+
* @param string $id transaction id
|
19 |
* @param Configuration $config gateway config
|
20 |
+
*
|
21 |
* @return Transaction
|
22 |
*/
|
23 |
public static function settle($transactionId)
|
28 |
/**
|
29 |
* settlement confirm a transaction by id in sandbox
|
30 |
*
|
31 |
+
* @param string $id transaction id
|
32 |
* @param Configuration $config gateway config
|
33 |
+
*
|
34 |
* @return Transaction
|
35 |
*/
|
36 |
public static function settlementConfirm($transactionId)
|
41 |
/**
|
42 |
* settlement decline a transaction by id in sandbox
|
43 |
*
|
44 |
+
* @param string $id transaction id
|
45 |
* @param Configuration $config gateway config
|
46 |
+
*
|
47 |
* @return Transaction
|
48 |
*/
|
49 |
public static function settlementDecline($transactionId)
|
54 |
/**
|
55 |
* settlement pending a transaction by id in sandbox
|
56 |
*
|
57 |
+
* @param string $id transaction id
|
58 |
* @param Configuration $config gateway config
|
59 |
+
*
|
60 |
* @return Transaction
|
61 |
*/
|
62 |
public static function settlementPending($transactionId)
|
64 |
return Configuration::gateway()->testing()->settlementPending($transactionId);
|
65 |
}
|
66 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/TransactionAmounts.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
/**
|
@@ -6,13 +7,10 @@ namespace Braintree\Test;
|
|
6 |
*
|
7 |
* The constants in this class can be used to create transactions with
|
8 |
* the desired status in the sandbox environment.
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Test
|
12 |
*/
|
13 |
class TransactionAmounts
|
14 |
{
|
15 |
-
|
16 |
-
|
|
|
17 |
}
|
18 |
-
class_alias('Braintree\Test\TransactionAmounts', 'Braintree_Test_TransactionAmounts');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
/**
|
7 |
*
|
8 |
* The constants in this class can be used to create transactions with
|
9 |
* the desired status in the sandbox environment.
|
|
|
|
|
|
|
10 |
*/
|
11 |
class TransactionAmounts
|
12 |
{
|
13 |
+
public static $authorize = '1000.00';
|
14 |
+
public static $decline = '2000.00';
|
15 |
+
public static $hardDecline = '2015.00';
|
16 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Test/VenmoSdk.php
CHANGED
@@ -1,30 +1,31 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Test;
|
3 |
|
4 |
/**
|
5 |
* VenmoSdk payment method codes used for testing purposes
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @subpackage Test
|
9 |
*/
|
10 |
class VenmoSdk
|
11 |
{
|
12 |
public static $visaPaymentMethodCode = "stub-4111111111111111";
|
13 |
|
14 |
-
public static function generateTestPaymentMethodCode($number)
|
|
|
15 |
return "stub-" . $number;
|
16 |
}
|
17 |
|
18 |
-
public static function getInvalidPaymentMethodCode()
|
|
|
19 |
return "stub-invalid-payment-method-code";
|
20 |
}
|
21 |
|
22 |
-
public static function getTestSession()
|
|
|
23 |
return "stub-session";
|
24 |
}
|
25 |
|
26 |
-
public static function getInvalidTestSession()
|
|
|
27 |
return "stub-invalid-session";
|
28 |
}
|
29 |
}
|
30 |
-
class_alias('Braintree\Test\VenmoSdk', 'Braintree_Test_VenmoSdk');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Test;
|
4 |
|
5 |
/**
|
6 |
* VenmoSdk payment method codes used for testing purposes
|
|
|
|
|
|
|
7 |
*/
|
8 |
class VenmoSdk
|
9 |
{
|
10 |
public static $visaPaymentMethodCode = "stub-4111111111111111";
|
11 |
|
12 |
+
public static function generateTestPaymentMethodCode($number)
|
13 |
+
{
|
14 |
return "stub-" . $number;
|
15 |
}
|
16 |
|
17 |
+
public static function getInvalidPaymentMethodCode()
|
18 |
+
{
|
19 |
return "stub-invalid-payment-method-code";
|
20 |
}
|
21 |
|
22 |
+
public static function getTestSession()
|
23 |
+
{
|
24 |
return "stub-session";
|
25 |
}
|
26 |
|
27 |
+
public static function getInvalidTestSession()
|
28 |
+
{
|
29 |
return "stub-invalid-session";
|
30 |
}
|
31 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TestingGateway.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
class TestingGateway
|
@@ -49,4 +51,3 @@ class TestingGateway
|
|
49 |
}
|
50 |
}
|
51 |
}
|
52 |
-
class_alias('Braintree\TestingGateway', 'Braintree_TestingGateway');
|
1 |
<?php
|
2 |
+
|
3 |
+
// phpcs:disable PEAR.Commenting
|
4 |
namespace Braintree;
|
5 |
|
6 |
class TestingGateway
|
51 |
}
|
52 |
}
|
53 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TextNode.php
CHANGED
@@ -1,12 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class TextNode extends PartialMatchNode
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public function contains($value)
|
7 |
{
|
8 |
$this->searchTerms["contains"] = strval($value);
|
9 |
return $this;
|
10 |
}
|
11 |
}
|
12 |
-
class_alias('Braintree\TextNode', 'Braintree_TextNode');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree TextNode
|
7 |
+
* TextNode is an object for text elements returned from the Braintree API
|
8 |
+
*/
|
9 |
class TextNode extends PartialMatchNode
|
10 |
{
|
11 |
+
/**
|
12 |
+
* Sets the value of the object's "contains" key to a string of $value
|
13 |
+
*
|
14 |
+
* @param object $value to have its string value set in $this
|
15 |
+
*
|
16 |
+
* @return object
|
17 |
+
*/
|
18 |
public function contains($value)
|
19 |
{
|
20 |
$this->searchTerms["contains"] = strval($value);
|
21 |
return $this;
|
22 |
}
|
23 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/ThreeDSecureInfo.php
CHANGED
@@ -1,8 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
class ThreeDSecureInfo extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function factory($attributes)
|
7 |
{
|
8 |
$instance = new self();
|
@@ -16,15 +29,10 @@ class ThreeDSecureInfo extends Base
|
|
16 |
$this->_attributes = $attributes;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
public function __toString()
|
24 |
{
|
25 |
return __CLASS__ . '[' .
|
26 |
-
Util::attributesToString($this->_attributes) .']';
|
27 |
}
|
28 |
-
|
29 |
}
|
30 |
-
class_alias('Braintree\ThreeDSecureInfo', 'Braintree_ThreeDSecureInfo');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Create and Manage 3D Secure Info type objects
|
7 |
+
*
|
8 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/payment-method-nonce/php#three_d_secure_info developer docs} for information on attributes
|
9 |
+
*/
|
10 |
class ThreeDSecureInfo extends Base
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Creates an instance from given attributes
|
14 |
+
*
|
15 |
+
* @param array $attributes response object attributes
|
16 |
+
*
|
17 |
+
* @return ThreeDSecureInfo
|
18 |
+
*/
|
19 |
public static function factory($attributes)
|
20 |
{
|
21 |
$instance = new self();
|
29 |
$this->_attributes = $attributes;
|
30 |
}
|
31 |
|
32 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
33 |
+
public function __toString()
|
|
|
|
|
|
|
34 |
{
|
35 |
return __CLASS__ . '[' .
|
36 |
+
Util::attributesToString($this->_attributes) . ']';
|
37 |
}
|
|
|
38 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction.php
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
-
* Braintree Transaction processor
|
6 |
-
* Creates and manages transactions
|
7 |
*
|
8 |
* At minimum, an amount, credit card number, and
|
9 |
* credit card expiration date are required.
|
@@ -133,47 +134,9 @@ namespace Braintree;
|
|
133 |
* ));
|
134 |
* </code>
|
135 |
*
|
136 |
-
*
|
137 |
-
|
138 |
-
* For more detailed information on Transactions, see {@link https://developers.braintreepayments.com/reference/response/transaction/php https://developers.braintreepayments.com/reference/response/transaction/php}
|
139 |
-
*
|
140 |
-
* @package Braintree
|
141 |
-
* @category Resources
|
142 |
-
*
|
143 |
-
*
|
144 |
-
* @property-read string $avsErrorResponseCode
|
145 |
-
* @property-read string $avsPostalCodeResponseCode
|
146 |
-
* @property-read string $avsStreetAddressResponseCode
|
147 |
-
* @property-read string $cvvResponseCode
|
148 |
-
* @property-read string $id transaction id
|
149 |
-
* @property-read string $amount transaction amount
|
150 |
-
* @property-read Braintree\Transaction\AddressDetails $billingDetails transaction billing address
|
151 |
-
* @property-read \DateTime $createdAt transaction created DateTime
|
152 |
-
* @property-read Braintree\ApplePayCardDetails $applePayCardDetails transaction Apple Pay card info
|
153 |
-
* @property-read Braintree\AndroidPayCardDetails $androidPayCardDetails transaction Android Pay card info
|
154 |
-
* @property-read Braintree\AmexExpressCheckoutCardDetails $amexExpressCheckoutCardDetails transaction Amex Express Checkout card info
|
155 |
-
* @property-read Braintree\CreditCardDetails $creditCardDetails transaction credit card info
|
156 |
-
* @property-read Braintree\CoinbaseDetails $coinbaseDetails transaction Coinbase account info
|
157 |
-
* @property-read Braintree\MasterpassCardDetails $masterpassCardDetails transaction Masterpass card info
|
158 |
-
* @property-read Braintree\PayPalDetails $paypalDetails transaction paypal account info
|
159 |
-
* @property-read Braintree\Transaction\CustomerDetails $customerDetails transaction customer info
|
160 |
-
* @property-read Braintree\VenmoAccount $venmoAccountDetails transaction Venmo Account info
|
161 |
-
* @property-read Braintree\IdealPayment $idealPaymentDetails transaction Ideal Payment info
|
162 |
-
* @property-read Braintree\VisaCheckoutCardDetails $visaCheckoutCardDetails transaction Visa Checkout card info
|
163 |
-
* @property-read array $customFields custom fields passed with the request
|
164 |
-
* @property-read string $processorResponseCode gateway response code
|
165 |
-
* @property-read string $additionalProcessorResponse raw response from processor
|
166 |
-
* @property-read Braintree\Transaction\AddressDetails $shippingDetails transaction shipping address
|
167 |
-
* @property-read string $status transaction status
|
168 |
-
* @property-read array $statusHistory array of StatusDetails objects
|
169 |
-
* @property-read string $type transaction type
|
170 |
-
* @property-read \DateTime $updatedAt transaction updated DateTime
|
171 |
-
* @property-read Braintree\Disbursement $disbursementDetails populated when transaction is disbursed
|
172 |
-
* @property-read Braintree\Dispute $disputes populated when transaction is disputed
|
173 |
-
* @property-read Braintree\AuthorizationAdjustment $authorizationAdjustments populated when a transaction has authorization adjustments created when submitted for settlement
|
174 |
-
*
|
175 |
*/
|
176 |
-
|
177 |
class Transaction extends Base
|
178 |
{
|
179 |
// Transaction Status
|
@@ -218,19 +181,29 @@ class Transaction extends Base
|
|
218 |
const CVV = 'cvv';
|
219 |
const DUPLICATE = 'duplicate';
|
220 |
const FRAUD = 'fraud';
|
|
|
221 |
const THREE_D_SECURE = 'three_d_secure';
|
|
|
222 |
const APPLICATION_INCOMPLETE = 'application_incomplete';
|
223 |
|
224 |
// Industry Types
|
225 |
const LODGING_INDUSTRY = 'lodging';
|
226 |
const TRAVEL_AND_CRUISE_INDUSTRY = 'travel_cruise';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
/**
|
229 |
* sets instance properties from an array of values
|
230 |
*
|
231 |
-
* @ignore
|
232 |
-
* @access protected
|
233 |
* @param array $transactionAttribs array of transaction data
|
|
|
234 |
* @return void
|
235 |
*/
|
236 |
protected function _initialize($transactionAttribs)
|
@@ -238,47 +211,45 @@ class Transaction extends Base
|
|
238 |
$this->_attributes = $transactionAttribs;
|
239 |
|
240 |
if (isset($transactionAttribs['applePay'])) {
|
241 |
-
$this->_set(
|
|
|
242 |
new Transaction\ApplePayCardDetails(
|
243 |
$transactionAttribs['applePay']
|
244 |
)
|
245 |
);
|
246 |
}
|
247 |
|
|
|
248 |
if (isset($transactionAttribs['androidPayCard'])) {
|
249 |
-
$this->_set(
|
250 |
-
|
|
|
251 |
$transactionAttribs['androidPayCard']
|
252 |
)
|
253 |
);
|
254 |
}
|
255 |
|
256 |
-
if (isset($transactionAttribs['masterpassCard'])) {
|
257 |
-
$this->_set('masterpassCardDetails',
|
258 |
-
new Transaction\MasterpassCardDetails(
|
259 |
-
$transactionAttribs['masterpassCard']
|
260 |
-
)
|
261 |
-
);
|
262 |
-
}
|
263 |
-
|
264 |
if (isset($transactionAttribs['visaCheckoutCard'])) {
|
265 |
-
$this->_set(
|
|
|
266 |
new Transaction\VisaCheckoutCardDetails(
|
267 |
$transactionAttribs['visaCheckoutCard']
|
268 |
)
|
269 |
);
|
270 |
}
|
271 |
|
272 |
-
if (isset($transactionAttribs['
|
273 |
-
$this->_set(
|
274 |
-
|
275 |
-
|
|
|
276 |
)
|
277 |
);
|
278 |
}
|
279 |
|
280 |
if (isset($transactionAttribs['venmoAccount'])) {
|
281 |
-
$this->_set(
|
|
|
282 |
new Transaction\VenmoAccountDetails(
|
283 |
$transactionAttribs['venmoAccount']
|
284 |
)
|
@@ -286,47 +257,53 @@ class Transaction extends Base
|
|
286 |
}
|
287 |
|
288 |
if (isset($transactionAttribs['creditCard'])) {
|
289 |
-
$this->_set(
|
|
|
290 |
new Transaction\CreditCardDetails(
|
291 |
$transactionAttribs['creditCard']
|
292 |
)
|
293 |
);
|
294 |
}
|
295 |
|
296 |
-
if (isset($transactionAttribs['
|
297 |
-
$this->_set(
|
298 |
-
|
299 |
-
|
|
|
300 |
)
|
301 |
);
|
302 |
}
|
303 |
|
304 |
-
if (isset($transactionAttribs['
|
305 |
-
$this->_set(
|
306 |
-
|
307 |
-
|
|
|
308 |
)
|
309 |
);
|
310 |
}
|
311 |
|
312 |
-
if (isset($transactionAttribs['
|
313 |
-
$this->_set(
|
314 |
-
|
315 |
-
|
|
|
316 |
)
|
317 |
);
|
318 |
}
|
319 |
|
320 |
-
if (isset($transactionAttribs['
|
321 |
-
$this->_set(
|
322 |
-
|
323 |
-
|
|
|
324 |
)
|
325 |
);
|
326 |
}
|
327 |
|
328 |
if (isset($transactionAttribs['customer'])) {
|
329 |
-
$this->_set(
|
|
|
330 |
new Transaction\CustomerDetails(
|
331 |
$transactionAttribs['customer']
|
332 |
)
|
@@ -334,7 +311,8 @@ class Transaction extends Base
|
|
334 |
}
|
335 |
|
336 |
if (isset($transactionAttribs['billing'])) {
|
337 |
-
$this->_set(
|
|
|
338 |
new Transaction\AddressDetails(
|
339 |
$transactionAttribs['billing']
|
340 |
)
|
@@ -342,7 +320,8 @@ class Transaction extends Base
|
|
342 |
}
|
343 |
|
344 |
if (isset($transactionAttribs['shipping'])) {
|
345 |
-
$this->_set(
|
|
|
346 |
new Transaction\AddressDetails(
|
347 |
$transactionAttribs['shipping']
|
348 |
)
|
@@ -350,7 +329,8 @@ class Transaction extends Base
|
|
350 |
}
|
351 |
|
352 |
if (isset($transactionAttribs['subscription'])) {
|
353 |
-
$this->_set(
|
|
|
354 |
new Transaction\SubscriptionDetails(
|
355 |
$transactionAttribs['subscription']
|
356 |
)
|
@@ -358,7 +338,8 @@ class Transaction extends Base
|
|
358 |
}
|
359 |
|
360 |
if (isset($transactionAttribs['descriptor'])) {
|
361 |
-
$this->_set(
|
|
|
362 |
new Descriptor(
|
363 |
$transactionAttribs['descriptor']
|
364 |
)
|
@@ -366,14 +347,15 @@ class Transaction extends Base
|
|
366 |
}
|
367 |
|
368 |
if (isset($transactionAttribs['disbursementDetails'])) {
|
369 |
-
$this->_set(
|
|
|
370 |
new DisbursementDetails($transactionAttribs['disbursementDetails'])
|
371 |
);
|
372 |
}
|
373 |
|
374 |
$disputes = [];
|
375 |
if (isset($transactionAttribs['disputes'])) {
|
376 |
-
foreach ($transactionAttribs['disputes']
|
377 |
$disputes[] = Dispute::factory($dispute);
|
378 |
}
|
379 |
}
|
@@ -382,7 +364,7 @@ class Transaction extends Base
|
|
382 |
|
383 |
$statusHistory = [];
|
384 |
if (isset($transactionAttribs['statusHistory'])) {
|
385 |
-
foreach ($transactionAttribs['statusHistory']
|
386 |
$statusHistory[] = new Transaction\StatusDetails($history);
|
387 |
}
|
388 |
}
|
@@ -391,7 +373,7 @@ class Transaction extends Base
|
|
391 |
|
392 |
$addOnArray = [];
|
393 |
if (isset($transactionAttribs['addOns'])) {
|
394 |
-
foreach ($transactionAttribs['addOns']
|
395 |
$addOnArray[] = AddOn::factory($addOn);
|
396 |
}
|
397 |
}
|
@@ -399,7 +381,7 @@ class Transaction extends Base
|
|
399 |
|
400 |
$discountArray = [];
|
401 |
if (isset($transactionAttribs['discounts'])) {
|
402 |
-
foreach ($transactionAttribs['discounts']
|
403 |
$discountArray[] = Discount::factory($discount);
|
404 |
}
|
405 |
}
|
@@ -407,32 +389,29 @@ class Transaction extends Base
|
|
407 |
|
408 |
$authorizationAdjustments = [];
|
409 |
if (isset($transactionAttribs['authorizationAdjustments'])) {
|
410 |
-
foreach ($transactionAttribs['authorizationAdjustments']
|
411 |
$authorizationAdjustments[] = AuthorizationAdjustment::factory($authorizationAdjustment);
|
412 |
}
|
413 |
}
|
414 |
|
415 |
$this->_set('authorizationAdjustments', $authorizationAdjustments);
|
416 |
|
417 |
-
if(isset($transactionAttribs['riskData'])) {
|
418 |
$this->_set('riskData', RiskData::factory($transactionAttribs['riskData']));
|
419 |
}
|
420 |
-
if(isset($transactionAttribs['threeDSecureInfo'])) {
|
421 |
$this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($transactionAttribs['threeDSecureInfo']));
|
422 |
}
|
423 |
-
if(isset($transactionAttribs['facilitatedDetails'])) {
|
424 |
$this->_set('facilitatedDetails', FacilitatedDetails::factory($transactionAttribs['facilitatedDetails']));
|
425 |
}
|
426 |
-
if(isset($transactionAttribs['facilitatorDetails'])) {
|
427 |
$this->_set('facilitatorDetails', FacilitatorDetails::factory($transactionAttribs['facilitatorDetails']));
|
428 |
}
|
429 |
}
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
* @return string
|
434 |
-
*/
|
435 |
-
public function __toString()
|
436 |
{
|
437 |
// array of attributes to print
|
438 |
$display = [
|
@@ -441,56 +420,76 @@ class Transaction extends Base
|
|
441 |
];
|
442 |
|
443 |
$displayAttributes = [];
|
444 |
-
foreach ($display
|
445 |
$displayAttributes[$attrib] = $this->$attrib;
|
446 |
}
|
447 |
return __CLASS__ . '[' .
|
448 |
-
Util::attributesToString($displayAttributes) .']';
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
public function isEqual($otherTx)
|
452 |
{
|
453 |
return $this->id === $otherTx->id;
|
454 |
}
|
455 |
|
|
|
|
|
456 |
public function vaultCreditCard()
|
457 |
{
|
458 |
$token = $this->creditCardDetails->token;
|
459 |
if (empty($token)) {
|
460 |
return null;
|
461 |
-
}
|
462 |
-
else {
|
463 |
return CreditCard::find($token);
|
464 |
}
|
465 |
}
|
466 |
|
467 |
-
|
|
|
468 |
public function vaultCustomer()
|
469 |
{
|
470 |
$customerId = $this->customerDetails->id;
|
471 |
if (empty($customerId)) {
|
472 |
return null;
|
473 |
-
}
|
474 |
-
else {
|
475 |
return Customer::find($customerId);
|
476 |
}
|
477 |
}
|
478 |
|
479 |
-
/**
|
480 |
-
|
|
|
|
|
|
|
|
|
|
|
481 |
return $this->disbursementDetails->isValid();
|
482 |
}
|
483 |
|
484 |
-
/**
|
485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
return Configuration::gateway()->transactionLineItem()->findAll($this->id);
|
487 |
}
|
488 |
|
489 |
/**
|
490 |
-
*
|
491 |
-
*
|
|
|
492 |
*
|
493 |
-
* @ignore
|
494 |
* @return Transaction
|
495 |
*/
|
496 |
public static function factory($attributes)
|
@@ -500,107 +499,287 @@ class Transaction extends Base
|
|
500 |
return $instance;
|
501 |
}
|
502 |
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
{
|
508 |
-
return Configuration::gateway()->transaction()->
|
509 |
}
|
510 |
|
511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
{
|
513 |
-
return Configuration::gateway()->transaction()->
|
514 |
}
|
515 |
|
|
|
516 |
public static function createTransactionUrl()
|
517 |
{
|
518 |
return Configuration::gateway()->transaction()->createTransactionUrl();
|
519 |
}
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
public static function credit($attribs)
|
522 |
{
|
523 |
return Configuration::gateway()->transaction()->credit($attribs);
|
524 |
}
|
525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
public static function creditNoValidate($attribs)
|
527 |
{
|
528 |
return Configuration::gateway()->transaction()->creditNoValidate($attribs);
|
529 |
}
|
530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
public static function find($id)
|
532 |
{
|
533 |
return Configuration::gateway()->transaction()->find($id);
|
534 |
}
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
public static function sale($attribs)
|
537 |
{
|
538 |
return Configuration::gateway()->transaction()->sale($attribs);
|
539 |
}
|
540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
public static function saleNoValidate($attribs)
|
542 |
{
|
543 |
return Configuration::gateway()->transaction()->saleNoValidate($attribs);
|
544 |
}
|
545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
public static function search($query)
|
547 |
{
|
548 |
return Configuration::gateway()->transaction()->search($query);
|
549 |
}
|
550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
public static function fetch($query, $ids)
|
552 |
{
|
553 |
return Configuration::gateway()->transaction()->fetch($query, $ids);
|
554 |
}
|
555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
public static function void($transactionId)
|
557 |
{
|
558 |
return Configuration::gateway()->transaction()->void($transactionId);
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
public static function voidNoValidate($transactionId)
|
562 |
{
|
563 |
return Configuration::gateway()->transaction()->voidNoValidate($transactionId);
|
564 |
}
|
565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
public static function submitForSettlement($transactionId, $amount = null, $attribs = [])
|
567 |
{
|
568 |
return Configuration::gateway()->transaction()->submitForSettlement($transactionId, $amount, $attribs);
|
569 |
}
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
public static function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
|
572 |
{
|
|
|
573 |
return Configuration::gateway()->transaction()->submitForSettlementNoValidate($transactionId, $amount, $attribs);
|
574 |
}
|
575 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
public static function updateDetails($transactionId, $attribs = [])
|
577 |
{
|
578 |
return Configuration::gateway()->transaction()->updateDetails($transactionId, $attribs);
|
579 |
}
|
580 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
public static function submitForPartialSettlement($transactionId, $amount, $attribs = [])
|
582 |
{
|
583 |
return Configuration::gateway()->transaction()->submitForPartialSettlement($transactionId, $amount, $attribs);
|
584 |
}
|
585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
public static function holdInEscrow($transactionId)
|
587 |
{
|
588 |
return Configuration::gateway()->transaction()->holdInEscrow($transactionId);
|
589 |
}
|
590 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
public static function releaseFromEscrow($transactionId)
|
592 |
{
|
593 |
return Configuration::gateway()->transaction()->releaseFromEscrow($transactionId);
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
public static function cancelRelease($transactionId)
|
597 |
{
|
598 |
return Configuration::gateway()->transaction()->cancelRelease($transactionId);
|
599 |
}
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
public static function refund($transactionId, $amount = null)
|
602 |
{
|
603 |
return Configuration::gateway()->transaction()->refund($transactionId, $amount);
|
604 |
}
|
605 |
}
|
606 |
-
class_alias('Braintree\Transaction', 'Braintree_Transaction');
|
1 |
<?php
|
2 |
+
|
3 |
+
// phpcs:disable Generic.Files.LineLength
|
4 |
namespace Braintree;
|
5 |
|
6 |
/**
|
7 |
+
* Braintree Transaction processor creates and manages transactions
|
|
|
8 |
*
|
9 |
* At minimum, an amount, credit card number, and
|
10 |
* credit card expiration date are required.
|
134 |
* ));
|
135 |
* </code>
|
136 |
*
|
137 |
+
* For more detailed information on Transactions, see {@link https://developer.paypal.com/braintree/docs/reference/response/transaction our developer docs}
|
138 |
+
// phpcs:enable Generic.Files.LineLength
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
*/
|
|
|
140 |
class Transaction extends Base
|
141 |
{
|
142 |
// Transaction Status
|
181 |
const CVV = 'cvv';
|
182 |
const DUPLICATE = 'duplicate';
|
183 |
const FRAUD = 'fraud';
|
184 |
+
const RISK_THRESHOLD = 'risk_threshold';
|
185 |
const THREE_D_SECURE = 'three_d_secure';
|
186 |
+
const TOKEN_ISSUANCE = 'token_issuance';
|
187 |
const APPLICATION_INCOMPLETE = 'application_incomplete';
|
188 |
|
189 |
// Industry Types
|
190 |
const LODGING_INDUSTRY = 'lodging';
|
191 |
const TRAVEL_AND_CRUISE_INDUSTRY = 'travel_cruise';
|
192 |
+
const TRAVEL_AND_FLIGHT_INDUSTRY = 'travel_flight';
|
193 |
+
|
194 |
+
// Additional Charge Types
|
195 |
+
const RESTAURANT = 'lodging';
|
196 |
+
const GIFT_SHOP = 'gift_shop';
|
197 |
+
const MINI_BAR = 'mini_bar';
|
198 |
+
const TELEPHONE = 'telephone';
|
199 |
+
const LAUNDRY = 'laundry';
|
200 |
+
const OTHER = 'other';
|
201 |
|
202 |
/**
|
203 |
* sets instance properties from an array of values
|
204 |
*
|
|
|
|
|
205 |
* @param array $transactionAttribs array of transaction data
|
206 |
+
*
|
207 |
* @return void
|
208 |
*/
|
209 |
protected function _initialize($transactionAttribs)
|
211 |
$this->_attributes = $transactionAttribs;
|
212 |
|
213 |
if (isset($transactionAttribs['applePay'])) {
|
214 |
+
$this->_set(
|
215 |
+
'applePayCardDetails',
|
216 |
new Transaction\ApplePayCardDetails(
|
217 |
$transactionAttribs['applePay']
|
218 |
)
|
219 |
);
|
220 |
}
|
221 |
|
222 |
+
// Rename androidPayCard from API responses to GooglePayCard
|
223 |
if (isset($transactionAttribs['androidPayCard'])) {
|
224 |
+
$this->_set(
|
225 |
+
'googlePayCardDetails',
|
226 |
+
new Transaction\GooglePayCardDetails(
|
227 |
$transactionAttribs['androidPayCard']
|
228 |
)
|
229 |
);
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
if (isset($transactionAttribs['visaCheckoutCard'])) {
|
233 |
+
$this->_set(
|
234 |
+
'visaCheckoutCardDetails',
|
235 |
new Transaction\VisaCheckoutCardDetails(
|
236 |
$transactionAttribs['visaCheckoutCard']
|
237 |
)
|
238 |
);
|
239 |
}
|
240 |
|
241 |
+
if (isset($transactionAttribs['samsungPayCard'])) {
|
242 |
+
$this->_set(
|
243 |
+
'samsungPayCardDetails',
|
244 |
+
new Transaction\SamsungPayCardDetails(
|
245 |
+
$transactionAttribs['samsungPayCard']
|
246 |
)
|
247 |
);
|
248 |
}
|
249 |
|
250 |
if (isset($transactionAttribs['venmoAccount'])) {
|
251 |
+
$this->_set(
|
252 |
+
'venmoAccountDetails',
|
253 |
new Transaction\VenmoAccountDetails(
|
254 |
$transactionAttribs['venmoAccount']
|
255 |
)
|
257 |
}
|
258 |
|
259 |
if (isset($transactionAttribs['creditCard'])) {
|
260 |
+
$this->_set(
|
261 |
+
'creditCardDetails',
|
262 |
new Transaction\CreditCardDetails(
|
263 |
$transactionAttribs['creditCard']
|
264 |
)
|
265 |
);
|
266 |
}
|
267 |
|
268 |
+
if (isset($transactionAttribs['usBankAccount'])) {
|
269 |
+
$this->_set(
|
270 |
+
'usBankAccount',
|
271 |
+
new Transaction\UsBankAccountDetails(
|
272 |
+
$transactionAttribs['usBankAccount']
|
273 |
)
|
274 |
);
|
275 |
}
|
276 |
|
277 |
+
if (isset($transactionAttribs['paypal'])) {
|
278 |
+
$this->_set(
|
279 |
+
'paypalDetails',
|
280 |
+
new Transaction\PayPalDetails(
|
281 |
+
$transactionAttribs['paypal']
|
282 |
)
|
283 |
);
|
284 |
}
|
285 |
|
286 |
+
if (isset($transactionAttribs['paypalHere'])) {
|
287 |
+
$this->_set(
|
288 |
+
'paypalHereDetails',
|
289 |
+
new Transaction\PayPalHereDetails(
|
290 |
+
$transactionAttribs['paypalHere']
|
291 |
)
|
292 |
);
|
293 |
}
|
294 |
|
295 |
+
if (isset($transactionAttribs['localPayment'])) {
|
296 |
+
$this->_set(
|
297 |
+
'localPaymentDetails',
|
298 |
+
new Transaction\LocalPaymentDetails(
|
299 |
+
$transactionAttribs['localPayment']
|
300 |
)
|
301 |
);
|
302 |
}
|
303 |
|
304 |
if (isset($transactionAttribs['customer'])) {
|
305 |
+
$this->_set(
|
306 |
+
'customerDetails',
|
307 |
new Transaction\CustomerDetails(
|
308 |
$transactionAttribs['customer']
|
309 |
)
|
311 |
}
|
312 |
|
313 |
if (isset($transactionAttribs['billing'])) {
|
314 |
+
$this->_set(
|
315 |
+
'billingDetails',
|
316 |
new Transaction\AddressDetails(
|
317 |
$transactionAttribs['billing']
|
318 |
)
|
320 |
}
|
321 |
|
322 |
if (isset($transactionAttribs['shipping'])) {
|
323 |
+
$this->_set(
|
324 |
+
'shippingDetails',
|
325 |
new Transaction\AddressDetails(
|
326 |
$transactionAttribs['shipping']
|
327 |
)
|
329 |
}
|
330 |
|
331 |
if (isset($transactionAttribs['subscription'])) {
|
332 |
+
$this->_set(
|
333 |
+
'subscriptionDetails',
|
334 |
new Transaction\SubscriptionDetails(
|
335 |
$transactionAttribs['subscription']
|
336 |
)
|
338 |
}
|
339 |
|
340 |
if (isset($transactionAttribs['descriptor'])) {
|
341 |
+
$this->_set(
|
342 |
+
'descriptor',
|
343 |
new Descriptor(
|
344 |
$transactionAttribs['descriptor']
|
345 |
)
|
347 |
}
|
348 |
|
349 |
if (isset($transactionAttribs['disbursementDetails'])) {
|
350 |
+
$this->_set(
|
351 |
+
'disbursementDetails',
|
352 |
new DisbursementDetails($transactionAttribs['disbursementDetails'])
|
353 |
);
|
354 |
}
|
355 |
|
356 |
$disputes = [];
|
357 |
if (isset($transactionAttribs['disputes'])) {
|
358 |
+
foreach ($transactionAttribs['disputes'] as $dispute) {
|
359 |
$disputes[] = Dispute::factory($dispute);
|
360 |
}
|
361 |
}
|
364 |
|
365 |
$statusHistory = [];
|
366 |
if (isset($transactionAttribs['statusHistory'])) {
|
367 |
+
foreach ($transactionAttribs['statusHistory'] as $history) {
|
368 |
$statusHistory[] = new Transaction\StatusDetails($history);
|
369 |
}
|
370 |
}
|
373 |
|
374 |
$addOnArray = [];
|
375 |
if (isset($transactionAttribs['addOns'])) {
|
376 |
+
foreach ($transactionAttribs['addOns'] as $addOn) {
|
377 |
$addOnArray[] = AddOn::factory($addOn);
|
378 |
}
|
379 |
}
|
381 |
|
382 |
$discountArray = [];
|
383 |
if (isset($transactionAttribs['discounts'])) {
|
384 |
+
foreach ($transactionAttribs['discounts'] as $discount) {
|
385 |
$discountArray[] = Discount::factory($discount);
|
386 |
}
|
387 |
}
|
389 |
|
390 |
$authorizationAdjustments = [];
|
391 |
if (isset($transactionAttribs['authorizationAdjustments'])) {
|
392 |
+
foreach ($transactionAttribs['authorizationAdjustments'] as $authorizationAdjustment) {
|
393 |
$authorizationAdjustments[] = AuthorizationAdjustment::factory($authorizationAdjustment);
|
394 |
}
|
395 |
}
|
396 |
|
397 |
$this->_set('authorizationAdjustments', $authorizationAdjustments);
|
398 |
|
399 |
+
if (isset($transactionAttribs['riskData'])) {
|
400 |
$this->_set('riskData', RiskData::factory($transactionAttribs['riskData']));
|
401 |
}
|
402 |
+
if (isset($transactionAttribs['threeDSecureInfo'])) {
|
403 |
$this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($transactionAttribs['threeDSecureInfo']));
|
404 |
}
|
405 |
+
if (isset($transactionAttribs['facilitatedDetails'])) {
|
406 |
$this->_set('facilitatedDetails', FacilitatedDetails::factory($transactionAttribs['facilitatedDetails']));
|
407 |
}
|
408 |
+
if (isset($transactionAttribs['facilitatorDetails'])) {
|
409 |
$this->_set('facilitatorDetails', FacilitatorDetails::factory($transactionAttribs['facilitatorDetails']));
|
410 |
}
|
411 |
}
|
412 |
|
413 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
414 |
+
public function __toString()
|
|
|
|
|
|
|
415 |
{
|
416 |
// array of attributes to print
|
417 |
$display = [
|
420 |
];
|
421 |
|
422 |
$displayAttributes = [];
|
423 |
+
foreach ($display as $attrib) {
|
424 |
$displayAttributes[$attrib] = $this->$attrib;
|
425 |
}
|
426 |
return __CLASS__ . '[' .
|
427 |
+
Util::attributesToString($displayAttributes) . ']';
|
428 |
}
|
429 |
|
430 |
+
/*
|
431 |
+
* Checks if one transaction's ID is the same as another transaction's Id.
|
432 |
+
*
|
433 |
+
* @param string $otherTx to be compared
|
434 |
+
*
|
435 |
+
* @return bool
|
436 |
+
*/
|
437 |
public function isEqual($otherTx)
|
438 |
{
|
439 |
return $this->id === $otherTx->id;
|
440 |
}
|
441 |
|
442 |
+
//NEXT_MAJOR_VERSION this function is only used for tests, the assertions this function provides are obfuscated.
|
443 |
+
//We should remove this function and update the tests to be more clear in what we're asserting.
|
444 |
public function vaultCreditCard()
|
445 |
{
|
446 |
$token = $this->creditCardDetails->token;
|
447 |
if (empty($token)) {
|
448 |
return null;
|
449 |
+
} else {
|
|
|
450 |
return CreditCard::find($token);
|
451 |
}
|
452 |
}
|
453 |
|
454 |
+
//NEXT_MAJOR_VERSION this function is only used for tests, the assertions this function provides are obfuscated.
|
455 |
+
//We should remove this function and update the tests to be more clear in what we're asserting.
|
456 |
public function vaultCustomer()
|
457 |
{
|
458 |
$customerId = $this->customerDetails->id;
|
459 |
if (empty($customerId)) {
|
460 |
return null;
|
461 |
+
} else {
|
|
|
462 |
return Customer::find($customerId);
|
463 |
}
|
464 |
}
|
465 |
|
466 |
+
/**
|
467 |
+
* Checks if transactions is disbursed
|
468 |
+
*
|
469 |
+
* @return boolean
|
470 |
+
*/
|
471 |
+
public function isDisbursed()
|
472 |
+
{
|
473 |
return $this->disbursementDetails->isValid();
|
474 |
}
|
475 |
|
476 |
+
/**
|
477 |
+
* Static methods redirecting to gateway class
|
478 |
+
*
|
479 |
+
* @see TransactionLineItemGateway::findAll()
|
480 |
+
*
|
481 |
+
* @return ResourceCollection of TransactionLineItem objects
|
482 |
+
*/
|
483 |
+
public function lineItems()
|
484 |
+
{
|
485 |
return Configuration::gateway()->transactionLineItem()->findAll($this->id);
|
486 |
}
|
487 |
|
488 |
/**
|
489 |
+
* Creates an instance from given attributes
|
490 |
+
*
|
491 |
+
* @param array $attributes response object attributes
|
492 |
*
|
|
|
493 |
* @return Transaction
|
494 |
*/
|
495 |
public static function factory($attributes)
|
499 |
return $instance;
|
500 |
}
|
501 |
|
502 |
+
/**
|
503 |
+
* Static methods redirecting to gateway class
|
504 |
+
*
|
505 |
+
* @param string $transactionId unique identifier
|
506 |
+
* @param string $amount to be adjusted
|
507 |
+
*
|
508 |
+
* @see TransactionGateway::adjustAuthorization()
|
509 |
+
*
|
510 |
+
* @return Transction|Result\Error
|
511 |
+
*/
|
512 |
+
public static function adjustAuthorization($transactionId, $amount)
|
513 |
{
|
514 |
+
return Configuration::gateway()->transaction()->adjustAuthorization($transactionId, $amount);
|
515 |
}
|
516 |
|
517 |
+
/**
|
518 |
+
* Static methods redirecting to gateway class
|
519 |
+
*
|
520 |
+
* @param string $transactionId to be cloned
|
521 |
+
* @param mixed $attribs containing any additional request parameters
|
522 |
+
*
|
523 |
+
* @see TransactionGateway::cloneTransaction()
|
524 |
+
*
|
525 |
+
* @return Transction|Result\Error
|
526 |
+
*/
|
527 |
+
public static function cloneTransaction($transactionId, $attribs)
|
528 |
{
|
529 |
+
return Configuration::gateway()->transaction()->cloneTransaction($transactionId, $attribs);
|
530 |
}
|
531 |
|
532 |
+
//NEXT_MAJOR_VERSION remove this function, it was only used for a Transparent Redirect test that no longer exists
|
533 |
public static function createTransactionUrl()
|
534 |
{
|
535 |
return Configuration::gateway()->transaction()->createTransactionUrl();
|
536 |
}
|
537 |
|
538 |
+
/**
|
539 |
+
* Static methods redirecting to gateway class
|
540 |
+
*
|
541 |
+
* @param mixed $attribs containing any request parameters
|
542 |
+
*
|
543 |
+
* @see TransactionGateway::credit()
|
544 |
+
*
|
545 |
+
* @return Result\Successful|Result\Error
|
546 |
+
*/
|
547 |
public static function credit($attribs)
|
548 |
{
|
549 |
return Configuration::gateway()->transaction()->credit($attribs);
|
550 |
}
|
551 |
|
552 |
+
/**
|
553 |
+
* Static methods redirecting to gateway class
|
554 |
+
*
|
555 |
+
* @param mixed $attribs containing any request parameters
|
556 |
+
*
|
557 |
+
* @see TransactionGateway::creditNoValidate()
|
558 |
+
*
|
559 |
+
* @return Transaction|Result\Error
|
560 |
+
*/
|
561 |
public static function creditNoValidate($attribs)
|
562 |
{
|
563 |
return Configuration::gateway()->transaction()->creditNoValidate($attribs);
|
564 |
}
|
565 |
|
566 |
+
/**
|
567 |
+
* Static methods redirecting to gateway class
|
568 |
+
*
|
569 |
+
* @param mixed $id unique identifier of the transaction to find
|
570 |
+
*
|
571 |
+
* @see TransactionGateway::find()
|
572 |
+
*
|
573 |
+
* @return Result\Successful|Exception\NotFound
|
574 |
+
*/
|
575 |
public static function find($id)
|
576 |
{
|
577 |
return Configuration::gateway()->transaction()->find($id);
|
578 |
}
|
579 |
|
580 |
+
/**
|
581 |
+
* Static methods redirecting to gateway class
|
582 |
+
*
|
583 |
+
* @param mixed $attribs containing any request parameters
|
584 |
+
*
|
585 |
+
* @see TransactionGateway::sale()
|
586 |
+
*
|
587 |
+
* @return Result\Successful|Exception\NotFound
|
588 |
+
*/
|
589 |
public static function sale($attribs)
|
590 |
{
|
591 |
return Configuration::gateway()->transaction()->sale($attribs);
|
592 |
}
|
593 |
|
594 |
+
/**
|
595 |
+
* Static methods redirecting to gateway class
|
596 |
+
*
|
597 |
+
* @param mixed $attribs containing any request parameters
|
598 |
+
*
|
599 |
+
* @see TransactionGateway::saleNoValidate()
|
600 |
+
*
|
601 |
+
* @return Transaction|Result\Error
|
602 |
+
*/
|
603 |
public static function saleNoValidate($attribs)
|
604 |
{
|
605 |
return Configuration::gateway()->transaction()->saleNoValidate($attribs);
|
606 |
}
|
607 |
|
608 |
+
/**
|
609 |
+
* Static methods redirecting to gateway class
|
610 |
+
*
|
611 |
+
* @param mixed $query containing search fields
|
612 |
+
*
|
613 |
+
* @see TransactionGateway::search()
|
614 |
+
*
|
615 |
+
* @return ResourceCollection of Transaction objects
|
616 |
+
*/
|
617 |
public static function search($query)
|
618 |
{
|
619 |
return Configuration::gateway()->transaction()->search($query);
|
620 |
}
|
621 |
|
622 |
+
/*
|
623 |
+
* Static methods redirecting to gateway class
|
624 |
+
*
|
625 |
+
* @param mixed $query of search fields
|
626 |
+
* @param array $ids to be fetched
|
627 |
+
*
|
628 |
+
* @see TransactionGateway::fetch()
|
629 |
+
*
|
630 |
+
* @return ResourceCollection of Transaction objects
|
631 |
+
*/
|
632 |
public static function fetch($query, $ids)
|
633 |
{
|
634 |
return Configuration::gateway()->transaction()->fetch($query, $ids);
|
635 |
}
|
636 |
|
637 |
+
/**
|
638 |
+
* Static methods redirecting to gateway class
|
639 |
+
*
|
640 |
+
* @param string $transactionId unque identifier of the transaction to be voided
|
641 |
+
*
|
642 |
+
* @see TransactionGateway::void()
|
643 |
+
*
|
644 |
+
* @return Result\Successful|Exception\NotFound
|
645 |
+
*/
|
646 |
public static function void($transactionId)
|
647 |
{
|
648 |
return Configuration::gateway()->transaction()->void($transactionId);
|
649 |
}
|
650 |
|
651 |
+
/**
|
652 |
+
* Static methods redirecting to gateway class
|
653 |
+
*
|
654 |
+
* @param string $transactionId unque identifier of the transaction to be voided
|
655 |
+
*
|
656 |
+
* @see TransactionGateway::voidNoValidate()
|
657 |
+
*
|
658 |
+
* @return Transaction|Result\Error
|
659 |
+
*/
|
660 |
public static function voidNoValidate($transactionId)
|
661 |
{
|
662 |
return Configuration::gateway()->transaction()->voidNoValidate($transactionId);
|
663 |
}
|
664 |
|
665 |
+
/**
|
666 |
+
* Static methods redirecting to gateway class
|
667 |
+
*
|
668 |
+
* @param string $transactionId unque identifier of the transaction to be submitted for settlement
|
669 |
+
* @param string $amount optional
|
670 |
+
* @param mixed $attribs any additional request parameters
|
671 |
+
*
|
672 |
+
* @see TransactionGateway::submitForSettlement()
|
673 |
+
*
|
674 |
+
* @return Result\Successful|Exception\NotFound
|
675 |
+
*/
|
676 |
public static function submitForSettlement($transactionId, $amount = null, $attribs = [])
|
677 |
{
|
678 |
return Configuration::gateway()->transaction()->submitForSettlement($transactionId, $amount, $attribs);
|
679 |
}
|
680 |
|
681 |
+
/**
|
682 |
+
* Static methods redirecting to gateway class
|
683 |
+
*
|
684 |
+
* @param string $transactionId unque identifier of the transaction to be submitted for settlement
|
685 |
+
* @param string $amount optional
|
686 |
+
* @param mixed $attribs any additional request parameters
|
687 |
+
*
|
688 |
+
* @see TransactionGateway::submitForSettlement()
|
689 |
+
*
|
690 |
+
* @return Transaction|Result\Error
|
691 |
+
*/
|
692 |
public static function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
|
693 |
{
|
694 |
+
// phpcs:ignore Generic.Files.LineLength
|
695 |
return Configuration::gateway()->transaction()->submitForSettlementNoValidate($transactionId, $amount, $attribs);
|
696 |
}
|
697 |
|
698 |
+
/**
|
699 |
+
* Static methods redirecting to gateway class
|
700 |
+
*
|
701 |
+
* @param string $transactionId to be updated
|
702 |
+
* @param array $attribs attributes to be updated in the request
|
703 |
+
*
|
704 |
+
* @see TransactionGateway::updateDetails()
|
705 |
+
*
|
706 |
+
* @return Result\Successful|Result\Error
|
707 |
+
*/
|
708 |
public static function updateDetails($transactionId, $attribs = [])
|
709 |
{
|
710 |
return Configuration::gateway()->transaction()->updateDetails($transactionId, $attribs);
|
711 |
}
|
712 |
|
713 |
+
/**
|
714 |
+
* Static methods redirecting to gateway class
|
715 |
+
*
|
716 |
+
* @param string $transactionId unque identifier of the transaction to be submitted for settlement
|
717 |
+
* @param string $amount optional
|
718 |
+
* @param mixed $attribs any additional request parameters
|
719 |
+
*
|
720 |
+
* @see TransactionGateway::submitForPartialSettlement()
|
721 |
+
*
|
722 |
+
* @return Result\Successful|Exception\NotFound
|
723 |
+
*/
|
724 |
public static function submitForPartialSettlement($transactionId, $amount, $attribs = [])
|
725 |
{
|
726 |
return Configuration::gateway()->transaction()->submitForPartialSettlement($transactionId, $amount, $attribs);
|
727 |
}
|
728 |
|
729 |
+
/**
|
730 |
+
* Static methods redirecting to gateway class
|
731 |
+
*
|
732 |
+
* @param string $transactionId unque identifier of the transaction to be held in escrow
|
733 |
+
*
|
734 |
+
* @see TransactionGateway::holdInEscrow()
|
735 |
+
*
|
736 |
+
* @return Result\Successful|Exception\NotFound
|
737 |
+
*/
|
738 |
public static function holdInEscrow($transactionId)
|
739 |
{
|
740 |
return Configuration::gateway()->transaction()->holdInEscrow($transactionId);
|
741 |
}
|
742 |
|
743 |
+
/**
|
744 |
+
* Static methods redirecting to gateway class
|
745 |
+
*
|
746 |
+
* @param string $transactionId unque identifier of the transaction to be released from escrow
|
747 |
+
*
|
748 |
+
* @see TransactionGateway::releaseFromEscrow()
|
749 |
+
*
|
750 |
+
* @return Result\Successful|Exception\NotFound
|
751 |
+
*/
|
752 |
public static function releaseFromEscrow($transactionId)
|
753 |
{
|
754 |
return Configuration::gateway()->transaction()->releaseFromEscrow($transactionId);
|
755 |
}
|
756 |
|
757 |
+
/**
|
758 |
+
* Static methods redirecting to gateway class
|
759 |
+
*
|
760 |
+
* @param string $transactionId unque identifier of the transaction whose escrow release is to be canceled
|
761 |
+
*
|
762 |
+
* @see TransactionGateway::cancelRelease()
|
763 |
+
*
|
764 |
+
* @return Result\Successful|Exception\NotFound
|
765 |
+
*/
|
766 |
public static function cancelRelease($transactionId)
|
767 |
{
|
768 |
return Configuration::gateway()->transaction()->cancelRelease($transactionId);
|
769 |
}
|
770 |
|
771 |
+
/**
|
772 |
+
* Static methods redirecting to gateway class
|
773 |
+
*
|
774 |
+
* @param string $transactionId unque identifier of the transaction to be refunded
|
775 |
+
* @param string $amount to be refunded, optional
|
776 |
+
*
|
777 |
+
* @see TransactionGateway::refund()
|
778 |
+
*
|
779 |
+
* @return Result\Successful|Exception\NotFound
|
780 |
+
*/
|
781 |
public static function refund($transactionId, $amount = null)
|
782 |
{
|
783 |
return Configuration::gateway()->transaction()->refund($transactionId, $amount);
|
784 |
}
|
785 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/AddressDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -6,22 +7,9 @@ use Braintree\Instance;
|
|
6 |
/**
|
7 |
* Creates an instance of AddressDetails as returned from a transaction
|
8 |
*
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $firstName
|
14 |
-
* @property-read string $lastName
|
15 |
-
* @property-read string $company
|
16 |
-
* @property-read string $streetAddress
|
17 |
-
* @property-read string $extendedAddress
|
18 |
-
* @property-read string $locality
|
19 |
-
* @property-read string $region
|
20 |
-
* @property-read string $postalCode
|
21 |
-
* @property-read string $countryName
|
22 |
*/
|
23 |
class AddressDetails extends Instance
|
24 |
{
|
25 |
protected $_attributes = [];
|
26 |
}
|
27 |
-
class_alias('Braintree\Transaction\AddressDetails', 'Braintree_Transaction_AddressDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
7 |
/**
|
8 |
* Creates an instance of AddressDetails as returned from a transaction
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class AddressDetails extends Instance
|
13 |
{
|
14 |
protected $_attributes = [];
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
/**
|
6 |
-
* Amex Express Checkout card details from a transaction
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
* @subpackage Transaction
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* creates an instance of AmexExpressCheckoutCardDetails
|
14 |
-
*
|
15 |
-
*
|
16 |
-
* @package Braintree
|
17 |
-
* @subpackage Transaction
|
18 |
-
*
|
19 |
-
* @property-read string $cardType
|
20 |
-
* @property-read string $bin
|
21 |
-
* @property-read string $cardMemberExpiryDate
|
22 |
-
* @property-read string $cardMemberNumber
|
23 |
-
* @property-read string $cardType
|
24 |
-
* @property-read string $sourceDescription
|
25 |
-
* @property-read string $token
|
26 |
-
* @property-read string $imageUrl
|
27 |
-
* @property-read string $expirationMonth
|
28 |
-
* @property-read string $expirationYear
|
29 |
-
* @uses Instance inherits methods
|
30 |
-
*/
|
31 |
-
class AmexExpressCheckoutCardDetails extends Instance
|
32 |
-
{
|
33 |
-
protected $_attributes = [];
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @ignore
|
37 |
-
*/
|
38 |
-
public function __construct($attributes)
|
39 |
-
{
|
40 |
-
parent::__construct($attributes);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
class_alias('Braintree\Transaction\AmexExpressCheckoutCardDetails', 'Braintree_Transaction_AmexExpressCheckoutCardDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/AndroidPayCardDetails.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Android Pay card details from a transaction
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Transaction
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* creates an instance of AndroidPayCardDetails
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @subpackage Transaction
|
19 |
-
*
|
20 |
-
* @property-read string $bin
|
21 |
-
* @property-read string $default
|
22 |
-
* @property-read string $expirationMonth
|
23 |
-
* @property-read string $expirationYear
|
24 |
-
* @property-read string $googleTransactionId
|
25 |
-
* @property-read string $imageUrl
|
26 |
-
* @property-read string $sourceCardLast4
|
27 |
-
* @property-read string $sourceCardType
|
28 |
-
* @property-read string $sourceDescription
|
29 |
-
* @property-read string $token
|
30 |
-
* @property-read string $virtualCardLast4
|
31 |
-
* @property-read string $virtualCardType
|
32 |
-
*/
|
33 |
-
class AndroidPayCardDetails extends Instance
|
34 |
-
{
|
35 |
-
protected $_attributes = [];
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @ignore
|
39 |
-
*/
|
40 |
-
public function __construct($attributes)
|
41 |
-
{
|
42 |
-
parent::__construct($attributes);
|
43 |
-
$this->_attributes['cardType'] = $this->virtualCardType;
|
44 |
-
$this->_attributes['last4'] = $this->virtualCardLast4;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
class_alias('Braintree\Transaction\AndroidPayCardDetails', 'Braintree_Transaction_AndroidPayCardDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/ApplePayCardDetails.php
CHANGED
@@ -1,39 +1,25 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
5 |
|
6 |
/**
|
7 |
* Apple Pay card details from a transaction
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Transaction
|
11 |
*/
|
12 |
|
13 |
/**
|
14 |
* creates an instance of ApplePayCardDetails
|
15 |
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @subpackage Transaction
|
19 |
-
*
|
20 |
-
* @property-read string $cardType
|
21 |
-
* @property-read string $paymentInstrumentName
|
22 |
-
* @property-read string $expirationMonth
|
23 |
-
* @property-read string $expirationYear
|
24 |
-
* @property-read string $cardholderName
|
25 |
-
* @property-read string $sourceDescription
|
26 |
*/
|
27 |
class ApplePayCardDetails extends Instance
|
28 |
{
|
29 |
protected $_attributes = [];
|
30 |
|
31 |
-
|
32 |
-
* @ignore
|
33 |
-
*/
|
34 |
public function __construct($attributes)
|
35 |
{
|
36 |
parent::__construct($attributes);
|
37 |
}
|
38 |
}
|
39 |
-
class_alias('Braintree\Transaction\ApplePayCardDetails', 'Braintree_Transaction_ApplePayCardDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
6 |
|
7 |
/**
|
8 |
* Apple Pay card details from a transaction
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* creates an instance of ApplePayCardDetails
|
13 |
*
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#apple_pay_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class ApplePayCardDetails extends Instance
|
17 |
{
|
18 |
protected $_attributes = [];
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
21 |
public function __construct($attributes)
|
22 |
{
|
23 |
parent::__construct($attributes);
|
24 |
}
|
25 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/CoinbaseDetails.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Coinbase details from a transaction
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Transaction
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* creates an instance of Coinbase
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @subpackage Transaction
|
19 |
-
*
|
20 |
-
* @property-read string $token
|
21 |
-
* @property-read string $userId
|
22 |
-
* @property-read string $userName
|
23 |
-
* @property-read string $userEmail
|
24 |
-
* @property-read string $imageUrl
|
25 |
-
*/
|
26 |
-
class CoinbaseDetails extends Instance
|
27 |
-
{
|
28 |
-
protected $_attributes = [];
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @ignore
|
32 |
-
*/
|
33 |
-
public function __construct($attributes)
|
34 |
-
{
|
35 |
-
parent::__construct($attributes);
|
36 |
-
}
|
37 |
-
}
|
38 |
-
class_alias('Braintree\Transaction\CoinbaseDetails', 'Braintree_Transaction_CoinbaseDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/CreditCardDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,33 +8,17 @@ use Braintree\Instance;
|
|
7 |
* CreditCard details from a transaction
|
8 |
* creates an instance of CreditCardDetails
|
9 |
*
|
10 |
-
* @
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $bin
|
14 |
-
* @property-read string $cardType
|
15 |
-
* @property-read string $cardholderName
|
16 |
-
* @property-read string $expirationDate
|
17 |
-
* @property-read string $expirationMonth
|
18 |
-
* @property-read string $expirationYear
|
19 |
-
* @property-read string $issuerLocation
|
20 |
-
* @property-read string $last4
|
21 |
-
* @property-read string $maskedNumber
|
22 |
-
* @property-read string $token
|
23 |
*/
|
24 |
class CreditCardDetails extends Instance
|
25 |
{
|
26 |
protected $_attributes = [];
|
27 |
|
28 |
-
|
29 |
-
* @ignore
|
30 |
-
*/
|
31 |
public function __construct($attributes)
|
32 |
{
|
33 |
parent::__construct($attributes);
|
34 |
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
35 |
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
36 |
-
|
37 |
}
|
38 |
}
|
39 |
-
class_alias('Braintree\Transaction\CreditCardDetails', 'Braintree_Transaction_CreditCardDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* CreditCard details from a transaction
|
9 |
* creates an instance of CreditCardDetails
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#credit_card_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class CreditCardDetails extends Instance
|
14 |
{
|
15 |
protected $_attributes = [];
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
18 |
public function __construct($attributes)
|
19 |
{
|
20 |
parent::__construct($attributes);
|
21 |
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
22 |
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
|
|
23 |
}
|
24 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/CustomerDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,19 +8,8 @@ use Braintree\Instance;
|
|
7 |
* Customer details from a transaction
|
8 |
* Creates an instance of customer details as returned from a transaction
|
9 |
*
|
10 |
-
* @
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $company
|
14 |
-
* @property-read string $email
|
15 |
-
* @property-read string $fax
|
16 |
-
* @property-read string $firstName
|
17 |
-
* @property-read string $id
|
18 |
-
* @property-read string $lastName
|
19 |
-
* @property-read string $phone
|
20 |
-
* @property-read string $website
|
21 |
*/
|
22 |
class CustomerDetails extends Instance
|
23 |
{
|
24 |
}
|
25 |
-
class_alias('Braintree\Transaction\CustomerDetails', 'Braintree_Transaction_CustomerDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* Customer details from a transaction
|
9 |
* Creates an instance of customer details as returned from a transaction
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#customer_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class CustomerDetails extends Instance
|
14 |
{
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/EuropeBankAccountDetails.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Europe bank account details from a transaction
|
8 |
-
* Creates an instance of europe bank account details as returned from a transaction
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $accountHolderName
|
14 |
-
* @property-read string $bic
|
15 |
-
* @property-read string $imageUrl
|
16 |
-
* @property-read string $mandateAcceptedAt
|
17 |
-
* @property-read string $mandateReferenceNumber
|
18 |
-
* @property-read string $maskedIban
|
19 |
-
* @property-read string $token
|
20 |
-
*/
|
21 |
-
class EuropeBankAccountDetails extends Instance
|
22 |
-
{
|
23 |
-
}
|
24 |
-
class_alias('Braintree\Transaction\EuropeBankAccountDetails', 'Braintree_Transaction_EuropeBankAccountDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/GooglePayCardDetails.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Transaction;
|
4 |
+
|
5 |
+
use Braintree\Instance;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Google Pay card details from a transaction
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* creates an instance of GooglePayCardDetails
|
13 |
+
*
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#android_pay_details developer docs} for information on attributes
|
15 |
+
*/
|
16 |
+
class GooglePayCardDetails extends Instance
|
17 |
+
{
|
18 |
+
protected $_attributes = [];
|
19 |
+
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
+
public function __construct($attributes)
|
22 |
+
{
|
23 |
+
parent::__construct($attributes);
|
24 |
+
$this->_attributes['cardType'] = $this->virtualCardType;
|
25 |
+
$this->_attributes['last4'] = $this->virtualCardLast4;
|
26 |
+
}
|
27 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/IdealPaymentDetails.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* iDEAL payment details from a transaction
|
8 |
-
* creates an instance of IdealPaymentDetails
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $idealPaymentId
|
14 |
-
* @property-read string $idealTransactionId
|
15 |
-
* @property-read string $imageUrl
|
16 |
-
* @property-read string $maskedIban
|
17 |
-
* @property-read string $bic
|
18 |
-
*/
|
19 |
-
class IdealPaymentDetails extends Instance
|
20 |
-
{
|
21 |
-
protected $_attributes = [];
|
22 |
-
}
|
23 |
-
class_alias('Braintree\Transaction\IdealPaymentDetails', 'Braintree_Transaction_IdealPaymentDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/LineItem.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
\class_exists('Braintree\TransactionLineItem');
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/LocalPaymentDetails.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Transaction;
|
4 |
+
|
5 |
+
use Braintree\Instance;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Local payment details from a transaction
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* creates an instance of LocalPaymentDetails
|
13 |
+
*
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction developer docs} for information on attributes
|
15 |
+
*/
|
16 |
+
class LocalPaymentDetails extends Instance
|
17 |
+
{
|
18 |
+
protected $_attributes = [];
|
19 |
+
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
+
public function __construct($attributes)
|
22 |
+
{
|
23 |
+
parent::__construct($attributes);
|
24 |
+
}
|
25 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/MasterpassCardDetails.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree\Transaction;
|
3 |
-
|
4 |
-
use Braintree\Instance;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* MasterpassCard details from a transaction
|
8 |
-
* creates an instance of MasterpassCardDetails
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $bin
|
14 |
-
* @property-read string $callId
|
15 |
-
* @property-read string $cardholderName
|
16 |
-
* @property-read string $commercial
|
17 |
-
* @property-read string $countryOfIssuance
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $customerLocation
|
20 |
-
* @property-read string $debit
|
21 |
-
* @property-read string $durbinRegulated
|
22 |
-
* @property-read string $expirationDate
|
23 |
-
* @property-read string $expirationMonth
|
24 |
-
* @property-read string $expirationYear
|
25 |
-
* @property-read string $healthcare
|
26 |
-
* @property-read string $imageUrl
|
27 |
-
* @property-read string $issuingBank
|
28 |
-
* @property-read string $last4
|
29 |
-
* @property-read string $maskedNumber
|
30 |
-
* @property-read string $payroll
|
31 |
-
* @property-read string $prepaid
|
32 |
-
* @property-read string $productId
|
33 |
-
* @property-read string $token
|
34 |
-
* @property-read string $updatedAt
|
35 |
-
*/
|
36 |
-
class MasterpassCardDetails extends Instance
|
37 |
-
{
|
38 |
-
protected $_attributes = [];
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @ignore
|
42 |
-
*/
|
43 |
-
public function __construct($attributes)
|
44 |
-
{
|
45 |
-
parent::__construct($attributes);
|
46 |
-
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
47 |
-
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
48 |
-
|
49 |
-
}
|
50 |
-
}
|
51 |
-
class_alias('Braintree\Transaction\MasterpassCardDetails', 'Braintree_Transaction_MasterpassCardDetails');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/PayPalDetails.php
CHANGED
@@ -1,41 +1,25 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
5 |
|
6 |
/**
|
7 |
* PayPal details from a transaction
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @subpackage Transaction
|
11 |
*/
|
12 |
|
13 |
/**
|
14 |
* creates an instance of PayPalDetails
|
15 |
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @subpackage Transaction
|
19 |
-
*
|
20 |
-
* @property-read string $payerEmail
|
21 |
-
* @property-read string $paymentId
|
22 |
-
* @property-read string $authorizationId
|
23 |
-
* @property-read string $token
|
24 |
-
* @property-read string $imageUrl
|
25 |
-
* @property-read string $transactionFeeAmount
|
26 |
-
* @property-read string $transactionFeeCurrencyIsoCode
|
27 |
-
* @property-read string $description
|
28 |
*/
|
29 |
class PayPalDetails extends Instance
|
30 |
{
|
31 |
protected $_attributes = [];
|
32 |
|
33 |
-
|
34 |
-
* @ignore
|
35 |
-
*/
|
36 |
public function __construct($attributes)
|
37 |
{
|
38 |
parent::__construct($attributes);
|
39 |
}
|
40 |
}
|
41 |
-
class_alias('Braintree\Transaction\PayPalDetails', 'Braintree_Transaction_PayPalDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
6 |
|
7 |
/**
|
8 |
* PayPal details from a transaction
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* creates an instance of PayPalDetails
|
13 |
*
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#paypal_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class PayPalDetails extends Instance
|
17 |
{
|
18 |
protected $_attributes = [];
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
21 |
public function __construct($attributes)
|
22 |
{
|
23 |
parent::__construct($attributes);
|
24 |
}
|
25 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/PayPalHereDetails.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Transaction;
|
4 |
+
|
5 |
+
use Braintree\Instance;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* PayPal Here details from a transaction
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* creates and instance of PayPalHereDetails
|
13 |
+
*
|
14 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#paypal_here_details developer docs} for information on attributes
|
15 |
+
*/
|
16 |
+
class PayPalHereDetails extends Instance
|
17 |
+
{
|
18 |
+
protected $_attributes = [];
|
19 |
+
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
21 |
+
public function __construct($attributes)
|
22 |
+
{
|
23 |
+
parent::__construct($attributes);
|
24 |
+
}
|
25 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/SamsungPayCardDetails.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree\Transaction;
|
4 |
+
|
5 |
+
use Braintree\Instance;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* SamsungPayCard details from a transaction
|
9 |
+
* creates an instance of SamsungPayCardDetails
|
10 |
+
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#samsung_pay_card_details developer docs} for information on attributes
|
12 |
+
*/
|
13 |
+
class SamsungPayCardDetails extends Instance
|
14 |
+
{
|
15 |
+
protected $_attributes = [];
|
16 |
+
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
18 |
+
public function __construct($attributes)
|
19 |
+
{
|
20 |
+
parent::__construct($attributes);
|
21 |
+
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
22 |
+
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
23 |
+
}
|
24 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/StatusDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,15 +8,8 @@ use Braintree\Instance;
|
|
7 |
* Status details from a transaction
|
8 |
* Creates an instance of StatusDetails, as part of a transaction response
|
9 |
*
|
10 |
-
* @
|
11 |
-
*
|
12 |
-
* @property-read string $amount
|
13 |
-
* @property-read string $status
|
14 |
-
* @property-read \DateTime $timestamp
|
15 |
-
* @property-read string $transactionSource
|
16 |
-
* @property-read string $user
|
17 |
*/
|
18 |
class StatusDetails extends Instance
|
19 |
{
|
20 |
}
|
21 |
-
class_alias('Braintree\Transaction\StatusDetails', 'Braintree_Transaction_StatusDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* Status details from a transaction
|
9 |
* Creates an instance of StatusDetails, as part of a transaction response
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#status_history developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class StatusDetails extends Instance
|
14 |
{
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/SubscriptionDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,13 +8,8 @@ use Braintree\Instance;
|
|
7 |
* Customer details from a transaction
|
8 |
* Creates an instance of customer details as returned from a transaction
|
9 |
*
|
10 |
-
* @
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $billing_period_start_date
|
14 |
-
* @property-read string $billing_period_end_date
|
15 |
*/
|
16 |
class SubscriptionDetails extends Instance
|
17 |
{
|
18 |
}
|
19 |
-
class_alias('Braintree\Transaction\SubscriptionDetails', 'Braintree_Transaction_SubscriptionDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* Customer details from a transaction
|
9 |
* Creates an instance of customer details as returned from a transaction
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#subscription_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class SubscriptionDetails extends Instance
|
14 |
{
|
15 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/UsBankAccountDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -8,25 +9,13 @@ use Braintree\AchMandate;
|
|
8 |
* US Bank Account details from a transaction
|
9 |
* creates an instance of UsbankAccountDetails
|
10 |
*
|
11 |
-
* @
|
12 |
-
* @subpackage Transaction
|
13 |
-
*
|
14 |
-
* @property-read string $token
|
15 |
-
* @property-read string $imageUrl
|
16 |
-
* @property-read string $routingNumber
|
17 |
-
* @property-read string $accountType
|
18 |
-
* @property-read string $accountHolderName
|
19 |
-
* @property-read string $last4
|
20 |
-
* @property-read string $bankName
|
21 |
-
* @property-read string $achMandate
|
22 |
*/
|
23 |
class UsBankAccountDetails extends Instance
|
24 |
{
|
25 |
protected $_attributes = [];
|
26 |
|
27 |
-
|
28 |
-
* @ignore
|
29 |
-
*/
|
30 |
public function __construct($attributes)
|
31 |
{
|
32 |
parent::__construct($attributes);
|
@@ -37,4 +26,3 @@ class UsBankAccountDetails extends Instance
|
|
37 |
$this->achMandate = $achMandate;
|
38 |
}
|
39 |
}
|
40 |
-
class_alias('Braintree\Transaction\UsBankAccountDetails', 'Braintree_Transaction_UsBankAccountDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
9 |
* US Bank Account details from a transaction
|
10 |
* creates an instance of UsbankAccountDetails
|
11 |
*
|
12 |
+
* See our {@link https://developer.paypal.com/braintree/docs/guides/ach/server-side developer docs} for more information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class UsBankAccountDetails extends Instance
|
15 |
{
|
16 |
protected $_attributes = [];
|
17 |
|
18 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
19 |
public function __construct($attributes)
|
20 |
{
|
21 |
parent::__construct($attributes);
|
26 |
$this->achMandate = $achMandate;
|
27 |
}
|
28 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/VenmoAccountDetails.php
CHANGED
@@ -1,38 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
5 |
-
/**
|
6 |
-
* Venmo account details from a transaction
|
7 |
-
*
|
8 |
-
* @package Braintree
|
9 |
-
* @subpackage Transaction
|
10 |
-
*/
|
11 |
|
12 |
/**
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
* @package Braintree
|
17 |
-
* @subpackage Transaction
|
18 |
*
|
19 |
-
* @
|
20 |
-
* @property-read string $token
|
21 |
-
* @property-read string $imageUrl
|
22 |
-
* @property-read string $username
|
23 |
-
* @property-read string $venmo_user_id
|
24 |
-
* @uses Instance inherits methods
|
25 |
*/
|
26 |
class VenmoAccountDetails extends Instance
|
27 |
{
|
28 |
protected $_attributes = array();
|
29 |
|
30 |
-
|
31 |
-
* @ignore
|
32 |
-
*/
|
33 |
public function __construct($attributes)
|
34 |
{
|
35 |
parent::__construct($attributes);
|
36 |
}
|
37 |
}
|
38 |
-
class_alias('Braintree\Transaction\VenmoAccountDetails', 'Braintree_Transaction_VenmoAccountDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
/**
|
8 |
+
* Venmo account details from a transaction
|
|
|
|
|
|
|
|
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#venmo_account_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class VenmoAccountDetails extends Instance
|
13 |
{
|
14 |
protected $_attributes = array();
|
15 |
|
16 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
17 |
public function __construct($attributes)
|
18 |
{
|
19 |
parent::__construct($attributes);
|
20 |
}
|
21 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Transaction/VisaCheckoutCardDetails.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Transaction;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -7,46 +8,17 @@ use Braintree\Instance;
|
|
7 |
* VisaCheckoutCard details from a transaction
|
8 |
* creates an instance of VisaCheckoutCardDetails
|
9 |
*
|
10 |
-
* @
|
11 |
-
* @subpackage Transaction
|
12 |
-
*
|
13 |
-
* @property-read string $bin
|
14 |
-
* @property-read string $callId
|
15 |
-
* @property-read string $cardType
|
16 |
-
* @property-read string $cardholderName
|
17 |
-
* @property-read string $commercial
|
18 |
-
* @property-read string $countryOfIssuance
|
19 |
-
* @property-read string $customerId
|
20 |
-
* @property-read string $customerLocation
|
21 |
-
* @property-read string $debit
|
22 |
-
* @property-read string $durbinRegulated
|
23 |
-
* @property-read string $expirationDate
|
24 |
-
* @property-read string $expirationMonth
|
25 |
-
* @property-read string $expirationYear
|
26 |
-
* @property-read string $healthcare
|
27 |
-
* @property-read string $imageUrl
|
28 |
-
* @property-read string $issuingBank
|
29 |
-
* @property-read string $last4
|
30 |
-
* @property-read string $maskedNumber
|
31 |
-
* @property-read string $payroll
|
32 |
-
* @property-read string $prepaid
|
33 |
-
* @property-read string $productId
|
34 |
-
* @property-read string $token
|
35 |
-
* @property-read string $updatedAt
|
36 |
*/
|
37 |
class VisaCheckoutCardDetails extends Instance
|
38 |
{
|
39 |
protected $_attributes = [];
|
40 |
|
41 |
-
|
42 |
-
* @ignore
|
43 |
-
*/
|
44 |
public function __construct($attributes)
|
45 |
{
|
46 |
parent::__construct($attributes);
|
47 |
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
48 |
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
49 |
-
|
50 |
}
|
51 |
}
|
52 |
-
class_alias('Braintree\Transaction\VisaCheckoutCardDetails', 'Braintree_Transaction_VisaCheckoutCardDetails');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Transaction;
|
4 |
|
5 |
use Braintree\Instance;
|
8 |
* VisaCheckoutCard details from a transaction
|
9 |
* creates an instance of VisaCheckoutCardDetails
|
10 |
*
|
11 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction#visa_checkout_card_details developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class VisaCheckoutCardDetails extends Instance
|
14 |
{
|
15 |
protected $_attributes = [];
|
16 |
|
17 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
18 |
public function __construct($attributes)
|
19 |
{
|
20 |
parent::__construct($attributes);
|
21 |
$this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
|
22 |
$this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
|
|
|
23 |
}
|
24 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TransactionGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -7,13 +8,8 @@ use InvalidArgumentException;
|
|
7 |
* Braintree TransactionGateway processor
|
8 |
* Creates and manages transactions
|
9 |
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
* For more detailed information on Transactions, see {@link https://developers.braintreepayments.com/reference/response/transaction/php https://developers.braintreepayments.com/reference/response/transaction/php}
|
14 |
-
*
|
15 |
-
* @package Braintree
|
16 |
-
* @category Resources
|
17 |
*/
|
18 |
|
19 |
class TransactionGateway
|
@@ -22,6 +18,7 @@ class TransactionGateway
|
|
22 |
private $_config;
|
23 |
private $_http;
|
24 |
|
|
|
25 |
public function __construct($gateway)
|
26 |
{
|
27 |
$this->_gateway = $gateway;
|
@@ -30,68 +27,43 @@ class TransactionGateway
|
|
30 |
$this->_http = new Http($gateway->config);
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public function cloneTransaction($transactionId, $attribs)
|
34 |
{
|
35 |
Util::verifyKeys(self::cloneSignature(), $attribs);
|
36 |
return $this->_doCreate('/transactions/' . $transactionId . '/clone', ['transactionClone' => $attribs]);
|
37 |
}
|
38 |
|
39 |
-
/**
|
40 |
-
* @ignore
|
41 |
-
* @access private
|
42 |
-
* @param array $attribs
|
43 |
-
* @return Result\Successful|Result\Error
|
44 |
-
*/
|
45 |
private function create($attribs)
|
46 |
{
|
47 |
Util::verifyKeys(self::createSignature(), $attribs);
|
|
|
48 |
return $this->_doCreate('/transactions', ['transaction' => $attribs]);
|
49 |
}
|
50 |
|
51 |
-
/**
|
52 |
-
* @ignore
|
53 |
-
* @access private
|
54 |
-
* @param array $attribs
|
55 |
-
* @return object
|
56 |
-
* @throws Exception\ValidationError
|
57 |
-
*/
|
58 |
private function createNoValidate($attribs)
|
59 |
{
|
60 |
$result = $this->create($attribs);
|
61 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
62 |
}
|
|
|
63 |
/**
|
|
|
64 |
*
|
65 |
-
* @
|
66 |
-
* @access public
|
67 |
-
* @param array $attribs
|
68 |
-
* @return object
|
69 |
-
*/
|
70 |
-
public function createFromTransparentRedirect($queryString)
|
71 |
-
{
|
72 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
|
73 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
74 |
-
$queryString
|
75 |
-
);
|
76 |
-
return $this->_doCreate(
|
77 |
-
'/transactions/all/confirm_transparent_redirect_request',
|
78 |
-
['id' => $params['id']]
|
79 |
-
);
|
80 |
-
}
|
81 |
-
/**
|
82 |
-
*
|
83 |
-
* @deprecated since version 2.3.0
|
84 |
-
* @access public
|
85 |
-
* @param none
|
86 |
-
* @return string
|
87 |
*/
|
88 |
-
public function createTransactionUrl()
|
89 |
-
{
|
90 |
-
trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
|
91 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath() .
|
92 |
-
'/transactions/all/create_via_transparent_redirect_request';
|
93 |
-
}
|
94 |
-
|
95 |
public static function cloneSignature()
|
96 |
{
|
97 |
return ['amount', 'channel', ['options' => ['submitForSettlement']]];
|
@@ -99,6 +71,7 @@ class TransactionGateway
|
|
99 |
|
100 |
/**
|
101 |
* creates a full array signature of a valid gateway request
|
|
|
102 |
* @return array gateway request signature format
|
103 |
*/
|
104 |
public static function createSignature()
|
@@ -109,12 +82,12 @@ class TransactionGateway
|
|
109 |
'channel',
|
110 |
'customerId',
|
111 |
'deviceData',
|
112 |
-
'
|
113 |
-
'fraudMerchantId',
|
114 |
'merchantAccountId',
|
115 |
'orderId',
|
116 |
'paymentMethodNonce',
|
117 |
'paymentMethodToken',
|
|
|
118 |
'purchaseOrderNumber',
|
119 |
'recurring',
|
120 |
'serviceFeeAmount',
|
@@ -127,17 +100,30 @@ class TransactionGateway
|
|
127 |
'taxAmount',
|
128 |
'taxExempt',
|
129 |
'threeDSecureToken',
|
|
|
130 |
'transactionSource',
|
131 |
'type',
|
132 |
'venmoSdkPaymentMethodCode',
|
|
|
133 |
'shippingAmount',
|
134 |
'discountAmount',
|
135 |
'shipsFromPostalCode',
|
136 |
['riskData' =>
|
137 |
-
[
|
|
|
|
|
138 |
],
|
139 |
['creditCard' =>
|
140 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
],
|
142 |
['customer' =>
|
143 |
[
|
@@ -148,21 +134,26 @@ class TransactionGateway
|
|
148 |
[
|
149 |
'firstName', 'lastName', 'company', 'countryName',
|
150 |
'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
|
151 |
-
'extendedAddress', 'locality', 'postalCode', 'region',
|
152 |
'streetAddress'],
|
153 |
],
|
154 |
['shipping' =>
|
155 |
[
|
156 |
'firstName', 'lastName', 'company', 'countryName',
|
157 |
'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
|
158 |
-
'extendedAddress', 'locality', 'postalCode', 'region',
|
159 |
-
'streetAddress'],
|
160 |
],
|
161 |
['threeDSecurePassThru' =>
|
162 |
[
|
163 |
'eciFlag',
|
164 |
'cavv',
|
165 |
-
'xid'
|
|
|
|
|
|
|
|
|
|
|
166 |
],
|
167 |
['options' =>
|
168 |
[
|
@@ -178,11 +169,10 @@ class TransactionGateway
|
|
178 |
'skipAdvancedFraudChecking',
|
179 |
'skipAvs',
|
180 |
'skipCvv',
|
181 |
-
['
|
182 |
-
['
|
183 |
],
|
184 |
-
|
185 |
-
['three_d_secure' =>
|
186 |
['required']
|
187 |
],
|
188 |
['paypal' =>
|
@@ -204,8 +194,6 @@ class TransactionGateway
|
|
204 |
],
|
205 |
['venmo' =>
|
206 |
[
|
207 |
-
# TODO: Snake case version included for backwards compatiblity. Remove in the next major version
|
208 |
-
'profile_id',
|
209 |
'profileId'
|
210 |
]
|
211 |
]
|
@@ -213,11 +201,17 @@ class TransactionGateway
|
|
213 |
],
|
214 |
['customFields' => ['_anyKey_']],
|
215 |
['descriptor' => ['name', 'phone', 'url']],
|
216 |
-
['paypalAccount' => ['payeeId', 'payeeEmail']],
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
['industry' =>
|
222 |
['industryType',
|
223 |
['data' =>
|
@@ -230,34 +224,156 @@ class TransactionGateway
|
|
230 |
'lodgingCheckInDate',
|
231 |
'lodgingCheckOutDate',
|
232 |
'lodgingName',
|
233 |
-
'roomRate'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
]
|
235 |
]
|
236 |
]
|
237 |
],
|
238 |
-
['lineItems' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
];
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
242 |
public static function submitForSettlementSignature()
|
243 |
{
|
244 |
-
return ['orderId', ['descriptor' => ['name', 'phone', 'url']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
247 |
public static function updateDetailsSignature()
|
248 |
{
|
249 |
return ['amount', 'orderId', ['descriptor' => ['name', 'phone', 'url']]];
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
252 |
public static function refundSignature()
|
253 |
{
|
254 |
-
return [
|
|
|
|
|
|
|
|
|
255 |
}
|
256 |
|
257 |
/**
|
|
|
|
|
|
|
258 |
*
|
259 |
-
* @access public
|
260 |
-
* @param array $attribs
|
261 |
* @return Result\Successful|Result\Error
|
262 |
*/
|
263 |
public function credit($attribs)
|
@@ -266,11 +382,11 @@ class TransactionGateway
|
|
266 |
}
|
267 |
|
268 |
/**
|
|
|
269 |
*
|
270 |
-
* @
|
271 |
-
*
|
272 |
-
* @return
|
273 |
-
* @throws Exception\ValidationError
|
274 |
*/
|
275 |
public function creditNoValidate($attribs)
|
276 |
{
|
@@ -279,9 +395,11 @@ class TransactionGateway
|
|
279 |
}
|
280 |
|
281 |
/**
|
282 |
-
*
|
283 |
-
*
|
284 |
-
* @
|
|
|
|
|
285 |
*/
|
286 |
public function find($id)
|
287 |
{
|
@@ -292,26 +410,31 @@ class TransactionGateway
|
|
292 |
return Transaction::factory($response['transaction']);
|
293 |
} catch (Exception\NotFound $e) {
|
294 |
throw new Exception\NotFound(
|
295 |
-
|
296 |
);
|
297 |
}
|
298 |
}
|
299 |
/**
|
300 |
-
* new sale
|
301 |
-
*
|
|
|
|
|
302 |
* @return Result\Successful|Result\Error
|
303 |
*/
|
304 |
public function sale($attribs)
|
305 |
{
|
|
|
|
|
|
|
306 |
return $this->create(array_merge(['type' => Transaction::SALE], $attribs));
|
307 |
}
|
308 |
|
309 |
/**
|
310 |
-
*
|
311 |
-
*
|
312 |
-
* @param
|
313 |
-
*
|
314 |
-
* @
|
315 |
*/
|
316 |
public function saleNoValidate($attribs)
|
317 |
{
|
@@ -324,12 +447,12 @@ class TransactionGateway
|
|
324 |
*
|
325 |
* If <b>query</b> is a string, the search will be a basic search.
|
326 |
* If <b>query</b> is a hash, the search will be an advanced search.
|
327 |
-
*
|
|
|
328 |
*
|
329 |
* @param mixed $query search query
|
330 |
-
*
|
331 |
* @return ResourceCollection
|
332 |
-
* @throws InvalidArgumentException
|
333 |
*/
|
334 |
public function search($query)
|
335 |
{
|
@@ -349,10 +472,18 @@ class TransactionGateway
|
|
349 |
|
350 |
return new ResourceCollection($response, $pager);
|
351 |
} else {
|
352 |
-
throw new Exception\
|
353 |
}
|
354 |
}
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
public function fetch($query, $ids)
|
357 |
{
|
358 |
$criteria = [];
|
@@ -369,26 +500,49 @@ class TransactionGateway
|
|
369 |
'transaction'
|
370 |
);
|
371 |
} else {
|
372 |
-
throw new Exception\
|
373 |
}
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
/**
|
377 |
* void a transaction by id
|
378 |
*
|
379 |
-
* @param string $
|
|
|
380 |
* @return Result\Successful|Result\Error
|
381 |
*/
|
382 |
public function void($transactionId)
|
383 |
{
|
384 |
$this->_validateId($transactionId);
|
385 |
|
386 |
-
$path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/void';
|
387 |
$response = $this->_http->put($path);
|
388 |
return $this->_verifyGatewayResponse($response);
|
389 |
}
|
|
|
390 |
/**
|
|
|
391 |
*
|
|
|
|
|
|
|
392 |
*/
|
393 |
public function voidNoValidate($transactionId)
|
394 |
{
|
@@ -396,44 +550,86 @@ class TransactionGateway
|
|
396 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
397 |
}
|
398 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
public function submitForSettlement($transactionId, $amount = null, $attribs = [])
|
400 |
{
|
401 |
$this->_validateId($transactionId);
|
402 |
Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
|
403 |
$attribs['amount'] = $amount;
|
404 |
|
405 |
-
$path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/submit_for_settlement';
|
406 |
$response = $this->_http->put($path, ['transaction' => $attribs]);
|
407 |
return $this->_verifyGatewayResponse($response);
|
408 |
}
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
public function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
|
411 |
{
|
412 |
$result = $this->submitForSettlement($transactionId, $amount, $attribs);
|
413 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
414 |
}
|
415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
public function updateDetails($transactionId, $attribs = [])
|
417 |
{
|
418 |
$this->_validateId($transactionId);
|
419 |
Util::verifyKeys(self::updateDetailsSignature(), $attribs);
|
420 |
|
421 |
-
$path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/update_details';
|
422 |
$response = $this->_http->put($path, ['transaction' => $attribs]);
|
423 |
return $this->_verifyGatewayResponse($response);
|
424 |
}
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
public function submitForPartialSettlement($transactionId, $amount, $attribs = [])
|
427 |
{
|
428 |
$this->_validateId($transactionId);
|
429 |
Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
|
430 |
$attribs['amount'] = $amount;
|
431 |
|
432 |
-
$path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/submit_for_partial_settlement';
|
433 |
$response = $this->_http->post($path, ['transaction' => $attribs]);
|
434 |
return $this->_verifyGatewayResponse($response);
|
435 |
}
|
436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
public function holdInEscrow($transactionId)
|
438 |
{
|
439 |
$this->_validateId($transactionId);
|
@@ -443,6 +639,13 @@ class TransactionGateway
|
|
443 |
return $this->_verifyGatewayResponse($response);
|
444 |
}
|
445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
public function releaseFromEscrow($transactionId)
|
447 |
{
|
448 |
$this->_validateId($transactionId);
|
@@ -452,6 +655,13 @@ class TransactionGateway
|
|
452 |
return $this->_verifyGatewayResponse($response);
|
453 |
}
|
454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
public function cancelRelease($transactionId)
|
456 |
{
|
457 |
$this->_validateId($transactionId);
|
@@ -461,11 +671,19 @@ class TransactionGateway
|
|
461 |
return $this->_verifyGatewayResponse($response);
|
462 |
}
|
463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
public function refund($transactionId, $amount_or_options = null)
|
465 |
{
|
466 |
self::_validateId($transactionId);
|
467 |
|
468 |
-
if(gettype($amount_or_options) == "array") {
|
469 |
$options = $amount_or_options;
|
470 |
} else {
|
471 |
$options = [
|
@@ -480,14 +698,7 @@ class TransactionGateway
|
|
480 |
return $this->_verifyGatewayResponse($response);
|
481 |
}
|
482 |
|
483 |
-
|
484 |
-
* sends the create request to the gateway
|
485 |
-
*
|
486 |
-
* @ignore
|
487 |
-
* @param var $subPath
|
488 |
-
* @param array $params
|
489 |
-
* @return Result\Successful|Result\Error
|
490 |
-
*/
|
491 |
public function _doCreate($subPath, $params)
|
492 |
{
|
493 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
@@ -498,20 +709,19 @@ class TransactionGateway
|
|
498 |
|
499 |
/**
|
500 |
* verifies that a valid transaction id is being used
|
501 |
-
*
|
502 |
* @param string transaction id
|
|
|
503 |
* @throws InvalidArgumentException
|
|
|
|
|
504 |
*/
|
505 |
-
private function _validateId($id = null)
|
|
|
506 |
if (empty($id)) {
|
507 |
-
throw new InvalidArgumentException(
|
508 |
-
'expected transaction id to be set'
|
509 |
-
);
|
510 |
-
}
|
511 |
-
if (!preg_match('/^[0-9a-z]+$/', $id)) {
|
512 |
throw new InvalidArgumentException(
|
513 |
-
|
514 |
-
|
515 |
}
|
516 |
}
|
517 |
|
@@ -523,25 +733,25 @@ class TransactionGateway
|
|
523 |
* encapsulates a Errors object inside a Result\Error
|
524 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
525 |
*
|
526 |
-
* @ignore
|
527 |
* @param array $response gateway response values
|
528 |
-
*
|
529 |
* @throws Exception\Unexpected
|
|
|
|
|
530 |
*/
|
531 |
private function _verifyGatewayResponse($response)
|
532 |
{
|
533 |
if (isset($response['transaction'])) {
|
534 |
// return a populated instance of Transaction
|
535 |
return new Result\Successful(
|
536 |
-
|
537 |
);
|
538 |
-
}
|
539 |
return new Result\Error($response['apiErrorResponse']);
|
540 |
} else {
|
541 |
throw new Exception\Unexpected(
|
542 |
-
|
543 |
);
|
544 |
}
|
545 |
}
|
546 |
}
|
547 |
-
class_alias('Braintree\TransactionGateway', 'Braintree_TransactionGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
8 |
* Braintree TransactionGateway processor
|
9 |
* Creates and manages transactions
|
10 |
*
|
11 |
+
* // phpcs:ignore Generic.Files.LineLength
|
12 |
+
* For more detailed information on Transactions, see {@link https://developer.paypal.com/braintree/docs/reference/response/transaction/php our developer docs}
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
|
15 |
class TransactionGateway
|
18 |
private $_config;
|
19 |
private $_http;
|
20 |
|
21 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
22 |
public function __construct($gateway)
|
23 |
{
|
24 |
$this->_gateway = $gateway;
|
27 |
$this->_http = new Http($gateway->config);
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* Create a new transaction by copying all the attributes, except amount, of the original transaction
|
32 |
+
*
|
33 |
+
* Instead of cloning transactions, a better practice in most cases is to use the Vault to save and reuse payment method or customer information
|
34 |
+
*
|
35 |
+
* @param string $transactionId to be cloned
|
36 |
+
* @param mixed $attribs containing additional request parameters
|
37 |
+
*
|
38 |
+
* @see PaymentMethodGateway
|
39 |
+
* @see CustomerGateway
|
40 |
+
*
|
41 |
+
* @return Result\Successful|Result\Error
|
42 |
+
*/
|
43 |
public function cloneTransaction($transactionId, $attribs)
|
44 |
{
|
45 |
Util::verifyKeys(self::cloneSignature(), $attribs);
|
46 |
return $this->_doCreate('/transactions/' . $transactionId . '/clone', ['transactionClone' => $attribs]);
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
private function create($attribs)
|
50 |
{
|
51 |
Util::verifyKeys(self::createSignature(), $attribs);
|
52 |
+
$attribs = Util::replaceKey($attribs, 'googlePayCard', 'androidPayCard');
|
53 |
return $this->_doCreate('/transactions', ['transaction' => $attribs]);
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
private function createNoValidate($attribs)
|
57 |
{
|
58 |
$result = $this->create($attribs);
|
59 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
60 |
}
|
61 |
+
|
62 |
/**
|
63 |
+
* creates a full array signature of a valid gateway request
|
64 |
*
|
65 |
+
* @return array gateway request signature format
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
public static function cloneSignature()
|
68 |
{
|
69 |
return ['amount', 'channel', ['options' => ['submitForSettlement']]];
|
71 |
|
72 |
/**
|
73 |
* creates a full array signature of a valid gateway request
|
74 |
+
*
|
75 |
* @return array gateway request signature format
|
76 |
*/
|
77 |
public static function createSignature()
|
82 |
'channel',
|
83 |
'customerId',
|
84 |
'deviceData',
|
85 |
+
'exchangeRateQuoteId',
|
|
|
86 |
'merchantAccountId',
|
87 |
'orderId',
|
88 |
'paymentMethodNonce',
|
89 |
'paymentMethodToken',
|
90 |
+
'productSku',
|
91 |
'purchaseOrderNumber',
|
92 |
'recurring',
|
93 |
'serviceFeeAmount',
|
100 |
'taxAmount',
|
101 |
'taxExempt',
|
102 |
'threeDSecureToken',
|
103 |
+
'threeDSecureAuthenticationId',
|
104 |
'transactionSource',
|
105 |
'type',
|
106 |
'venmoSdkPaymentMethodCode',
|
107 |
+
'scaExemption',
|
108 |
'shippingAmount',
|
109 |
'discountAmount',
|
110 |
'shipsFromPostalCode',
|
111 |
['riskData' =>
|
112 |
+
[
|
113 |
+
'customerBrowser', 'customerIp', 'customerDeviceId',
|
114 |
+
'customerLocationZip', 'customerTenure'],
|
115 |
],
|
116 |
['creditCard' =>
|
117 |
+
[
|
118 |
+
'token',
|
119 |
+
'cardholderName',
|
120 |
+
'cvv',
|
121 |
+
'expirationDate',
|
122 |
+
'expirationMonth',
|
123 |
+
'expirationYear',
|
124 |
+
'number',
|
125 |
+
['paymentReaderCardDetails' => ['encryptedCardData', 'keySerialNumber']],
|
126 |
+
],
|
127 |
],
|
128 |
['customer' =>
|
129 |
[
|
134 |
[
|
135 |
'firstName', 'lastName', 'company', 'countryName',
|
136 |
'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
|
137 |
+
'extendedAddress', 'locality', 'phoneNumber', 'postalCode', 'region',
|
138 |
'streetAddress'],
|
139 |
],
|
140 |
['shipping' =>
|
141 |
[
|
142 |
'firstName', 'lastName', 'company', 'countryName',
|
143 |
'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
|
144 |
+
'extendedAddress', 'locality', 'phoneNumber', 'postalCode', 'region',
|
145 |
+
'shippingMethod', 'streetAddress'],
|
146 |
],
|
147 |
['threeDSecurePassThru' =>
|
148 |
[
|
149 |
'eciFlag',
|
150 |
'cavv',
|
151 |
+
'xid',
|
152 |
+
'threeDSecureVersion',
|
153 |
+
'authenticationResponse',
|
154 |
+
'directoryResponse',
|
155 |
+
'cavvAlgorithm',
|
156 |
+
'dsTransactionId'],
|
157 |
],
|
158 |
['options' =>
|
159 |
[
|
169 |
'skipAdvancedFraudChecking',
|
170 |
'skipAvs',
|
171 |
'skipCvv',
|
172 |
+
['creditCard' =>
|
173 |
+
['accountType']
|
174 |
],
|
175 |
+
['threeDSecure' =>
|
|
|
176 |
['required']
|
177 |
],
|
178 |
['paypal' =>
|
194 |
],
|
195 |
['venmo' =>
|
196 |
[
|
|
|
|
|
197 |
'profileId'
|
198 |
]
|
199 |
]
|
201 |
],
|
202 |
['customFields' => ['_anyKey_']],
|
203 |
['descriptor' => ['name', 'phone', 'url']],
|
204 |
+
['paypalAccount' => ['payeeId', 'payeeEmail', 'payerId', 'paymentId']],
|
205 |
+
['applePayCard' =>
|
206 |
+
[
|
207 |
+
'cardholderName',
|
208 |
+
'cryptogram',
|
209 |
+
'eciIndicator',
|
210 |
+
'expirationMonth',
|
211 |
+
'expirationYear',
|
212 |
+
'number'
|
213 |
+
]
|
214 |
+
],
|
215 |
['industry' =>
|
216 |
['industryType',
|
217 |
['data' =>
|
224 |
'lodgingCheckInDate',
|
225 |
'lodgingCheckOutDate',
|
226 |
'lodgingName',
|
227 |
+
'roomRate',
|
228 |
+
'roomTax',
|
229 |
+
'passengerFirstName',
|
230 |
+
'passengerLastName',
|
231 |
+
'passengerMiddleInitial',
|
232 |
+
'passengerTitle',
|
233 |
+
'issuedDate',
|
234 |
+
'travelAgencyName',
|
235 |
+
'travelAgencyCode',
|
236 |
+
'ticketNumber',
|
237 |
+
'issuingCarrierCode',
|
238 |
+
'customerCode',
|
239 |
+
'fareAmount',
|
240 |
+
'feeAmount',
|
241 |
+
'taxAmount',
|
242 |
+
'restrictedTicket',
|
243 |
+
'noShow',
|
244 |
+
'advancedDeposit',
|
245 |
+
'fireSafe',
|
246 |
+
'propertyPhone',
|
247 |
+
['legs' =>
|
248 |
+
[
|
249 |
+
'conjunctionTicket',
|
250 |
+
'exchangeTicket',
|
251 |
+
'couponNumber',
|
252 |
+
'serviceClass',
|
253 |
+
'carrierCode',
|
254 |
+
'fareBasisCode',
|
255 |
+
'flightNumber',
|
256 |
+
'departureDate',
|
257 |
+
'departureAirportCode',
|
258 |
+
'departureTime',
|
259 |
+
'arrivalAirportCode',
|
260 |
+
'arrivalTime',
|
261 |
+
'stopoverPermitted',
|
262 |
+
'fareAmount',
|
263 |
+
'feeAmount',
|
264 |
+
'taxAmount',
|
265 |
+
'endorsementOrRestrictions'
|
266 |
+
]
|
267 |
+
],
|
268 |
+
['additionalCharges' =>
|
269 |
+
[
|
270 |
+
'kind',
|
271 |
+
'amount'
|
272 |
+
]
|
273 |
+
]
|
274 |
]
|
275 |
]
|
276 |
]
|
277 |
],
|
278 |
+
['lineItems' =>
|
279 |
+
[
|
280 |
+
'commodityCode',
|
281 |
+
'description',
|
282 |
+
'discountAmount',
|
283 |
+
'kind',
|
284 |
+
'name',
|
285 |
+
'productCode',
|
286 |
+
'quantity',
|
287 |
+
'taxAmount',
|
288 |
+
'totalAmount',
|
289 |
+
'unitAmount',
|
290 |
+
'unitOfMeasure',
|
291 |
+
'unitTaxAmount',
|
292 |
+
'url'
|
293 |
+
]
|
294 |
+
],
|
295 |
+
['externalVault' =>
|
296 |
+
['status' , 'previousNetworkTransactionId'],
|
297 |
+
],
|
298 |
+
['googlePayCard' =>
|
299 |
+
[
|
300 |
+
'cryptogram',
|
301 |
+
'eciIndicator',
|
302 |
+
'expirationMonth',
|
303 |
+
'expirationYear',
|
304 |
+
'googleTransactionId',
|
305 |
+
'number',
|
306 |
+
'sourceCardLastFour',
|
307 |
+
'sourceCardType'
|
308 |
+
]
|
309 |
+
],
|
310 |
+
['installments' => ['count']]
|
311 |
];
|
312 |
}
|
313 |
|
314 |
+
/**
|
315 |
+
* creates a full array signature of a valid gateway request
|
316 |
+
*
|
317 |
+
* @return array gateway request signature format
|
318 |
+
*/
|
319 |
public static function submitForSettlementSignature()
|
320 |
{
|
321 |
+
return ['orderId', ['descriptor' => ['name', 'phone', 'url']],
|
322 |
+
'purchaseOrderNumber',
|
323 |
+
'taxAmount',
|
324 |
+
'taxExempt',
|
325 |
+
'shippingAmount',
|
326 |
+
'discountAmount',
|
327 |
+
'shipsFromPostalCode',
|
328 |
+
['lineItems' =>
|
329 |
+
[
|
330 |
+
'commodityCode',
|
331 |
+
'description',
|
332 |
+
'discountAmount',
|
333 |
+
'kind',
|
334 |
+
'name',
|
335 |
+
'productCode',
|
336 |
+
'quantity',
|
337 |
+
'taxAmount',
|
338 |
+
'totalAmount',
|
339 |
+
'unitAmount',
|
340 |
+
'unitOfMeasure',
|
341 |
+
'unitTaxAmount',
|
342 |
+
'url'
|
343 |
+
]
|
344 |
+
],
|
345 |
+
];
|
346 |
}
|
347 |
|
348 |
+
/**
|
349 |
+
* creates a full array signature of a valid gateway request
|
350 |
+
*
|
351 |
+
* @return array gateway request signature format
|
352 |
+
*/
|
353 |
public static function updateDetailsSignature()
|
354 |
{
|
355 |
return ['amount', 'orderId', ['descriptor' => ['name', 'phone', 'url']]];
|
356 |
}
|
357 |
|
358 |
+
/**
|
359 |
+
* creates a full array signature of a valid gateway request
|
360 |
+
*
|
361 |
+
* @return array gateway request signature format
|
362 |
+
*/
|
363 |
public static function refundSignature()
|
364 |
{
|
365 |
+
return [
|
366 |
+
'amount',
|
367 |
+
'merchantAccountId',
|
368 |
+
'orderId'
|
369 |
+
];
|
370 |
}
|
371 |
|
372 |
/**
|
373 |
+
* Request a credit to a payment method
|
374 |
+
*
|
375 |
+
* @param array $attribs containing request parameters
|
376 |
*
|
|
|
|
|
377 |
* @return Result\Successful|Result\Error
|
378 |
*/
|
379 |
public function credit($attribs)
|
382 |
}
|
383 |
|
384 |
/**
|
385 |
+
* Request a credit to a payment method. Returns either a Transaction or error
|
386 |
*
|
387 |
+
* @param array $attribs containing request parameters
|
388 |
+
*
|
389 |
+
* @return Transaction|Result\Error
|
|
|
390 |
*/
|
391 |
public function creditNoValidate($attribs)
|
392 |
{
|
395 |
}
|
396 |
|
397 |
/**
|
398 |
+
* Retrieve transaction information given its ID
|
399 |
+
*
|
400 |
+
* @param string $id unique identifier of the transaction
|
401 |
+
*
|
402 |
+
* @return Transaction|Exception\NotFound
|
403 |
*/
|
404 |
public function find($id)
|
405 |
{
|
410 |
return Transaction::factory($response['transaction']);
|
411 |
} catch (Exception\NotFound $e) {
|
412 |
throw new Exception\NotFound(
|
413 |
+
'transaction with id ' . $id . ' not found'
|
414 |
);
|
415 |
}
|
416 |
}
|
417 |
/**
|
418 |
+
* Request a new sale
|
419 |
+
*
|
420 |
+
* @param array $attribs (Note: $recurring param is deprecated. Use $transactionSource instead)
|
421 |
+
*
|
422 |
* @return Result\Successful|Result\Error
|
423 |
*/
|
424 |
public function sale($attribs)
|
425 |
{
|
426 |
+
if (array_key_exists('recurring', $attribs)) {
|
427 |
+
trigger_error('$recurring is deprecated, use $transactionSource instead', E_USER_DEPRECATED);
|
428 |
+
}
|
429 |
return $this->create(array_merge(['type' => Transaction::SALE], $attribs));
|
430 |
}
|
431 |
|
432 |
/**
|
433 |
+
* Request a new sale. Returns a Transaction object instead of a Result
|
434 |
+
*
|
435 |
+
* @param mixed $attribs containing any request parameters
|
436 |
+
*
|
437 |
+
* @return Transaction|Result\Error
|
438 |
*/
|
439 |
public function saleNoValidate($attribs)
|
440 |
{
|
447 |
*
|
448 |
* If <b>query</b> is a string, the search will be a basic search.
|
449 |
* If <b>query</b> is a hash, the search will be an advanced search.
|
450 |
+
* // phpcs:ignore Generic.Files.LineLength
|
451 |
+
* For more detailed information and examples, see {@link https://developer.paypal.com/braintree/docs/reference/request/transaction/search/php our developer docs}
|
452 |
*
|
453 |
* @param mixed $query search query
|
454 |
+
*
|
455 |
* @return ResourceCollection
|
|
|
456 |
*/
|
457 |
public function search($query)
|
458 |
{
|
472 |
|
473 |
return new ResourceCollection($response, $pager);
|
474 |
} else {
|
475 |
+
throw new Exception\RequestTimeout();
|
476 |
}
|
477 |
}
|
478 |
|
479 |
+
/**
|
480 |
+
* Function to fetch results in building paged reults
|
481 |
+
*
|
482 |
+
* @param mixed $query including method arguments
|
483 |
+
* @param array $ids to use in searching
|
484 |
+
*
|
485 |
+
* @return array
|
486 |
+
*/
|
487 |
public function fetch($query, $ids)
|
488 |
{
|
489 |
$criteria = [];
|
500 |
'transaction'
|
501 |
);
|
502 |
} else {
|
503 |
+
throw new Exception\RequestTimeout();
|
504 |
}
|
505 |
}
|
506 |
|
507 |
+
/**
|
508 |
+
* Adjusts the authorization amount of a transaction
|
509 |
+
*
|
510 |
+
* @param string $transactionId unique identifier
|
511 |
+
* @param string $amount tp be adjusted
|
512 |
+
*
|
513 |
+
* @return Result\Successful|Result\Error
|
514 |
+
*/
|
515 |
+
public function adjustAuthorization($transactionId, $amount)
|
516 |
+
{
|
517 |
+
self::_validateId($transactionId);
|
518 |
+
$params = ['amount' => $amount];
|
519 |
+
$path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/adjust_authorization';
|
520 |
+
$response = $this->_http->put($path, ['transaction' => $params]);
|
521 |
+
return $this->_verifyGatewayResponse($response);
|
522 |
+
}
|
523 |
+
|
524 |
/**
|
525 |
* void a transaction by id
|
526 |
*
|
527 |
+
* @param string $transactionId unique identifier
|
528 |
+
*
|
529 |
* @return Result\Successful|Result\Error
|
530 |
*/
|
531 |
public function void($transactionId)
|
532 |
{
|
533 |
$this->_validateId($transactionId);
|
534 |
|
535 |
+
$path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/void';
|
536 |
$response = $this->_http->put($path);
|
537 |
return $this->_verifyGatewayResponse($response);
|
538 |
}
|
539 |
+
|
540 |
/**
|
541 |
+
* void a transaction by id. Returns a Transaction instead of Result\Successful
|
542 |
*
|
543 |
+
* @param string $transactionId unique identifier
|
544 |
+
*
|
545 |
+
* @return Transaction|Result\Error
|
546 |
*/
|
547 |
public function voidNoValidate($transactionId)
|
548 |
{
|
550 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
551 |
}
|
552 |
|
553 |
+
/**
|
554 |
+
* Submits an authorized transaction be captured and submitted for settlement.
|
555 |
+
*
|
556 |
+
* @param string $transactionId uniquq identifier
|
557 |
+
* @param string|null $amount to be submitted for settlement
|
558 |
+
* @param array $attribs containing any additional request parameters
|
559 |
+
*
|
560 |
+
* @return Result\Successful|Result\Error
|
561 |
+
*/
|
562 |
public function submitForSettlement($transactionId, $amount = null, $attribs = [])
|
563 |
{
|
564 |
$this->_validateId($transactionId);
|
565 |
Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
|
566 |
$attribs['amount'] = $amount;
|
567 |
|
568 |
+
$path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/submit_for_settlement';
|
569 |
$response = $this->_http->put($path, ['transaction' => $attribs]);
|
570 |
return $this->_verifyGatewayResponse($response);
|
571 |
}
|
572 |
|
573 |
+
/**
|
574 |
+
* Submits an authorized transaction be captured and submitted for settlement. Returns a Transaction object on success
|
575 |
+
*
|
576 |
+
* @param string $transactionId uniquq identifier
|
577 |
+
* @param string|null $amount to be submitted for settlement
|
578 |
+
* @param array $attribs containing any additional request parameters
|
579 |
+
*
|
580 |
+
* @return Transaction|Exception
|
581 |
+
*/
|
582 |
public function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
|
583 |
{
|
584 |
$result = $this->submitForSettlement($transactionId, $amount, $attribs);
|
585 |
return Util::returnObjectOrThrowException(__CLASS__, $result);
|
586 |
}
|
587 |
|
588 |
+
/**
|
589 |
+
* Update certain details for a transaction that has been submitted for settlement
|
590 |
+
*
|
591 |
+
* @param string $transactionId to be updated
|
592 |
+
* @param array $attribs attributes to be updated in the request
|
593 |
+
*
|
594 |
+
* @return Result\Successful|Result\Error
|
595 |
+
*/
|
596 |
public function updateDetails($transactionId, $attribs = [])
|
597 |
{
|
598 |
$this->_validateId($transactionId);
|
599 |
Util::verifyKeys(self::updateDetailsSignature(), $attribs);
|
600 |
|
601 |
+
$path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/update_details';
|
602 |
$response = $this->_http->put($path, ['transaction' => $attribs]);
|
603 |
return $this->_verifyGatewayResponse($response);
|
604 |
}
|
605 |
|
606 |
+
/**
|
607 |
+
* Settle multiple partial amounts against the same authorization
|
608 |
+
*
|
609 |
+
* @param string $transactionId unque identifier of the transaction to be submitted for settlement
|
610 |
+
* @param string $amount optional
|
611 |
+
* @param mixed $attribs any additional request parameters
|
612 |
+
*
|
613 |
+
* @return Result\Successful|Exception\NotFound
|
614 |
+
*/
|
615 |
public function submitForPartialSettlement($transactionId, $amount, $attribs = [])
|
616 |
{
|
617 |
$this->_validateId($transactionId);
|
618 |
Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
|
619 |
$attribs['amount'] = $amount;
|
620 |
|
621 |
+
$path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/submit_for_partial_settlement';
|
622 |
$response = $this->_http->post($path, ['transaction' => $attribs]);
|
623 |
return $this->_verifyGatewayResponse($response);
|
624 |
}
|
625 |
|
626 |
+
/**
|
627 |
+
* Specific to Marketplace merchants
|
628 |
+
*
|
629 |
+
* @param string $transactionId unque identifier of the transaction to be held in escrow
|
630 |
+
*
|
631 |
+
* @return Result\Successful|Exception\NotFound
|
632 |
+
*/
|
633 |
public function holdInEscrow($transactionId)
|
634 |
{
|
635 |
$this->_validateId($transactionId);
|
639 |
return $this->_verifyGatewayResponse($response);
|
640 |
}
|
641 |
|
642 |
+
/**
|
643 |
+
* Specific to Marketplace merchants
|
644 |
+
*
|
645 |
+
* @param string $transactionId unque identifier of the transaction to be released from escrow
|
646 |
+
*
|
647 |
+
* @return Result\Successful|Exception\NotFound
|
648 |
+
*/
|
649 |
public function releaseFromEscrow($transactionId)
|
650 |
{
|
651 |
$this->_validateId($transactionId);
|
655 |
return $this->_verifyGatewayResponse($response);
|
656 |
}
|
657 |
|
658 |
+
/**
|
659 |
+
* Specific to Marketplace merchants
|
660 |
+
*
|
661 |
+
* @param string $transactionId unque identifier of the transaction whose escrow release is to be canceled
|
662 |
+
*
|
663 |
+
* @return Result\Successful|Exception\NotFound
|
664 |
+
*/
|
665 |
public function cancelRelease($transactionId)
|
666 |
{
|
667 |
$this->_validateId($transactionId);
|
671 |
return $this->_verifyGatewayResponse($response);
|
672 |
}
|
673 |
|
674 |
+
/**
|
675 |
+
* Request a refund to a payment method
|
676 |
+
*
|
677 |
+
* @param string $transactionId unque identifier of the transaction to be refunded
|
678 |
+
* @param mixed $amount_or_options if a string amount, the amount to be refunded, if array of options, additional request parameters
|
679 |
+
*
|
680 |
+
* @return Result\Successful|Exception\NotFound
|
681 |
+
*/
|
682 |
public function refund($transactionId, $amount_or_options = null)
|
683 |
{
|
684 |
self::_validateId($transactionId);
|
685 |
|
686 |
+
if (gettype($amount_or_options) == "array") {
|
687 |
$options = $amount_or_options;
|
688 |
} else {
|
689 |
$options = [
|
698 |
return $this->_verifyGatewayResponse($response);
|
699 |
}
|
700 |
|
701 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
public function _doCreate($subPath, $params)
|
703 |
{
|
704 |
$fullPath = $this->_config->merchantPath() . $subPath;
|
709 |
|
710 |
/**
|
711 |
* verifies that a valid transaction id is being used
|
712 |
+
*
|
713 |
* @param string transaction id
|
714 |
+
|
715 |
* @throws InvalidArgumentException
|
716 |
+
*
|
717 |
+
* @return null
|
718 |
*/
|
719 |
+
private function _validateId($id = null)
|
720 |
+
{
|
721 |
if (empty($id)) {
|
|
|
|
|
|
|
|
|
|
|
722 |
throw new InvalidArgumentException(
|
723 |
+
'expected transaction id to be set'
|
724 |
+
);
|
725 |
}
|
726 |
}
|
727 |
|
733 |
* encapsulates a Errors object inside a Result\Error
|
734 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
735 |
*
|
|
|
736 |
* @param array $response gateway response values
|
737 |
+
*
|
738 |
* @throws Exception\Unexpected
|
739 |
+
*
|
740 |
+
* @return Result\Successful|Result\Error
|
741 |
*/
|
742 |
private function _verifyGatewayResponse($response)
|
743 |
{
|
744 |
if (isset($response['transaction'])) {
|
745 |
// return a populated instance of Transaction
|
746 |
return new Result\Successful(
|
747 |
+
Transaction::factory($response['transaction'])
|
748 |
);
|
749 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
750 |
return new Result\Error($response['apiErrorResponse']);
|
751 |
} else {
|
752 |
throw new Exception\Unexpected(
|
753 |
+
"Expected transaction or apiErrorResponse"
|
754 |
);
|
755 |
}
|
756 |
}
|
757 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TransactionLineItem.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use Braintree\Instance;
|
@@ -6,49 +7,33 @@ use Braintree\Instance;
|
|
6 |
/**
|
7 |
* Line item associated with a transaction
|
8 |
*
|
9 |
-
* @
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* creates an instance of TransactionLineItem
|
14 |
-
*
|
15 |
-
*
|
16 |
-
* @package Braintree
|
17 |
-
*
|
18 |
-
* @property-read string $quantity
|
19 |
-
* @property-read string $name
|
20 |
-
* @property-read string $description
|
21 |
-
* @property-read string $kind
|
22 |
-
* @property-read string $unitAmount
|
23 |
-
* @property-read string $unitTaxAmount
|
24 |
-
* @property-read string $totalAmount
|
25 |
-
* @property-read string $discountAmount
|
26 |
-
* @property-read string $unitOfMeasure
|
27 |
-
* @property-read string $productCode
|
28 |
-
* @property-read string $commodityCode
|
29 |
-
* @property-read string $url
|
30 |
*/
|
31 |
class TransactionLineItem extends Instance
|
32 |
{
|
33 |
-
//
|
34 |
const CREDIT = 'credit';
|
35 |
const DEBIT = 'debit';
|
36 |
|
37 |
protected $_attributes = [];
|
38 |
|
39 |
-
|
40 |
-
* @ignore
|
41 |
-
*/
|
42 |
public function __construct($attributes)
|
43 |
{
|
44 |
parent::__construct($attributes);
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
public static function findAll($transactionId)
|
48 |
{
|
49 |
return Configuration::gateway()->transactionLineItem()->findAll($transactionId);
|
50 |
}
|
51 |
}
|
52 |
-
class_alias('Braintree\TransactionLineItem', 'Braintree_TransactionLineItem');
|
53 |
-
class_alias('Braintree\TransactionLineItem', 'Braintree\Transaction\LineItem');
|
54 |
-
class_alias('Braintree\TransactionLineItem', 'Braintree_Transaction_LineItem');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use Braintree\Instance;
|
7 |
/**
|
8 |
* Line item associated with a transaction
|
9 |
*
|
10 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/transaction-line-item developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class TransactionLineItem extends Instance
|
13 |
{
|
14 |
+
// TransactionLineItem Kinds
|
15 |
const CREDIT = 'credit';
|
16 |
const DEBIT = 'debit';
|
17 |
|
18 |
protected $_attributes = [];
|
19 |
|
20 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
|
|
|
|
21 |
public function __construct($attributes)
|
22 |
{
|
23 |
parent::__construct($attributes);
|
24 |
}
|
25 |
|
26 |
+
/**
|
27 |
+
* Static methods redirecting to gateway class
|
28 |
+
*
|
29 |
+
* @param string $transactionId of the Transaction to search for line items
|
30 |
+
*
|
31 |
+
* @see TransactionLineItemGateway::findAll()
|
32 |
+
*
|
33 |
+
* @return TransactionLineItem|Exception
|
34 |
+
*/
|
35 |
public static function findAll($transactionId)
|
36 |
{
|
37 |
return Configuration::gateway()->transactionLineItem()->findAll($transactionId);
|
38 |
}
|
39 |
}
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/TransactionLineItemGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -6,9 +7,6 @@ use InvalidArgumentException;
|
|
6 |
/**
|
7 |
* Braintree TransactionLineItemGateway processor
|
8 |
* Creates and manages transaction line items
|
9 |
-
*
|
10 |
-
* @package Braintree
|
11 |
-
* @category Resources
|
12 |
*/
|
13 |
|
14 |
class TransactionLineItemGateway
|
@@ -17,6 +15,7 @@ class TransactionLineItemGateway
|
|
17 |
private $_config;
|
18 |
private $_http;
|
19 |
|
|
|
20 |
public function __construct($gateway)
|
21 |
{
|
22 |
$this->_gateway = $gateway;
|
@@ -26,9 +25,11 @@ class TransactionLineItemGateway
|
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
-
*
|
31 |
-
* @
|
|
|
|
|
32 |
*/
|
33 |
public function findAll($id)
|
34 |
{
|
@@ -39,7 +40,7 @@ class TransactionLineItemGateway
|
|
39 |
|
40 |
$lineItems = [];
|
41 |
if (isset($response['lineItems'])) {
|
42 |
-
foreach ($response['lineItems']
|
43 |
$lineItems[] = new TransactionLineItem($lineItem);
|
44 |
}
|
45 |
}
|
@@ -51,17 +52,18 @@ class TransactionLineItemGateway
|
|
51 |
|
52 |
/**
|
53 |
* verifies that a valid transaction id is being used
|
54 |
-
*
|
55 |
* @param string transaction id
|
|
|
56 |
* @throws InvalidArgumentException
|
57 |
*/
|
58 |
-
private function _validateId($id = null)
|
|
|
59 |
if (empty($id)) {
|
60 |
-
|
61 |
}
|
62 |
if (!preg_match('/^[0-9a-z]+$/', $id)) {
|
63 |
throw new InvalidArgumentException($id . ' is an invalid transaction id.');
|
64 |
}
|
65 |
}
|
66 |
}
|
67 |
-
class_alias('Braintree\TransactionLineItemGateway', 'Braintree_TransactionLineItemGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
7 |
/**
|
8 |
* Braintree TransactionLineItemGateway processor
|
9 |
* Creates and manages transaction line items
|
|
|
|
|
|
|
10 |
*/
|
11 |
|
12 |
class TransactionLineItemGateway
|
15 |
private $_config;
|
16 |
private $_http;
|
17 |
|
18 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
19 |
public function __construct($gateway)
|
20 |
{
|
21 |
$this->_gateway = $gateway;
|
25 |
}
|
26 |
|
27 |
/**
|
28 |
+
* Find all Transaction Line Items or return an error
|
29 |
+
*
|
30 |
+
* @param string $id of the Transaction to search for line items
|
31 |
+
*
|
32 |
+
* @return TransactionLineItem|Exception
|
33 |
*/
|
34 |
public function findAll($id)
|
35 |
{
|
40 |
|
41 |
$lineItems = [];
|
42 |
if (isset($response['lineItems'])) {
|
43 |
+
foreach ($response['lineItems'] as $lineItem) {
|
44 |
$lineItems[] = new TransactionLineItem($lineItem);
|
45 |
}
|
46 |
}
|
52 |
|
53 |
/**
|
54 |
* verifies that a valid transaction id is being used
|
55 |
+
*
|
56 |
* @param string transaction id
|
57 |
+
*
|
58 |
* @throws InvalidArgumentException
|
59 |
*/
|
60 |
+
private function _validateId($id = null)
|
61 |
+
{
|
62 |
if (empty($id)) {
|
63 |
+
throw new InvalidArgumentException('expected transaction id to be set');
|
64 |
}
|
65 |
if (!preg_match('/^[0-9a-z]+$/', $id)) {
|
66 |
throw new InvalidArgumentException($id . ' is an invalid transaction id.');
|
67 |
}
|
68 |
}
|
69 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TransactionReview.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree TransactionReview
|
7 |
+
*
|
8 |
+
* A class of information related to when a transaction is manually reviewed in the Fraud Protection Dashboard.
|
9 |
+
*
|
10 |
+
* For more information, see {@link https://developer.paypal.com/braintree/docs/guides/premium-fraud-management-tools/overview our developer docs}
|
11 |
+
*/
|
12 |
+
class TransactionReview extends Base
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Creates an instance from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
+
*
|
19 |
+
* @return TransactionReview
|
20 |
+
*/
|
21 |
+
public static function factory($attributes)
|
22 |
+
{
|
23 |
+
$instance = new self();
|
24 |
+
$instance->_initialize($attributes);
|
25 |
+
|
26 |
+
return $instance;
|
27 |
+
}
|
28 |
+
|
29 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
30 |
+
protected function _initialize($attributes)
|
31 |
+
{
|
32 |
+
$this->_attributes = $attributes;
|
33 |
+
}
|
34 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/TransactionSearch.php
CHANGED
@@ -1,66 +1,602 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
4 |
class TransactionSearch
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
public static function
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
public static function
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public static function
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
public static function
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
public static function
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
public static function
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
public static function createdUsing()
|
65 |
{
|
66 |
return new MultipleValueNode('created_using', [
|
@@ -69,6 +605,11 @@ class TransactionSearch
|
|
69 |
]);
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
72 |
public static function creditCardCardType()
|
73 |
{
|
74 |
return new MultipleValueNode('credit_card_card_type', [
|
@@ -77,6 +618,7 @@ class TransactionSearch
|
|
77 |
CreditCard::CHINA_UNION_PAY,
|
78 |
CreditCard::DINERS_CLUB_INTERNATIONAL,
|
79 |
CreditCard::DISCOVER,
|
|
|
80 |
CreditCard::JCB,
|
81 |
CreditCard::LASER,
|
82 |
CreditCard::MAESTRO,
|
@@ -88,6 +630,11 @@ class TransactionSearch
|
|
88 |
]);
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
91 |
public static function creditCardCustomerLocation()
|
92 |
{
|
93 |
return new MultipleValueNode('credit_card_customer_location', [
|
@@ -96,11 +643,21 @@ class TransactionSearch
|
|
96 |
]);
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
99 |
public static function source()
|
100 |
{
|
101 |
return new MultipleValueNode('source', []);
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
104 |
public static function status()
|
105 |
{
|
106 |
return new MultipleValueNode('status', [
|
@@ -119,6 +676,11 @@ class TransactionSearch
|
|
119 |
]);
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
122 |
public static function type()
|
123 |
{
|
124 |
return new MultipleValueNode('type', [
|
@@ -127,4 +689,3 @@ class TransactionSearch
|
|
127 |
]);
|
128 |
}
|
129 |
}
|
130 |
-
class_alias('Braintree\TransactionSearch', 'Braintree_TransactionSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Class for setting transaction search queries
|
7 |
+
*/
|
8 |
class TransactionSearch
|
9 |
{
|
10 |
+
/*
|
11 |
+
* Create a new range node for amount
|
12 |
+
*
|
13 |
+
* @return RangeNode
|
14 |
+
*/
|
15 |
+
public static function amount()
|
16 |
+
{
|
17 |
+
return new RangeNode("amount");
|
18 |
+
}
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Create a new range node for authorization expired at
|
22 |
+
*
|
23 |
+
* @return RangeNode
|
24 |
+
*/
|
25 |
+
public static function authorizationExpiredAt()
|
26 |
+
{
|
27 |
+
return new RangeNode("authorizationExpiredAt");
|
28 |
+
}
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Create a new range node for authorization at
|
32 |
+
*
|
33 |
+
* @return RangeNode
|
34 |
+
*/
|
35 |
+
public static function authorizedAt()
|
36 |
+
{
|
37 |
+
return new RangeNode("authorizedAt");
|
38 |
+
}
|
39 |
+
|
40 |
+
/*
|
41 |
+
* Create a new text node for billing company
|
42 |
+
*
|
43 |
+
* @return TextNode
|
44 |
+
*/
|
45 |
+
public static function billingCompany()
|
46 |
+
{
|
47 |
+
return new TextNode('billing_company');
|
48 |
+
}
|
49 |
+
|
50 |
+
/*
|
51 |
+
* Create a new text node for billing country name
|
52 |
+
*
|
53 |
+
* @return TextNode
|
54 |
+
*/
|
55 |
+
public static function billingCountryName()
|
56 |
+
{
|
57 |
+
return new TextNode('billing_country_name');
|
58 |
+
}
|
59 |
+
|
60 |
+
/*
|
61 |
+
* Create a new text node for billing extended address
|
62 |
+
*
|
63 |
+
* @return TextNode
|
64 |
+
*/
|
65 |
+
public static function billingExtendedAddress()
|
66 |
+
{
|
67 |
+
return new TextNode('billing_extended_address');
|
68 |
+
}
|
69 |
+
|
70 |
+
// NEXT_MAJOR_VERSION this should be changed to Given name. First name is US ethnocentric
|
71 |
+
/*
|
72 |
+
* Create a new text node for billing first or given name
|
73 |
+
*
|
74 |
+
* @return TextNode
|
75 |
+
*/
|
76 |
+
public static function billingFirstName()
|
77 |
+
{
|
78 |
+
return new TextNode('billing_first_name');
|
79 |
+
}
|
80 |
+
|
81 |
+
// NEXT_MAJOR_VERSION this should be changed to Surname. Last name is US ethnocentric
|
82 |
+
/*
|
83 |
+
* Create a new text node for billing last or surname
|
84 |
+
*
|
85 |
+
* @return TextNode
|
86 |
+
*/
|
87 |
+
public static function billingLastName()
|
88 |
+
{
|
89 |
+
return new TextNode('billing_last_name');
|
90 |
+
}
|
91 |
+
|
92 |
+
/*
|
93 |
+
* Create a new text node for billing locality or city
|
94 |
+
*
|
95 |
+
* @return TextNode
|
96 |
+
*/
|
97 |
+
public static function billingLocality()
|
98 |
+
{
|
99 |
+
return new TextNode('billing_locality');
|
100 |
+
}
|
101 |
+
|
102 |
+
/*
|
103 |
+
* Create a new text node for billing postal code
|
104 |
+
*
|
105 |
+
* @return TextNode
|
106 |
+
*/
|
107 |
+
public static function billingPostalCode()
|
108 |
+
{
|
109 |
+
return new TextNode('billing_postal_code');
|
110 |
+
}
|
111 |
+
|
112 |
+
/*
|
113 |
+
* Create a new text node for billing region or state
|
114 |
+
*
|
115 |
+
* @return TextNode
|
116 |
+
*/
|
117 |
+
public static function billingRegion()
|
118 |
+
{
|
119 |
+
return new TextNode('billing_region');
|
120 |
+
}
|
121 |
+
|
122 |
+
/*
|
123 |
+
* Create a new text node for billing street address
|
124 |
+
*
|
125 |
+
* @return TextNode
|
126 |
+
*/
|
127 |
+
public static function billingStreetAddress()
|
128 |
+
{
|
129 |
+
return new TextNode('billing_street_address');
|
130 |
+
}
|
131 |
+
|
132 |
+
/*
|
133 |
+
* Create a new range node for created at
|
134 |
+
*
|
135 |
+
* @return RangeNode
|
136 |
+
*/
|
137 |
+
public static function createdAt()
|
138 |
+
{
|
139 |
+
return new RangeNode("createdAt");
|
140 |
+
}
|
141 |
+
|
142 |
+
// NEXT_MAJOR_VERSION we may want to rename this to just cardholder name
|
143 |
+
/*
|
144 |
+
* Create a new text node for cardholder name
|
145 |
+
*
|
146 |
+
* @return TextNode
|
147 |
+
*/
|
148 |
+
public static function creditCardCardholderName()
|
149 |
+
{
|
150 |
+
return new TextNode('credit_card_cardholderName');
|
151 |
+
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* Create a new equality node for card expiration date
|
155 |
+
*
|
156 |
+
* @return EqualityNode
|
157 |
+
*/
|
158 |
+
public static function creditCardExpirationDate()
|
159 |
+
{
|
160 |
+
return new EqualityNode('credit_card_expiration_date');
|
161 |
+
}
|
162 |
+
|
163 |
+
/*
|
164 |
+
* Create a new partial match node for credit card number
|
165 |
+
*
|
166 |
+
* @return PartialMatchNode
|
167 |
+
*/
|
168 |
+
public static function creditCardNumber()
|
169 |
+
{
|
170 |
+
return new PartialMatchNode('credit_card_number');
|
171 |
+
}
|
172 |
+
|
173 |
+
/*
|
174 |
+
* Create a new text node for card unigue identifier
|
175 |
+
*
|
176 |
+
* @return TextNode
|
177 |
+
*/
|
178 |
+
public static function creditCardUniqueIdentifier()
|
179 |
+
{
|
180 |
+
return new TextNode('credit_card_unique_identifier');
|
181 |
+
}
|
182 |
+
|
183 |
+
/*
|
184 |
+
* Create a new text node for currency
|
185 |
+
*
|
186 |
+
* @return TextNode
|
187 |
+
*/
|
188 |
+
public static function currency()
|
189 |
+
{
|
190 |
+
return new TextNode('currency');
|
191 |
+
}
|
192 |
+
|
193 |
+
/*
|
194 |
+
* Create a new text node for customer company
|
195 |
+
*
|
196 |
+
* @return TextNode
|
197 |
+
*/
|
198 |
+
public static function customerCompany()
|
199 |
+
{
|
200 |
+
return new TextNode('customer_company');
|
201 |
+
}
|
202 |
+
|
203 |
+
/*
|
204 |
+
* Create a new text node for customer email
|
205 |
+
*
|
206 |
+
* @return TextNode
|
207 |
+
*/
|
208 |
+
public static function customerEmail()
|
209 |
+
{
|
210 |
+
return new TextNode('customer_email');
|
211 |
+
}
|
212 |
+
|
213 |
+
/*
|
214 |
+
* Create a new text node for customer fax
|
215 |
+
*
|
216 |
+
* @return TextNode
|
217 |
+
*/
|
218 |
+
public static function customerFax()
|
219 |
+
{
|
220 |
+
return new TextNode('customer_fax');
|
221 |
+
}
|
222 |
+
|
223 |
+
// NEXT_MAJOR_VERSION this should be changed to Given name. First name is US ethnocentric
|
224 |
+
/*
|
225 |
+
* Create a new text node for billing first or given name
|
226 |
+
*
|
227 |
+
* @return TextNode
|
228 |
+
*/
|
229 |
+
public static function customerFirstName()
|
230 |
+
{
|
231 |
+
return new TextNode('customer_first_name');
|
232 |
+
}
|
233 |
+
|
234 |
+
/*
|
235 |
+
* Create a new text node for customer id
|
236 |
+
*
|
237 |
+
* @return TextNode
|
238 |
+
*/
|
239 |
+
public static function customerId()
|
240 |
+
{
|
241 |
+
return new TextNode('customer_id');
|
242 |
+
}
|
243 |
+
|
244 |
+
// NEXT_MAJOR_VERSION this should be changed to Surname. Last name is US ethnocentric
|
245 |
+
/*
|
246 |
+
* Create a new text node for billing last or surname
|
247 |
+
*
|
248 |
+
* @return TextNode
|
249 |
+
*/
|
250 |
+
public static function customerLastName()
|
251 |
+
{
|
252 |
+
return new TextNode('customer_last_name');
|
253 |
+
}
|
254 |
+
|
255 |
+
/*
|
256 |
+
* Create a new text node for customer phone
|
257 |
+
*
|
258 |
+
* @return TextNode
|
259 |
+
*/
|
260 |
+
public static function customerPhone()
|
261 |
+
{
|
262 |
+
return new TextNode('customer_phone');
|
263 |
+
}
|
264 |
+
|
265 |
+
/*
|
266 |
+
* Create a new text node for customer website
|
267 |
+
*
|
268 |
+
* @return TextNode
|
269 |
+
*/
|
270 |
+
public static function customerWebsite()
|
271 |
+
{
|
272 |
+
return new TextNode('customer_website');
|
273 |
+
}
|
274 |
+
|
275 |
+
/*
|
276 |
+
* Create a new range node for disbursement date
|
277 |
+
*
|
278 |
+
* @return RangeNode
|
279 |
+
*/
|
280 |
+
public static function disbursementDate()
|
281 |
+
{
|
282 |
+
return new RangeNode("disbursementDate");
|
283 |
+
}
|
284 |
+
/*
|
285 |
+
* Create a new range node for dispute date
|
286 |
+
*
|
287 |
+
* @return RangeNode
|
288 |
+
*/
|
289 |
+
public static function disputeDate()
|
290 |
+
{
|
291 |
+
return new RangeNode("disputeDate");
|
292 |
+
}
|
293 |
+
/*
|
294 |
+
* Create a new range node for failed at date
|
295 |
+
*
|
296 |
+
* @return RangeNode
|
297 |
+
*/
|
298 |
+
public static function failedAt()
|
299 |
+
{
|
300 |
+
return new RangeNode("failedAt");
|
301 |
+
}
|
302 |
+
|
303 |
+
/*
|
304 |
+
* Create a new range node for gateway rejected at date
|
305 |
+
*
|
306 |
+
* @return RangeNode
|
307 |
+
*/
|
308 |
+
public static function gatewayRejectedAt()
|
309 |
+
{
|
310 |
+
return new RangeNode("gatewayRejectedAt");
|
311 |
+
}
|
312 |
+
|
313 |
+
/*
|
314 |
+
* Create a new text node for id
|
315 |
+
*
|
316 |
+
* @return TextNode
|
317 |
+
*/
|
318 |
+
public static function id()
|
319 |
+
{
|
320 |
+
return new TextNode('id');
|
321 |
+
}
|
322 |
+
|
323 |
+
/*
|
324 |
+
* Create a multiple value node for customer ids
|
325 |
+
*
|
326 |
+
* @return MultipleValueNode
|
327 |
+
*/
|
328 |
+
public static function ids()
|
329 |
+
{
|
330 |
+
return new MultipleValueNode('ids');
|
331 |
+
}
|
332 |
+
|
333 |
+
/*
|
334 |
+
* Create a multiple value node for merchant account id
|
335 |
+
*
|
336 |
+
* @return MultipleValueNode
|
337 |
+
*/
|
338 |
+
public static function merchantAccountId()
|
339 |
+
{
|
340 |
+
return new MultipleValueNode("merchant_account_id");
|
341 |
+
}
|
342 |
+
|
343 |
+
/*
|
344 |
+
* Create a new text node for order id
|
345 |
+
*
|
346 |
+
* @return TextNode
|
347 |
+
*/
|
348 |
+
public static function orderId()
|
349 |
+
{
|
350 |
+
return new TextNode('order_id');
|
351 |
+
}
|
352 |
+
|
353 |
+
/*
|
354 |
+
* Create a multiple value node for payment instrument type
|
355 |
+
*
|
356 |
+
* @return MultipleValueNode
|
357 |
+
*/
|
358 |
+
public static function paymentInstrumentType()
|
359 |
+
{
|
360 |
+
return new MultipleValueNode('paymentInstrumentType');
|
361 |
+
}
|
362 |
+
|
363 |
+
/*
|
364 |
+
* Create a new text node for payment method token
|
365 |
+
*
|
366 |
+
* @return TextNode
|
367 |
+
*/
|
368 |
+
public static function paymentMethodToken()
|
369 |
+
{
|
370 |
+
return new TextNode('payment_method_token');
|
371 |
+
}
|
372 |
+
|
373 |
+
/*
|
374 |
+
* Create a new text node for paypal authorization id
|
375 |
+
*
|
376 |
+
* @return TextNode
|
377 |
+
*/
|
378 |
+
public static function paypalAuthorizationId()
|
379 |
+
{
|
380 |
+
return new TextNode('paypal_authorization_id');
|
381 |
+
}
|
382 |
+
|
383 |
+
/*
|
384 |
+
* Create a new text node for paypal payer email
|
385 |
+
*
|
386 |
+
* @return TextNode
|
387 |
+
*/
|
388 |
+
public static function paypalPayerEmail()
|
389 |
+
{
|
390 |
+
return new TextNode('paypal_payer_email');
|
391 |
+
}
|
392 |
+
|
393 |
+
/*
|
394 |
+
* Create a new text node for paypal payment id
|
395 |
+
*
|
396 |
+
* @return TextNode
|
397 |
+
*/
|
398 |
+
public static function paypalPaymentId()
|
399 |
+
{
|
400 |
+
return new TextNode('paypal_payment_id');
|
401 |
+
}
|
402 |
+
|
403 |
+
/*
|
404 |
+
* Create a new text node for processor authorization code
|
405 |
+
*
|
406 |
+
* @return TextNode
|
407 |
+
*/
|
408 |
+
public static function processorAuthorizationCode()
|
409 |
+
{
|
410 |
+
return new TextNode('processor_authorization_code');
|
411 |
+
}
|
412 |
+
|
413 |
+
/*
|
414 |
+
* Create a new range node for processor declined at
|
415 |
+
*
|
416 |
+
* @return RangeNode
|
417 |
+
*/
|
418 |
+
public static function processorDeclinedAt()
|
419 |
+
{
|
420 |
+
return new RangeNode("processorDeclinedAt");
|
421 |
+
}
|
422 |
+
|
423 |
+
/*
|
424 |
+
* Create a new key value node for refund
|
425 |
+
*
|
426 |
+
* @return KeyValueNode
|
427 |
+
*/
|
428 |
+
public static function refund()
|
429 |
+
{
|
430 |
+
return new KeyValueNode("refund");
|
431 |
+
}
|
432 |
+
|
433 |
+
/*
|
434 |
+
* Create a new range node for settled at
|
435 |
+
*
|
436 |
+
* @return RangeNode
|
437 |
+
*/
|
438 |
+
public static function settledAt()
|
439 |
+
{
|
440 |
+
return new RangeNode("settledAt");
|
441 |
+
}
|
442 |
+
|
443 |
+
/*
|
444 |
+
* Create a new text node for settlement batch id
|
445 |
+
*
|
446 |
+
* @return TextNode
|
447 |
+
*/
|
448 |
+
public static function settlementBatchId()
|
449 |
+
{
|
450 |
+
return new TextNode('settlement_batch_id');
|
451 |
+
}
|
452 |
+
|
453 |
+
/*
|
454 |
+
* Create a new text node for shipping company
|
455 |
+
*
|
456 |
+
* @return TextNode
|
457 |
+
*/
|
458 |
+
public static function shippingCompany()
|
459 |
+
{
|
460 |
+
return new TextNode('shipping_company');
|
461 |
+
}
|
462 |
+
|
463 |
+
/*
|
464 |
+
* Create a new text node for shipping country name
|
465 |
+
*
|
466 |
+
* @return TextNode
|
467 |
+
*/
|
468 |
+
public static function shippingCountryName()
|
469 |
+
{
|
470 |
+
return new TextNode('shipping_country_name');
|
471 |
+
}
|
472 |
+
|
473 |
+
/*
|
474 |
+
* Create a new text node for shipping extended address
|
475 |
+
*
|
476 |
+
* @return TextNode
|
477 |
+
*/
|
478 |
+
public static function shippingExtendedAddress()
|
479 |
+
{
|
480 |
+
return new TextNode('shipping_extended_address');
|
481 |
+
}
|
482 |
+
|
483 |
+
// NEXT_MAJOR_VERSION this should be changed to Given name. First name is US ethnocentric
|
484 |
+
/*
|
485 |
+
* Create a new text node for shipping first or given name
|
486 |
+
*
|
487 |
+
* @return TextNode
|
488 |
+
*/
|
489 |
+
public static function shippingFirstName()
|
490 |
+
{
|
491 |
+
return new TextNode('shipping_first_name');
|
492 |
+
}
|
493 |
+
|
494 |
+
// NEXT_MAJOR_VERSION this should be changed to Surname. Last name is US ethnocentric
|
495 |
+
/*
|
496 |
+
* Create a new text node for shipping last or surname
|
497 |
+
*
|
498 |
+
* @return TextNode
|
499 |
+
*/
|
500 |
+
public static function shippingLastName()
|
501 |
+
{
|
502 |
+
return new TextNode('shipping_last_name');
|
503 |
+
}
|
504 |
+
|
505 |
+
/*
|
506 |
+
* Create a new text node for shipping locality or city
|
507 |
+
*
|
508 |
+
* @return TextNode
|
509 |
+
*/
|
510 |
+
public static function shippingLocality()
|
511 |
+
{
|
512 |
+
return new TextNode('shipping_locality');
|
513 |
+
}
|
514 |
+
|
515 |
+
/*
|
516 |
+
* Create a new text node for shipping postal code
|
517 |
+
*
|
518 |
+
* @return TextNode
|
519 |
+
*/
|
520 |
+
public static function shippingPostalCode()
|
521 |
+
{
|
522 |
+
return new TextNode('shipping_postal_code');
|
523 |
+
}
|
524 |
+
|
525 |
+
/*
|
526 |
+
* Create a new text node for shipping region or state
|
527 |
+
*
|
528 |
+
* @return TextNode
|
529 |
+
*/
|
530 |
+
public static function shippingRegion()
|
531 |
+
{
|
532 |
+
return new TextNode('shipping_region');
|
533 |
+
}
|
534 |
+
|
535 |
+
/*
|
536 |
+
* Create a new text node for shipping street address
|
537 |
+
*
|
538 |
+
* @return TextNode
|
539 |
+
*/
|
540 |
+
public static function shippingStreetAddress()
|
541 |
+
{
|
542 |
+
return new TextNode('shipping_street_address');
|
543 |
+
}
|
544 |
+
|
545 |
+
/*
|
546 |
+
* Create a new range node for submitted for settlement at date
|
547 |
+
*
|
548 |
+
* @return RangeNode
|
549 |
+
*/
|
550 |
+
public static function submittedForSettlementAt()
|
551 |
+
{
|
552 |
+
return new RangeNode("submittedForSettlementAt");
|
553 |
+
}
|
554 |
+
|
555 |
+
/*
|
556 |
+
* Create a new text node for store id
|
557 |
+
*
|
558 |
+
* @return TextNode
|
559 |
+
*/
|
560 |
+
public static function storeId()
|
561 |
+
{
|
562 |
+
return new TextNode('store_id');
|
563 |
+
}
|
564 |
+
|
565 |
+
/*
|
566 |
+
* Create a new multiple value node for store ids
|
567 |
+
*
|
568 |
+
* @return MultipleValueNode
|
569 |
+
*/
|
570 |
+
public static function storeIds()
|
571 |
+
{
|
572 |
+
return new MultipleValueNode('store_ids');
|
573 |
+
}
|
574 |
+
|
575 |
+
/*
|
576 |
+
* Create a new multiple value node for user
|
577 |
+
*
|
578 |
+
* @return MultipleValueNode
|
579 |
+
*/
|
580 |
+
public static function user()
|
581 |
+
{
|
582 |
+
return new MultipleValueNode('user');
|
583 |
+
}
|
584 |
+
|
585 |
+
/*
|
586 |
+
* Create a new range node for submitted for voided at date
|
587 |
+
*
|
588 |
+
* @return RangeNode
|
589 |
+
*/
|
590 |
+
public static function voidedAt()
|
591 |
+
{
|
592 |
+
return new RangeNode("voidedAt");
|
593 |
+
}
|
594 |
|
595 |
+
/*
|
596 |
+
* Create a new multiple value node for created using
|
597 |
+
*
|
598 |
+
* @return MultipleValueNode
|
599 |
+
*/
|
600 |
public static function createdUsing()
|
601 |
{
|
602 |
return new MultipleValueNode('created_using', [
|
605 |
]);
|
606 |
}
|
607 |
|
608 |
+
/*
|
609 |
+
* Create a new multiple value node for credit card type
|
610 |
+
*
|
611 |
+
* @return MultipleValueNode
|
612 |
+
*/
|
613 |
public static function creditCardCardType()
|
614 |
{
|
615 |
return new MultipleValueNode('credit_card_card_type', [
|
618 |
CreditCard::CHINA_UNION_PAY,
|
619 |
CreditCard::DINERS_CLUB_INTERNATIONAL,
|
620 |
CreditCard::DISCOVER,
|
621 |
+
CreditCard::ELO,
|
622 |
CreditCard::JCB,
|
623 |
CreditCard::LASER,
|
624 |
CreditCard::MAESTRO,
|
630 |
]);
|
631 |
}
|
632 |
|
633 |
+
/*
|
634 |
+
* Create a new multiple value node for credit card customer location
|
635 |
+
*
|
636 |
+
* @return MultipleValueNode
|
637 |
+
*/
|
638 |
public static function creditCardCustomerLocation()
|
639 |
{
|
640 |
return new MultipleValueNode('credit_card_customer_location', [
|
643 |
]);
|
644 |
}
|
645 |
|
646 |
+
/*
|
647 |
+
* Create a new multiple value node for source
|
648 |
+
*
|
649 |
+
* @return MultipleValueNode
|
650 |
+
*/
|
651 |
public static function source()
|
652 |
{
|
653 |
return new MultipleValueNode('source', []);
|
654 |
}
|
655 |
|
656 |
+
/*
|
657 |
+
* Create a new multiple value node for status
|
658 |
+
*
|
659 |
+
* @return MultipleValueNode
|
660 |
+
*/
|
661 |
public static function status()
|
662 |
{
|
663 |
return new MultipleValueNode('status', [
|
676 |
]);
|
677 |
}
|
678 |
|
679 |
+
/*
|
680 |
+
* Create a new multiple value node for type
|
681 |
+
*
|
682 |
+
* @return MultipleValueNode
|
683 |
+
*/
|
684 |
public static function type()
|
685 |
{
|
686 |
return new MultipleValueNode('type', [
|
689 |
]);
|
690 |
}
|
691 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/TransparentRedirect.php
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Braintree Transparent Redirect module
|
6 |
-
* Static class providing methods to build Transparent Redirect urls.
|
7 |
-
*
|
8 |
-
* The TransparentRedirect module provides methods to build the tr_data param
|
9 |
-
* that must be submitted when using the transparent redirect API.
|
10 |
-
* For more information
|
11 |
-
* about transparent redirect, see (TODO).
|
12 |
-
*
|
13 |
-
* You must provide a redirectUrl to which the gateway will redirect the
|
14 |
-
* user the action is complete.
|
15 |
-
*
|
16 |
-
* <code>
|
17 |
-
* $trData = TransparentRedirect::createCustomerData(array(
|
18 |
-
* 'redirectUrl => 'http://example.com/redirect_back_to_merchant_site',
|
19 |
-
* ));
|
20 |
-
* </code>
|
21 |
-
*
|
22 |
-
* In addition to the redirectUrl, any data that needs to be protected
|
23 |
-
* from user tampering should be included in the trData.
|
24 |
-
* For example, to prevent the user from tampering with the transaction
|
25 |
-
* amount, include the amount in the trData.
|
26 |
-
*
|
27 |
-
* <code>
|
28 |
-
* $trData = TransparentRedirect::transactionData(array(
|
29 |
-
* 'redirectUrl' => 'http://example.com/complete_transaction',
|
30 |
-
* 'transaction' => array('amount' => '100.00'),
|
31 |
-
* ));
|
32 |
-
*
|
33 |
-
* </code>
|
34 |
-
*
|
35 |
-
* @package Braintree
|
36 |
-
* @category Resources
|
37 |
-
*/
|
38 |
-
class TransparentRedirect
|
39 |
-
{
|
40 |
-
// Request Kinds
|
41 |
-
const CREATE_TRANSACTION = 'create_transaction';
|
42 |
-
const CREATE_PAYMENT_METHOD = 'create_payment_method';
|
43 |
-
const UPDATE_PAYMENT_METHOD = 'update_payment_method';
|
44 |
-
const CREATE_CUSTOMER = 'create_customer';
|
45 |
-
const UPDATE_CUSTOMER = 'update_customer';
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @ignore
|
49 |
-
* don't permit an explicit call of the constructor!
|
50 |
-
* (like $t = new TransparentRedirect())
|
51 |
-
*/
|
52 |
-
protected function __construct()
|
53 |
-
{
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
// static methods redirecting to gateway
|
59 |
-
|
60 |
-
public static function confirm($queryString)
|
61 |
-
{
|
62 |
-
return Configuration::gateway()->transparentRedirect()->confirm($queryString);
|
63 |
-
}
|
64 |
-
|
65 |
-
public static function createCreditCardData($params)
|
66 |
-
{
|
67 |
-
return Configuration::gateway()->transparentRedirect()->createCreditCardData($params);
|
68 |
-
}
|
69 |
-
|
70 |
-
public static function createCustomerData($params)
|
71 |
-
{
|
72 |
-
return Configuration::gateway()->transparentRedirect()->createCustomerData($params);
|
73 |
-
}
|
74 |
-
|
75 |
-
public static function url()
|
76 |
-
{
|
77 |
-
return Configuration::gateway()->transparentRedirect()->url();
|
78 |
-
}
|
79 |
-
|
80 |
-
public static function transactionData($params)
|
81 |
-
{
|
82 |
-
return Configuration::gateway()->transparentRedirect()->transactionData($params);
|
83 |
-
}
|
84 |
-
|
85 |
-
public static function updateCreditCardData($params)
|
86 |
-
{
|
87 |
-
return Configuration::gateway()->transparentRedirect()->updateCreditCardData($params);
|
88 |
-
}
|
89 |
-
|
90 |
-
public static function updateCustomerData($params)
|
91 |
-
{
|
92 |
-
return Configuration::gateway()->transparentRedirect()->updateCustomerData($params);
|
93 |
-
}
|
94 |
-
|
95 |
-
public static function parseAndValidateQueryString($queryString)
|
96 |
-
{
|
97 |
-
return Configuration::gateway()->transparentRedirect()->parseAndValidateQueryString($queryString);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
class_alias('Braintree\TransparentRedirect', 'Braintree_TransparentRedirect');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/TransparentRedirectGateway.php
DELETED
@@ -1,289 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Braintree;
|
3 |
-
|
4 |
-
use InvalidArgumentException;
|
5 |
-
use DateTime;
|
6 |
-
use DateTimeZone;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Braintree Transparent Redirect Gateway module
|
10 |
-
* Static class providing methods to build Transparent Redirect urls
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*/
|
15 |
-
class TransparentRedirectGateway
|
16 |
-
{
|
17 |
-
private $_gateway;
|
18 |
-
private $_config;
|
19 |
-
|
20 |
-
public function __construct($gateway)
|
21 |
-
{
|
22 |
-
$this->_gateway = $gateway;
|
23 |
-
$this->_config = $gateway->config;
|
24 |
-
$this->_config->assertHasAccessTokenOrKeys();
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
*
|
29 |
-
* @ignore
|
30 |
-
*/
|
31 |
-
private static $_transparentRedirectKeys = 'redirectUrl';
|
32 |
-
private static $_createCustomerSignature;
|
33 |
-
private static $_updateCustomerSignature;
|
34 |
-
private static $_transactionSignature;
|
35 |
-
private static $_createCreditCardSignature;
|
36 |
-
private static $_updateCreditCardSignature;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* create signatures for different call types
|
40 |
-
* @ignore
|
41 |
-
*/
|
42 |
-
public static function init()
|
43 |
-
{
|
44 |
-
|
45 |
-
self::$_createCustomerSignature = [
|
46 |
-
self::$_transparentRedirectKeys,
|
47 |
-
['customer' => CustomerGateway::createSignature()],
|
48 |
-
];
|
49 |
-
self::$_updateCustomerSignature = [
|
50 |
-
self::$_transparentRedirectKeys,
|
51 |
-
'customerId',
|
52 |
-
['customer' => CustomerGateway::updateSignature()],
|
53 |
-
];
|
54 |
-
self::$_transactionSignature = [
|
55 |
-
self::$_transparentRedirectKeys,
|
56 |
-
['transaction' => TransactionGateway::createSignature()],
|
57 |
-
];
|
58 |
-
self::$_createCreditCardSignature = [
|
59 |
-
self::$_transparentRedirectKeys,
|
60 |
-
['creditCard' => CreditCardGateway::createSignature()],
|
61 |
-
];
|
62 |
-
self::$_updateCreditCardSignature = [
|
63 |
-
self::$_transparentRedirectKeys,
|
64 |
-
'paymentMethodToken',
|
65 |
-
['creditCard' => CreditCardGateway::updateSignature()],
|
66 |
-
];
|
67 |
-
}
|
68 |
-
|
69 |
-
public function confirm($queryString)
|
70 |
-
{
|
71 |
-
$params = TransparentRedirect::parseAndValidateQueryString(
|
72 |
-
$queryString
|
73 |
-
);
|
74 |
-
$confirmationKlasses = [
|
75 |
-
TransparentRedirect::CREATE_TRANSACTION => 'Braintree\TransactionGateway',
|
76 |
-
TransparentRedirect::CREATE_CUSTOMER => 'Braintree\CustomerGateway',
|
77 |
-
TransparentRedirect::UPDATE_CUSTOMER => 'Braintree\CustomerGateway',
|
78 |
-
TransparentRedirect::CREATE_PAYMENT_METHOD => 'Braintree\CreditCardGateway',
|
79 |
-
TransparentRedirect::UPDATE_PAYMENT_METHOD => 'Braintree\CreditCardGateway',
|
80 |
-
];
|
81 |
-
$confirmationGateway = new $confirmationKlasses[$params["kind"]]($this->_gateway);
|
82 |
-
return $confirmationGateway->_doCreate('/transparent_redirect_requests/' . $params['id'] . '/confirm', []);
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* returns the trData string for creating a credit card,
|
87 |
-
* @param array $params
|
88 |
-
* @return string
|
89 |
-
*/
|
90 |
-
public function createCreditCardData($params)
|
91 |
-
{
|
92 |
-
Util::verifyKeys(
|
93 |
-
self::$_createCreditCardSignature,
|
94 |
-
$params
|
95 |
-
);
|
96 |
-
$params["kind"] = TransparentRedirect::CREATE_PAYMENT_METHOD;
|
97 |
-
return $this->_data($params);
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* returns the trData string for creating a customer.
|
102 |
-
* @param array $params
|
103 |
-
* @return string
|
104 |
-
*/
|
105 |
-
public function createCustomerData($params)
|
106 |
-
{
|
107 |
-
Util::verifyKeys(
|
108 |
-
self::$_createCustomerSignature,
|
109 |
-
$params
|
110 |
-
);
|
111 |
-
$params["kind"] = TransparentRedirect::CREATE_CUSTOMER;
|
112 |
-
return $this->_data($params);
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
public function url()
|
117 |
-
{
|
118 |
-
return $this->_config->baseUrl() . $this->_config->merchantPath() . '/transparent_redirect_requests';
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* returns the trData string for creating a transaction
|
123 |
-
* @param array $params
|
124 |
-
* @return string
|
125 |
-
*/
|
126 |
-
public function transactionData($params)
|
127 |
-
{
|
128 |
-
Util::verifyKeys(
|
129 |
-
self::$_transactionSignature,
|
130 |
-
$params
|
131 |
-
);
|
132 |
-
$params["kind"] = TransparentRedirect::CREATE_TRANSACTION;
|
133 |
-
$transactionType = isset($params['transaction']['type']) ?
|
134 |
-
$params['transaction']['type'] :
|
135 |
-
null;
|
136 |
-
if ($transactionType != Transaction::SALE && $transactionType != Transaction::CREDIT) {
|
137 |
-
throw new InvalidArgumentException(
|
138 |
-
'expected transaction[type] of sale or credit, was: ' .
|
139 |
-
$transactionType
|
140 |
-
);
|
141 |
-
}
|
142 |
-
|
143 |
-
return $this->_data($params);
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Returns the trData string for updating a credit card.
|
148 |
-
*
|
149 |
-
* The paymentMethodToken of the credit card to update is required.
|
150 |
-
*
|
151 |
-
* <code>
|
152 |
-
* $trData = TransparentRedirect::updateCreditCardData(array(
|
153 |
-
* 'redirectUrl' => 'http://example.com/redirect_here',
|
154 |
-
* 'paymentMethodToken' => 'token123',
|
155 |
-
* ));
|
156 |
-
* </code>
|
157 |
-
*
|
158 |
-
* @param array $params
|
159 |
-
* @return string
|
160 |
-
*/
|
161 |
-
public function updateCreditCardData($params)
|
162 |
-
{
|
163 |
-
Util::verifyKeys(
|
164 |
-
self::$_updateCreditCardSignature,
|
165 |
-
$params
|
166 |
-
);
|
167 |
-
if (!isset($params['paymentMethodToken'])) {
|
168 |
-
throw new InvalidArgumentException(
|
169 |
-
'expected params to contain paymentMethodToken.'
|
170 |
-
);
|
171 |
-
}
|
172 |
-
$params["kind"] = TransparentRedirect::UPDATE_PAYMENT_METHOD;
|
173 |
-
return $this->_data($params);
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Returns the trData string for updating a customer.
|
178 |
-
*
|
179 |
-
* The customerId of the customer to update is required.
|
180 |
-
*
|
181 |
-
* <code>
|
182 |
-
* $trData = TransparentRedirect::updateCustomerData(array(
|
183 |
-
* 'redirectUrl' => 'http://example.com/redirect_here',
|
184 |
-
* 'customerId' => 'customer123',
|
185 |
-
* ));
|
186 |
-
* </code>
|
187 |
-
*
|
188 |
-
* @param array $params
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
public function updateCustomerData($params)
|
192 |
-
{
|
193 |
-
Util::verifyKeys(
|
194 |
-
self::$_updateCustomerSignature,
|
195 |
-
$params
|
196 |
-
);
|
197 |
-
if (!isset($params['customerId'])) {
|
198 |
-
throw new InvalidArgumentException(
|
199 |
-
'expected params to contain customerId of customer to update'
|
200 |
-
);
|
201 |
-
}
|
202 |
-
$params["kind"] = TransparentRedirect::UPDATE_CUSTOMER;
|
203 |
-
return $this->_data($params);
|
204 |
-
}
|
205 |
-
|
206 |
-
public function parseAndValidateQueryString($queryString)
|
207 |
-
{
|
208 |
-
// parse the params into an array
|
209 |
-
parse_str($queryString, $params);
|
210 |
-
// remove the hash
|
211 |
-
$queryStringWithoutHash = null;
|
212 |
-
if (preg_match('/^(.*)&hash=[a-f0-9]+$/', $queryString, $match)) {
|
213 |
-
$queryStringWithoutHash = $match[1];
|
214 |
-
}
|
215 |
-
|
216 |
-
if($params['http_status'] != '200') {
|
217 |
-
$message = null;
|
218 |
-
if(array_key_exists('bt_message', $params)) {
|
219 |
-
$message = $params['bt_message'];
|
220 |
-
}
|
221 |
-
Util::throwStatusCodeException(isset($params['http_status']) ? $params['http_status'] : null, $message);
|
222 |
-
}
|
223 |
-
|
224 |
-
// recreate the hash and compare it
|
225 |
-
if ($this->_hash($queryStringWithoutHash) == $params['hash']) {
|
226 |
-
return $params;
|
227 |
-
} else {
|
228 |
-
throw new Exception\ForgedQueryString();
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
|
233 |
-
/**
|
234 |
-
*
|
235 |
-
* @ignore
|
236 |
-
*/
|
237 |
-
private function _data($params)
|
238 |
-
{
|
239 |
-
if (!isset($params['redirectUrl'])) {
|
240 |
-
throw new InvalidArgumentException(
|
241 |
-
'expected params to contain redirectUrl'
|
242 |
-
);
|
243 |
-
}
|
244 |
-
$params = $this->_underscoreKeys($params);
|
245 |
-
$now = new DateTime('now', new DateTimeZone('UTC'));
|
246 |
-
$trDataParams = array_merge($params,
|
247 |
-
[
|
248 |
-
'api_version' => Configuration::API_VERSION,
|
249 |
-
'public_key' => $this->_config->publicKey(),
|
250 |
-
'time' => $now->format('YmdHis'),
|
251 |
-
]
|
252 |
-
);
|
253 |
-
ksort($trDataParams);
|
254 |
-
$urlEncodedData = http_build_query($trDataParams, null, "&");
|
255 |
-
$signatureService = new SignatureService(
|
256 |
-
$this->_config->privateKey(),
|
257 |
-
"Braintree\Digest::hexDigestSha1"
|
258 |
-
);
|
259 |
-
return $signatureService->sign($urlEncodedData);
|
260 |
-
}
|
261 |
-
|
262 |
-
private function _underscoreKeys($array)
|
263 |
-
{
|
264 |
-
foreach($array as $key=>$value)
|
265 |
-
{
|
266 |
-
$newKey = Util::camelCaseToDelimiter($key, '_');
|
267 |
-
unset($array[$key]);
|
268 |
-
if (is_array($value))
|
269 |
-
{
|
270 |
-
$array[$newKey] = $this->_underscoreKeys($value);
|
271 |
-
}
|
272 |
-
else
|
273 |
-
{
|
274 |
-
$array[$newKey] = $value;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
return $array;
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* @ignore
|
282 |
-
*/
|
283 |
-
private function _hash($string)
|
284 |
-
{
|
285 |
-
return Digest::hexDigestSha1($this->_config->privateKey(), $string);
|
286 |
-
}
|
287 |
-
}
|
288 |
-
TransparentRedirectGateway::init();
|
289 |
-
class_alias('Braintree\TransparentRedirectGateway', 'Braintree_TransparentRedirectGateway');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/UnknownPaymentMethod.php
CHANGED
@@ -1,34 +1,21 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree UnknownPaymentMethod module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
* Manages Braintree UnknownPaymentMethod
|
13 |
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
-
* @property-read string $token
|
21 |
-
* @property-read string $imageUrl
|
22 |
*/
|
|
|
23 |
class UnknownPaymentMethod extends Base
|
24 |
{
|
25 |
-
|
26 |
-
|
27 |
/**
|
28 |
-
*
|
29 |
-
*
|
|
|
30 |
*
|
31 |
-
* @ignore
|
32 |
* @return UnknownPaymentMethod
|
33 |
*/
|
34 |
public static function factory($attributes)
|
@@ -54,8 +41,8 @@ class UnknownPaymentMethod extends Base
|
|
54 |
/**
|
55 |
* sets instance properties from an array of values
|
56 |
*
|
57 |
-
* @access protected
|
58 |
* @param array $unknownPaymentMethodAttribs array of unknownPaymentMethod data
|
|
|
59 |
* @return void
|
60 |
*/
|
61 |
protected function _initialize($unknownPaymentMethodAttribs)
|
@@ -64,6 +51,4 @@ class UnknownPaymentMethod extends Base
|
|
64 |
$this->imageUrl = 'https://assets.braintreegateway.com/payment_method_logo/unknown.png';
|
65 |
$this->_attributes = $unknownPaymentMethodAttribs;
|
66 |
}
|
67 |
-
|
68 |
}
|
69 |
-
class_alias('Braintree\UnknownPaymentMethod', 'Braintree_UnknownPaymentMethod');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree UnknownPaymentMethod module
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* Manages Braintree UnknownPaymentMethod
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/payment-method developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
+
|
12 |
class UnknownPaymentMethod extends Base
|
13 |
{
|
|
|
|
|
14 |
/**
|
15 |
+
* Creates an instance from given attributes
|
16 |
+
*
|
17 |
+
* @param array $attributes response object attributes
|
18 |
*
|
|
|
19 |
* @return UnknownPaymentMethod
|
20 |
*/
|
21 |
public static function factory($attributes)
|
41 |
/**
|
42 |
* sets instance properties from an array of values
|
43 |
*
|
|
|
44 |
* @param array $unknownPaymentMethodAttribs array of unknownPaymentMethod data
|
45 |
+
*
|
46 |
* @return void
|
47 |
*/
|
48 |
protected function _initialize($unknownPaymentMethodAttribs)
|
51 |
$this->imageUrl = 'https://assets.braintreegateway.com/payment_method_logo/unknown.png';
|
52 |
$this->_attributes = $unknownPaymentMethodAttribs;
|
53 |
}
|
|
|
54 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/UsBankAccount.php
CHANGED
@@ -1,42 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree UsBankAccount module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
* Manages Braintree UsBankAccounts
|
13 |
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
-
* @property-read string $customerId
|
21 |
-
* @property-read string $email
|
22 |
-
* @property-read string $token
|
23 |
-
* @property-read string $imageUrl
|
24 |
-
* @property-read string $routingNumber
|
25 |
-
* @property-read string $accountType
|
26 |
-
* @property-read string $accountHolderName
|
27 |
-
* @property-read string $last4
|
28 |
-
* @property-read string $bankName
|
29 |
-
* @property-read string $achMandate
|
30 |
-
* @property-read string $default
|
31 |
-
* @property-read boolean $verified
|
32 |
*/
|
33 |
class UsBankAccount extends Base
|
34 |
{
|
35 |
/**
|
36 |
-
*
|
37 |
-
*
|
|
|
38 |
*
|
39 |
-
* @ignore
|
40 |
* @return UsBankAccount
|
41 |
*/
|
42 |
public static function factory($attributes)
|
@@ -46,14 +24,12 @@ class UsBankAccount extends Base
|
|
46 |
return $instance;
|
47 |
}
|
48 |
|
49 |
-
/* instance methods */
|
50 |
-
|
51 |
/**
|
52 |
* sets instance properties from an array of values
|
53 |
*
|
54 |
-
* @access protected
|
55 |
* @param array $usBankAccountAttribs array of usBankAccount data
|
56 |
-
*
|
|
|
57 |
*/
|
58 |
protected function _initialize($usBankAccountAttribs)
|
59 |
{
|
@@ -78,12 +54,8 @@ class UsBankAccount extends Base
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
* ClassName[property=value, property=value]
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function __toString()
|
87 |
{
|
88 |
return __CLASS__ . '[' .
|
89 |
Util::attributesToString($this->_attributes) . ']';
|
@@ -99,13 +71,28 @@ class UsBankAccount extends Base
|
|
99 |
return $this->default;
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
public static function find($token)
|
105 |
{
|
106 |
return Configuration::gateway()->usBankAccount()->find($token);
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
public static function sale($token, $transactionAttribs)
|
110 |
{
|
111 |
$transactionAttribs['options'] = [
|
@@ -114,4 +101,3 @@ class UsBankAccount extends Base
|
|
114 |
return Configuration::gateway()->usBankAccount()->sale($token, $transactionAttribs);
|
115 |
}
|
116 |
}
|
117 |
-
class_alias('Braintree\UsBankAccount', 'Braintree_UsBankAccount');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree UsBankAccount module
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* Manages Braintree UsBankAccounts
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/us-bank-account developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class UsBankAccount extends Base
|
12 |
{
|
13 |
/**
|
14 |
+
* Creates an instance from given attributes
|
15 |
+
*
|
16 |
+
* @param array $attributes response object attributes
|
17 |
*
|
|
|
18 |
* @return UsBankAccount
|
19 |
*/
|
20 |
public static function factory($attributes)
|
24 |
return $instance;
|
25 |
}
|
26 |
|
|
|
|
|
27 |
/**
|
28 |
* sets instance properties from an array of values
|
29 |
*
|
|
|
30 |
* @param array $usBankAccountAttribs array of usBankAccount data
|
31 |
+
*
|
32 |
+
* @return mixed
|
33 |
*/
|
34 |
protected function _initialize($usBankAccountAttribs)
|
35 |
{
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
58 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
59 |
{
|
60 |
return __CLASS__ . '[' .
|
61 |
Util::attributesToString($this->_attributes) . ']';
|
71 |
return $this->default;
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* Static methods redirecting to gateway class
|
76 |
+
*
|
77 |
+
* @param string $token the payment method identifier
|
78 |
+
*
|
79 |
+
* @see USBankAccountGateway::find()
|
80 |
+
*
|
81 |
+
* @return UsBankAccount|Error
|
82 |
+
*/
|
83 |
public static function find($token)
|
84 |
{
|
85 |
return Configuration::gateway()->usBankAccount()->find($token);
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* DO NOT USE, Use Transaction#sale instead. If you do choose to use this function, note that the subsequent transaction (if successful) will be automatically submitted for settlement.
|
90 |
+
*
|
91 |
+
* @param string $token the payment method identifier
|
92 |
+
* @param array $transactionAttribs all other transaction parameters
|
93 |
+
*
|
94 |
+
* @return UsBankAccount|Error
|
95 |
+
*/
|
96 |
public static function sale($token, $transactionAttribs)
|
97 |
{
|
98 |
$transactionAttribs['options'] = [
|
101 |
return Configuration::gateway()->usBankAccount()->sale($token, $transactionAttribs);
|
102 |
}
|
103 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/UsBankAccountGateway.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
@@ -6,18 +7,7 @@ use InvalidArgumentException;
|
|
6 |
/**
|
7 |
* Braintree UsBankAccountGateway module
|
8 |
*
|
9 |
-
* @package Braintree
|
10 |
-
* @category Resources
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
* Manages Braintree UsBankAccounts
|
15 |
-
*
|
16 |
-
* <b>== More information ==</b>
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @package Braintree
|
20 |
-
* @category Resources
|
21 |
*/
|
22 |
class UsBankAccountGateway
|
23 |
{
|
@@ -25,6 +15,7 @@ class UsBankAccountGateway
|
|
25 |
private $_config;
|
26 |
private $_http;
|
27 |
|
|
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -37,10 +28,11 @@ class UsBankAccountGateway
|
|
37 |
/**
|
38 |
* find a usBankAccount by token
|
39 |
*
|
40 |
-
* @access public
|
41 |
* @param string $token paypal accountunique id
|
42 |
-
*
|
43 |
* @throws Exception\NotFound
|
|
|
|
|
44 |
*/
|
45 |
public function find($token)
|
46 |
{
|
@@ -53,16 +45,17 @@ class UsBankAccountGateway
|
|
53 |
'US bank account with token ' . $token . ' not found'
|
54 |
);
|
55 |
}
|
56 |
-
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
* create a new sale for the current UsBank account
|
61 |
*
|
62 |
-
* @param string $token
|
63 |
-
* @param array
|
64 |
-
*
|
65 |
* @see Transaction::sale()
|
|
|
|
|
66 |
*/
|
67 |
public function sale($token, $transactionAttribs)
|
68 |
{
|
@@ -82,25 +75,25 @@ class UsBankAccountGateway
|
|
82 |
* encapsulates a Errors object inside a Result\Error
|
83 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
84 |
*
|
85 |
-
* @ignore
|
86 |
* @param array $response gateway response values
|
87 |
-
*
|
88 |
* @throws Exception\Unexpected
|
|
|
|
|
89 |
*/
|
90 |
private function _verifyGatewayResponse($response)
|
91 |
{
|
92 |
if (isset($response['usBankAccount'])) {
|
93 |
// return a populated instance of UsBankAccount
|
94 |
return new Result\Successful(
|
95 |
-
|
96 |
);
|
97 |
-
}
|
98 |
return new Result\Error($response['apiErrorResponse']);
|
99 |
} else {
|
100 |
throw new Exception\Unexpected(
|
101 |
-
|
102 |
);
|
103 |
}
|
104 |
}
|
105 |
}
|
106 |
-
class_alias('Braintree\UsBankAccountGateway', 'Braintree_UsBankAccountGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
7 |
/**
|
8 |
* Braintree UsBankAccountGateway module
|
9 |
*
|
|
|
|
|
|
|
|
|
|
|
10 |
* Manages Braintree UsBankAccounts
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
class UsBankAccountGateway
|
13 |
{
|
15 |
private $_config;
|
16 |
private $_http;
|
17 |
|
18 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
19 |
public function __construct($gateway)
|
20 |
{
|
21 |
$this->_gateway = $gateway;
|
28 |
/**
|
29 |
* find a usBankAccount by token
|
30 |
*
|
|
|
31 |
* @param string $token paypal accountunique id
|
32 |
+
*
|
33 |
* @throws Exception\NotFound
|
34 |
+
*
|
35 |
+
* @return UsBankAccount
|
36 |
*/
|
37 |
public function find($token)
|
38 |
{
|
45 |
'US bank account with token ' . $token . ' not found'
|
46 |
);
|
47 |
}
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* create a new sale for the current UsBank account
|
52 |
*
|
53 |
+
* @param string $token payment method identifier
|
54 |
+
* @param array $transactionAttribs request parameters
|
55 |
+
*
|
56 |
* @see Transaction::sale()
|
57 |
+
*
|
58 |
+
* @return Result\Successful|Result\Error
|
59 |
*/
|
60 |
public function sale($token, $transactionAttribs)
|
61 |
{
|
75 |
* encapsulates a Errors object inside a Result\Error
|
76 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
77 |
*
|
|
|
78 |
* @param array $response gateway response values
|
79 |
+
*
|
80 |
* @throws Exception\Unexpected
|
81 |
+
*
|
82 |
+
* @return Result\Successful|Result\Error
|
83 |
*/
|
84 |
private function _verifyGatewayResponse($response)
|
85 |
{
|
86 |
if (isset($response['usBankAccount'])) {
|
87 |
// return a populated instance of UsBankAccount
|
88 |
return new Result\Successful(
|
89 |
+
UsBankAccount::factory($response['usBankAccount'])
|
90 |
);
|
91 |
+
} elseif (isset($response['apiErrorResponse'])) {
|
92 |
return new Result\Error($response['apiErrorResponse']);
|
93 |
} else {
|
94 |
throw new Exception\Unexpected(
|
95 |
+
'Expected US bank account or apiErrorResponse'
|
96 |
);
|
97 |
}
|
98 |
}
|
99 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerification.php
CHANGED
@@ -1,30 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree UsBankAccountVerification module
|
6 |
-
*
|
7 |
-
* @package Braintree
|
8 |
-
* @category Resources
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* Manages Braintree UsBankAccountVerifications
|
13 |
*
|
14 |
* <b>== More information ==</b>
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* @package Braintree
|
18 |
-
* @category Resources
|
19 |
-
*
|
20 |
*/
|
21 |
class UsBankAccountVerification extends Result\UsBankAccountVerification
|
22 |
{
|
23 |
/**
|
24 |
-
*
|
25 |
-
*
|
|
|
26 |
*
|
27 |
-
* @ignore
|
28 |
* @return UsBankAccountVerification
|
29 |
*/
|
30 |
public static function factory($attributes)
|
@@ -39,8 +32,8 @@ class UsBankAccountVerification extends Result\UsBankAccountVerification
|
|
39 |
/**
|
40 |
* sets instance properties from an array of values
|
41 |
*
|
42 |
-
* @access protected
|
43 |
* @param array $usBankAccountVerificationAttribs array of usBankAccountVerification data
|
|
|
44 |
* @return void
|
45 |
*/
|
46 |
protected function _initialize($usBankAccountVerificationAttribs)
|
@@ -49,24 +42,20 @@ class UsBankAccountVerification extends Result\UsBankAccountVerification
|
|
49 |
$this->_attributes = $usBankAccountVerificationAttribs;
|
50 |
}
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
* ClassName[property=value, property=value]
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
public function __toString()
|
58 |
{
|
59 |
return __CLASS__ . '[' . Util::attributesToString($this->_attributes) . ']';
|
60 |
}
|
61 |
|
62 |
|
63 |
-
// static methods redirecting to gateway
|
64 |
-
|
65 |
/**
|
66 |
-
*
|
67 |
*
|
68 |
-
* @access public
|
69 |
* @param string $token unique id
|
|
|
|
|
|
|
70 |
* @return UsBankAccountVerification
|
71 |
*/
|
72 |
public static function find($token)
|
@@ -75,10 +64,12 @@ class UsBankAccountVerification extends Result\UsBankAccountVerification
|
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
-
*
|
79 |
*
|
80 |
-
* @access public
|
81 |
* @param mixed $query search query
|
|
|
|
|
|
|
82 |
* @return ResourceCollection
|
83 |
*/
|
84 |
public static function search($query)
|
@@ -87,11 +78,13 @@ class UsBankAccountVerification extends Result\UsBankAccountVerification
|
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
-
*
|
|
|
|
|
|
|
|
|
|
|
91 |
*
|
92 |
-
* @access public
|
93 |
-
* @param string $token unique id
|
94 |
-
* @param array $amounts micro transfer amounts
|
95 |
* @return ResourceCollection
|
96 |
*/
|
97 |
public static function confirmMicroTransferAmounts($token, $amounts)
|
@@ -99,4 +92,3 @@ class UsBankAccountVerification extends Result\UsBankAccountVerification
|
|
99 |
return Configuration::gateway()->usBankAccountVerification()->confirmMicroTransferAmounts($token, $amounts);
|
100 |
}
|
101 |
}
|
102 |
-
class_alias('Braintree\UsBankAccountVerification', 'Braintree_UsBankAccountVerification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree UsBankAccountVerification module
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
10 |
* Manages Braintree UsBankAccountVerifications
|
11 |
*
|
12 |
* <b>== More information ==</b>
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
class UsBankAccountVerification extends Result\UsBankAccountVerification
|
15 |
{
|
16 |
/**
|
17 |
+
* Creates an instance from given attributes
|
18 |
+
*
|
19 |
+
* @param array $attributes response object attributes
|
20 |
*
|
|
|
21 |
* @return UsBankAccountVerification
|
22 |
*/
|
23 |
public static function factory($attributes)
|
32 |
/**
|
33 |
* sets instance properties from an array of values
|
34 |
*
|
|
|
35 |
* @param array $usBankAccountVerificationAttribs array of usBankAccountVerification data
|
36 |
+
*
|
37 |
* @return void
|
38 |
*/
|
39 |
protected function _initialize($usBankAccountVerificationAttribs)
|
42 |
$this->_attributes = $usBankAccountVerificationAttribs;
|
43 |
}
|
44 |
|
45 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
46 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
47 |
{
|
48 |
return __CLASS__ . '[' . Util::attributesToString($this->_attributes) . ']';
|
49 |
}
|
50 |
|
51 |
|
|
|
|
|
52 |
/**
|
53 |
+
* Static methods redirecting to gateway class
|
54 |
*
|
|
|
55 |
* @param string $token unique id
|
56 |
+
*
|
57 |
+
* @see UsBankAccountVerificationGateway::find()
|
58 |
+
*
|
59 |
* @return UsBankAccountVerification
|
60 |
*/
|
61 |
public static function find($token)
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* Static methods redirecting to gateway class
|
68 |
*
|
|
|
69 |
* @param mixed $query search query
|
70 |
+
*
|
71 |
+
* @see UsBankAccountVerificationGateway::search()
|
72 |
+
*
|
73 |
* @return ResourceCollection
|
74 |
*/
|
75 |
public static function search($query)
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
+
* Static methods redirecting to gateway class
|
82 |
+
*
|
83 |
+
* @param string $token unique id
|
84 |
+
* @param array $amounts micro transfer amounts
|
85 |
+
*
|
86 |
+
* @see UsBankAccountVerificationGateway::confirmMicroTransferAmounts()
|
87 |
*
|
|
|
|
|
|
|
88 |
* @return ResourceCollection
|
89 |
*/
|
90 |
public static function confirmMicroTransferAmounts($token, $amounts)
|
92 |
return Configuration::gateway()->usBankAccountVerification()->confirmMicroTransferAmounts($token, $amounts);
|
93 |
}
|
94 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerificationGateway.php
CHANGED
@@ -1,23 +1,17 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use InvalidArgumentException;
|
5 |
|
6 |
/**
|
7 |
* Braintree UsBankAccountVerificationGateway module
|
8 |
-
*
|
9 |
-
* @package Braintree
|
10 |
-
* @category Resources
|
11 |
*/
|
12 |
|
13 |
/**
|
14 |
* Manages Braintree UsBankAccountVerifications
|
15 |
*
|
16 |
* <b>== More information ==</b>
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @package Braintree
|
20 |
-
* @category Resources
|
21 |
*/
|
22 |
class UsBankAccountVerificationGateway
|
23 |
{
|
@@ -25,6 +19,7 @@ class UsBankAccountVerificationGateway
|
|
25 |
private $_config;
|
26 |
private $_http;
|
27 |
|
|
|
28 |
public function __construct($gateway)
|
29 |
{
|
30 |
$this->_gateway = $gateway;
|
@@ -36,10 +31,11 @@ class UsBankAccountVerificationGateway
|
|
36 |
/**
|
37 |
* find a usBankAccountVerification by token
|
38 |
*
|
39 |
-
* @access public
|
40 |
* @param string $token unique id
|
41 |
-
*
|
42 |
* @throws Exception\NotFound
|
|
|
|
|
43 |
*/
|
44 |
public function find($token)
|
45 |
{
|
@@ -54,6 +50,13 @@ class UsBankAccountVerificationGateway
|
|
54 |
}
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
public function search($query)
|
58 |
{
|
59 |
$criteria = [];
|
@@ -75,15 +78,17 @@ class UsBankAccountVerificationGateway
|
|
75 |
/**
|
76 |
* complete micro transfer verification by confirming the transfer amounts
|
77 |
*
|
78 |
-
* @
|
79 |
-
* @param
|
80 |
-
*
|
81 |
-
* @return UsBankAccountVerification
|
82 |
* @throws Exception\Unexpected
|
|
|
|
|
83 |
*/
|
84 |
public function confirmMicroTransferAmounts($token, $amounts)
|
85 |
{
|
86 |
try {
|
|
|
87 |
$path = $this->_config->merchantPath() . '/us_bank_account_verifications/' . $token . '/confirm_micro_transfer_amounts';
|
88 |
$response = $this->_http->put($path, [
|
89 |
"us_bank_account_verification" => ["deposit_amounts" => $amounts]
|
@@ -104,16 +109,17 @@ class UsBankAccountVerificationGateway
|
|
104 |
* encapsulates a Errors object inside a Result\Error
|
105 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
106 |
*
|
107 |
-
* @ignore
|
108 |
* @param array $response gateway response values
|
109 |
-
*
|
110 |
* @throws Exception\Unexpected
|
|
|
|
|
111 |
*/
|
112 |
private function _verifyGatewayResponse($response)
|
113 |
{
|
114 |
if (isset($response['apiErrorResponse'])) {
|
115 |
return new Result\Error($response['apiErrorResponse']);
|
116 |
-
}
|
117 |
// return a populated instance of UsBankAccountVerification
|
118 |
return new Result\Successful(
|
119 |
UsBankAccountVerification::factory($response['usBankAccountVerification'])
|
@@ -125,5 +131,3 @@ class UsBankAccountVerificationGateway
|
|
125 |
}
|
126 |
}
|
127 |
}
|
128 |
-
|
129 |
-
class_alias('Braintree\UsBankAccountVerificationGateway', 'Braintree_UsBankAccountVerificationGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use InvalidArgumentException;
|
6 |
|
7 |
/**
|
8 |
* Braintree UsBankAccountVerificationGateway module
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
12 |
* Manages Braintree UsBankAccountVerifications
|
13 |
*
|
14 |
* <b>== More information ==</b>
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class UsBankAccountVerificationGateway
|
17 |
{
|
19 |
private $_config;
|
20 |
private $_http;
|
21 |
|
22 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
23 |
public function __construct($gateway)
|
24 |
{
|
25 |
$this->_gateway = $gateway;
|
31 |
/**
|
32 |
* find a usBankAccountVerification by token
|
33 |
*
|
|
|
34 |
* @param string $token unique id
|
35 |
+
*
|
36 |
* @throws Exception\NotFound
|
37 |
+
*
|
38 |
+
* @return UsBankAccountVerification
|
39 |
*/
|
40 |
public function find($token)
|
41 |
{
|
50 |
}
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* Returns a ResourceCollection of US bank account verifications matching the search query.
|
55 |
+
*
|
56 |
+
* @param mixed $query search query
|
57 |
+
*
|
58 |
+
* @return ResourceCollection
|
59 |
+
*/
|
60 |
public function search($query)
|
61 |
{
|
62 |
$criteria = [];
|
78 |
/**
|
79 |
* complete micro transfer verification by confirming the transfer amounts
|
80 |
*
|
81 |
+
* @param string $token unique id
|
82 |
+
* @param array $amounts amounts deposited in micro transfer
|
83 |
+
*
|
|
|
84 |
* @throws Exception\Unexpected
|
85 |
+
*
|
86 |
+
* @return UsBankAccountVerification
|
87 |
*/
|
88 |
public function confirmMicroTransferAmounts($token, $amounts)
|
89 |
{
|
90 |
try {
|
91 |
+
// phpcs:ignore Generic.Files.LineLength
|
92 |
$path = $this->_config->merchantPath() . '/us_bank_account_verifications/' . $token . '/confirm_micro_transfer_amounts';
|
93 |
$response = $this->_http->put($path, [
|
94 |
"us_bank_account_verification" => ["deposit_amounts" => $amounts]
|
109 |
* encapsulates a Errors object inside a Result\Error
|
110 |
* alternatively, throws an Unexpected exception if the response is invalid.
|
111 |
*
|
|
|
112 |
* @param array $response gateway response values
|
113 |
+
*
|
114 |
* @throws Exception\Unexpected
|
115 |
+
*
|
116 |
+
* @return Result\Successful|Result\Error
|
117 |
*/
|
118 |
private function _verifyGatewayResponse($response)
|
119 |
{
|
120 |
if (isset($response['apiErrorResponse'])) {
|
121 |
return new Result\Error($response['apiErrorResponse']);
|
122 |
+
} elseif (isset($response['usBankAccountVerification'])) {
|
123 |
// return a populated instance of UsBankAccountVerification
|
124 |
return new Result\Successful(
|
125 |
UsBankAccountVerification::factory($response['usBankAccountVerification'])
|
131 |
}
|
132 |
}
|
133 |
}
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/UsBankAccountVerificationSearch.php
CHANGED
@@ -1,36 +1,88 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class UsBankAccountVerificationSearch
|
5 |
{
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
return new TextNode('account_holder_name');
|
8 |
}
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return new TextNode('customer_email');
|
12 |
}
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return new TextNode('customer_id');
|
16 |
}
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
return new TextNode('id');
|
20 |
}
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
return new TextNode('payment_method_token');
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
return new TextNode('routiner_number');
|
28 |
}
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return new MultipleValueNode('ids');
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
public static function status()
|
35 |
{
|
36 |
return new MultipleValueNode(
|
@@ -39,6 +91,11 @@ class UsBankAccountVerificationSearch
|
|
39 |
);
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
public static function verificationMethod()
|
43 |
{
|
44 |
return new MultipleValueNode(
|
@@ -47,18 +104,33 @@ class UsBankAccountVerificationSearch
|
|
47 |
);
|
48 |
}
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
return new RangeNode("created_at");
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
public static function accountType()
|
55 |
{
|
56 |
return new EqualityNode("account_type");
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
public static function accountNumber()
|
60 |
{
|
61 |
return new EndsWithNode("account_number");
|
62 |
}
|
63 |
}
|
64 |
-
class_alias('Braintree\UsBankAccountVerificationSearch', 'Braintree_UsBankAccountVerificationSearch');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree UsBankAccountVerificationSearch
|
7 |
+
* UsBankAccountVerificationSearch is used in searching US Bank Account verifications (ACH)
|
8 |
+
*/
|
9 |
class UsBankAccountVerificationSearch
|
10 |
{
|
11 |
+
/**
|
12 |
+
* Sets account holder name in search terms
|
13 |
+
*
|
14 |
+
* @return TextNode
|
15 |
+
*/
|
16 |
+
public static function accountHolderName()
|
17 |
+
{
|
18 |
return new TextNode('account_holder_name');
|
19 |
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Sets customer email in search terms
|
23 |
+
*
|
24 |
+
* @return TextNode
|
25 |
+
*/
|
26 |
+
public static function customerEmail()
|
27 |
+
{
|
28 |
return new TextNode('customer_email');
|
29 |
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Sets customer Id in search terms
|
33 |
+
*
|
34 |
+
* @return TextNode
|
35 |
+
*/
|
36 |
+
public static function customerId()
|
37 |
+
{
|
38 |
return new TextNode('customer_id');
|
39 |
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Sets Id in search terms
|
43 |
+
*
|
44 |
+
* @return TextNode
|
45 |
+
*/
|
46 |
+
public static function id()
|
47 |
+
{
|
48 |
return new TextNode('id');
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* Sets payment method token in search terms
|
53 |
+
*
|
54 |
+
* @return TextNode
|
55 |
+
*/
|
56 |
+
public static function paymentMethodToken()
|
57 |
+
{
|
58 |
return new TextNode('payment_method_token');
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* Sets routing number in search terms
|
63 |
+
*
|
64 |
+
* @return TextNode
|
65 |
+
*/
|
66 |
+
public static function routingNumber()
|
67 |
+
{
|
68 |
return new TextNode('routiner_number');
|
69 |
}
|
70 |
|
71 |
+
/**
|
72 |
+
* Sets Ids in search terms
|
73 |
+
*
|
74 |
+
* @return TextNode
|
75 |
+
*/
|
76 |
+
public static function ids()
|
77 |
+
{
|
78 |
return new MultipleValueNode('ids');
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Sets US bank account verification statuses in search terms
|
83 |
+
*
|
84 |
+
* @return MultipleValueNode
|
85 |
+
*/
|
86 |
public static function status()
|
87 |
{
|
88 |
return new MultipleValueNode(
|
91 |
);
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Sets US bank account verification methods in search terms
|
96 |
+
*
|
97 |
+
* @return MultipleValueNode
|
98 |
+
*/
|
99 |
public static function verificationMethod()
|
100 |
{
|
101 |
return new MultipleValueNode(
|
104 |
);
|
105 |
}
|
106 |
|
107 |
+
/**
|
108 |
+
* Sets created at date range in search terms
|
109 |
+
*
|
110 |
+
* @return RangeNode
|
111 |
+
*/
|
112 |
+
public static function createdAt()
|
113 |
+
{
|
114 |
return new RangeNode("created_at");
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* Sets account type in search terms
|
119 |
+
*
|
120 |
+
* @return EqualityNode
|
121 |
+
*/
|
122 |
public static function accountType()
|
123 |
{
|
124 |
return new EqualityNode("account_type");
|
125 |
}
|
126 |
|
127 |
+
/**
|
128 |
+
* Sets account number in search terms
|
129 |
+
*
|
130 |
+
* @return EndsWithNode
|
131 |
+
*/
|
132 |
public static function accountNumber()
|
133 |
{
|
134 |
return new EndsWithNode("account_number");
|
135 |
}
|
136 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Util.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
use DateTime;
|
@@ -6,7 +7,6 @@ use InvalidArgumentException;
|
|
6 |
|
7 |
/**
|
8 |
* Braintree Utility methods
|
9 |
-
* PHP version 5
|
10 |
*/
|
11 |
|
12 |
class Util
|
@@ -20,11 +20,12 @@ class Util
|
|
20 |
*
|
21 |
* @param array $attribArray attributes from a search response
|
22 |
* @param string $attributeName indicates which element of the passed array to extract
|
|
|
23 |
* @return array array of $attributeName objects, or a single element array
|
24 |
*/
|
25 |
public static function extractAttributeAsArray(&$attribArray, $attributeName)
|
26 |
{
|
27 |
-
if(!isset($attribArray[$attributeName])):
|
28 |
return [];
|
29 |
endif;
|
30 |
|
@@ -32,10 +33,10 @@ class Util
|
|
32 |
$data = $attribArray[$attributeName];
|
33 |
// set up the class that will be used to convert each array element
|
34 |
$classFactory = self::buildClassName($attributeName) . '::factory';
|
35 |
-
if(is_array($data)):
|
36 |
// create an object from the data in each element
|
37 |
$objectArray = array_map($classFactory, $data);
|
38 |
-
else:
|
39 |
return [$data];
|
40 |
endif;
|
41 |
|
@@ -44,47 +45,104 @@ class Util
|
|
44 |
}
|
45 |
/**
|
46 |
* throws an exception based on the type of error
|
47 |
-
*
|
48 |
-
* @param
|
|
|
|
|
49 |
* @throws Exception multiple types depending on the error
|
|
|
50 |
* @return void
|
51 |
*/
|
52 |
-
public static function throwStatusCodeException($statusCode, $message=null)
|
53 |
{
|
54 |
-
switch($statusCode) {
|
55 |
-
|
56 |
-
|
57 |
break;
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
break;
|
61 |
-
|
62 |
-
|
63 |
break;
|
64 |
-
|
65 |
-
|
66 |
break;
|
67 |
-
|
68 |
-
|
69 |
break;
|
70 |
-
|
71 |
-
|
72 |
break;
|
73 |
-
|
74 |
-
|
75 |
break;
|
76 |
-
|
77 |
-
|
78 |
break;
|
79 |
}
|
80 |
}
|
81 |
|
82 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
*
|
84 |
-
* @param string $className
|
85 |
-
* @param object $resultObj
|
86 |
-
* @return object returns the passed object if successful
|
87 |
* @throws Exception\ValidationsFailed
|
|
|
|
|
88 |
*/
|
89 |
public static function returnObjectOrThrowException($className, $resultObj)
|
90 |
{
|
@@ -100,83 +158,54 @@ class Util
|
|
100 |
* removes the header from a classname
|
101 |
*
|
102 |
* @param string $name ClassName
|
|
|
103 |
* @return camelCased classname minus header
|
104 |
*/
|
105 |
public static function cleanClassName($name)
|
106 |
{
|
107 |
$classNamesToResponseKeys = [
|
108 |
'Braintree\CreditCard' => 'creditCard',
|
109 |
-
'Braintree_CreditCard' => 'creditCard',
|
110 |
'Braintree\CreditCardGateway' => 'creditCard',
|
111 |
-
'Braintree_CreditCardGateway' => 'creditCard',
|
112 |
'Braintree\Customer' => 'customer',
|
113 |
-
'Braintree_Customer' => 'customer',
|
114 |
'Braintree\CustomerGateway' => 'customer',
|
115 |
-
'Braintree_CustomerGateway' => 'customer',
|
116 |
'Braintree\Subscription' => 'subscription',
|
117 |
-
'Braintree_Subscription' => 'subscription',
|
118 |
'Braintree\SubscriptionGateway' => 'subscription',
|
119 |
-
'Braintree_SubscriptionGateway' => 'subscription',
|
120 |
'Braintree\Transaction' => 'transaction',
|
121 |
-
'Braintree_Transaction' => 'transaction',
|
122 |
'Braintree\TransactionGateway' => 'transaction',
|
123 |
-
'Braintree_TransactionGateway' => 'transaction',
|
124 |
'Braintree\CreditCardVerification' => 'verification',
|
125 |
-
'Braintree_CreditCardVerification' => 'verification',
|
126 |
'Braintree\CreditCardVerificationGateway' => 'verification',
|
127 |
-
'Braintree_CreditCardVerificationGateway' => 'verification',
|
128 |
'Braintree\AddOn' => 'addOn',
|
129 |
-
'Braintree_AddOn' => 'addOn',
|
130 |
'Braintree\AddOnGateway' => 'addOn',
|
131 |
-
'Braintree_AddOnGateway' => 'addOn',
|
132 |
'Braintree\Discount' => 'discount',
|
133 |
-
'Braintree_Discount' => 'discount',
|
134 |
'Braintree\DiscountGateway' => 'discount',
|
135 |
-
'Braintree_DiscountGateway' => 'discount',
|
136 |
'Braintree\Dispute' => 'dispute',
|
137 |
-
'Braintree_Dispute' => 'dispute',
|
138 |
'Braintree\Dispute\EvidenceDetails' => 'evidence',
|
139 |
-
'Braintree_Dispute_EvidenceDetails' => 'evidence',
|
140 |
'Braintree\DocumentUpload' => 'documentUpload',
|
141 |
-
'Braintree_DocumentUpload' => 'doumentUpload',
|
142 |
'Braintree\Plan' => 'plan',
|
143 |
-
'Braintree_Plan' => 'plan',
|
144 |
'Braintree\PlanGateway' => 'plan',
|
145 |
-
'Braintree_PlanGateway' => 'plan',
|
146 |
'Braintree\Address' => 'address',
|
147 |
-
'Braintree_Address' => 'address',
|
148 |
'Braintree\AddressGateway' => 'address',
|
149 |
-
'Braintree_AddressGateway' => 'address',
|
150 |
'Braintree\SettlementBatchSummary' => 'settlementBatchSummary',
|
151 |
-
'Braintree_SettlementBatchSummary' => 'settlementBatchSummary',
|
152 |
'Braintree\SettlementBatchSummaryGateway' => 'settlementBatchSummary',
|
153 |
-
'Braintree_SettlementBatchSummaryGateway' => 'settlementBatchSummary',
|
154 |
'Braintree\Merchant' => 'merchant',
|
155 |
-
'Braintree_Merchant' => 'merchant',
|
156 |
'Braintree\MerchantGateway' => 'merchant',
|
157 |
-
'Braintree_MerchantGateway' => 'merchant',
|
158 |
'Braintree\MerchantAccount' => 'merchantAccount',
|
159 |
-
'Braintree_MerchantAccount' => 'merchantAccount',
|
160 |
'Braintree\MerchantAccountGateway' => 'merchantAccount',
|
161 |
-
'Braintree_MerchantAccountGateway' => 'merchantAccount',
|
162 |
'Braintree\OAuthCredentials' => 'credentials',
|
163 |
-
'Braintree_OAuthCredentials' => 'credentials',
|
164 |
'Braintree\OAuthResult' => 'result',
|
165 |
-
'Braintree_OAuthResult' => 'result',
|
166 |
'Braintree\PayPalAccount' => 'paypalAccount',
|
167 |
-
'Braintree_PayPalAccount' => 'paypalAccount',
|
168 |
'Braintree\PayPalAccountGateway' => 'paypalAccount',
|
169 |
-
'Braintree_PayPalAccountGateway' => 'paypalAccount',
|
170 |
'Braintree\UsBankAccountVerification' => 'usBankAccountVerification',
|
171 |
-
'Braintree_UsBankAccountVerification' => 'usBankAccountVerification',
|
172 |
];
|
173 |
|
174 |
return $classNamesToResponseKeys[$name];
|
175 |
}
|
176 |
|
177 |
/**
|
|
|
178 |
*
|
179 |
* @param string $name className
|
|
|
180 |
* @return string ClassName
|
181 |
*/
|
182 |
public static function buildClassName($name)
|
@@ -203,9 +232,9 @@ class Util
|
|
203 |
/**
|
204 |
* convert alpha-beta-gamma to alphaBetaGamma
|
205 |
*
|
206 |
-
* @
|
207 |
-
* @param string $
|
208 |
-
*
|
209 |
* @return string modified string
|
210 |
*/
|
211 |
public static function delimiterToCamelCase($string, $delimiter = '[\-\_]')
|
@@ -223,8 +252,8 @@ class Util
|
|
223 |
/**
|
224 |
* convert alpha-beta-gamma to alpha_beta_gamma
|
225 |
*
|
226 |
-
* @
|
227 |
-
*
|
228 |
* @return string modified string
|
229 |
*/
|
230 |
public static function delimiterToUnderscore($string)
|
@@ -236,9 +265,9 @@ class Util
|
|
236 |
/**
|
237 |
* find capitals and convert to delimiter + lowercase
|
238 |
*
|
239 |
-
* @
|
240 |
-
* @param string $
|
241 |
-
*
|
242 |
* @return string modified string
|
243 |
*/
|
244 |
public static function camelCaseToDelimiter($string, $delimiter = '-')
|
@@ -246,6 +275,14 @@ class Util
|
|
246 |
return strtolower(preg_replace('/([A-Z])/', "$delimiter\\1", $string));
|
247 |
}
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
public static function delimiterToCamelCaseArray($array, $delimiter = '[\-\_]')
|
250 |
{
|
251 |
$converted = [];
|
@@ -268,6 +305,14 @@ class Util
|
|
268 |
return $converted;
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
public static function camelCaseToDelimiterArray($array, $delimiter = '-')
|
272 |
{
|
273 |
$converted = [];
|
@@ -283,6 +328,13 @@ class Util
|
|
283 |
return $converted;
|
284 |
}
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
public static function delimiterToUnderscoreArray($array)
|
287 |
{
|
288 |
$converted = [];
|
@@ -294,17 +346,19 @@ class Util
|
|
294 |
}
|
295 |
|
296 |
/**
|
|
|
297 |
*
|
298 |
-
* @param array
|
299 |
* @param string $separator (optional, defaults to =)
|
300 |
-
* @param string $glue
|
301 |
-
*
|
|
|
302 |
*/
|
303 |
public static function implodeAssociativeArray($array, $separator = '=', $glue = ', ')
|
304 |
{
|
305 |
// build a new array with joined keys and values
|
306 |
$tmpArray = null;
|
307 |
-
foreach ($array
|
308 |
if ($value instanceof DateTime) {
|
309 |
$value = $value->format('r');
|
310 |
}
|
@@ -314,12 +368,20 @@ class Util
|
|
314 |
return (is_array($tmpArray)) ? implode($glue, $tmpArray) : false;
|
315 |
}
|
316 |
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
$printableAttribs = [];
|
319 |
-
foreach ($attributes
|
320 |
if (is_array($value)) {
|
321 |
$pAttrib = self::attributesToString($value);
|
322 |
-
}
|
323 |
$pAttrib = $value->format(DateTime::RFC850);
|
324 |
} else {
|
325 |
$pAttrib = $value;
|
@@ -335,8 +397,12 @@ class Util
|
|
335 |
* compares the expected signature of a gateway request
|
336 |
* against the actual structure sent by the user
|
337 |
*
|
338 |
-
* @param array $signature
|
339 |
-
* @param array $attributes
|
|
|
|
|
|
|
|
|
340 |
*/
|
341 |
public static function verifyKeys($signature, $attributes)
|
342 |
{
|
@@ -345,23 +411,44 @@ class Util
|
|
345 |
$invalidKeys = array_diff($userKeys, $validKeys);
|
346 |
$invalidKeys = self::_removeWildcardKeys($validKeys, $invalidKeys);
|
347 |
|
348 |
-
if(!empty($invalidKeys)) {
|
349 |
asort($invalidKeys);
|
350 |
$sortedList = join(', ', $invalidKeys);
|
351 |
throw new InvalidArgumentException('invalid keys: ' . $sortedList);
|
352 |
}
|
353 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
/**
|
355 |
* flattens a numerically indexed nested array to a single level
|
356 |
-
*
|
|
|
357 |
* @param string $namespace
|
|
|
358 |
* @return array
|
359 |
*/
|
360 |
private static function _flattenArray($keys, $namespace = null)
|
361 |
{
|
362 |
$flattenedArray = [];
|
363 |
-
foreach($keys
|
364 |
-
if(is_array($key)) {
|
365 |
$theKeys = array_keys($key);
|
366 |
$theValues = array_values($key);
|
367 |
$scope = $theKeys[0];
|
@@ -378,39 +465,41 @@ class Util
|
|
378 |
|
379 |
private static function _flattenUserKeys($keys, $namespace = null)
|
380 |
{
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
}
|
401 |
|
402 |
/**
|
403 |
* removes wildcard entries from the invalid keys array
|
404 |
-
*
|
|
|
405 |
* @param <array $invalidKeys
|
|
|
406 |
* @return array
|
407 |
*/
|
408 |
private static function _removeWildcardKeys($validKeys, $invalidKeys)
|
409 |
{
|
410 |
-
foreach($validKeys
|
411 |
if (stristr($key, '[_anyKey_]')) {
|
412 |
$wildcardKey = str_replace('[_anyKey_]', '', $key);
|
413 |
-
foreach ($invalidKeys
|
414 |
if (stristr($invalidKey, $wildcardKey)) {
|
415 |
unset($invalidKeys[$index]);
|
416 |
}
|
@@ -420,4 +509,3 @@ class Util
|
|
420 |
return $invalidKeys;
|
421 |
}
|
422 |
}
|
423 |
-
class_alias('Braintree\Util', 'Braintree_Util');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
use DateTime;
|
7 |
|
8 |
/**
|
9 |
* Braintree Utility methods
|
|
|
10 |
*/
|
11 |
|
12 |
class Util
|
20 |
*
|
21 |
* @param array $attribArray attributes from a search response
|
22 |
* @param string $attributeName indicates which element of the passed array to extract
|
23 |
+
*
|
24 |
* @return array array of $attributeName objects, or a single element array
|
25 |
*/
|
26 |
public static function extractAttributeAsArray(&$attribArray, $attributeName)
|
27 |
{
|
28 |
+
if (!isset($attribArray[$attributeName])) :
|
29 |
return [];
|
30 |
endif;
|
31 |
|
33 |
$data = $attribArray[$attributeName];
|
34 |
// set up the class that will be used to convert each array element
|
35 |
$classFactory = self::buildClassName($attributeName) . '::factory';
|
36 |
+
if (is_array($data)) :
|
37 |
// create an object from the data in each element
|
38 |
$objectArray = array_map($classFactory, $data);
|
39 |
+
else :
|
40 |
return [$data];
|
41 |
endif;
|
42 |
|
45 |
}
|
46 |
/**
|
47 |
* throws an exception based on the type of error
|
48 |
+
*
|
49 |
+
* @param string $statusCode HTTP status code to throw exception from
|
50 |
+
* @param null|string $message optional
|
51 |
+
*
|
52 |
* @throws Exception multiple types depending on the error
|
53 |
+
*
|
54 |
* @return void
|
55 |
*/
|
56 |
+
public static function throwStatusCodeException($statusCode, $message = null)
|
57 |
{
|
58 |
+
switch ($statusCode) {
|
59 |
+
case 401:
|
60 |
+
throw new Exception\Authentication();
|
61 |
break;
|
62 |
+
case 403:
|
63 |
+
if (is_null($message)) {
|
64 |
+
$message = "";
|
65 |
+
}
|
66 |
+
throw new Exception\Authorization($message);
|
67 |
+
break;
|
68 |
+
case 404:
|
69 |
+
throw new Exception\NotFound();
|
70 |
break;
|
71 |
+
case 408:
|
72 |
+
throw new Exception\RequestTimeout();
|
73 |
break;
|
74 |
+
case 426:
|
75 |
+
throw new Exception\UpgradeRequired();
|
76 |
break;
|
77 |
+
case 429:
|
78 |
+
throw new Exception\TooManyRequests();
|
79 |
break;
|
80 |
+
case 500:
|
81 |
+
throw new Exception\ServerError();
|
82 |
break;
|
83 |
+
case 504:
|
84 |
+
throw new Exception\GatewayTimeout();
|
85 |
break;
|
86 |
+
default:
|
87 |
+
throw new Exception\Unexpected('Unexpected HTTP_RESPONSE #' . $statusCode);
|
88 |
break;
|
89 |
}
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
+
* throws an exception based on the type of error returned from graphql
|
94 |
+
*
|
95 |
+
* @param array $response complete graphql response
|
96 |
+
*
|
97 |
+
* @throws Exception multiple types depending on the error
|
98 |
+
*
|
99 |
+
* @return void
|
100 |
+
*/
|
101 |
+
public static function throwGraphQLResponseException($response)
|
102 |
+
{
|
103 |
+
if (!array_key_exists("errors", $response) || !($errors = $response["errors"])) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
foreach ($errors as $error) {
|
108 |
+
$message = $error["message"];
|
109 |
+
if ($error["extensions"] == null) {
|
110 |
+
throw new Exception\Unexpected("Unexpected exception:" . $message);
|
111 |
+
}
|
112 |
+
|
113 |
+
$errorClass = $error["extensions"]["errorClass"];
|
114 |
+
|
115 |
+
if ($errorClass == "VALIDATION") {
|
116 |
+
continue;
|
117 |
+
} elseif ($errorClass == "AUTHENTICATION") {
|
118 |
+
throw new Exception\Authentication();
|
119 |
+
} elseif ($errorClass == "AUTHORIZATION") {
|
120 |
+
throw new Exception\Authorization($message);
|
121 |
+
} elseif ($errorClass == "NOT_FOUND") {
|
122 |
+
throw new Exception\NotFound();
|
123 |
+
} elseif ($errorClass == "UNSUPPORTED_CLIENT") {
|
124 |
+
throw new Exception\UpgradeRequired();
|
125 |
+
} elseif ($errorClass == "RESOURCE_LIMIT") {
|
126 |
+
throw new Exception\TooManyRequests();
|
127 |
+
} elseif ($errorClass == "INTERNAL") {
|
128 |
+
throw new Exception\ServerError();
|
129 |
+
} elseif ($errorClass == "SERVICE_AVAILABILITY") {
|
130 |
+
throw new Exception\ServiceUnavailable();
|
131 |
+
} else {
|
132 |
+
throw new Exception\Unexpected('Unexpected exception ' . $message);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Returns a class object or throws an exception
|
139 |
+
*
|
140 |
+
* @param string $className to be used to determine if objects are present
|
141 |
+
* @param object $resultObj the object returned from an API response
|
142 |
*
|
|
|
|
|
|
|
143 |
* @throws Exception\ValidationsFailed
|
144 |
+
*
|
145 |
+
* @return object returns the passed object if successful
|
146 |
*/
|
147 |
public static function returnObjectOrThrowException($className, $resultObj)
|
148 |
{
|
158 |
* removes the header from a classname
|
159 |
*
|
160 |
* @param string $name ClassName
|
161 |
+
*
|
162 |
* @return camelCased classname minus header
|
163 |
*/
|
164 |
public static function cleanClassName($name)
|
165 |
{
|
166 |
$classNamesToResponseKeys = [
|
167 |
'Braintree\CreditCard' => 'creditCard',
|
|
|
168 |
'Braintree\CreditCardGateway' => 'creditCard',
|
|
|
169 |
'Braintree\Customer' => 'customer',
|
|
|
170 |
'Braintree\CustomerGateway' => 'customer',
|
|
|
171 |
'Braintree\Subscription' => 'subscription',
|
|
|
172 |
'Braintree\SubscriptionGateway' => 'subscription',
|
|
|
173 |
'Braintree\Transaction' => 'transaction',
|
|
|
174 |
'Braintree\TransactionGateway' => 'transaction',
|
|
|
175 |
'Braintree\CreditCardVerification' => 'verification',
|
|
|
176 |
'Braintree\CreditCardVerificationGateway' => 'verification',
|
|
|
177 |
'Braintree\AddOn' => 'addOn',
|
|
|
178 |
'Braintree\AddOnGateway' => 'addOn',
|
|
|
179 |
'Braintree\Discount' => 'discount',
|
|
|
180 |
'Braintree\DiscountGateway' => 'discount',
|
|
|
181 |
'Braintree\Dispute' => 'dispute',
|
|
|
182 |
'Braintree\Dispute\EvidenceDetails' => 'evidence',
|
|
|
183 |
'Braintree\DocumentUpload' => 'documentUpload',
|
|
|
184 |
'Braintree\Plan' => 'plan',
|
|
|
185 |
'Braintree\PlanGateway' => 'plan',
|
|
|
186 |
'Braintree\Address' => 'address',
|
|
|
187 |
'Braintree\AddressGateway' => 'address',
|
|
|
188 |
'Braintree\SettlementBatchSummary' => 'settlementBatchSummary',
|
|
|
189 |
'Braintree\SettlementBatchSummaryGateway' => 'settlementBatchSummary',
|
|
|
190 |
'Braintree\Merchant' => 'merchant',
|
|
|
191 |
'Braintree\MerchantGateway' => 'merchant',
|
|
|
192 |
'Braintree\MerchantAccount' => 'merchantAccount',
|
|
|
193 |
'Braintree\MerchantAccountGateway' => 'merchantAccount',
|
|
|
194 |
'Braintree\OAuthCredentials' => 'credentials',
|
|
|
195 |
'Braintree\OAuthResult' => 'result',
|
|
|
196 |
'Braintree\PayPalAccount' => 'paypalAccount',
|
|
|
197 |
'Braintree\PayPalAccountGateway' => 'paypalAccount',
|
|
|
198 |
'Braintree\UsBankAccountVerification' => 'usBankAccountVerification',
|
|
|
199 |
];
|
200 |
|
201 |
return $classNamesToResponseKeys[$name];
|
202 |
}
|
203 |
|
204 |
/**
|
205 |
+
* Returns corresponding class name based on response keys
|
206 |
*
|
207 |
* @param string $name className
|
208 |
+
*
|
209 |
* @return string ClassName
|
210 |
*/
|
211 |
public static function buildClassName($name)
|
232 |
/**
|
233 |
* convert alpha-beta-gamma to alphaBetaGamma
|
234 |
*
|
235 |
+
* @param string $string to be scrubbed for camelCase formatting
|
236 |
+
* @param null|string $delimiter to be replaced
|
237 |
+
*
|
238 |
* @return string modified string
|
239 |
*/
|
240 |
public static function delimiterToCamelCase($string, $delimiter = '[\-\_]')
|
252 |
/**
|
253 |
* convert alpha-beta-gamma to alpha_beta_gamma
|
254 |
*
|
255 |
+
* @param string $string to be modified
|
256 |
+
*
|
257 |
* @return string modified string
|
258 |
*/
|
259 |
public static function delimiterToUnderscore($string)
|
265 |
/**
|
266 |
* find capitals and convert to delimiter + lowercase
|
267 |
*
|
268 |
+
* @param string $string to be scrubbed
|
269 |
+
* @param null|string $delimiter to replace camelCase
|
270 |
+
*
|
271 |
* @return string modified string
|
272 |
*/
|
273 |
public static function camelCaseToDelimiter($string, $delimiter = '-')
|
275 |
return strtolower(preg_replace('/([A-Z])/', "$delimiter\\1", $string));
|
276 |
}
|
277 |
|
278 |
+
/**
|
279 |
+
* converts a-string-here to [aStringHere]
|
280 |
+
*
|
281 |
+
* @param array $array to be iterated over
|
282 |
+
* @param null|string $delimiter to be replaced with camelCase
|
283 |
+
*
|
284 |
+
* @return array modified array
|
285 |
+
*/
|
286 |
public static function delimiterToCamelCaseArray($array, $delimiter = '[\-\_]')
|
287 |
{
|
288 |
$converted = [];
|
305 |
return $converted;
|
306 |
}
|
307 |
|
308 |
+
/**
|
309 |
+
* find capitals and convert to delimiter + lowercase
|
310 |
+
*
|
311 |
+
* @param array $array to be iterated over
|
312 |
+
* @param null|string $delimiter to replace camelCase
|
313 |
+
*
|
314 |
+
* @return array modified array
|
315 |
+
*/
|
316 |
public static function camelCaseToDelimiterArray($array, $delimiter = '-')
|
317 |
{
|
318 |
$converted = [];
|
328 |
return $converted;
|
329 |
}
|
330 |
|
331 |
+
/**
|
332 |
+
* converts a-string-here to [a_string_here]
|
333 |
+
*
|
334 |
+
* @param array $array to be iterated over
|
335 |
+
*
|
336 |
+
* @return array modified array
|
337 |
+
*/
|
338 |
public static function delimiterToUnderscoreArray($array)
|
339 |
{
|
340 |
$converted = [];
|
346 |
}
|
347 |
|
348 |
/**
|
349 |
+
* Join arrays with string or return false
|
350 |
*
|
351 |
+
* @param array $array associative array to implode
|
352 |
* @param string $separator (optional, defaults to =)
|
353 |
+
* @param string $glue (optional, defaults to ', ')
|
354 |
+
*
|
355 |
+
* @return string|false
|
356 |
*/
|
357 |
public static function implodeAssociativeArray($array, $separator = '=', $glue = ', ')
|
358 |
{
|
359 |
// build a new array with joined keys and values
|
360 |
$tmpArray = null;
|
361 |
+
foreach ($array as $key => $value) {
|
362 |
if ($value instanceof DateTime) {
|
363 |
$value = $value->format('r');
|
364 |
}
|
368 |
return (is_array($tmpArray)) ? implode($glue, $tmpArray) : false;
|
369 |
}
|
370 |
|
371 |
+
/*
|
372 |
+
* Turn all attributes into a string
|
373 |
+
*
|
374 |
+
* @param array $attributes to be turned into a string
|
375 |
+
*
|
376 |
+
* @return string|false
|
377 |
+
*/
|
378 |
+
public static function attributesToString($attributes)
|
379 |
+
{
|
380 |
$printableAttribs = [];
|
381 |
+
foreach ($attributes as $key => $value) {
|
382 |
if (is_array($value)) {
|
383 |
$pAttrib = self::attributesToString($value);
|
384 |
+
} elseif ($value instanceof DateTime) {
|
385 |
$pAttrib = $value->format(DateTime::RFC850);
|
386 |
} else {
|
387 |
$pAttrib = $value;
|
397 |
* compares the expected signature of a gateway request
|
398 |
* against the actual structure sent by the user
|
399 |
*
|
400 |
+
* @param array $signature expected signature
|
401 |
+
* @param array $attributes actual structure sent by user
|
402 |
+
*
|
403 |
+
* @throws InvalidArgumentException
|
404 |
+
*
|
405 |
+
* @return self
|
406 |
*/
|
407 |
public static function verifyKeys($signature, $attributes)
|
408 |
{
|
411 |
$invalidKeys = array_diff($userKeys, $validKeys);
|
412 |
$invalidKeys = self::_removeWildcardKeys($validKeys, $invalidKeys);
|
413 |
|
414 |
+
if (!empty($invalidKeys)) {
|
415 |
asort($invalidKeys);
|
416 |
$sortedList = join(', ', $invalidKeys);
|
417 |
throw new InvalidArgumentException('invalid keys: ' . $sortedList);
|
418 |
}
|
419 |
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* replaces the value of a key in an array
|
423 |
+
*
|
424 |
+
* @param array $array to have key replaced
|
425 |
+
* @param string $oldKey to be replace
|
426 |
+
* @param string $newKey to replace
|
427 |
+
*
|
428 |
+
* @return array
|
429 |
+
*/
|
430 |
+
public static function replaceKey($array, $oldKey, $newKey)
|
431 |
+
{
|
432 |
+
if (array_key_exists($oldKey, $array)) {
|
433 |
+
$array[$newKey] = $array[$oldKey];
|
434 |
+
unset($array[$oldKey]);
|
435 |
+
}
|
436 |
+
return $array;
|
437 |
+
}
|
438 |
+
|
439 |
/**
|
440 |
* flattens a numerically indexed nested array to a single level
|
441 |
+
*
|
442 |
+
* @param array $keys
|
443 |
* @param string $namespace
|
444 |
+
*
|
445 |
* @return array
|
446 |
*/
|
447 |
private static function _flattenArray($keys, $namespace = null)
|
448 |
{
|
449 |
$flattenedArray = [];
|
450 |
+
foreach ($keys as $key) {
|
451 |
+
if (is_array($key)) {
|
452 |
$theKeys = array_keys($key);
|
453 |
$theValues = array_values($key);
|
454 |
$scope = $theKeys[0];
|
465 |
|
466 |
private static function _flattenUserKeys($keys, $namespace = null)
|
467 |
{
|
468 |
+
$flattenedArray = [];
|
469 |
+
|
470 |
+
foreach ($keys as $key => $value) {
|
471 |
+
$fullKey = empty($namespace) ? $key : $namespace;
|
472 |
+
if (!is_numeric($key) && $namespace != null) {
|
473 |
+
$fullKey .= '[' . $key . ']';
|
474 |
+
}
|
475 |
+
if (is_numeric($key) && is_string($value)) {
|
476 |
+
$fullKey .= '[' . $value . ']';
|
477 |
+
}
|
478 |
+
if (is_array($value)) {
|
479 |
+
$more = self::_flattenUserKeys($value, $fullKey);
|
480 |
+
$flattenedArray = array_merge($flattenedArray, $more);
|
481 |
+
} else {
|
482 |
+
$flattenedArray[] = $fullKey;
|
483 |
+
}
|
484 |
+
}
|
485 |
+
sort($flattenedArray);
|
486 |
+
return $flattenedArray;
|
487 |
}
|
488 |
|
489 |
/**
|
490 |
* removes wildcard entries from the invalid keys array
|
491 |
+
*
|
492 |
+
* @param array $validKeys
|
493 |
* @param <array $invalidKeys
|
494 |
+
*
|
495 |
* @return array
|
496 |
*/
|
497 |
private static function _removeWildcardKeys($validKeys, $invalidKeys)
|
498 |
{
|
499 |
+
foreach ($validKeys as $key) {
|
500 |
if (stristr($key, '[_anyKey_]')) {
|
501 |
$wildcardKey = str_replace('[_anyKey_]', '', $key);
|
502 |
+
foreach ($invalidKeys as $index => $invalidKey) {
|
503 |
if (stristr($invalidKey, $wildcardKey)) {
|
504 |
unset($invalidKeys[$index]);
|
505 |
}
|
509 |
return $invalidKeys;
|
510 |
}
|
511 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/VenmoAccount.php
CHANGED
@@ -1,26 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree VenmoAccount module
|
6 |
* Creates and manages Braintree Venmo accounts
|
7 |
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* See {@link https://developers.braintreepayments.com/javascript+php}<br />
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $createdAt
|
16 |
-
* @property-read string $default
|
17 |
-
* @property-read string $updatedAt
|
18 |
-
* @property-read string $customerId
|
19 |
-
* @property-read string $sourceDescription
|
20 |
-
* @property-read string $token
|
21 |
-
* @property-read string $imageUrl
|
22 |
-
* @property-read string $username
|
23 |
-
* @property-read string $venmoUserId
|
24 |
*/
|
25 |
class VenmoAccount extends Base
|
26 |
{
|
@@ -36,10 +22,10 @@ class VenmoAccount extends Base
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
-
*
|
|
|
41 |
*
|
42 |
-
* @ignore
|
43 |
* @return VenmoAccount
|
44 |
*/
|
45 |
public static function factory($attributes)
|
@@ -53,8 +39,8 @@ class VenmoAccount extends Base
|
|
53 |
/**
|
54 |
* sets instance properties from an array of values
|
55 |
*
|
56 |
-
* @access protected
|
57 |
* @param array $venmoAccountAttribs array of Venmo account properties
|
|
|
58 |
* @return void
|
59 |
*/
|
60 |
protected function _initialize($venmoAccountAttribs)
|
@@ -63,7 +49,7 @@ class VenmoAccount extends Base
|
|
63 |
|
64 |
$subscriptionArray = array();
|
65 |
if (isset($venmoAccountAttribs['subscriptions'])) {
|
66 |
-
foreach ($venmoAccountAttribs['subscriptions']
|
67 |
$subscriptionArray[] = Subscription::factory($subscription);
|
68 |
}
|
69 |
}
|
@@ -71,4 +57,3 @@ class VenmoAccount extends Base
|
|
71 |
$this->_set('subscriptions', $subscriptionArray);
|
72 |
}
|
73 |
}
|
74 |
-
class_alias('Braintree\VenmoAccount', 'Braintree_VenmoAccount');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree VenmoAccount module
|
7 |
* Creates and manages Braintree Venmo accounts
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/venmo-account developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class VenmoAccount extends Base
|
12 |
{
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
+
* Creates an instance from given attributes
|
26 |
+
*
|
27 |
+
* @param array $attributes response object attributes
|
28 |
*
|
|
|
29 |
* @return VenmoAccount
|
30 |
*/
|
31 |
public static function factory($attributes)
|
39 |
/**
|
40 |
* sets instance properties from an array of values
|
41 |
*
|
|
|
42 |
* @param array $venmoAccountAttribs array of Venmo account properties
|
43 |
+
*
|
44 |
* @return void
|
45 |
*/
|
46 |
protected function _initialize($venmoAccountAttribs)
|
49 |
|
50 |
$subscriptionArray = array();
|
51 |
if (isset($venmoAccountAttribs['subscriptions'])) {
|
52 |
+
foreach ($venmoAccountAttribs['subscriptions'] as $subscription) {
|
53 |
$subscriptionArray[] = Subscription::factory($subscription);
|
54 |
}
|
55 |
}
|
57 |
$this->_set('subscriptions', $subscriptionArray);
|
58 |
}
|
59 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/VenmoProfileData.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Braintree;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Braintree VenmoProfileData module
|
7 |
+
*/
|
8 |
+
class VenmoProfileData extends Base
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* factory method: returns an instance of VenmoProfileData
|
12 |
+
* to the requesting method, with populated properties
|
13 |
+
*
|
14 |
+
* @param array $attributes to be used in creating the object
|
15 |
+
*
|
16 |
+
* @return VenmoProfileData
|
17 |
+
*/
|
18 |
+
public static function factory($attributes)
|
19 |
+
{
|
20 |
+
$instance = new self();
|
21 |
+
$instance->_initialize($attributes);
|
22 |
+
return $instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _initialize($venmoProfileDataAttribs)
|
26 |
+
{
|
27 |
+
$this->_attributes = $venmoProfileDataAttribs;
|
28 |
+
}
|
29 |
+
|
30 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
31 |
+
public function __toString()
|
32 |
+
{
|
33 |
+
return __CLASS__ . '[' .
|
34 |
+
Util::attributesToString($this->_attributes) . ']';
|
35 |
+
}
|
36 |
+
}
|
vendor/braintree/braintree_php/lib/Braintree/Version.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
@@ -7,22 +8,16 @@ namespace Braintree;
|
|
7 |
*/
|
8 |
class Version
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
-
*/
|
13 |
-
const MAJOR = 3;
|
14 |
-
const MINOR = 34;
|
15 |
const TINY = 0;
|
16 |
|
17 |
-
|
18 |
-
* @ignore
|
19 |
-
* @access protected
|
20 |
-
*/
|
21 |
-
protected function __construct()
|
22 |
{
|
23 |
}
|
24 |
|
25 |
/**
|
|
|
26 |
*
|
27 |
* @return string the current library version
|
28 |
*/
|
@@ -31,4 +26,3 @@ class Version
|
|
31 |
return self::MAJOR . '.' . self::MINOR . '.' . self::TINY;
|
32 |
}
|
33 |
}
|
34 |
-
class_alias('Braintree\Version', 'Braintree_Version');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
8 |
*/
|
9 |
class Version
|
10 |
{
|
11 |
+
const MAJOR = 6;
|
12 |
+
const MINOR = 7;
|
|
|
|
|
|
|
13 |
const TINY = 0;
|
14 |
|
15 |
+
protected function __construct()
|
|
|
|
|
|
|
|
|
16 |
{
|
17 |
}
|
18 |
|
19 |
/**
|
20 |
+
* Get the version
|
21 |
*
|
22 |
* @return string the current library version
|
23 |
*/
|
26 |
return self::MAJOR . '.' . self::MINOR . '.' . self::TINY;
|
27 |
}
|
28 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/VisaCheckoutCard.php
CHANGED
@@ -1,46 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree VisaCheckoutCard module
|
6 |
* Creates and manages Braintree VisaCheckoutCards
|
7 |
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* For more detailed information on CreditCard verifications, see {@link https://developers.braintreepayments.com/reference/response/credit-card-verification/php https://developers.braintreepayments.com/reference/response/credit-card-verification/php}
|
11 |
-
*
|
12 |
-
* @package Braintree
|
13 |
-
* @category Resources
|
14 |
-
*
|
15 |
-
* @property-read string $billingAddress
|
16 |
-
* @property-read string $bin
|
17 |
-
* @property-read string $callId
|
18 |
-
* @property-read string $cardType
|
19 |
-
* @property-read string $cardholderName
|
20 |
-
* @property-read string $commercial
|
21 |
-
* @property-read string $countryOfIssuance
|
22 |
-
* @property-read string $createdAt
|
23 |
-
* @property-read string $customerId
|
24 |
-
* @property-read string $customerLocation
|
25 |
-
* @property-read string $debit
|
26 |
-
* @property-read string $default
|
27 |
-
* @property-read string $durbinRegulated
|
28 |
-
* @property-read string $expirationDate
|
29 |
-
* @property-read string $expirationMonth
|
30 |
-
* @property-read string $expirationYear
|
31 |
-
* @property-read string $expired
|
32 |
-
* @property-read string $healthcare
|
33 |
-
* @property-read string $imageUrl
|
34 |
-
* @property-read string $issuingBank
|
35 |
-
* @property-read string $last4
|
36 |
-
* @property-read string $maskedNumber
|
37 |
-
* @property-read string $payroll
|
38 |
-
* @property-read string $prepaid
|
39 |
-
* @property-read string $productId
|
40 |
-
* @property-read string $subscriptions
|
41 |
-
* @property-read string $token
|
42 |
-
* @property-read string $uniqueNumberIdentifier
|
43 |
-
* @property-read string $updatedAt
|
44 |
*/
|
45 |
class VisaCheckoutCard extends Base
|
46 |
{
|
@@ -68,8 +34,8 @@ class VisaCheckoutCard extends Base
|
|
68 |
/**
|
69 |
* sets instance properties from an array of values
|
70 |
*
|
71 |
-
* @access protected
|
72 |
* @param array $creditCardAttribs array of creditcard data
|
|
|
73 |
* @return void
|
74 |
*/
|
75 |
protected function _initialize($creditCardAttribs)
|
@@ -84,7 +50,7 @@ class VisaCheckoutCard extends Base
|
|
84 |
|
85 |
$subscriptionArray = [];
|
86 |
if (isset($creditCardAttribs['subscriptions'])) {
|
87 |
-
foreach ($creditCardAttribs['subscriptions']
|
88 |
$subscriptionArray[] = Subscription::factory($subscription);
|
89 |
}
|
90 |
}
|
@@ -94,7 +60,7 @@ class VisaCheckoutCard extends Base
|
|
94 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
95 |
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
96 |
|
97 |
-
if(isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
|
98 |
$verifications = $creditCardAttribs['verifications'];
|
99 |
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
|
100 |
|
@@ -112,6 +78,7 @@ class VisaCheckoutCard extends Base
|
|
112 |
* or is a VisaCheckoutCard with a different id
|
113 |
*
|
114 |
* @param object $otherVisaCheckoutCard customer to compare against
|
|
|
115 |
* @return boolean
|
116 |
*/
|
117 |
public function isEqual($otherVisaCheckoutCard)
|
@@ -119,22 +86,18 @@ class VisaCheckoutCard extends Base
|
|
119 |
return !($otherVisaCheckoutCard instanceof self) ? false : $this->token === $otherVisaCheckoutCard->token;
|
120 |
}
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
* ClassName[property=value, property=value]
|
125 |
-
* @return string
|
126 |
-
*/
|
127 |
-
public function __toString()
|
128 |
{
|
129 |
return __CLASS__ . '[' .
|
130 |
-
Util::attributesToString($this->_attributes) .']';
|
131 |
}
|
132 |
|
133 |
/**
|
134 |
-
*
|
135 |
-
*
|
|
|
136 |
*
|
137 |
-
* @ignore
|
138 |
* @return VisaCheckoutCard
|
139 |
*/
|
140 |
public static function factory($attributes)
|
@@ -151,4 +114,3 @@ class VisaCheckoutCard extends Base
|
|
151 |
return $instance;
|
152 |
}
|
153 |
}
|
154 |
-
class_alias('Braintree\VisaCheckoutCard', 'Braintree_VisaCheckoutCard');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree VisaCheckoutCard module
|
7 |
* Creates and manages Braintree VisaCheckoutCards
|
8 |
*
|
9 |
+
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/visa-checkout-card developer docs} for information on attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
class VisaCheckoutCard extends Base
|
12 |
{
|
34 |
/**
|
35 |
* sets instance properties from an array of values
|
36 |
*
|
|
|
37 |
* @param array $creditCardAttribs array of creditcard data
|
38 |
+
*
|
39 |
* @return void
|
40 |
*/
|
41 |
protected function _initialize($creditCardAttribs)
|
50 |
|
51 |
$subscriptionArray = [];
|
52 |
if (isset($creditCardAttribs['subscriptions'])) {
|
53 |
+
foreach ($creditCardAttribs['subscriptions'] as $subscription) {
|
54 |
$subscriptionArray[] = Subscription::factory($subscription);
|
55 |
}
|
56 |
}
|
60 |
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
|
61 |
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
|
62 |
|
63 |
+
if (isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
|
64 |
$verifications = $creditCardAttribs['verifications'];
|
65 |
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
|
66 |
|
78 |
* or is a VisaCheckoutCard with a different id
|
79 |
*
|
80 |
* @param object $otherVisaCheckoutCard customer to compare against
|
81 |
+
*
|
82 |
* @return boolean
|
83 |
*/
|
84 |
public function isEqual($otherVisaCheckoutCard)
|
86 |
return !($otherVisaCheckoutCard instanceof self) ? false : $this->token === $otherVisaCheckoutCard->token;
|
87 |
}
|
88 |
|
89 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
90 |
+
public function __toString()
|
|
|
|
|
|
|
|
|
91 |
{
|
92 |
return __CLASS__ . '[' .
|
93 |
+
Util::attributesToString($this->_attributes) . ']';
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
+
* Creates an instance from given attributes
|
98 |
+
*
|
99 |
+
* @param array $attributes response object attributes
|
100 |
*
|
|
|
101 |
* @return VisaCheckoutCard
|
102 |
*/
|
103 |
public static function factory($attributes)
|
114 |
return $instance;
|
115 |
}
|
116 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/WebhookNotification.php
CHANGED
@@ -1,8 +1,39 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class WebhookNotification extends Base
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
const SUBSCRIPTION_CANCELED = 'subscription_canceled';
|
7 |
const SUBSCRIPTION_CHARGED_SUCCESSFULLY = 'subscription_charged_successfully';
|
8 |
const SUBSCRIPTION_CHARGED_UNSUCCESSFULLY = 'subscription_charged_unsuccessfully';
|
@@ -13,33 +44,47 @@ class WebhookNotification extends Base
|
|
13 |
const SUB_MERCHANT_ACCOUNT_APPROVED = 'sub_merchant_account_approved';
|
14 |
const SUB_MERCHANT_ACCOUNT_DECLINED = 'sub_merchant_account_declined';
|
15 |
const TRANSACTION_DISBURSED = 'transaction_disbursed';
|
|
|
16 |
const TRANSACTION_SETTLED = 'transaction_settled';
|
17 |
const TRANSACTION_SETTLEMENT_DECLINED = 'transaction_settlement_declined';
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
const IDEAL_PAYMENT_FAILED = 'ideal_payment_failed';
|
33 |
-
const GRANTED_PAYMENT_INSTRUMENT_UPDATE = 'granted_payment_instrument_update';
|
34 |
-
|
35 |
-
public static function parse($signature, $payload) {
|
36 |
return Configuration::gateway()->webhookNotification()->parse($signature, $payload);
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
return Configuration::gateway()->webhookNotification()->verify($challenge);
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
public static function factory($attributes)
|
44 |
{
|
45 |
$instance = new self();
|
@@ -49,6 +94,7 @@ class WebhookNotification extends Base
|
|
49 |
|
50 |
protected function _initialize($attributes)
|
51 |
{
|
|
|
52 |
$this->_attributes = $attributes;
|
53 |
|
54 |
if (!isset($attributes['sourceMerchantId'])) {
|
@@ -73,6 +119,10 @@ class WebhookNotification extends Base
|
|
73 |
$this->_set('transaction', Transaction::factory($wrapperNode['transaction']));
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
76 |
if (isset($wrapperNode['disbursement'])) {
|
77 |
$this->_set('disbursement', Disbursement::factory($wrapperNode['disbursement']));
|
78 |
}
|
@@ -101,18 +151,38 @@ class WebhookNotification extends Base
|
|
101 |
$this->_set('accountUpdaterDailyReport', AccountUpdaterDailyReport::factory($wrapperNode['accountUpdaterDailyReport']));
|
102 |
}
|
103 |
|
104 |
-
if (isset($wrapperNode['idealPayment'])) {
|
105 |
-
$this->_set('idealPayment', IdealPayment::factory($wrapperNode['idealPayment']));
|
106 |
-
}
|
107 |
-
|
108 |
if (isset($wrapperNode['grantedPaymentInstrumentUpdate'])) {
|
109 |
$this->_set('grantedPaymentInstrumentUpdate', GrantedPaymentInstrumentUpdate::factory($wrapperNode['grantedPaymentInstrumentUpdate']));
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
if (isset($wrapperNode['errors'])) {
|
113 |
$this->_set('errors', new Error\ValidationErrorCollection($wrapperNode['errors']));
|
114 |
$this->_set('message', $wrapperNode['message']);
|
115 |
}
|
|
|
116 |
}
|
117 |
}
|
118 |
-
class_alias('Braintree\WebhookNotification', 'Braintree_WebhookNotification');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* WebhookNotification class
|
7 |
+
* module for webhook objects
|
8 |
+
*/
|
9 |
class WebhookNotification extends Base
|
10 |
{
|
11 |
+
// phpcs:disable Generic.Files.LineLength
|
12 |
+
const ACCOUNT_UPDATER_DAILY_REPORT = 'account_updater_daily_report';
|
13 |
+
const CHECK = 'check';
|
14 |
+
const CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED = 'connected_merchant_paypal_status_changed';
|
15 |
+
const CONNECTED_MERCHANT_STATUS_TRANSITIONED = 'connected_merchant_status_transitioned';
|
16 |
+
const DISBURSEMENT = 'disbursement';
|
17 |
+
const DISBURSEMENT_EXCEPTION = 'disbursement_exception';
|
18 |
+
const DISPUTE_ACCEPTED = 'dispute_accepted';
|
19 |
+
const DISPUTE_DISPUTED = 'dispute_disputed';
|
20 |
+
const DISPUTE_EXPIRED = 'dispute_expired';
|
21 |
+
const DISPUTE_LOST = 'dispute_lost';
|
22 |
+
const DISPUTE_OPENED = 'dispute_opened';
|
23 |
+
const DISPUTE_WON = 'dispute_won';
|
24 |
+
const GRANTED_PAYMENT_METHOD_REVOKED = 'granted_payment_method_revoked';
|
25 |
+
const GRANTOR_UPDATED_GRANTED_PAYMENT_METHOD = 'grantor_updated_granted_payment_method';
|
26 |
+
const LOCAL_PAYMENT_COMPLETED = "local_payment_completed";
|
27 |
+
const LOCAL_PAYMENT_EXPIRED = "local_payment_expired";
|
28 |
+
const LOCAL_PAYMENT_FUNDED = "local_payment_funded";
|
29 |
+
const LOCAL_PAYMENT_REVERSED = "local_payment_reversed";
|
30 |
+
const OAUTH_ACCESS_REVOKED = 'oauth_access_revoked';
|
31 |
+
const PARTNER_MERCHANT_CONNECTED = 'partner_merchant_connected';
|
32 |
+
const PARTNER_MERCHANT_DECLINED = 'partner_merchant_declined';
|
33 |
+
const PARTNER_MERCHANT_DISCONNECTED = 'partner_merchant_disconnected';
|
34 |
+
const PAYMENT_METHOD_CUSTOMER_DATA_UPDATED = 'payment_method_customer_data_updated';
|
35 |
+
const PAYMENT_METHOD_REVOKED_BY_CUSTOMER = 'payment_method_revoked_by_customer';
|
36 |
+
const RECIPIENT_UPDATED_GRANTED_PAYMENT_METHOD = 'recipient_updated_granted_payment_method';
|
37 |
const SUBSCRIPTION_CANCELED = 'subscription_canceled';
|
38 |
const SUBSCRIPTION_CHARGED_SUCCESSFULLY = 'subscription_charged_successfully';
|
39 |
const SUBSCRIPTION_CHARGED_UNSUCCESSFULLY = 'subscription_charged_unsuccessfully';
|
44 |
const SUB_MERCHANT_ACCOUNT_APPROVED = 'sub_merchant_account_approved';
|
45 |
const SUB_MERCHANT_ACCOUNT_DECLINED = 'sub_merchant_account_declined';
|
46 |
const TRANSACTION_DISBURSED = 'transaction_disbursed';
|
47 |
+
const TRANSACTION_REVIEWED = 'transaction_reviewed';
|
48 |
const TRANSACTION_SETTLED = 'transaction_settled';
|
49 |
const TRANSACTION_SETTLEMENT_DECLINED = 'transaction_settlement_declined';
|
50 |
+
// phpcs:enable Generic.Files.LineLength
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Static methods redirecting to gateway class
|
54 |
+
*
|
55 |
+
* @param string $signature used to verify before parsing
|
56 |
+
* @param mixed $payload to be parsed
|
57 |
+
*
|
58 |
+
* @see WebHookNotificationGateway::parse()
|
59 |
+
*
|
60 |
+
* @return WebhookNotification object|Exception
|
61 |
+
*/
|
62 |
+
public static function parse($signature, $payload)
|
63 |
+
{
|
|
|
|
|
|
|
|
|
64 |
return Configuration::gateway()->webhookNotification()->parse($signature, $payload);
|
65 |
}
|
66 |
|
67 |
+
/*
|
68 |
+
* Static methods redirecting to gateway class
|
69 |
+
*
|
70 |
+
* @param object $challenge to be verified
|
71 |
+
*
|
72 |
+
* @see WebHookNotificationGateway::verify()
|
73 |
+
*
|
74 |
+
* @return string|Exception
|
75 |
+
*/
|
76 |
+
public static function verify($challenge)
|
77 |
+
{
|
78 |
return Configuration::gateway()->webhookNotification()->verify($challenge);
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Creates an instance from given attributes
|
83 |
+
*
|
84 |
+
* @param array $attributes response object attributes
|
85 |
+
*
|
86 |
+
* @return WebhookNotification
|
87 |
+
*/
|
88 |
public static function factory($attributes)
|
89 |
{
|
90 |
$instance = new self();
|
94 |
|
95 |
protected function _initialize($attributes)
|
96 |
{
|
97 |
+
// phpcs:disable Generic.Files.LineLength
|
98 |
$this->_attributes = $attributes;
|
99 |
|
100 |
if (!isset($attributes['sourceMerchantId'])) {
|
119 |
$this->_set('transaction', Transaction::factory($wrapperNode['transaction']));
|
120 |
}
|
121 |
|
122 |
+
if (isset($wrapperNode['transactionReview'])) {
|
123 |
+
$this->_set('transactionReview', TransactionReview::factory($wrapperNode['transactionReview']));
|
124 |
+
}
|
125 |
+
|
126 |
if (isset($wrapperNode['disbursement'])) {
|
127 |
$this->_set('disbursement', Disbursement::factory($wrapperNode['disbursement']));
|
128 |
}
|
151 |
$this->_set('accountUpdaterDailyReport', AccountUpdaterDailyReport::factory($wrapperNode['accountUpdaterDailyReport']));
|
152 |
}
|
153 |
|
|
|
|
|
|
|
|
|
154 |
if (isset($wrapperNode['grantedPaymentInstrumentUpdate'])) {
|
155 |
$this->_set('grantedPaymentInstrumentUpdate', GrantedPaymentInstrumentUpdate::factory($wrapperNode['grantedPaymentInstrumentUpdate']));
|
156 |
}
|
157 |
|
158 |
+
if (in_array($attributes['kind'], [self::GRANTED_PAYMENT_METHOD_REVOKED, self::PAYMENT_METHOD_REVOKED_BY_CUSTOMER])) {
|
159 |
+
$this->_set('revokedPaymentMethodMetadata', RevokedPaymentMethodMetadata::factory($wrapperNode));
|
160 |
+
}
|
161 |
+
|
162 |
+
if (isset($wrapperNode['localPayment'])) {
|
163 |
+
$this->_set('localPaymentCompleted', LocalPaymentCompleted::factory($wrapperNode['localPayment']));
|
164 |
+
}
|
165 |
+
|
166 |
+
if (isset($wrapperNode['localPaymentExpired'])) {
|
167 |
+
$this->_set('localPaymentExpired', LocalPaymentExpired::factory($wrapperNode['localPaymentExpired']));
|
168 |
+
}
|
169 |
+
|
170 |
+
if (isset($wrapperNode['localPaymentFunded'])) {
|
171 |
+
$this->_set('localPaymentFunded', LocalPaymentFunded::factory($wrapperNode['localPaymentFunded']));
|
172 |
+
}
|
173 |
+
|
174 |
+
if (isset($wrapperNode['localPaymentReversed'])) {
|
175 |
+
$this->_set('localPaymentReversed', LocalPaymentReversed::factory($wrapperNode['localPaymentReversed']));
|
176 |
+
}
|
177 |
+
|
178 |
+
if (isset($wrapperNode['paymentMethodCustomerDataUpdatedMetadata'])) {
|
179 |
+
$this->_set('paymentMethodCustomerDataUpdatedMetadata', PaymentMethodCustomerDataUpdatedMetadata::factory($wrapperNode['paymentMethodCustomerDataUpdatedMetadata']));
|
180 |
+
}
|
181 |
+
|
182 |
if (isset($wrapperNode['errors'])) {
|
183 |
$this->_set('errors', new Error\ValidationErrorCollection($wrapperNode['errors']));
|
184 |
$this->_set('message', $wrapperNode['message']);
|
185 |
}
|
186 |
+
// phpcs:enable Generic.Files.LineLength
|
187 |
}
|
188 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/WebhookNotificationGateway.php
CHANGED
@@ -1,15 +1,30 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class WebhookNotificationGateway
|
5 |
{
|
6 |
-
|
7 |
public function __construct($gateway)
|
8 |
{
|
9 |
$this->config = $gateway->config;
|
10 |
$this->config->assertHasAccessTokenOrKeys();
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function parse($signature, $payload)
|
14 |
{
|
15 |
if (is_null($signature)) {
|
@@ -31,6 +46,15 @@ class WebhookNotificationGateway
|
|
31 |
return WebhookNotification::factory($attributes['notification']);
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public function verify($challenge)
|
35 |
{
|
36 |
if (!preg_match('/^[a-f0-9]{20,32}$/', $challenge)) {
|
@@ -62,8 +86,7 @@ class WebhookNotificationGateway
|
|
62 |
|
63 |
private function _matchingSignature($signaturePairs)
|
64 |
{
|
65 |
-
foreach ($signaturePairs as $pair)
|
66 |
-
{
|
67 |
$components = preg_split("/\|/", $pair);
|
68 |
if ($components[0] == $this->config->getPublicKey()) {
|
69 |
return $components[1];
|
@@ -73,5 +96,3 @@ class WebhookNotificationGateway
|
|
73 |
return null;
|
74 |
}
|
75 |
}
|
76 |
-
|
77 |
-
class_alias('Braintree\WebhookNotificationGateway', 'Braintree_WebhookNotificationGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* Braintree WebhookNotificationGateway
|
7 |
+
* Manages Webhooks
|
8 |
+
*/
|
9 |
class WebhookNotificationGateway
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($gateway)
|
13 |
{
|
14 |
$this->config = $gateway->config;
|
15 |
$this->config->assertHasAccessTokenOrKeys();
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Parses a webhook from the Braintree API
|
20 |
+
*
|
21 |
+
* @param string $signature used to verify before parsing
|
22 |
+
* @param mixed $payload to be parsed
|
23 |
+
*
|
24 |
+
* @throws Exception\InvalidSignature
|
25 |
+
*
|
26 |
+
* @return WebhookNotification object
|
27 |
+
*/
|
28 |
public function parse($signature, $payload)
|
29 |
{
|
30 |
if (is_null($signature)) {
|
46 |
return WebhookNotification::factory($attributes['notification']);
|
47 |
}
|
48 |
|
49 |
+
/*
|
50 |
+
* Verify a webhook challenge
|
51 |
+
*
|
52 |
+
* @param object $challenge to be verified
|
53 |
+
*
|
54 |
+
* @throws Exception\InvalidChallenge
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
public function verify($challenge)
|
59 |
{
|
60 |
if (!preg_match('/^[a-f0-9]{20,32}$/', $challenge)) {
|
86 |
|
87 |
private function _matchingSignature($signaturePairs)
|
88 |
{
|
89 |
+
foreach ($signaturePairs as $pair) {
|
|
|
90 |
$components = preg_split("/\|/", $pair);
|
91 |
if ($components[0] == $this->config->getPublicKey()) {
|
92 |
return $components[1];
|
96 |
return null;
|
97 |
}
|
98 |
}
|
|
|
|
vendor/braintree/braintree_php/lib/Braintree/WebhookTesting.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
class WebhookTesting
|
@@ -8,4 +9,3 @@ class WebhookTesting
|
|
8 |
return Configuration::gateway()->webhookTesting()->sampleNotification($kind, $id, $sourceMerchantId);
|
9 |
}
|
10 |
}
|
11 |
-
class_alias('Braintree\WebhookTesting', 'Braintree_WebhookTesting');
|
1 |
+
<?php //phpcs:disable PEAR
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
class WebhookTesting
|
9 |
return Configuration::gateway()->webhookTesting()->sampleNotification($kind, $id, $sourceMerchantId);
|
10 |
}
|
11 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/WebhookTestingGateway.php
CHANGED
@@ -1,20 +1,36 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
class WebhookTestingGateway
|
5 |
{
|
6 |
-
|
7 |
public function __construct($gateway)
|
8 |
{
|
9 |
$this->config = $gateway->config;
|
10 |
$this->config->assertHasAccessTokenOrKeys();
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function sampleNotification($kind, $id, $sourceMerchantId = null)
|
14 |
{
|
15 |
$xml = self::_sampleXml($kind, $id, $sourceMerchantId);
|
16 |
$payload = base64_encode($xml) . "\n";
|
17 |
-
$
|
|
|
|
|
18 |
|
19 |
return [
|
20 |
'bt_signature' => $signature,
|
@@ -34,6 +50,9 @@ class WebhookTestingGateway
|
|
34 |
case WebhookNotification::TRANSACTION_DISBURSED:
|
35 |
$subjectXml = self::_transactionDisbursedSampleXml($id);
|
36 |
break;
|
|
|
|
|
|
|
37 |
case WebhookNotification::TRANSACTION_SETTLED:
|
38 |
$subjectXml = self::_transactionSettledSampleXml($id);
|
39 |
break;
|
@@ -73,24 +92,63 @@ class WebhookTestingGateway
|
|
73 |
case WebhookNotification::DISPUTE_WON:
|
74 |
$subjectXml = self::_disputeWonSampleXml($id);
|
75 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
case WebhookNotification::SUBSCRIPTION_CHARGED_SUCCESSFULLY:
|
77 |
$subjectXml = self::_subscriptionChargedSuccessfullySampleXml($id);
|
78 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
case WebhookNotification::CHECK:
|
80 |
$subjectXml = self::_checkSampleXml();
|
81 |
break;
|
82 |
case WebhookNotification::ACCOUNT_UPDATER_DAILY_REPORT:
|
83 |
$subjectXml = self::_accountUpdaterDailyReportSampleXml($id);
|
84 |
break;
|
85 |
-
case WebhookNotification::
|
86 |
-
$subjectXml = self::
|
87 |
-
break;
|
88 |
-
case WebhookNotification::IDEAL_PAYMENT_FAILED:
|
89 |
-
$subjectXml = self::_idealPaymentFailedSampleXml($id);
|
90 |
break;
|
91 |
-
case WebhookNotification::
|
92 |
$subjectXml = self::_grantedPaymentInstrumentUpdateSampleXml();
|
93 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
default:
|
95 |
$subjectXml = self::_subscriptionSampleXml($id);
|
96 |
break;
|
@@ -168,6 +226,19 @@ class WebhookTestingGateway
|
|
168 |
";
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
private static function _transactionSettledSampleXml($id)
|
172 |
{
|
173 |
return "
|
@@ -331,11 +402,81 @@ class WebhookTestingGateway
|
|
331 |
";
|
332 |
}
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
private static function _subscriptionSampleXml($id)
|
335 |
{
|
336 |
return "
|
337 |
<subscription>
|
338 |
<id>{$id}</id>
|
|
|
339 |
<transactions type=\"array\">
|
340 |
</transactions>
|
341 |
<add_ons type=\"array\">
|
@@ -351,10 +492,12 @@ class WebhookTestingGateway
|
|
351 |
return "
|
352 |
<subscription>
|
353 |
<id>{$id}</id>
|
|
|
354 |
<billing-period-start-date type=\"date\">2016-03-21</billing-period-start-date>
|
355 |
<billing-period-end-date type=\"date\">2017-03-31</billing-period-end-date>
|
356 |
<transactions type=\"array\">
|
357 |
<transaction>
|
|
|
358 |
<status>submitted_for_settlement</status>
|
359 |
<amount>49.99</amount>
|
360 |
</transaction>
|
@@ -367,6 +510,77 @@ class WebhookTestingGateway
|
|
367 |
";
|
368 |
}
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
private static function _checkSampleXml()
|
371 |
{
|
372 |
return "
|
@@ -447,42 +661,8 @@ class WebhookTestingGateway
|
|
447 |
";
|
448 |
}
|
449 |
|
450 |
-
private static function _idealPaymentCompleteSampleXml($id)
|
451 |
-
{
|
452 |
-
return "
|
453 |
-
<ideal-payment>
|
454 |
-
<id>{$id}</id>
|
455 |
-
<status>COMPLETE</status>
|
456 |
-
<issuer>ABCISSUER</issuer>
|
457 |
-
<order-id>ORDERABC</order-id>
|
458 |
-
<currency>EUR</currency>
|
459 |
-
<amount>10.00</amount>
|
460 |
-
<created-at>2016-11-29T23:27:34.547Z</created-at>
|
461 |
-
<approval-url>https://example.com</approval-url>
|
462 |
-
<ideal-transaction-id>1234567890</ideal-transaction-id>
|
463 |
-
</ideal-payment>
|
464 |
-
";
|
465 |
-
}
|
466 |
-
|
467 |
-
private static function _idealPaymentFailedSampleXml($id)
|
468 |
-
{
|
469 |
-
return "
|
470 |
-
<ideal-payment>
|
471 |
-
<id>{$id}</id>
|
472 |
-
<status>FAILED</status>
|
473 |
-
<issuer>ABCISSUER</issuer>
|
474 |
-
<order-id>ORDERABC</order-id>
|
475 |
-
<currency>EUR</currency>
|
476 |
-
<amount>10.00</amount>
|
477 |
-
<created-at>2016-11-29T23:27:34.547Z</created-at>
|
478 |
-
<approval-url>https://example.com</approval-url>
|
479 |
-
<ideal-transaction-id>1234567890</ideal-transaction-id>
|
480 |
-
</ideal-payment>
|
481 |
-
";
|
482 |
-
}
|
483 |
-
|
484 |
private static function _grantedPaymentInstrumentUpdateSampleXml()
|
485 |
-
|
486 |
return "
|
487 |
<granted-payment-instrument-update>
|
488 |
<grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
|
@@ -501,14 +681,133 @@ class WebhookTestingGateway
|
|
501 |
";
|
502 |
}
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
private static function _timestamp()
|
505 |
{
|
506 |
$originalZone = date_default_timezone_get();
|
507 |
date_default_timezone_set('UTC');
|
508 |
-
$timestamp =
|
509 |
date_default_timezone_set($originalZone);
|
510 |
|
511 |
return $timestamp;
|
512 |
}
|
513 |
}
|
514 |
-
class_alias('Braintree\WebhookTestingGateway', 'Braintree_WebhookTestingGateway');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
+
/**
|
6 |
+
* WebhookTestingGateway module
|
7 |
+
* Creates and manages test webhooks
|
8 |
+
*/
|
9 |
class WebhookTestingGateway
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
public function __construct($gateway)
|
13 |
{
|
14 |
$this->config = $gateway->config;
|
15 |
$this->config->assertHasAccessTokenOrKeys();
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Build a sample Webhook
|
20 |
+
*
|
21 |
+
* @param string $kind the kind of Webhook you want to generate
|
22 |
+
* @param string $id unique identifier
|
23 |
+
* @param string $sourceMerchantId optional
|
24 |
+
*
|
25 |
+
* @return Webhook
|
26 |
+
*/
|
27 |
public function sampleNotification($kind, $id, $sourceMerchantId = null)
|
28 |
{
|
29 |
$xml = self::_sampleXml($kind, $id, $sourceMerchantId);
|
30 |
$payload = base64_encode($xml) . "\n";
|
31 |
+
$publicKey = $this->config->getPublicKey();
|
32 |
+
$sha = Digest::hexDigestSha1($this->config->getPrivateKey(), $payload);
|
33 |
+
$signature = $publicKey . "|" . $sha;
|
34 |
|
35 |
return [
|
36 |
'bt_signature' => $signature,
|
50 |
case WebhookNotification::TRANSACTION_DISBURSED:
|
51 |
$subjectXml = self::_transactionDisbursedSampleXml($id);
|
52 |
break;
|
53 |
+
case WebhookNotification::TRANSACTION_REVIEWED:
|
54 |
+
$subjectXml = self::_transactionReviewedSampleXml($id);
|
55 |
+
break;
|
56 |
case WebhookNotification::TRANSACTION_SETTLED:
|
57 |
$subjectXml = self::_transactionSettledSampleXml($id);
|
58 |
break;
|
92 |
case WebhookNotification::DISPUTE_WON:
|
93 |
$subjectXml = self::_disputeWonSampleXml($id);
|
94 |
break;
|
95 |
+
case WebhookNotification::DISPUTE_ACCEPTED:
|
96 |
+
$subjectXml = self::_disputeAcceptedSampleXml($id);
|
97 |
+
break;
|
98 |
+
case WebhookNotification::DISPUTE_DISPUTED:
|
99 |
+
$subjectXml = self::_disputeDisputedSampleXml($id);
|
100 |
+
break;
|
101 |
+
case WebhookNotification::DISPUTE_EXPIRED:
|
102 |
+
$subjectXml = self::_disputeExpiredSampleXml($id);
|
103 |
+
break;
|
104 |
case WebhookNotification::SUBSCRIPTION_CHARGED_SUCCESSFULLY:
|
105 |
$subjectXml = self::_subscriptionChargedSuccessfullySampleXml($id);
|
106 |
break;
|
107 |
+
case WebhookNotification::SUBSCRIPTION_CHARGED_UNSUCCESSFULLY:
|
108 |
+
$subjectXml = self::_subscriptionChargedUnsuccessfullySampleXml($id);
|
109 |
+
break;
|
110 |
+
case WebhookNotification::SUBSCRIPTION_EXPIRED:
|
111 |
+
$subjectXml = self::_subscriptionExpiredSampleXml($id);
|
112 |
+
break;
|
113 |
+
case WebhookNotification::SUBSCRIPTION_CANCELED:
|
114 |
+
$subjectXml = self::_subscriptionCanceledSampleXml($id);
|
115 |
+
break;
|
116 |
+
case WebhookNotification::SUBSCRIPTION_WENT_PAST_DUE:
|
117 |
+
$subjectXml = self::_subscriptionWentPastDueSampleXml($id);
|
118 |
+
break;
|
119 |
case WebhookNotification::CHECK:
|
120 |
$subjectXml = self::_checkSampleXml();
|
121 |
break;
|
122 |
case WebhookNotification::ACCOUNT_UPDATER_DAILY_REPORT:
|
123 |
$subjectXml = self::_accountUpdaterDailyReportSampleXml($id);
|
124 |
break;
|
125 |
+
case WebhookNotification::GRANTOR_UPDATED_GRANTED_PAYMENT_METHOD:
|
126 |
+
$subjectXml = self::_grantedPaymentInstrumentUpdateSampleXml();
|
|
|
|
|
|
|
127 |
break;
|
128 |
+
case WebhookNotification::RECIPIENT_UPDATED_GRANTED_PAYMENT_METHOD:
|
129 |
$subjectXml = self::_grantedPaymentInstrumentUpdateSampleXml();
|
130 |
break;
|
131 |
+
case WebhookNotification::GRANTED_PAYMENT_METHOD_REVOKED:
|
132 |
+
$subjectXml = self::_venmoAccountXml($id);
|
133 |
+
break;
|
134 |
+
case WebhookNotification::PAYMENT_METHOD_REVOKED_BY_CUSTOMER:
|
135 |
+
$subjectXml = self::_paymentMethodRevokedByCustomerSampleXml($id);
|
136 |
+
break;
|
137 |
+
case WebhookNotification::LOCAL_PAYMENT_COMPLETED:
|
138 |
+
$subjectXml = self::_localPaymentCompletedSampleXml();
|
139 |
+
break;
|
140 |
+
case WebhookNotification::LOCAL_PAYMENT_EXPIRED:
|
141 |
+
$subjectXml = self::_localPaymentExpiredSampleXml();
|
142 |
+
break;
|
143 |
+
case WebhookNotification::LOCAL_PAYMENT_FUNDED:
|
144 |
+
$subjectXml = self::_localPaymentFundedSampleXml();
|
145 |
+
break;
|
146 |
+
case WebhookNotification::LOCAL_PAYMENT_REVERSED:
|
147 |
+
$subjectXml = self::_localPaymentReversedSampleXml();
|
148 |
+
break;
|
149 |
+
case WebhookNotification::PAYMENT_METHOD_CUSTOMER_DATA_UPDATED:
|
150 |
+
$subjectXml = self::_paymentMethodCustomerDataUpdatedSampleXml($id);
|
151 |
+
break;
|
152 |
default:
|
153 |
$subjectXml = self::_subscriptionSampleXml($id);
|
154 |
break;
|
226 |
";
|
227 |
}
|
228 |
|
229 |
+
private static function _transactionReviewedSampleXml($id)
|
230 |
+
{
|
231 |
+
return "
|
232 |
+
<transaction-review>
|
233 |
+
<transaction-id>my_id</transaction-id>
|
234 |
+
<decision>smart_decision</decision>
|
235 |
+
<reviewer-email>hey@girl.com</reviewer-email>
|
236 |
+
<reviewer-note>I reviewed this</reviewer-note>
|
237 |
+
<reviewed-time type='dateTime'>2018-10-11T21:28:37Z</reviewed-time>
|
238 |
+
</transaction-review>
|
239 |
+
";
|
240 |
+
}
|
241 |
+
|
242 |
private static function _transactionSettledSampleXml($id)
|
243 |
{
|
244 |
return "
|
402 |
";
|
403 |
}
|
404 |
|
405 |
+
private static function _disputeAcceptedSampleXml($id)
|
406 |
+
{
|
407 |
+
return "
|
408 |
+
<dispute>
|
409 |
+
<amount>250.00</amount>
|
410 |
+
<amount-disputed>250.0</amount-disputed>
|
411 |
+
<amount-won>245.00</amount-won>
|
412 |
+
<currency-iso-code>USD</currency-iso-code>
|
413 |
+
<received-date type=\"date\">2014-03-01</received-date>
|
414 |
+
<reply-by-date type=\"date\">2014-03-21</reply-by-date>
|
415 |
+
<kind>chargeback</kind>
|
416 |
+
<status>accepted</status>
|
417 |
+
<reason>fraud</reason>
|
418 |
+
<id>${id}</id>
|
419 |
+
<transaction>
|
420 |
+
<id>${id}</id>
|
421 |
+
<amount>250.00</amount>
|
422 |
+
</transaction>
|
423 |
+
<date-opened type=\"date\">2014-03-21</date-opened>
|
424 |
+
</dispute>
|
425 |
+
";
|
426 |
+
}
|
427 |
+
|
428 |
+
private static function _disputeDisputedSampleXml($id)
|
429 |
+
{
|
430 |
+
return "
|
431 |
+
<dispute>
|
432 |
+
<amount>250.00</amount>
|
433 |
+
<amount-disputed>250.0</amount-disputed>
|
434 |
+
<amount-won>245.00</amount-won>
|
435 |
+
<currency-iso-code>USD</currency-iso-code>
|
436 |
+
<received-date type=\"date\">2014-03-01</received-date>
|
437 |
+
<reply-by-date type=\"date\">2014-03-21</reply-by-date>
|
438 |
+
<kind>chargeback</kind>
|
439 |
+
<status>disputed</status>
|
440 |
+
<reason>fraud</reason>
|
441 |
+
<id>${id}</id>
|
442 |
+
<transaction>
|
443 |
+
<id>${id}</id>
|
444 |
+
<amount>250.00</amount>
|
445 |
+
</transaction>
|
446 |
+
<date-opened type=\"date\">2014-03-21</date-opened>
|
447 |
+
</dispute>
|
448 |
+
";
|
449 |
+
}
|
450 |
+
|
451 |
+
private static function _disputeExpiredSampleXml($id)
|
452 |
+
{
|
453 |
+
return "
|
454 |
+
<dispute>
|
455 |
+
<amount>250.00</amount>
|
456 |
+
<amount-disputed>250.0</amount-disputed>
|
457 |
+
<amount-won>245.00</amount-won>
|
458 |
+
<currency-iso-code>USD</currency-iso-code>
|
459 |
+
<received-date type=\"date\">2014-03-01</received-date>
|
460 |
+
<reply-by-date type=\"date\">2014-03-21</reply-by-date>
|
461 |
+
<kind>chargeback</kind>
|
462 |
+
<status>expired</status>
|
463 |
+
<reason>fraud</reason>
|
464 |
+
<id>${id}</id>
|
465 |
+
<transaction>
|
466 |
+
<id>${id}</id>
|
467 |
+
<amount>250.00</amount>
|
468 |
+
</transaction>
|
469 |
+
<date-opened type=\"date\">2014-03-21</date-opened>
|
470 |
+
</dispute>
|
471 |
+
";
|
472 |
+
}
|
473 |
+
|
474 |
private static function _subscriptionSampleXml($id)
|
475 |
{
|
476 |
return "
|
477 |
<subscription>
|
478 |
<id>{$id}</id>
|
479 |
+
<status>Active</status>
|
480 |
<transactions type=\"array\">
|
481 |
</transactions>
|
482 |
<add_ons type=\"array\">
|
492 |
return "
|
493 |
<subscription>
|
494 |
<id>{$id}</id>
|
495 |
+
<status>Active</status>
|
496 |
<billing-period-start-date type=\"date\">2016-03-21</billing-period-start-date>
|
497 |
<billing-period-end-date type=\"date\">2017-03-31</billing-period-end-date>
|
498 |
<transactions type=\"array\">
|
499 |
<transaction>
|
500 |
+
<id>{$id}</id>
|
501 |
<status>submitted_for_settlement</status>
|
502 |
<amount>49.99</amount>
|
503 |
</transaction>
|
510 |
";
|
511 |
}
|
512 |
|
513 |
+
private static function _subscriptionChargedUnsuccessfullySampleXml($id)
|
514 |
+
{
|
515 |
+
return "
|
516 |
+
<subscription>
|
517 |
+
<id>{$id}</id>
|
518 |
+
<status>Active</status>
|
519 |
+
<billing-period-start-date type=\"date\">2016-03-21</billing-period-start-date>
|
520 |
+
<billing-period-end-date type=\"date\">2017-03-31</billing-period-end-date>
|
521 |
+
<transactions type=\"array\">
|
522 |
+
<transaction>
|
523 |
+
<id>{$id}</id>
|
524 |
+
<status>failed</status>
|
525 |
+
<amount>49.99</amount>
|
526 |
+
</transaction>
|
527 |
+
</transactions>
|
528 |
+
<add_ons type=\"array\">
|
529 |
+
</add_ons>
|
530 |
+
<discounts type=\"array\">
|
531 |
+
</discounts>
|
532 |
+
</subscription>
|
533 |
+
";
|
534 |
+
}
|
535 |
+
|
536 |
+
private static function _subscriptionExpiredSampleXml($id)
|
537 |
+
{
|
538 |
+
return "
|
539 |
+
<subscription>
|
540 |
+
<id>{$id}</id>
|
541 |
+
<status>Expired</status>
|
542 |
+
<transactions type=\"array\">
|
543 |
+
</transactions>
|
544 |
+
<add_ons type=\"array\">
|
545 |
+
</add_ons>
|
546 |
+
<discounts type=\"array\">
|
547 |
+
</discounts>
|
548 |
+
</subscription>
|
549 |
+
";
|
550 |
+
}
|
551 |
+
|
552 |
+
private static function _subscriptionCanceledSampleXml($id)
|
553 |
+
{
|
554 |
+
return "
|
555 |
+
<subscription>
|
556 |
+
<id>{$id}</id>
|
557 |
+
<status>Canceled</status>
|
558 |
+
<transactions type=\"array\">
|
559 |
+
</transactions>
|
560 |
+
<add_ons type=\"array\">
|
561 |
+
</add_ons>
|
562 |
+
<discounts type=\"array\">
|
563 |
+
</discounts>
|
564 |
+
</subscription>
|
565 |
+
";
|
566 |
+
}
|
567 |
+
|
568 |
+
private static function _subscriptionWentPastDueSampleXml($id)
|
569 |
+
{
|
570 |
+
return "
|
571 |
+
<subscription>
|
572 |
+
<id>{$id}</id>
|
573 |
+
<status>Past Due</status>
|
574 |
+
<transactions type=\"array\">
|
575 |
+
</transactions>
|
576 |
+
<add_ons type=\"array\">
|
577 |
+
</add_ons>
|
578 |
+
<discounts type=\"array\">
|
579 |
+
</discounts>
|
580 |
+
</subscription>
|
581 |
+
";
|
582 |
+
}
|
583 |
+
|
584 |
private static function _checkSampleXml()
|
585 |
{
|
586 |
return "
|
661 |
";
|
662 |
}
|
663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
private static function _grantedPaymentInstrumentUpdateSampleXml()
|
665 |
+
{
|
666 |
return "
|
667 |
<granted-payment-instrument-update>
|
668 |
<grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
|
681 |
";
|
682 |
}
|
683 |
|
684 |
+
private static function _paymentMethodRevokedByCustomerSampleXml($id)
|
685 |
+
{
|
686 |
+
return "
|
687 |
+
<paypal-account>
|
688 |
+
<billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
|
689 |
+
<created-at type='datetime'>2019-01-01T12:00:00Z</created-at>
|
690 |
+
<customer-id>a-customer-id</customer-id>
|
691 |
+
<default type='boolean'>true</default>
|
692 |
+
<email>name@email.com</email>
|
693 |
+
<global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
|
694 |
+
<image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
|
695 |
+
<subscriptions type='array'/>
|
696 |
+
<token>{$id}</token>
|
697 |
+
<updated-at type='datetime'>2019-01-02T12:00:00Z</updated-at>
|
698 |
+
<is-channel-initiated nil='true'/>
|
699 |
+
<payer-id>a-payer-id</payer-id>
|
700 |
+
<payer-info nil='true'/>
|
701 |
+
<limited-use-order-id nil='true'/>
|
702 |
+
<revoked-at type='datetime'>2019-01-02T12:00:00Z</revoked-at>
|
703 |
+
</paypal-account>
|
704 |
+
";
|
705 |
+
}
|
706 |
+
|
707 |
+
private static function _localPaymentCompletedSampleXml()
|
708 |
+
{
|
709 |
+
return "
|
710 |
+
<local-payment>
|
711 |
+
<payment-id>a-payment-id</payment-id>
|
712 |
+
<payer-id>a-payer-id</payer-id>
|
713 |
+
<payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
|
714 |
+
<transaction>
|
715 |
+
<id>1</id>
|
716 |
+
<status>authorizing</status>
|
717 |
+
<amount>10.00</amount>
|
718 |
+
<order-id>order1234</order-id>
|
719 |
+
</transaction>
|
720 |
+
</local-payment>
|
721 |
+
";
|
722 |
+
}
|
723 |
+
|
724 |
+
private static function _localPaymentExpiredSampleXml()
|
725 |
+
{
|
726 |
+
return "
|
727 |
+
<local-payment-expired>
|
728 |
+
<payment-id>a-payment-id</payment-id>
|
729 |
+
<payment-context-id>a-payment-context-id</payment-context-id>
|
730 |
+
</local-payment-expired>
|
731 |
+
";
|
732 |
+
}
|
733 |
+
|
734 |
+
private static function _localPaymentFundedSampleXml()
|
735 |
+
{
|
736 |
+
return "
|
737 |
+
<local-payment-funded>
|
738 |
+
<payment-id>a-payment-id</payment-id>
|
739 |
+
<payment-context-id>a-payment-context-id</payment-context-id>
|
740 |
+
<transaction>
|
741 |
+
<id>1</id>
|
742 |
+
<status>settled</status>
|
743 |
+
<amount>10.00</amount>
|
744 |
+
<order-id>order1234</order-id>
|
745 |
+
</transaction>
|
746 |
+
</local-payment-funded>
|
747 |
+
";
|
748 |
+
}
|
749 |
+
|
750 |
+
private static function _localPaymentReversedSampleXml()
|
751 |
+
{
|
752 |
+
return "
|
753 |
+
<local-payment-reversed>
|
754 |
+
<payment-id>a-payment-id</payment-id>
|
755 |
+
</local-payment-reversed>
|
756 |
+
";
|
757 |
+
}
|
758 |
+
|
759 |
+
private static function _paymentMethodCustomerDataUpdatedSampleXml($id)
|
760 |
+
{
|
761 |
+
$venmoAccountXml = self::_venmoAccountXml($id);
|
762 |
+
return "
|
763 |
+
<payment-method-customer-data-updated-metadata>
|
764 |
+
<token>TOKEN-12345</token>
|
765 |
+
<payment-method>
|
766 |
+
{$venmoAccountXml}
|
767 |
+
</payment-method>
|
768 |
+
<datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
|
769 |
+
<enriched-customer-data>
|
770 |
+
<fields-updated type='array'>
|
771 |
+
<item>firstName</item>
|
772 |
+
</fields-updated>
|
773 |
+
<profile-data>
|
774 |
+
<username>venmo_username</username>
|
775 |
+
<first-name>John</first-name>
|
776 |
+
<last-name>Doe</last-name>
|
777 |
+
<phone-number>1231231234</phone-number>
|
778 |
+
<email>john.doe@paypal.com</email>
|
779 |
+
</profile-data>
|
780 |
+
</enriched-customer-data>
|
781 |
+
</payment-method-customer-data-updated-metadata>
|
782 |
+
";
|
783 |
+
}
|
784 |
+
|
785 |
+
private static function _venmoAccountXml($id)
|
786 |
+
{
|
787 |
+
return "
|
788 |
+
<venmo-account>
|
789 |
+
<created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
|
790 |
+
<updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
|
791 |
+
<default type='boolean'>true</default>
|
792 |
+
<image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
|
793 |
+
<token>{$id}</token>
|
794 |
+
<source-description>Venmo Account: venmojoe</source-description>
|
795 |
+
<username>venmojoe</username>
|
796 |
+
<venmo-user-id>456</venmo-user-id>
|
797 |
+
<subscriptions type='array'/>
|
798 |
+
<customer-id>venmo_customer_id</customer-id>
|
799 |
+
<global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
|
800 |
+
</venmo-account>
|
801 |
+
";
|
802 |
+
}
|
803 |
+
|
804 |
private static function _timestamp()
|
805 |
{
|
806 |
$originalZone = date_default_timezone_get();
|
807 |
date_default_timezone_set('UTC');
|
808 |
+
$timestamp = date("Y-m-d\TH:i:s\Z", time());
|
809 |
date_default_timezone_set($originalZone);
|
810 |
|
811 |
return $timestamp;
|
812 |
}
|
813 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Xml.php
CHANGED
@@ -1,24 +1,23 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree;
|
3 |
|
4 |
/**
|
5 |
* Braintree Xml parser and generator
|
6 |
-
* PHP version 5
|
7 |
* superclass for Braintree XML parsing and generation
|
8 |
*/
|
9 |
class Xml
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
-
*/
|
14 |
-
protected function __construct()
|
15 |
{
|
16 |
-
|
17 |
}
|
18 |
|
19 |
/**
|
|
|
|
|
|
|
20 |
*
|
21 |
-
* @param string $xml
|
22 |
* @return array
|
23 |
*/
|
24 |
public static function buildArrayFromXml($xml)
|
@@ -27,8 +26,10 @@ class Xml
|
|
27 |
}
|
28 |
|
29 |
/**
|
|
|
|
|
|
|
30 |
*
|
31 |
-
* @param array $array
|
32 |
* @return string
|
33 |
*/
|
34 |
public static function buildXmlFromArray($array)
|
@@ -36,4 +37,3 @@ class Xml
|
|
36 |
return Xml\Generator::arrayToXml($array);
|
37 |
}
|
38 |
}
|
39 |
-
class_alias('Braintree\Xml', 'Braintree_Xml');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree;
|
4 |
|
5 |
/**
|
6 |
* Braintree Xml parser and generator
|
|
|
7 |
* superclass for Braintree XML parsing and generation
|
8 |
*/
|
9 |
class Xml
|
10 |
{
|
11 |
+
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
|
12 |
+
protected function __construct()
|
|
|
|
|
13 |
{
|
|
|
14 |
}
|
15 |
|
16 |
/**
|
17 |
+
* Create an array from XML element(s)
|
18 |
+
*
|
19 |
+
* @param string $xml elements(s)
|
20 |
*
|
|
|
21 |
* @return array
|
22 |
*/
|
23 |
public static function buildArrayFromXml($xml)
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
+
* Create an XML string from an Array object
|
30 |
+
*
|
31 |
+
* @param array $array object
|
32 |
*
|
|
|
33 |
* @return string
|
34 |
*/
|
35 |
public static function buildXmlFromArray($array)
|
37 |
return Xml\Generator::arrayToXml($array);
|
38 |
}
|
39 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Xml/Generator.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Xml;
|
3 |
|
4 |
use DateTime;
|
@@ -6,10 +7,6 @@ use DateTimeZone;
|
|
6 |
use XMLWriter;
|
7 |
use Braintree\Util;
|
8 |
|
9 |
-
/**
|
10 |
-
* PHP version 5
|
11 |
-
*/
|
12 |
-
|
13 |
/**
|
14 |
* Generates XML output from arrays using PHP's
|
15 |
* built-in XMLWriter
|
@@ -19,7 +16,9 @@ class Generator
|
|
19 |
/**
|
20 |
* arrays passed to this method should have a single root element
|
21 |
* with an array as its value
|
|
|
22 |
* @param array $aData the array of data
|
|
|
23 |
* @return string XML string
|
24 |
*/
|
25 |
public static function arrayToXml($aData)
|
@@ -52,10 +51,9 @@ class Generator
|
|
52 |
/**
|
53 |
* Construct XML elements with attributes from an associative array.
|
54 |
*
|
55 |
-
* @access protected
|
56 |
-
* @static
|
57 |
* @param object $writer XMLWriter object
|
58 |
-
* @param array
|
|
|
59 |
* @return void
|
60 |
*/
|
61 |
private static function _createElementsFromArray(&$writer, $aData)
|
@@ -66,21 +64,20 @@ class Generator
|
|
66 |
} else {
|
67 |
$writer->text($aData);
|
68 |
}
|
69 |
-
|
70 |
}
|
71 |
-
foreach ($aData
|
72 |
// handle child elements
|
73 |
$writer->startElement($elementName);
|
74 |
if (is_array($element)) {
|
75 |
if (array_key_exists(0, $element) || empty($element)) {
|
76 |
$writer->writeAttribute('type', 'array');
|
77 |
-
foreach ($element
|
78 |
$writer->startElement('item');
|
79 |
self::_createElementsFromArray($writer, $itemInArray);
|
80 |
$writer->endElement();
|
81 |
}
|
82 |
-
}
|
83 |
-
else {
|
84 |
self::_createElementsFromArray($writer, $element);
|
85 |
}
|
86 |
} else {
|
@@ -90,7 +87,11 @@ class Generator
|
|
90 |
$writer->writeAttribute($attribute[0], $attribute[1]);
|
91 |
$element = $attribute[2];
|
92 |
}
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
$writer->endElement();
|
96 |
}
|
@@ -99,14 +100,15 @@ class Generator
|
|
99 |
/**
|
100 |
* convert passed data into an array of attributeType, attributeName, and value
|
101 |
* dates sent as DateTime objects will be converted to strings
|
102 |
-
*
|
103 |
* @param mixed $value
|
|
|
104 |
* @return array attributes and element value
|
105 |
*/
|
106 |
private static function _generateXmlAttribute($value)
|
107 |
{
|
108 |
-
if ($value instanceof DateTime) {
|
109 |
-
return ['type', 'datetime', self::
|
110 |
}
|
111 |
if (is_int($value)) {
|
112 |
return ['type', 'integer', $value];
|
@@ -114,19 +116,24 @@ class Generator
|
|
114 |
if (is_bool($value)) {
|
115 |
return ['type', 'boolean', ($value ? 'true' : 'false')];
|
116 |
}
|
117 |
-
if ($value ===
|
118 |
return ['nil', 'true', $value];
|
119 |
}
|
120 |
}
|
121 |
/**
|
122 |
* converts datetime back to xml schema format
|
123 |
-
*
|
124 |
* @param object $dateTime
|
|
|
125 |
* @return string XML schema formatted timestamp
|
126 |
*/
|
127 |
-
private static function
|
128 |
{
|
129 |
-
$
|
|
|
|
|
|
|
|
|
130 |
|
131 |
$dateTimeForUTC->setTimeZone(new DateTimeZone('UTC'));
|
132 |
return ($dateTimeForUTC->format('Y-m-d\TH:i:s') . 'Z');
|
@@ -136,14 +143,13 @@ class Generator
|
|
136 |
{
|
137 |
try {
|
138 |
if (empty($string)) {
|
139 |
-
|
140 |
}
|
141 |
$dateTime = new DateTime($string);
|
142 |
-
return self::
|
143 |
} catch (Exception $e) {
|
144 |
// not a datetime
|
145 |
return false;
|
146 |
}
|
147 |
}
|
148 |
}
|
149 |
-
class_alias('Braintree\Xml\Generator', 'Braintree_Xml_Generator');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Xml;
|
4 |
|
5 |
use DateTime;
|
7 |
use XMLWriter;
|
8 |
use Braintree\Util;
|
9 |
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* Generates XML output from arrays using PHP's
|
12 |
* built-in XMLWriter
|
16 |
/**
|
17 |
* arrays passed to this method should have a single root element
|
18 |
* with an array as its value
|
19 |
+
*
|
20 |
* @param array $aData the array of data
|
21 |
+
*
|
22 |
* @return string XML string
|
23 |
*/
|
24 |
public static function arrayToXml($aData)
|
51 |
/**
|
52 |
* Construct XML elements with attributes from an associative array.
|
53 |
*
|
|
|
|
|
54 |
* @param object $writer XMLWriter object
|
55 |
+
* @param array $aData contains attributes and values
|
56 |
+
*
|
57 |
* @return void
|
58 |
*/
|
59 |
private static function _createElementsFromArray(&$writer, $aData)
|
64 |
} else {
|
65 |
$writer->text($aData);
|
66 |
}
|
67 |
+
return;
|
68 |
}
|
69 |
+
foreach ($aData as $elementName => $element) {
|
70 |
// handle child elements
|
71 |
$writer->startElement($elementName);
|
72 |
if (is_array($element)) {
|
73 |
if (array_key_exists(0, $element) || empty($element)) {
|
74 |
$writer->writeAttribute('type', 'array');
|
75 |
+
foreach ($element as $ignored => $itemInArray) {
|
76 |
$writer->startElement('item');
|
77 |
self::_createElementsFromArray($writer, $itemInArray);
|
78 |
$writer->endElement();
|
79 |
}
|
80 |
+
} else {
|
|
|
81 |
self::_createElementsFromArray($writer, $element);
|
82 |
}
|
83 |
} else {
|
87 |
$writer->writeAttribute($attribute[0], $attribute[1]);
|
88 |
$element = $attribute[2];
|
89 |
}
|
90 |
+
if (!is_null($element)) {
|
91 |
+
$writer->text($element);
|
92 |
+
} else {
|
93 |
+
$writer->text("");
|
94 |
+
}
|
95 |
}
|
96 |
$writer->endElement();
|
97 |
}
|
100 |
/**
|
101 |
* convert passed data into an array of attributeType, attributeName, and value
|
102 |
* dates sent as DateTime objects will be converted to strings
|
103 |
+
*
|
104 |
* @param mixed $value
|
105 |
+
*
|
106 |
* @return array attributes and element value
|
107 |
*/
|
108 |
private static function _generateXmlAttribute($value)
|
109 |
{
|
110 |
+
if ($value instanceof DateTime || is_a($value, 'DateTimeImmutable')) {
|
111 |
+
return ['type', 'datetime', self::_convertDateTimeObjectToXmlTimestamp($value)];
|
112 |
}
|
113 |
if (is_int($value)) {
|
114 |
return ['type', 'integer', $value];
|
116 |
if (is_bool($value)) {
|
117 |
return ['type', 'boolean', ($value ? 'true' : 'false')];
|
118 |
}
|
119 |
+
if ($value === null) {
|
120 |
return ['nil', 'true', $value];
|
121 |
}
|
122 |
}
|
123 |
/**
|
124 |
* converts datetime back to xml schema format
|
125 |
+
*
|
126 |
* @param object $dateTime
|
127 |
+
*
|
128 |
* @return string XML schema formatted timestamp
|
129 |
*/
|
130 |
+
private static function _convertDateTimeObjectToXmlTimestamp($dateTime)
|
131 |
{
|
132 |
+
if (is_a($dateTime, 'DateTimeImmutable')) {
|
133 |
+
$dateTimeForUTC = DateTime::createFromImmutable($dateTime);
|
134 |
+
} else {
|
135 |
+
$dateTimeForUTC = clone $dateTime;
|
136 |
+
}
|
137 |
|
138 |
$dateTimeForUTC->setTimeZone(new DateTimeZone('UTC'));
|
139 |
return ($dateTimeForUTC->format('Y-m-d\TH:i:s') . 'Z');
|
143 |
{
|
144 |
try {
|
145 |
if (empty($string)) {
|
146 |
+
return false;
|
147 |
}
|
148 |
$dateTime = new DateTime($string);
|
149 |
+
return self::_convertDateTimeObjectToXmlTimestamp($dateTime);
|
150 |
} catch (Exception $e) {
|
151 |
// not a datetime
|
152 |
return false;
|
153 |
}
|
154 |
}
|
155 |
}
|
|
vendor/braintree/braintree_php/lib/Braintree/Xml/Parser.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
namespace Braintree\Xml;
|
3 |
|
4 |
use DateTime;
|
@@ -16,7 +17,8 @@ class Parser
|
|
16 |
/**
|
17 |
* Converts an XML string into a multidimensional array
|
18 |
*
|
19 |
-
* @param string $xml
|
|
|
20 |
* @return array
|
21 |
*/
|
22 |
public static function arrayFromXml($xml)
|
@@ -35,6 +37,7 @@ class Parser
|
|
35 |
* Converts a node to an array of values or nodes
|
36 |
*
|
37 |
* @param DOMNode @node
|
|
|
38 |
* @return mixed
|
39 |
*/
|
40 |
private static function _nodeToArray($node)
|
@@ -44,40 +47,40 @@ class Parser
|
|
44 |
$type = $node->getAttribute('type');
|
45 |
}
|
46 |
|
47 |
-
switch($type) {
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
}
|
55 |
-
}
|
56 |
-
return $array;
|
57 |
-
case 'collection':
|
58 |
-
$collection = [];
|
59 |
-
foreach ($node->childNodes as $child) {
|
60 |
-
$value = self::_nodetoValue($child);
|
61 |
-
if ($value !== null) {
|
62 |
-
if (!isset($collection[$child->nodeName])) {
|
63 |
-
$collection[$child->nodeName] = [];
|
64 |
}
|
65 |
-
$collection[$child->nodeName][] = self::_nodeToValue($child);
|
66 |
}
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
$values = [];
|
71 |
-
if ($node->childNodes->length === 1 && $node->childNodes->item(0) instanceof DOMText) {
|
72 |
-
return $node->childNodes->item(0)->nodeValue;
|
73 |
-
} else {
|
74 |
foreach ($node->childNodes as $child) {
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
}
|
79 |
-
return $
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
}
|
83 |
|
@@ -85,6 +88,7 @@ class Parser
|
|
85 |
* Converts a node to a PHP value
|
86 |
*
|
87 |
* @param DOMNode $node
|
|
|
88 |
* @return mixed
|
89 |
*/
|
90 |
private static function _nodeToValue($node)
|
@@ -94,31 +98,31 @@ class Parser
|
|
94 |
$type = $node->getAttribute('type');
|
95 |
}
|
96 |
|
97 |
-
switch($type) {
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
return self::_nodeToArray($node);
|
114 |
-
default:
|
115 |
-
if ($node->hasChildNodes()) {
|
116 |
return self::_nodeToArray($node);
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
|
@@ -127,6 +131,7 @@ class Parser
|
|
127 |
* Converts XML timestamps into DateTime instances
|
128 |
*
|
129 |
* @param string $timestamp
|
|
|
130 |
* @return DateTime
|
131 |
*/
|
132 |
private static function _timestampToUTC($timestamp)
|
@@ -137,4 +142,3 @@ class Parser
|
|
137 |
return $dateTime;
|
138 |
}
|
139 |
}
|
140 |
-
class_alias('Braintree\Xml\Parser', 'Braintree_Xml_Parser');
|
1 |
<?php
|
2 |
+
|
3 |
namespace Braintree\Xml;
|
4 |
|
5 |
use DateTime;
|
17 |
/**
|
18 |
* Converts an XML string into a multidimensional array
|
19 |
*
|
20 |
+
* @param string $xml string to be parsed
|
21 |
+
*
|
22 |
* @return array
|
23 |
*/
|
24 |
public static function arrayFromXml($xml)
|
37 |
* Converts a node to an array of values or nodes
|
38 |
*
|
39 |
* @param DOMNode @node
|
40 |
+
*
|
41 |
* @return mixed
|
42 |
*/
|
43 |
private static function _nodeToArray($node)
|
47 |
$type = $node->getAttribute('type');
|
48 |
}
|
49 |
|
50 |
+
switch ($type) {
|
51 |
+
case 'array':
|
52 |
+
$array = [];
|
53 |
+
foreach ($node->childNodes as $child) {
|
54 |
+
$value = self::_nodeToValue($child);
|
55 |
+
if ($value !== null) {
|
56 |
+
$array[] = $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
|
|
58 |
}
|
59 |
+
return $array;
|
60 |
+
case 'collection':
|
61 |
+
$collection = [];
|
|
|
|
|
|
|
|
|
62 |
foreach ($node->childNodes as $child) {
|
63 |
+
$value = self::_nodetoValue($child);
|
64 |
+
if ($value !== null) {
|
65 |
+
if (!isset($collection[$child->nodeName])) {
|
66 |
+
$collection[$child->nodeName] = [];
|
67 |
+
}
|
68 |
+
$collection[$child->nodeName][] = self::_nodeToValue($child);
|
69 |
}
|
70 |
}
|
71 |
+
return $collection;
|
72 |
+
default:
|
73 |
+
$values = [];
|
74 |
+
if ($node->childNodes->length === 1 && $node->childNodes->item(0) instanceof DOMText) {
|
75 |
+
return $node->childNodes->item(0)->nodeValue;
|
76 |
+
} else {
|
77 |
+
foreach ($node->childNodes as $child) {
|
78 |
+
if (!$child instanceof DOMText) {
|
79 |
+
$values[$child->nodeName] = self::_nodeToValue($child);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return $values;
|
83 |
+
}
|
84 |
}
|
85 |
}
|
86 |
|
88 |
* Converts a node to a PHP value
|
89 |
*
|
90 |
* @param DOMNode $node
|
91 |
+
*
|
92 |
* @return mixed
|
93 |
*/
|
94 |
private static function _nodeToValue($node)
|
98 |
$type = $node->getAttribute('type');
|
99 |
}
|
100 |
|
101 |
+
switch ($type) {
|
102 |
+
case 'datetime':
|
103 |
+
return self::_timestampToUTC((string) $node->nodeValue);
|
104 |
+
case 'date':
|
105 |
+
return new DateTime((string) $node->nodeValue);
|
106 |
+
case 'integer':
|
107 |
+
return (int) $node->nodeValue;
|
108 |
+
case 'boolean':
|
109 |
+
$value = (string) $node->nodeValue;
|
110 |
+
if (is_numeric($value)) {
|
111 |
+
return (bool) $value;
|
112 |
+
} else {
|
113 |
+
return ($value !== "true") ? false : true;
|
114 |
+
}
|
115 |
+
case 'array':
|
116 |
+
case 'collection':
|
|
|
|
|
|
|
117 |
return self::_nodeToArray($node);
|
118 |
+
default:
|
119 |
+
if ($node->hasChildNodes()) {
|
120 |
+
return self::_nodeToArray($node);
|
121 |
+
} elseif (trim($node->nodeValue) === '') {
|
122 |
+
return null;
|
123 |
+
} else {
|
124 |
+
return $node->nodeValue;
|
125 |
+
}
|
126 |
}
|
127 |
}
|
128 |
|
131 |
* Converts XML timestamps into DateTime instances
|
132 |
*
|
133 |
* @param string $timestamp
|
134 |
+
*
|
135 |
* @return DateTime
|
136 |
*/
|
137 |
private static function _timestampToUTC($timestamp)
|
142 |
return $dateTime;
|
143 |
}
|
144 |
}
|
|
vendor/braintree/braintree_php/lib/autoload.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
spl_autoload_register(function ($className) {
|
4 |
if (strpos($className, 'Braintree') !== 0) {
|
@@ -19,3 +19,4 @@ spl_autoload_register(function ($className) {
|
|
19 |
require_once $fileName;
|
20 |
}
|
21 |
});
|
|
1 |
+
<?php // phpcs:disable Generic.Commenting PEAR.Commenting
|
2 |
|
3 |
spl_autoload_register(function ($className) {
|
4 |
if (strpos($className, 'Braintree') !== 0) {
|
19 |
require_once $fileName;
|
20 |
}
|
21 |
});
|
22 |
+
// phpcs:enable Generic.Commenting PEAR.Commenting
|
vendor/braintree/braintree_php/phpcs.xml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="MyRuleset">
|
3 |
+
<description>Coding standard based on internal Braintree coding practices.</description>
|
4 |
+
|
5 |
+
<!-- PSR-12 is the latest PHP published standard for code style.
|
6 |
+
This ruleset includes PSR1 & 2 -->
|
7 |
+
<rule ref="PSR12"/>
|
8 |
+
|
9 |
+
<!-- Exclude some rules -->
|
10 |
+
<!-- This rule pops up for Braintree.php and test files,
|
11 |
+
and aren't really that smelly for those instances -->
|
12 |
+
<rule ref="PSR1">
|
13 |
+
<exclude-pattern>tests/*</exclude-pattern>
|
14 |
+
<exclude name="PSR1.Files.SideEffects"/>
|
15 |
+
</rule>
|
16 |
+
|
17 |
+
<!-- Our tests use a syntax `methodname_doesAThingWeTest` so let's ignore -->
|
18 |
+
<rule ref="PSR1.Methods.CamelCapsMethodName">
|
19 |
+
<exclude-pattern>tests/*</exclude-pattern>
|
20 |
+
</rule>
|
21 |
+
|
22 |
+
<rule ref="Generic.Files.LineLength">
|
23 |
+
<exclude name="Generic.Files.LineLength.TooLong"/>
|
24 |
+
</rule>
|
25 |
+
|
26 |
+
<!-- We mark internal properties and methods with `_`
|
27 |
+
so let's ignore these two rules to save ignore comment lines -->
|
28 |
+
<rule ref="PSR2.Classes.PropertyDeclaration">
|
29 |
+
<exclude name="PSR2.Classes.PropertyDeclaration"/>
|
30 |
+
</rule>
|
31 |
+
|
32 |
+
<rule ref="PSR2.Methods.MethodDeclaration">
|
33 |
+
<exclude name="PSR2.Methods.MethodDeclaration"/>
|
34 |
+
</rule>
|
35 |
+
|
36 |
+
<!-- NEXT_MAJOR_VERSION remove this rule and add visibility modifiers,
|
37 |
+
https://www.php.net/manual/en/language.oop5.constants.php -->
|
38 |
+
<rule ref="PSR12.Properties.ConstantVisibility">
|
39 |
+
<exclude name="PSR12.Properties.ConstantVisibility"/>
|
40 |
+
</rule>
|
41 |
+
|
42 |
+
<!-- scan for missing phpDoc -->
|
43 |
+
<rule ref="Generic.Commenting">
|
44 |
+
<exclude-pattern>tests/*</exclude-pattern>
|
45 |
+
<exclude-pattern>lib/Braintree/Test/*</exclude-pattern>
|
46 |
+
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
|
47 |
+
<exclude name="Generic.Commenting.DocComment.LongNotCapital"/>
|
48 |
+
</rule>
|
49 |
+
|
50 |
+
<!-- NEXT_MAJOR_VERSION there are a number of public functions that are marked to ignore the rule
|
51 |
+
PEAR.Commenting.FunctionComment.Missing in their class files. This is because they're public functions
|
52 |
+
that aren't meant to be used by merchants as standalone functions. -->
|
53 |
+
<rule ref="PEAR.Commenting">
|
54 |
+
<properties>
|
55 |
+
<property name="minimumVisibility" value="public" />
|
56 |
+
</properties>
|
57 |
+
<exclude-pattern>tests/*</exclude-pattern>
|
58 |
+
<exclude-pattern>lib/Braintree/Test/*</exclude-pattern>
|
59 |
+
<exclude name="PEAR.Commenting.FileComment.Missing"/>
|
60 |
+
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/>
|
61 |
+
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/>
|
62 |
+
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/>
|
63 |
+
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag"/>
|
64 |
+
<exclude name="PEAR.Commenting.ClassComment.CategoryTagOrder"/>
|
65 |
+
<exclude name="PEAR.Commenting.ClassComment.PackageTagOrder"/>
|
66 |
+
<exclude name="PEAR.Commenting.ClassComment.MissingPackageTag"/>
|
67 |
+
<exclude name="PEAR.Commenting.FunctionComment.WrongStyle"/>
|
68 |
+
<exclude name="PEAR.Commenting.FileComment.WrongStyle"/>
|
69 |
+
</rule>
|
70 |
+
</ruleset>
|
vendor/braintree/braintree_php/phpunit.xml.dist
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<phpunit backupGlobals="false"
|
3 |
-
backupStaticAttributes="false"
|
4 |
-
bootstrap="./vendor/autoload.php"
|
5 |
-
convertErrorsToExceptions="true"
|
6 |
-
convertNoticesToExceptions="true"
|
7 |
-
convertWarningsToExceptions="true"
|
8 |
-
processIsolation="false"
|
9 |
-
stopOnFailure="false"
|
10 |
-
syntaxCheck="false">
|
11 |
-
|
12 |
-
<php>
|
13 |
-
<ini name="error_reporting" value="32767"/>
|
14 |
-
</php>
|
15 |
-
|
16 |
-
<testsuites>
|
17 |
-
<testsuite name="unit">
|
18 |
-
<directory>./tests/unit</directory>
|
19 |
-
</testsuite>
|
20 |
-
<testsuite name="integration">
|
21 |
-
<directory>./tests/integration</directory>
|
22 |
-
</testsuite>
|
23 |
-
</testsuites>
|
24 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/ClassLoader.php
CHANGED
@@ -42,30 +42,75 @@ namespace Composer\Autoload;
|
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
|
|
45 |
private $vendorDir;
|
46 |
|
47 |
// PSR-4
|
|
|
|
|
|
|
|
|
48 |
private $prefixLengthsPsr4 = array();
|
|
|
|
|
|
|
|
|
49 |
private $prefixDirsPsr4 = array();
|
|
|
|
|
|
|
|
|
50 |
private $fallbackDirsPsr4 = array();
|
51 |
|
52 |
// PSR-0
|
|
|
|
|
|
|
|
|
53 |
private $prefixesPsr0 = array();
|
|
|
|
|
|
|
|
|
54 |
private $fallbackDirsPsr0 = array();
|
55 |
|
|
|
56 |
private $useIncludePath = false;
|
|
|
|
|
|
|
|
|
|
|
57 |
private $classMap = array();
|
|
|
|
|
58 |
private $classMapAuthoritative = false;
|
|
|
|
|
|
|
|
|
|
|
59 |
private $missingClasses = array();
|
|
|
|
|
60 |
private $apcuPrefix;
|
61 |
|
|
|
|
|
|
|
62 |
private static $registeredLoaders = array();
|
63 |
|
|
|
|
|
|
|
64 |
public function __construct($vendorDir = null)
|
65 |
{
|
66 |
$this->vendorDir = $vendorDir;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
69 |
public function getPrefixes()
|
70 |
{
|
71 |
if (!empty($this->prefixesPsr0)) {
|
@@ -75,28 +120,47 @@ class ClassLoader
|
|
75 |
return array();
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
78 |
public function getPrefixesPsr4()
|
79 |
{
|
80 |
return $this->prefixDirsPsr4;
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
83 |
public function getFallbackDirs()
|
84 |
{
|
85 |
return $this->fallbackDirsPsr0;
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
88 |
public function getFallbackDirsPsr4()
|
89 |
{
|
90 |
return $this->fallbackDirsPsr4;
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
93 |
public function getClassMap()
|
94 |
{
|
95 |
return $this->classMap;
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
-
* @param
|
|
|
|
|
|
|
100 |
*/
|
101 |
public function addClassMap(array $classMap)
|
102 |
{
|
@@ -111,9 +175,11 @@ class ClassLoader
|
|
111 |
* Registers a set of PSR-0 directories for a given prefix, either
|
112 |
* appending or prepending to the ones previously set for this prefix.
|
113 |
*
|
114 |
-
* @param string
|
115 |
-
* @param
|
116 |
-
* @param bool
|
|
|
|
|
117 |
*/
|
118 |
public function add($prefix, $paths, $prepend = false)
|
119 |
{
|
@@ -156,11 +222,13 @@ class ClassLoader
|
|
156 |
* Registers a set of PSR-4 directories for a given namespace, either
|
157 |
* appending or prepending to the ones previously set for this namespace.
|
158 |
*
|
159 |
-
* @param string
|
160 |
-
* @param
|
161 |
-
* @param bool
|
162 |
*
|
163 |
* @throws \InvalidArgumentException
|
|
|
|
|
164 |
*/
|
165 |
public function addPsr4($prefix, $paths, $prepend = false)
|
166 |
{
|
@@ -204,8 +272,10 @@ class ClassLoader
|
|
204 |
* Registers a set of PSR-0 directories for a given prefix,
|
205 |
* replacing any others previously set for this prefix.
|
206 |
*
|
207 |
-
* @param string
|
208 |
-
* @param
|
|
|
|
|
209 |
*/
|
210 |
public function set($prefix, $paths)
|
211 |
{
|
@@ -220,10 +290,12 @@ class ClassLoader
|
|
220 |
* Registers a set of PSR-4 directories for a given namespace,
|
221 |
* replacing any others previously set for this namespace.
|
222 |
*
|
223 |
-
* @param string
|
224 |
-
* @param
|
225 |
*
|
226 |
* @throws \InvalidArgumentException
|
|
|
|
|
227 |
*/
|
228 |
public function setPsr4($prefix, $paths)
|
229 |
{
|
@@ -243,6 +315,8 @@ class ClassLoader
|
|
243 |
* Turns on searching the include path for class files.
|
244 |
*
|
245 |
* @param bool $useIncludePath
|
|
|
|
|
246 |
*/
|
247 |
public function setUseIncludePath($useIncludePath)
|
248 |
{
|
@@ -265,6 +339,8 @@ class ClassLoader
|
|
265 |
* that have not been registered with the class map.
|
266 |
*
|
267 |
* @param bool $classMapAuthoritative
|
|
|
|
|
268 |
*/
|
269 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
270 |
{
|
@@ -285,6 +361,8 @@ class ClassLoader
|
|
285 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
286 |
*
|
287 |
* @param string|null $apcuPrefix
|
|
|
|
|
288 |
*/
|
289 |
public function setApcuPrefix($apcuPrefix)
|
290 |
{
|
@@ -305,6 +383,8 @@ class ClassLoader
|
|
305 |
* Registers this instance as an autoloader.
|
306 |
*
|
307 |
* @param bool $prepend Whether to prepend the autoloader or not
|
|
|
|
|
308 |
*/
|
309 |
public function register($prepend = false)
|
310 |
{
|
@@ -324,6 +404,8 @@ class ClassLoader
|
|
324 |
|
325 |
/**
|
326 |
* Unregisters this instance as an autoloader.
|
|
|
|
|
327 |
*/
|
328 |
public function unregister()
|
329 |
{
|
@@ -403,6 +485,11 @@ class ClassLoader
|
|
403 |
return self::$registeredLoaders;
|
404 |
}
|
405 |
|
|
|
|
|
|
|
|
|
|
|
406 |
private function findFileWithExtension($class, $ext)
|
407 |
{
|
408 |
// PSR-4 lookup
|
@@ -474,6 +561,10 @@ class ClassLoader
|
|
474 |
* Scope isolated include.
|
475 |
*
|
476 |
* Prevents access to $this/self from included files.
|
|
|
|
|
|
|
|
|
477 |
*/
|
478 |
function includeFile($file)
|
479 |
{
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
45 |
+
/** @var ?string */
|
46 |
private $vendorDir;
|
47 |
|
48 |
// PSR-4
|
49 |
+
/**
|
50 |
+
* @var array[]
|
51 |
+
* @psalm-var array<string, array<string, int>>
|
52 |
+
*/
|
53 |
private $prefixLengthsPsr4 = array();
|
54 |
+
/**
|
55 |
+
* @var array[]
|
56 |
+
* @psalm-var array<string, array<int, string>>
|
57 |
+
*/
|
58 |
private $prefixDirsPsr4 = array();
|
59 |
+
/**
|
60 |
+
* @var array[]
|
61 |
+
* @psalm-var array<string, string>
|
62 |
+
*/
|
63 |
private $fallbackDirsPsr4 = array();
|
64 |
|
65 |
// PSR-0
|
66 |
+
/**
|
67 |
+
* @var array[]
|
68 |
+
* @psalm-var array<string, array<string, string[]>>
|
69 |
+
*/
|
70 |
private $prefixesPsr0 = array();
|
71 |
+
/**
|
72 |
+
* @var array[]
|
73 |
+
* @psalm-var array<string, string>
|
74 |
+
*/
|
75 |
private $fallbackDirsPsr0 = array();
|
76 |
|
77 |
+
/** @var bool */
|
78 |
private $useIncludePath = false;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @var string[]
|
82 |
+
* @psalm-var array<string, string>
|
83 |
+
*/
|
84 |
private $classMap = array();
|
85 |
+
|
86 |
+
/** @var bool */
|
87 |
private $classMapAuthoritative = false;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @var bool[]
|
91 |
+
* @psalm-var array<string, bool>
|
92 |
+
*/
|
93 |
private $missingClasses = array();
|
94 |
+
|
95 |
+
/** @var ?string */
|
96 |
private $apcuPrefix;
|
97 |
|
98 |
+
/**
|
99 |
+
* @var self[]
|
100 |
+
*/
|
101 |
private static $registeredLoaders = array();
|
102 |
|
103 |
+
/**
|
104 |
+
* @param ?string $vendorDir
|
105 |
+
*/
|
106 |
public function __construct($vendorDir = null)
|
107 |
{
|
108 |
$this->vendorDir = $vendorDir;
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* @return string[]
|
113 |
+
*/
|
114 |
public function getPrefixes()
|
115 |
{
|
116 |
if (!empty($this->prefixesPsr0)) {
|
120 |
return array();
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* @return array[]
|
125 |
+
* @psalm-return array<string, array<int, string>>
|
126 |
+
*/
|
127 |
public function getPrefixesPsr4()
|
128 |
{
|
129 |
return $this->prefixDirsPsr4;
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* @return array[]
|
134 |
+
* @psalm-return array<string, string>
|
135 |
+
*/
|
136 |
public function getFallbackDirs()
|
137 |
{
|
138 |
return $this->fallbackDirsPsr0;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @return array[]
|
143 |
+
* @psalm-return array<string, string>
|
144 |
+
*/
|
145 |
public function getFallbackDirsPsr4()
|
146 |
{
|
147 |
return $this->fallbackDirsPsr4;
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* @return string[] Array of classname => path
|
152 |
+
* @psalm-return array<string, string>
|
153 |
+
*/
|
154 |
public function getClassMap()
|
155 |
{
|
156 |
return $this->classMap;
|
157 |
}
|
158 |
|
159 |
/**
|
160 |
+
* @param string[] $classMap Class to filename map
|
161 |
+
* @psalm-param array<string, string> $classMap
|
162 |
+
*
|
163 |
+
* @return void
|
164 |
*/
|
165 |
public function addClassMap(array $classMap)
|
166 |
{
|
175 |
* Registers a set of PSR-0 directories for a given prefix, either
|
176 |
* appending or prepending to the ones previously set for this prefix.
|
177 |
*
|
178 |
+
* @param string $prefix The prefix
|
179 |
+
* @param string[]|string $paths The PSR-0 root directories
|
180 |
+
* @param bool $prepend Whether to prepend the directories
|
181 |
+
*
|
182 |
+
* @return void
|
183 |
*/
|
184 |
public function add($prefix, $paths, $prepend = false)
|
185 |
{
|
222 |
* Registers a set of PSR-4 directories for a given namespace, either
|
223 |
* appending or prepending to the ones previously set for this namespace.
|
224 |
*
|
225 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
226 |
+
* @param string[]|string $paths The PSR-4 base directories
|
227 |
+
* @param bool $prepend Whether to prepend the directories
|
228 |
*
|
229 |
* @throws \InvalidArgumentException
|
230 |
+
*
|
231 |
+
* @return void
|
232 |
*/
|
233 |
public function addPsr4($prefix, $paths, $prepend = false)
|
234 |
{
|
272 |
* Registers a set of PSR-0 directories for a given prefix,
|
273 |
* replacing any others previously set for this prefix.
|
274 |
*
|
275 |
+
* @param string $prefix The prefix
|
276 |
+
* @param string[]|string $paths The PSR-0 base directories
|
277 |
+
*
|
278 |
+
* @return void
|
279 |
*/
|
280 |
public function set($prefix, $paths)
|
281 |
{
|
290 |
* Registers a set of PSR-4 directories for a given namespace,
|
291 |
* replacing any others previously set for this namespace.
|
292 |
*
|
293 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
294 |
+
* @param string[]|string $paths The PSR-4 base directories
|
295 |
*
|
296 |
* @throws \InvalidArgumentException
|
297 |
+
*
|
298 |
+
* @return void
|
299 |
*/
|
300 |
public function setPsr4($prefix, $paths)
|
301 |
{
|
315 |
* Turns on searching the include path for class files.
|
316 |
*
|
317 |
* @param bool $useIncludePath
|
318 |
+
*
|
319 |
+
* @return void
|
320 |
*/
|
321 |
public function setUseIncludePath($useIncludePath)
|
322 |
{
|
339 |
* that have not been registered with the class map.
|
340 |
*
|
341 |
* @param bool $classMapAuthoritative
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
*/
|
345 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
346 |
{
|
361 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
362 |
*
|
363 |
* @param string|null $apcuPrefix
|
364 |
+
*
|
365 |
+
* @return void
|
366 |
*/
|
367 |
public function setApcuPrefix($apcuPrefix)
|
368 |
{
|
383 |
* Registers this instance as an autoloader.
|
384 |
*
|
385 |
* @param bool $prepend Whether to prepend the autoloader or not
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
*/
|
389 |
public function register($prepend = false)
|
390 |
{
|
404 |
|
405 |
/**
|
406 |
* Unregisters this instance as an autoloader.
|
407 |
+
*
|
408 |
+
* @return void
|
409 |
*/
|
410 |
public function unregister()
|
411 |
{
|
485 |
return self::$registeredLoaders;
|
486 |
}
|
487 |
|
488 |
+
/**
|
489 |
+
* @param string $class
|
490 |
+
* @param string $ext
|
491 |
+
* @return string|false
|
492 |
+
*/
|
493 |
private function findFileWithExtension($class, $ext)
|
494 |
{
|
495 |
// PSR-4 lookup
|
561 |
* Scope isolated include.
|
562 |
*
|
563 |
* Prevents access to $this/self from included files.
|
564 |
+
*
|
565 |
+
* @param string $file
|
566 |
+
* @return void
|
567 |
+
* @private
|
568 |
*/
|
569 |
function includeFile($file)
|
570 |
{
|
vendor/composer/InstalledVersions.php
CHANGED
@@ -20,12 +20,27 @@ use Composer\Semver\VersionParser;
|
|
20 |
*
|
21 |
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
*
|
23 |
-
* To require
|
|
|
|
|
24 |
*/
|
25 |
class InstalledVersions
|
26 |
{
|
|
|
|
|
|
|
|
|
27 |
private static $installed;
|
|
|
|
|
|
|
|
|
28 |
private static $canGetVendors;
|
|
|
|
|
|
|
|
|
|
|
29 |
private static $installedByVendor = array();
|
30 |
|
31 |
/**
|
@@ -228,7 +243,7 @@ class InstalledVersions
|
|
228 |
|
229 |
/**
|
230 |
* @return array
|
231 |
-
* @psalm-return array{name: string, version: string, reference: string,
|
232 |
*/
|
233 |
public static function getRootPackage()
|
234 |
{
|
@@ -242,7 +257,7 @@ class InstalledVersions
|
|
242 |
*
|
243 |
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
244 |
* @return array[]
|
245 |
-
* @psalm-return array{root: array{name: string, version: string, reference: string,
|
246 |
*/
|
247 |
public static function getRawData()
|
248 |
{
|
@@ -265,7 +280,7 @@ class InstalledVersions
|
|
265 |
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
266 |
*
|
267 |
* @return array[]
|
268 |
-
* @psalm-return list<array{root: array{name: string, version: string, reference: string,
|
269 |
*/
|
270 |
public static function getAllRawData()
|
271 |
{
|
@@ -288,7 +303,7 @@ class InstalledVersions
|
|
288 |
* @param array[] $data A vendor/composer/installed.php data set
|
289 |
* @return void
|
290 |
*
|
291 |
-
* @psalm-param array{root: array{name: string, version: string, reference: string,
|
292 |
*/
|
293 |
public static function reload($data)
|
294 |
{
|
@@ -298,7 +313,7 @@ class InstalledVersions
|
|
298 |
|
299 |
/**
|
300 |
* @return array[]
|
301 |
-
* @psalm-return list<array{root: array{name: string, version: string, reference: string,
|
302 |
*/
|
303 |
private static function getInstalled()
|
304 |
{
|
20 |
*
|
21 |
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
*
|
23 |
+
* To require its presence, you can require `composer-runtime-api ^2.0`
|
24 |
+
*
|
25 |
+
* @final
|
26 |
*/
|
27 |
class InstalledVersions
|
28 |
{
|
29 |
+
/**
|
30 |
+
* @var mixed[]|null
|
31 |
+
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
32 |
+
*/
|
33 |
private static $installed;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var bool|null
|
37 |
+
*/
|
38 |
private static $canGetVendors;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @var array[]
|
42 |
+
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
43 |
+
*/
|
44 |
private static $installedByVendor = array();
|
45 |
|
46 |
/**
|
243 |
|
244 |
/**
|
245 |
* @return array
|
246 |
+
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
247 |
*/
|
248 |
public static function getRootPackage()
|
249 |
{
|
257 |
*
|
258 |
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
259 |
* @return array[]
|
260 |
+
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
261 |
*/
|
262 |
public static function getRawData()
|
263 |
{
|
280 |
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
281 |
*
|
282 |
* @return array[]
|
283 |
+
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
284 |
*/
|
285 |
public static function getAllRawData()
|
286 |
{
|
303 |
* @param array[] $data A vendor/composer/installed.php data set
|
304 |
* @return void
|
305 |
*
|
306 |
+
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
307 |
*/
|
308 |
public static function reload($data)
|
309 |
{
|
313 |
|
314 |
/**
|
315 |
* @return array[]
|
316 |
+
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
317 |
*/
|
318 |
private static function getInstalled()
|
319 |
{
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_classmap.php @generated by Composer
|
4 |
|
5 |
-
$vendorDir = dirname(
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
2 |
|
3 |
// autoload_classmap.php @generated by Composer
|
4 |
|
5 |
+
$vendorDir = dirname(__DIR__);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
vendor/composer/autoload_namespaces.php
CHANGED
@@ -2,9 +2,8 @@
|
|
2 |
|
3 |
// autoload_namespaces.php @generated by Composer
|
4 |
|
5 |
-
$vendorDir = dirname(
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'Braintree' => array($vendorDir . '/braintree/braintree_php/lib'),
|
10 |
);
|
2 |
|
3 |
// autoload_namespaces.php @generated by Composer
|
4 |
|
5 |
+
$vendorDir = dirname(__DIR__);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
);
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_psr4.php @generated by Composer
|
4 |
|
5 |
-
$vendorDir = dirname(
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
2 |
|
3 |
// autoload_psr4.php @generated by Composer
|
4 |
|
5 |
+
$vendorDir = dirname(__DIR__);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -24,31 +24,12 @@ class ComposerAutoloaderInit0f0e14966061cbbec2a3562cf88406be
|
|
24 |
|
25 |
require __DIR__ . '/platform_check.php';
|
26 |
|
27 |
-
spl_autoload_register(array('
|
28 |
-
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(
|
29 |
-
spl_autoload_unregister(array('
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
require __DIR__ . '/autoload_static.php';
|
34 |
-
|
35 |
-
call_user_func(\Composer\Autoload\ComposerStaticInit0f0e14966061cbbec2a3562cf88406be::getInitializer($loader));
|
36 |
-
} else {
|
37 |
-
$map = require __DIR__ . '/autoload_namespaces.php';
|
38 |
-
foreach ($map as $namespace => $path) {
|
39 |
-
$loader->set($namespace, $path);
|
40 |
-
}
|
41 |
-
|
42 |
-
$map = require __DIR__ . '/autoload_psr4.php';
|
43 |
-
foreach ($map as $namespace => $path) {
|
44 |
-
$loader->setPsr4($namespace, $path);
|
45 |
-
}
|
46 |
-
|
47 |
-
$classMap = require __DIR__ . '/autoload_classmap.php';
|
48 |
-
if ($classMap) {
|
49 |
-
$loader->addClassMap($classMap);
|
50 |
-
}
|
51 |
-
}
|
52 |
|
53 |
$loader->register(true);
|
54 |
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit6493576a93c8a5819bd1c57c1ca2bae7
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
24 |
|
25 |
require __DIR__ . '/platform_check.php';
|
26 |
|
27 |
+
spl_autoload_register(array('ComposerAutoloaderInit6493576a93c8a5819bd1c57c1ca2bae7', 'loadClassLoader'), true, true);
|
28 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
29 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit6493576a93c8a5819bd1c57c1ca2bae7', 'loadClassLoader'));
|
30 |
+
|
31 |
+
require __DIR__ . '/autoload_static.php';
|
32 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit6493576a93c8a5819bd1c57c1ca2bae7::getInitializer($loader));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
$loader->register(true);
|
35 |
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'B' =>
|
@@ -20,16 +20,6 @@ class ComposerStaticInit0f0e14966061cbbec2a3562cf88406be
|
|
20 |
),
|
21 |
);
|
22 |
|
23 |
-
public static $prefixesPsr0 = array (
|
24 |
-
'B' =>
|
25 |
-
array (
|
26 |
-
'Braintree' =>
|
27 |
-
array (
|
28 |
-
0 => __DIR__ . '/..' . '/braintree/braintree_php/lib',
|
29 |
-
),
|
30 |
-
),
|
31 |
-
);
|
32 |
-
|
33 |
public static $classMap = array (
|
34 |
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
35 |
);
|
@@ -37,10 +27,9 @@ class ComposerStaticInit0f0e14966061cbbec2a3562cf88406be
|
|
37 |
public static function getInitializer(ClassLoader $loader)
|
38 |
{
|
39 |
return \Closure::bind(function () use ($loader) {
|
40 |
-
$loader->prefixLengthsPsr4 =
|
41 |
-
$loader->prefixDirsPsr4 =
|
42 |
-
$loader->
|
43 |
-
$loader->classMap = ComposerStaticInit0f0e14966061cbbec2a3562cf88406be::$classMap;
|
44 |
|
45 |
}, null, ClassLoader::class);
|
46 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit6493576a93c8a5819bd1c57c1ca2bae7
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'B' =>
|
20 |
),
|
21 |
);
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
public static $classMap = array (
|
24 |
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
25 |
);
|
27 |
public static function getInitializer(ClassLoader $loader)
|
28 |
{
|
29 |
return \Closure::bind(function () use ($loader) {
|
30 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit6493576a93c8a5819bd1c57c1ca2bae7::$prefixLengthsPsr4;
|
31 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit6493576a93c8a5819bd1c57c1ca2bae7::$prefixDirsPsr4;
|
32 |
+
$loader->classMap = ComposerStaticInit6493576a93c8a5819bd1c57c1ca2bae7::$classMap;
|
|
|
33 |
|
34 |
}, null, ClassLoader::class);
|
35 |
}
|
vendor/composer/installed.json
CHANGED
@@ -2,17 +2,17 @@
|
|
2 |
"packages": [
|
3 |
{
|
4 |
"name": "braintree/braintree_php",
|
5 |
-
"version": "
|
6 |
-
"version_normalized": "
|
7 |
"source": {
|
8 |
"type": "git",
|
9 |
"url": "https://github.com/braintree/braintree_php.git",
|
10 |
-
"reference": "
|
11 |
},
|
12 |
"dist": {
|
13 |
"type": "zip",
|
14 |
-
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/
|
15 |
-
"reference": "
|
16 |
"shasum": ""
|
17 |
},
|
18 |
"require": {
|
@@ -21,18 +21,16 @@
|
|
21 |
"ext-hash": "*",
|
22 |
"ext-openssl": "*",
|
23 |
"ext-xmlwriter": "*",
|
24 |
-
"php": ">=
|
25 |
},
|
26 |
"require-dev": {
|
27 |
-
"phpunit/phpunit": "
|
|
|
28 |
},
|
29 |
-
"time": "
|
30 |
"type": "library",
|
31 |
"installation-source": "dist",
|
32 |
"autoload": {
|
33 |
-
"psr-0": {
|
34 |
-
"Braintree": "lib/"
|
35 |
-
},
|
36 |
"psr-4": {
|
37 |
"Braintree\\": "lib/Braintree"
|
38 |
}
|
@@ -50,7 +48,7 @@
|
|
50 |
"description": "Braintree PHP Client Library",
|
51 |
"support": {
|
52 |
"issues": "https://github.com/braintree/braintree_php/issues",
|
53 |
-
"source": "https://github.com/braintree/braintree_php/tree/
|
54 |
},
|
55 |
"install-path": "../braintree/braintree_php"
|
56 |
},
|
@@ -79,10 +77,11 @@
|
|
79 |
"time": "2022-01-14T03:01:10+00:00",
|
80 |
"type": "library",
|
81 |
"installation-source": "dist",
|
|
|
82 |
"description": "The official SkyVerge WooCommerce plugin framework",
|
83 |
"support": {
|
84 |
-
"
|
85 |
-
"
|
86 |
},
|
87 |
"install-path": "../skyverge/wc-plugin-framework"
|
88 |
}
|
2 |
"packages": [
|
3 |
{
|
4 |
"name": "braintree/braintree_php",
|
5 |
+
"version": "6.7.0",
|
6 |
+
"version_normalized": "6.7.0.0",
|
7 |
"source": {
|
8 |
"type": "git",
|
9 |
"url": "https://github.com/braintree/braintree_php.git",
|
10 |
+
"reference": "3406aa331c3eb5ac38aecb135389897dd50f35a1"
|
11 |
},
|
12 |
"dist": {
|
13 |
"type": "zip",
|
14 |
+
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/3406aa331c3eb5ac38aecb135389897dd50f35a1",
|
15 |
+
"reference": "3406aa331c3eb5ac38aecb135389897dd50f35a1",
|
16 |
"shasum": ""
|
17 |
},
|
18 |
"require": {
|
21 |
"ext-hash": "*",
|
22 |
"ext-openssl": "*",
|
23 |
"ext-xmlwriter": "*",
|
24 |
+
"php": ">=7.3.0"
|
25 |
},
|
26 |
"require-dev": {
|
27 |
+
"phpunit/phpunit": "^9.0",
|
28 |
+
"squizlabs/php_codesniffer": "^3.0"
|
29 |
},
|
30 |
+
"time": "2022-02-23T22:28:07+00:00",
|
31 |
"type": "library",
|
32 |
"installation-source": "dist",
|
33 |
"autoload": {
|
|
|
|
|
|
|
34 |
"psr-4": {
|
35 |
"Braintree\\": "lib/Braintree"
|
36 |
}
|
48 |
"description": "Braintree PHP Client Library",
|
49 |
"support": {
|
50 |
"issues": "https://github.com/braintree/braintree_php/issues",
|
51 |
+
"source": "https://github.com/braintree/braintree_php/tree/6.7.0"
|
52 |
},
|
53 |
"install-path": "../braintree/braintree_php"
|
54 |
},
|
77 |
"time": "2022-01-14T03:01:10+00:00",
|
78 |
"type": "library",
|
79 |
"installation-source": "dist",
|
80 |
+
"notification-url": "https://packagist.org/downloads/",
|
81 |
"description": "The official SkyVerge WooCommerce plugin framework",
|
82 |
"support": {
|
83 |
+
"issues": "https://github.com/skyverge/wc-plugin-framework/issues",
|
84 |
+
"source": "https://github.com/skyverge/wc-plugin-framework/tree/5.10.12"
|
85 |
},
|
86 |
"install-path": "../skyverge/wc-plugin-framework"
|
87 |
}
|
vendor/composer/installed.php
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
<?php return array(
|
2 |
'root' => array(
|
|
|
3 |
'pretty_version' => 'dev-trunk',
|
4 |
'version' => 'dev-trunk',
|
|
|
5 |
'type' => 'library',
|
6 |
'install_path' => __DIR__ . '/../../',
|
7 |
'aliases' => array(),
|
8 |
-
'reference' => '14d2862855ad4cc59e23b9c2ccbf41fec0dd6d0e',
|
9 |
-
'name' => '__root__',
|
10 |
'dev' => false,
|
11 |
),
|
12 |
'versions' => array(
|
13 |
'__root__' => array(
|
14 |
'pretty_version' => 'dev-trunk',
|
15 |
'version' => 'dev-trunk',
|
|
|
16 |
'type' => 'library',
|
17 |
'install_path' => __DIR__ . '/../../',
|
18 |
'aliases' => array(),
|
19 |
-
'reference' => '14d2862855ad4cc59e23b9c2ccbf41fec0dd6d0e',
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'braintree/braintree_php' => array(
|
23 |
-
'pretty_version' => '
|
24 |
-
'version' => '
|
|
|
25 |
'type' => 'library',
|
26 |
'install_path' => __DIR__ . '/../braintree/braintree_php',
|
27 |
'aliases' => array(),
|
28 |
-
'reference' => 'fd55c466d0d0088c67705d7ba0b3876d9767bfda',
|
29 |
'dev_requirement' => false,
|
30 |
),
|
31 |
'skyverge/wc-plugin-framework' => array(
|
32 |
'pretty_version' => '5.10.12',
|
33 |
'version' => '5.10.12.0',
|
|
|
34 |
'type' => 'library',
|
35 |
'install_path' => __DIR__ . '/../skyverge/wc-plugin-framework',
|
36 |
'aliases' => array(),
|
37 |
-
'reference' => '0c79b5799955c59e644caf1da222c20c982eba06',
|
38 |
'dev_requirement' => false,
|
39 |
),
|
40 |
),
|
1 |
<?php return array(
|
2 |
'root' => array(
|
3 |
+
'name' => '__root__',
|
4 |
'pretty_version' => 'dev-trunk',
|
5 |
'version' => 'dev-trunk',
|
6 |
+
'reference' => '287fa0d3deb5b36708b38c313eec6beda488a20e',
|
7 |
'type' => 'library',
|
8 |
'install_path' => __DIR__ . '/../../',
|
9 |
'aliases' => array(),
|
|
|
|
|
10 |
'dev' => false,
|
11 |
),
|
12 |
'versions' => array(
|
13 |
'__root__' => array(
|
14 |
'pretty_version' => 'dev-trunk',
|
15 |
'version' => 'dev-trunk',
|
16 |
+
'reference' => '287fa0d3deb5b36708b38c313eec6beda488a20e',
|
17 |
'type' => 'library',
|
18 |
'install_path' => __DIR__ . '/../../',
|
19 |
'aliases' => array(),
|
|
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'braintree/braintree_php' => array(
|
23 |
+
'pretty_version' => '6.7.0',
|
24 |
+
'version' => '6.7.0.0',
|
25 |
+
'reference' => '3406aa331c3eb5ac38aecb135389897dd50f35a1',
|
26 |
'type' => 'library',
|
27 |
'install_path' => __DIR__ . '/../braintree/braintree_php',
|
28 |
'aliases' => array(),
|
|
|
29 |
'dev_requirement' => false,
|
30 |
),
|
31 |
'skyverge/wc-plugin-framework' => array(
|
32 |
'pretty_version' => '5.10.12',
|
33 |
'version' => '5.10.12.0',
|
34 |
+
'reference' => '0c79b5799955c59e644caf1da222c20c982eba06',
|
35 |
'type' => 'library',
|
36 |
'install_path' => __DIR__ . '/../skyverge/wc-plugin-framework',
|
37 |
'aliases' => array(),
|
|
|
38 |
'dev_requirement' => false,
|
39 |
),
|
40 |
),
|
vendor/composer/platform_check.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
|
5 |
$issues = array();
|
6 |
|
7 |
-
if (!(PHP_VERSION_ID >=
|
8 |
-
$issues[] = 'Your Composer dependencies require a PHP version ">=
|
9 |
}
|
10 |
|
11 |
if ($issues) {
|
4 |
|
5 |
$issues = array();
|
6 |
|
7 |
+
if (!(PHP_VERSION_ID >= 70300)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
|
9 |
}
|
10 |
|
11 |
if ($issues) {
|
woocommerce-gateway-paypal-powered-by-braintree.php
CHANGED
@@ -3,16 +3,18 @@
|
|
3 |
* Plugin Name: Braintree for WooCommerce Payment Gateway
|
4 |
* Plugin URI: https://docs.woocommerce.com/document/woocommerce-gateway-paypal-powered-by-braintree/
|
5 |
* Documentation URI: https://docs.woocommerce.com/document/woocommerce-gateway-paypal-powered-by-braintree/
|
6 |
-
* Description: Receive credit card or PayPal payments using Braintree for WooCommerce. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: http://woocommerce.com/
|
9 |
-
* Version: 2.
|
10 |
* Text Domain: woocommerce-gateway-paypal-powered-by-braintree
|
11 |
* Domain Path: /i18n/languages/
|
12 |
*
|
|
|
13 |
* Tested up to: 6.0
|
14 |
-
*
|
15 |
-
* WC
|
|
|
16 |
*
|
17 |
* Copyright (c) 2016-2020, Automattic, Inc.
|
18 |
*
|
@@ -35,7 +37,7 @@ defined( 'ABSPATH' ) or exit;
|
|
35 |
/**
|
36 |
* Required minimums
|
37 |
*/
|
38 |
-
define( 'WC_PAYPAL_BRAINTREE_MIN_PHP_VER', '
|
39 |
|
40 |
/**
|
41 |
* Base plugin file
|
@@ -51,13 +53,13 @@ class WC_PayPal_Braintree_Loader {
|
|
51 |
|
52 |
|
53 |
/** minimum PHP version required by this plugin */
|
54 |
-
const MINIMUM_PHP_VERSION = '7.
|
55 |
|
56 |
/** minimum WordPress version required by this plugin */
|
57 |
-
const MINIMUM_WP_VERSION = '5.
|
58 |
|
59 |
/** minimum WooCommerce version required by this plugin */
|
60 |
-
const MINIMUM_WC_VERSION = '
|
61 |
|
62 |
/** SkyVerge plugin framework version used by this plugin */
|
63 |
const FRAMEWORK_VERSION = '5.10.7';
|
3 |
* Plugin Name: Braintree for WooCommerce Payment Gateway
|
4 |
* Plugin URI: https://docs.woocommerce.com/document/woocommerce-gateway-paypal-powered-by-braintree/
|
5 |
* Documentation URI: https://docs.woocommerce.com/document/woocommerce-gateway-paypal-powered-by-braintree/
|
6 |
+
* Description: Receive credit card or PayPal payments using Braintree for WooCommerce. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 7.3+
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: http://woocommerce.com/
|
9 |
+
* Version: 2.8.0
|
10 |
* Text Domain: woocommerce-gateway-paypal-powered-by-braintree
|
11 |
* Domain Path: /i18n/languages/
|
12 |
*
|
13 |
+
* Requires at least: 5.6
|
14 |
* Tested up to: 6.0
|
15 |
+
* Requires PHP: 7.3
|
16 |
+
* WC requires at least: 6.0
|
17 |
+
* WC tested up to: 6.7
|
18 |
*
|
19 |
* Copyright (c) 2016-2020, Automattic, Inc.
|
20 |
*
|
37 |
/**
|
38 |
* Required minimums
|
39 |
*/
|
40 |
+
define( 'WC_PAYPAL_BRAINTREE_MIN_PHP_VER', '7.3.0' );
|
41 |
|
42 |
/**
|
43 |
* Base plugin file
|
53 |
|
54 |
|
55 |
/** minimum PHP version required by this plugin */
|
56 |
+
const MINIMUM_PHP_VERSION = '7.3';
|
57 |
|
58 |
/** minimum WordPress version required by this plugin */
|
59 |
+
const MINIMUM_WP_VERSION = '5.6';
|
60 |
|
61 |
/** minimum WooCommerce version required by this plugin */
|
62 |
+
const MINIMUM_WC_VERSION = '6.0';
|
63 |
|
64 |
/** SkyVerge plugin framework version used by this plugin */
|
65 |
const FRAMEWORK_VERSION = '5.10.7';
|