Skip to content

Commit

Permalink
6.15.0
Browse files Browse the repository at this point in the history
Co-authored-by: Sara Vasquez <saravasquez@paypal.com>
Co-authored-by: Debra Do <debdo@paypal.com>
  • Loading branch information
3 people committed Nov 8, 2023
1 parent 084ed5b commit 16efb08
Show file tree
Hide file tree
Showing 26 changed files with 927 additions and 61 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog

## 6.15.0
* Add `billingAddress` and `shippingAddress` to `VenmoProfileData` for `PaymentMethodCustomerDataUpdated` webhook
* Add `MetaCheckoutCard` and `MetaCheckoutToken` payment methods
* Add `MetaCheckoutCardDetails` and `MetaCheckoutTokenDetails` to Transaction object
* Add `verificationAddOns` and `additionalProcessorResponse` to `PaymentMethodCreate` for ACH Network Check
* Add `dateOfBirth` and `countryCode` to `industry_data`

## 6.14.0
* Add `arrivalDate` and `ticketIssuerAddress` to Transaction object
* Add `SUBSCRIPTION_BILLING_SKIPPED` WebhookNotification
Expand Down
100 changes: 100 additions & 0 deletions lib/Braintree/MetaCheckoutCard.php
@@ -0,0 +1,100 @@
<?php

namespace Braintree;

/**
* Braintree MetaCheckoutCard module
* Creates and manages Braintree MetaCheckoutCards
*/
class MetaCheckoutCard extends Base
{
/* instance methods */
/**
* returns false if default is null or false
*
* @return boolean
*/
public function isDefault()
{
return $this->default;
}

/**
* checks whether the card is expired based on the current date
*
* @return boolean
*/
public function isExpired()
{
return $this->expired;
}

/**
* sets instance properties from an array of values
*
* @param array $creditCardAttribs array of creditcard data
*
* @return void
*/
protected function _initialize($creditCardAttribs)
{
// set the attributes
$this->_attributes = $creditCardAttribs;

$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);

if (isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
$verifications = $creditCardAttribs['verifications'];
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);

$this->_set('verification', CreditCardVerification::factory($verifications[0]));
}
}

private function _compareCreatedAtOnVerifications($verificationAttrib1, $verificationAttrib2)
{
return ($verificationAttrib2['createdAt'] < $verificationAttrib1['createdAt']) ? -1 : 1;
}

/**
* returns false if comparing object is not a MetaCheckoutCard,
* or is a MetaCheckoutCard with a different id
*
* @param object $otherMetaCheckoutCard customer to compare against
*
* @return boolean
*/
public function isEqual($otherMetaCheckoutCard)
{
return !($otherMetaCheckoutCard instanceof self) ? false : $this->token === $otherMetaCheckoutCard->token;
}

// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __toString()
{
return __CLASS__ . '[' .
Util::attributesToString($this->_attributes) . ']';
}

/**
* Creates an instance from given attributes
*
* @param array $attributes response object attributes
*
* @return MetaCheckoutCard
*/
public static function factory($attributes)
{
$defaultAttributes = [
'bin' => '',
'expirationMonth' => '',
'expirationYear' => '',
'last4' => '',
];

$instance = new self();
$instance->_initialize(array_merge($defaultAttributes, $attributes));
return $instance;
}
}
101 changes: 101 additions & 0 deletions lib/Braintree/MetaCheckoutToken.php
@@ -0,0 +1,101 @@
<?php

namespace Braintree;

/**
* Braintree MetaCheckoutToken module
* Creates and manages Braintree MetaCheckoutTokens
*/
class MetaCheckoutToken extends Base
{
/* instance methods */
/**
* returns false if default is null or false
*
* @return boolean
*/
public function isDefault()
{
return $this->default;
}

/**
* checks whether the card is expired based on the current date
*
* @return boolean
*/
public function isExpired()
{
return $this->expired;
}

/**
* sets instance properties from an array of values
*
* @param array $creditCardAttribs array of creditcard data
*
* @return void
*/
protected function _initialize($creditCardAttribs)
{
// set the attributes
$this->_attributes = $creditCardAttribs;


$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);

if (isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
$verifications = $creditCardAttribs['verifications'];
usort($verifications, [$this, '_compareCreatedAtOnVerifications']);

$this->_set('verification', CreditCardVerification::factory($verifications[0]));
}
}

private function _compareCreatedAtOnVerifications($verificationAttrib1, $verificationAttrib2)
{
return ($verificationAttrib2['createdAt'] < $verificationAttrib1['createdAt']) ? -1 : 1;
}

/**
* returns false if comparing object is not a MetaCheckoutToken,
* or is a MetaCheckoutToken with a different id
*
* @param object $otherMetaCheckoutToken customer to compare against
*
* @return boolean
*/
public function isEqual($otherMetaCheckoutToken)
{
return !($otherMetaCheckoutToken instanceof self) ? false : $this->token === $otherMetaCheckoutToken->token;
}

// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __toString()
{
return __CLASS__ . '[' .
Util::attributesToString($this->_attributes) . ']';
}

/**
* Creates an instance from given attributes
*
* @param array $attributes response object attributes
*
* @return MetaCheckoutToken
*/
public static function factory($attributes)
{
$defaultAttributes = [
'bin' => '',
'expirationMonth' => '',
'expirationYear' => '',
'last4' => '',
];

$instance = new self();
$instance->_initialize(array_merge($defaultAttributes, $attributes));
return $instance;
}
}
2 changes: 2 additions & 0 deletions lib/Braintree/PaymentInstrumentType.php
Expand Up @@ -13,6 +13,8 @@ class PaymentInstrumentType
const CREDIT_CARD = 'credit_card';
const GOOGLE_PAY_CARD = 'android_pay_card';
const LOCAL_PAYMENT = 'local_payment';
const META_CHECKOUT_CARD = 'meta_checkout_card';
const META_CHECKOUT_TOKEN = 'meta_checkout_token';
const PAYPAL_ACCOUNT = 'paypal_account';
const PAYPAL_HERE = 'paypal_here';
const SAMSUNG_PAY_CARD = 'samsung_pay_card';
Expand Down
1 change: 1 addition & 0 deletions lib/Braintree/PaymentMethodGateway.php
Expand Up @@ -152,6 +152,7 @@ private static function baseSignature()
'skipAdvancedFraudChecking',
'usBankAccountVerificationMethod',
'verificationAccountType',
'verificationAddOns',
'verificationAmount',
'verificationMerchantAccountId',
'verifyCard',
Expand Down
16 changes: 16 additions & 0 deletions lib/Braintree/Result/UsBankAccountVerification.php
Expand Up @@ -24,11 +24,15 @@ class UsBankAccountVerification extends Base
const VERIFIED = 'verified';
const PENDING = 'pending';

// Verification Method
const TOKENIZED_CHECK = 'tokenized_check';
const NETWORK_CHECK = 'network_check';
const INDEPENDENT_CHECK = 'independent_check';
const MICRO_TRANSFERS = 'micro_transfers';

// Verification Add Ons
const CUSTOMER_VERIFICATION = 'customer_verification';

private $_gatewayRejectionReason;
private $_status;

Expand Down Expand Up @@ -103,4 +107,16 @@ public static function allVerificationMethods()
UsBankAccountVerification::MICRO_TRANSFERS,
];
}

/**
* returns an array of all possible US Bank Account Verification Add Ons
*
* @return array
*/
public static function allVerificationAddOns()
{
return [
UsBankAccountVerification::CUSTOMER_VERIFICATION,
];
}
}
111 changes: 57 additions & 54 deletions lib/Braintree/Test/Nonces.php
Expand Up @@ -15,75 +15,78 @@
class Nonces
{
// phpcs:disable Generic.Files.LineLength
public static $transactable = "fake-valid-nonce";
public static $consumed = "fake-consumed-nonce";
public static $paypalOneTimePayment = "fake-paypal-one-time-nonce";
// NEXT_MAJOR_VERSION - no longer supported in the Gateway, remove this constant
public static $paypalFuturePayment = "fake-paypal-future-nonce";
public static $paypalBillingAgreement = "fake-paypal-billing-agreement-nonce";
public static $applePayVisa = "fake-apple-pay-visa-nonce";
public static $applePayMasterCard = "fake-apple-pay-visa-nonce";
public static $abstractTransactable = "fake-abstract-transactable-nonce";
public static $applePayAmEx = "fake-apple-pay-amex-nonce";
public static $applePayMasterCard = "fake-apple-pay-visa-nonce";
public static $applePayVisa = "fake-apple-pay-visa-nonce";
public static $consumed = "fake-consumed-nonce";
public static $europe = "fake-europe-bank-account-nonce";
public static $gatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce";
public static $gatewayRejectedTokenIssuance = "fake-token-issuance-error-venmo-account-nonce";
public static $googlePay = "fake-android-pay-nonce";
public static $googlePayAmEx = "fake-android-pay-amex-nonce";
public static $googlePayDiscover = "fake-android-pay-discover-nonce";
public static $googlePayVisa = "fake-android-pay-visa-nonce";
public static $googlePayMasterCard = "fake-android-pay-mastercard-nonce";
public static $googlePayAmEx = "fake-android-pay-amex-nonce";
public static $abstractTransactable = "fake-abstract-transactable-nonce";
public static $europe = "fake-europe-bank-account-nonce";
public static $googlePayVisa = "fake-android-pay-visa-nonce";
public static $localPayment = "fake-local-payment-method-nonce";
public static $luhnInvalid = "fake-luhn-invalid-nonce";
public static $metaCheckoutCard = "fake-meta-checkout-card-nonce";
public static $metaCheckoutToken = "fake-meta-checkout-token-nonce";
public static $paypalBillingAgreement = "fake-paypal-billing-agreement-nonce";
// NEXT_MAJOR_VERSION - no longer supported in the Gateway, remove this constant
public static $paypalFuturePayment = "fake-paypal-future-nonce";
public static $paypalFuturePaymentRefreshToken = "fake-paypal-future-refresh-token-nonce";
public static $paypalOneTimePayment = "fake-paypal-one-time-nonce";
public static $processorDeclinedAmEx = "fake-processor-declined-amex-nonce";
public static $processorDeclinedDiscover = "fake-processor-declined-discover-nonce";
public static $processorDeclinedMasterCard = "fake-processor-declined-mastercard-nonce";
public static $processorDeclinedVisa = "fake-processor-declined-visa-nonce";
public static $processorFailureJCB = "fake-processor-failure-jcb-nonce";
public static $samsungPayAmEx = "tokensam_fake_american_express";
public static $samsungPayDiscover = "tokensam_fake_discover";
public static $samsungPayMasterCard = "tokensam_fake_mastercard";
public static $samsungPayVisa = "tokensam_fake_visa";
public static $sepa = "fake-sepa-bank-account-nonce";
public static $sepaDirectDebit = "fake-sepa-direct-debit-nonce";
public static $transactableVisa = "fake-valid-visa-nonce";
public static $transactableAmEx = "fake-valid-amex-nonce";
public static $transactableMasterCard = "fake-valid-mastercard-nonce";
public static $transactableDiscover = "fake-valid-discover-nonce";
public static $transactableJCB = "fake-valid-jcb-nonce";
public static $transactableMaestro = "fake-valid-maestro-nonce";
public static $transactableDinersClub = "fake-valid-dinersclub-nonce";
public static $transactablePrepaid = "fake-valid-prepaid-nonce";
public static $transactableCommercial = "fake-valid-commercial-nonce";
public static $transactableDurbinRegulated = "fake-valid-durbin-regulated-nonce";
public static $transactableHealthcare = "fake-valid-healthcare-nonce";
public static $transactableDebit = "fake-valid-debit-nonce";
public static $transactablePayroll = "fake-valid-payroll-nonce";
public static $threeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-nonce";
public static $threeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce";
public static $threeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-nonce";
public static $threeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-nonce";
public static $threeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-nonce";
public static $threeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-nonce";
public static $threeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-nonce";
public static $threeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-nonce";
public static $threeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-nonce";
public static $threeDSecureVisaFullAuthenticationNonce = "fake-three-d-secure-visa-full-authentication-nonce";
public static $threeDSecureVisaLookupTimeout = "fake-three-d-secure-visa-lookup-timeout-nonce";
public static $threeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-nonce";
public static $threeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-nonce";
public static $threeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-nonce";
public static $threeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-nonce";
public static $threeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-nonce";
public static $threeDSecureVisaNoteEnrolled = "fake-three-d-secure-visa-not-enrolled-nonce";
public static $threeDSecureVisaUnavailable = "fake-three-d-secure-visa-unavailable-nonce";
public static $threeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-nonce";
public static $threeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-nonce";
public static $threeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-nonce";
public static $threeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-nonce";
public static $threeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce";
public static $threeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-nonce";
public static $threeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-nonce";
public static $threeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-nonce";
public static $transactableNoIndicators = "fake-valid-no-indicators-nonce";
public static $transactableUnknownIndicators = "fake-valid-unknown-indicators-nonce";
public static $transactableCountryOfIssuanceUSA = "fake-valid-country-of-issuance-usa-nonce";
public static $transactable = "fake-valid-nonce";
public static $transactableAmEx = "fake-valid-amex-nonce";
public static $transactableCommercial = "fake-valid-commercial-nonce";
public static $transactableCountryOfIssuanceCAD = "fake-valid-country-of-issuance-cad-nonce";
public static $transactableCountryOfIssuanceUSA = "fake-valid-country-of-issuance-usa-nonce";
public static $transactableDebit = "fake-valid-debit-nonce";
public static $transactableDinersClub = "fake-valid-dinersclub-nonce";
public static $transactableDiscover = "fake-valid-discover-nonce";
public static $transactableDurbinRegulated = "fake-valid-durbin-regulated-nonce";
public static $transactableHealthcare = "fake-valid-healthcare-nonce";
public static $transactableIssuingBankNetworkOnly = "fake-valid-issuing-bank-network-only-nonce";
public static $processorDeclinedVisa = "fake-processor-declined-visa-nonce";
public static $processorDeclinedMasterCard = "fake-processor-declined-mastercard-nonce";
public static $processorDeclinedAmEx = "fake-processor-declined-amex-nonce";
public static $processorDeclinedDiscover = "fake-processor-declined-discover-nonce";
public static $processorFailureJCB = "fake-processor-failure-jcb-nonce";
public static $luhnInvalid = "fake-luhn-invalid-nonce";
public static $localPayment = "fake-local-payment-method-nonce";
public static $paypalFuturePaymentRefreshToken = "fake-paypal-future-refresh-token-nonce";
public static $sepa = "fake-sepa-bank-account-nonce";
public static $gatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce";
public static $gatewayRejectedTokenIssuance = "fake-token-issuance-error-venmo-account-nonce";
public static $transactableJCB = "fake-valid-jcb-nonce";
public static $transactableMaestro = "fake-valid-maestro-nonce";
public static $transactableMasterCard = "fake-valid-mastercard-nonce";
public static $transactableNoIndicators = "fake-valid-no-indicators-nonce";
public static $transactablePayroll = "fake-valid-payroll-nonce";
public static $transactablePrepaid = "fake-valid-prepaid-nonce";
public static $transactableUnknownIndicators = "fake-valid-unknown-indicators-nonce";
public static $transactableVisa = "fake-valid-visa-nonce";
public static $usBankAccount = "fake-us-bank-account-nonce";
public static $venmoAccount = "fake-venmo-account-nonce";
public static $visaCheckoutAmEx = "fake-visa-checkout-amex-nonce";
public static $visaCheckoutDiscover = "fake-visa-checkout-discover-nonce";
public static $visaCheckoutMasterCard = "fake-visa-checkout-mastercard-nonce";
public static $visaCheckoutVisa = "fake-visa-checkout-visa-nonce";
public static $samsungPayAmEx = "tokensam_fake_american_express";
public static $samsungPayDiscover = "tokensam_fake_discover";
public static $samsungPayMasterCard = "tokensam_fake_mastercard";
public static $samsungPayVisa = "tokensam_fake_visa";
// phpcs:enable Generic.Files.LineLength
}

0 comments on commit 16efb08

Please sign in to comment.