Skip to content

Commit

Permalink
2.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed May 13, 2020
1 parent 7819d7a commit 27b80ac
Show file tree
Hide file tree
Showing 17 changed files with 797 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -1,3 +1,5 @@
<!-- Only open an issue here if you think you've found an issue with our SDK. If you need help troubleshooting your integration, reach out to Braintree Support at https://help.braintreepayments.com. -->

### General information

* SDK/Library version: <!-- Example: 2.1.3 -->
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,13 @@
## 2.23.0
* Add `threeDSecurePassThru` parameters to `Customer.create`, `PaymentMethod.create`, `CreditCard.create`, `Customer.update`, `PaymentMethod.update` and `CreditCard.update`
* Add `threeDSecureAuthenticationId` support on transaction sale
* Add ThreeDSecure test payment method nonces
* Add test `AuthenticationId`s Unreleased
* Add `DisputeAccepted`, `DisputeDisputed`, and `DisputeExpired` webhook constants
* Add `Authentication Insight` support to payment method nonce create
* Add `recurringCustomerConsent` and `recurringMaxAmount` to `authenticationInsightOptions` for `PaymentMethodNonce.create`
* Add `FileIsEmpty` error code

## 2.22.0
* Add `RefundAuthHardDeclined` and `RefundAuthSoftDeclined` to validation errors
* Add GraphQL ID to `CreditCardVerification`, `Customer`, `Dispute`, and `Transaction`
Expand Down
9 changes: 9 additions & 0 deletions lib/braintree/customer_gateway.js
Expand Up @@ -93,6 +93,15 @@ class CustomerGateway extends Gateway {
'creditCard[paymentMethodNonce]',
'creditCard[venmoSdkPaymentMethodCode]',
'creditCard[options]',
'creditCard[threeDSecurePassThru]',
'creditCard[threeDSecurePassThru][eciFlag]',
'creditCard[threeDSecurePassThru][cavv]',
'creditCard[threeDSecurePassThru][xid]',
'creditCard[threeDSecurePassThru][threeDSecureVersion]',
'creditCard[threeDSecurePassThru][authenticationResponse]',
'creditCard[threeDSecurePassThru][directoryResponse]',
'creditCard[threeDSecurePassThru][cavvAlgorithm]',
'creditCard[threeDSecurePassThru][dsTransactionId]',
'creditCard[options][failOnDuplicatePaymentMethod]',
'creditCard[options][makeDefault]',
'creditCard[options][verificationAmount]',
Expand Down
21 changes: 19 additions & 2 deletions lib/braintree/payment_method_nonce_gateway.js
@@ -1,6 +1,7 @@
'use strict';

let Gateway = require('./gateway').Gateway;
let Util = require('./util').Util;
let PaymentMethodNonce = require('./payment_method_nonce').PaymentMethodNonce;
let wrapPrototype = require('@braintree/wrap-promise').wrapPrototype;

Expand All @@ -23,8 +24,24 @@ class PaymentMethodNonceGateway extends Gateway {
};
}

create(paymentMethodToken) {
return this.gateway.http.post(`${this.config.baseMerchantPath()}/payment_methods/${paymentMethodToken}/nonces`, {}).then(this.responseHandler());
create(paymentMethodToken, params) {
let schema = {
valid: [
'paymentMethodNonce[merchantAccountId]',
'paymentMethodNonce[authenticationInsight]',
'paymentMethodNonce[authenticationInsightOptions][amount]',
'paymentMethodNonce[authenticationInsightOptions][recurringCustomerConsent]',
'paymentMethodNonce[authenticationInsightOptions][recurringMaxAmount]'
]
};

let invalidKeysError = Util.verifyKeys(schema, params);

if (invalidKeysError) {
return Promise.reject(invalidKeysError);
}

return this.gateway.http.post(`${this.config.baseMerchantPath()}/payment_methods/${paymentMethodToken}/nonces`, params).then(this.responseHandler());
}

find(paymentMethodNonce) {
Expand Down
21 changes: 21 additions & 0 deletions lib/braintree/test/authentication_ids.js
@@ -0,0 +1,21 @@
'use strict';

let AuthenticationIds = {
ThreeDSecureVisaFullAuthentication: 'fake-three-d-secure-visa-full-authentication-id',
ThreeDSecureVisaLookupTimeout: 'fake-three-d-secure-visa-lookup-timeout-id',
ThreeDSecureVisaFailedSignature: 'fake-three-d-secure-visa-failed-signature-id',
ThreeDSecureVisaFailedAuthentication: 'fake-three-d-secure-visa-failed-authentication-id',
ThreeDSecureVisaAttemptsNonParticipating: 'fake-three-d-secure-visa-attempts-non-participating-id',
ThreeDSecureVisaNoteEnrolled: 'fake-three-d-secure-visa-not-enrolled-id',
ThreeDSecureVisaUnavailable: 'fake-three-d-secure-visa-unavailable-id',
ThreeDSecureVisaMPILookupError: 'fake-three-d-secure-visa-mpi-lookup-error-id',
ThreeDSecureVisaMPIAuthenticateError: 'fake-three-d-secure-visa-mpi-authenticate-error-id',
ThreeDSecureVisaAuthenticationUnavailable: 'fake-three-d-secure-visa-authentication-unavailable-id',
ThreeDSecureVisaBypassedAuthentication: 'fake-three-d-secure-visa-bypassed-authentication-id',
ThreeDSecureTwoVisaSuccessfulFrictionlessAuthentication: 'fake-three-d-secure-two-visa-successful-frictionless-authentication-id',
ThreeDSecureTwoVisaSuccessfulStepUpAuthentication: 'fake-three-d-secure-two-visa-successful-step-up-authentication-id',
ThreeDSecureTwoVisaErrorOnLookup: 'fake-three-d-secure-two-visa-error-on-lookup-id',
ThreeDSecureTwoVisaTimeoutOnLookup: 'fake-three-d-secure-two-visa-timeout-on-lookup-id'
};

module.exports = {AuthenticationIds: AuthenticationIds};
14 changes: 14 additions & 0 deletions lib/braintree/test/nonces.js
Expand Up @@ -19,6 +19,20 @@ let Nonces = {
AndroidPayAmEx: 'fake-android-pay-amex-nonce',
AmexExpressCheckout: 'fake-amex-express-checkout-nonce',
ThreeDSecureVisaFullAuthentication: 'fake-three-d-secure-visa-full-authentication-nonce',
ThreeDSecureVisaLookupTimeout: 'fake-three-d-secure-visa-lookup-timeout-nonce',
ThreeDSecureVisaFailedSignature: 'fake-three-d-secure-visa-failed-signature-nonce',
ThreeDSecureVisaFailedAuthentication: 'fake-three-d-secure-visa-failed-authentication-nonce',
ThreeDSecureVisaAttemptsNonParticipating: 'fake-three-d-secure-visa-attempts-non-participating-nonce',
ThreeDSecureVisaNoteEnrolled: 'fake-three-d-secure-visa-not-enrolled-nonce',
ThreeDSecureVisaUnavailable: 'fake-three-d-secure-visa-unavailable-nonce',
ThreeDSecureVisaMPILookupError: 'fake-three-d-secure-visa-mpi-lookup-error-nonce',
ThreeDSecureVisaMPIAuthenticateError: 'fake-three-d-secure-visa-mpi-authenticate-error-nonce',
ThreeDSecureVisaAuthenticationUnavailable: 'fake-three-d-secure-visa-authentication-unavailable-nonce',
ThreeDSecureVisaBypassedAuthentication: 'fake-three-d-secure-visa-bypassed-authentication-nonce',
ThreeDSecureTwoVisaSuccessfulFrictionlessAuthentication: 'fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce',
ThreeDSecureTwoVisaSuccessfulStepUpAuthentication: 'fake-three-d-secure-two-visa-successful-step-up-authentication-nonce',
ThreeDSecureTwoVisaErrorOnLookup: 'fake-three-d-secure-two-visa-error-on-lookup-nonce',
ThreeDSecureTwoVisaTimeoutOnLookup: 'fake-three-d-secure-two-visa-timeout-on-lookup-nonce',
TransactableVisa: 'fake-valid-visa-nonce',
TransactableAmEx: 'fake-valid-amex-nonce',
TransactableMasterCard: 'fake-valid-mastercard-nonce',
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/transaction_gateway.js
Expand Up @@ -204,6 +204,7 @@ class TransactionGateway extends Gateway {
'paymentMethodNonce',
'paymentMethodToken',
'threeDSecureToken',
'threeDSecureAuthenticationId',
'sharedPaymentMethodToken',
'sharedPaymentMethodNonce',
'sharedBillingAddressId',
Expand Down
23 changes: 22 additions & 1 deletion lib/braintree/validation_error_codes.js
Expand Up @@ -199,7 +199,8 @@ class ValidationErrorCodes {
FileIsTooLarge: '84902',
FileTypeIsInvalid: '84903',
FileIsMalformedOrEncrypted: '84904',
FileIsTooLong: '84905'
FileIsTooLong: '84905',
FileIsEmpty: '84906'
};

this.Merchant = {
Expand Down Expand Up @@ -744,6 +745,26 @@ class ValidationErrorCodes {
MerchantAccountCannotBeSubMerchantAccount: '94208',
AccountTypeIsInvalid: '942184',
AccountTypeNotSupported: '942185'
},
ThreeDSecureAuthenticationIdIsInvalid: '942196',
ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication: '942198',
ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod: '942197',
ThreeDSecureAuthenticationIdWithThreeDSecurePassThruIsInvalid: '942199',
ThreeDSecureAuthenticationFailed: '94271',
ThreeDSecureTokenIsInvalid: '94268',
ThreeDSecureVerificationDataDoesntMatchVerify: '94270',
MerchantAccountDoesNotSupport3DSecure: '942169',
MerchantAcountDoesNotMatch3DSecureMerchantAccount: '94284',
AmountDoesNotMatch3DSecureAmount: '94285',
ThreeDSecurePassThru: {
EciFlagIsRequired: '942113',
EciFlagIsInvalid: '942114',
CavvIsRequired: '942116',
ThreeDSecureVersionIsRequired: '942117',
ThreeDSecureVersionIsInvalid: '942119',
AuthenticationResponseIsInvalid: '942120',
DirectoryResponseIsInvalid: '942121',
CavvAlgorithmIsInvalid: '942122'
}
};
}
Expand Down
3 changes: 3 additions & 0 deletions lib/braintree/webhook_notification.js
Expand Up @@ -29,6 +29,9 @@ const Kind = {
DisputeOpened: 'dispute_opened',
DisputeLost: 'dispute_lost',
DisputeWon: 'dispute_won',
DisputeAccepted: 'dispute_accepted',
DisputeDisputed: 'dispute_disputed',
DisputeExpired: 'dispute_expired',
GrantorUpdatedGrantedPaymentMethod: 'grantor_updated_granted_payment_method',
// NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate. Kind is not sent by Braintree Gateway.
// Kind will either be GrantorUpdatedGrantedPaymentMethod or RecipientUpdatedGrantedPaymentMethod.
Expand Down
63 changes: 63 additions & 0 deletions lib/braintree/webhook_testing_gateway.js
Expand Up @@ -58,6 +58,9 @@ class WebhookTestingGateway extends Gateway {
case WebhookNotification.Kind.DisputeOpened: return this.subjectXmlForDisputeOpened(id);
case WebhookNotification.Kind.DisputeLost: return this.subjectXmlForDisputeLost(id);
case WebhookNotification.Kind.DisputeWon: return this.subjectXmlForDisputeWon(id);
case WebhookNotification.Kind.DisputeAccepted: return this.subjectXmlForDisputeAccepted(id);
case WebhookNotification.Kind.DisputeDisputed: return this.subjectXmlForDisputeDisputed(id);
case WebhookNotification.Kind.DisputeExpired: return this.subjectXmlForDisputeExpired(id);
case WebhookNotification.Kind.GrantorUpdatedGrantedPaymentMethod: return this.subjectXmlForGrantedPaymentInstrumentUpdate();
// NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate
case WebhookNotification.Kind.GrantedPaymentInstrumentUpdate: return this.subjectXmlForGrantedPaymentInstrumentUpdate();
Expand Down Expand Up @@ -200,6 +203,66 @@ class WebhookTestingGateway extends Gateway {
</dispute>`;
}

subjectXmlForDisputeAccepted(id) {
return `<dispute>
<amount>250.00</amount>
<amount-disputed>250.0</amount-disputed>
<amount-won>245.00</amount-won>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>accepted</status>
<reason>fraud</reason>
<id>${id}</id>
<transaction>
<id>${id}</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>`;
}

subjectXmlForDisputeDisputed(id) {
return `<dispute>
<amount>250.00</amount>
<amount-disputed>250.0</amount-disputed>
<amount-won>245.00</amount-won>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>disputed</status>
<reason>fraud</reason>
<id>${id}</id>
<transaction>
<id>${id}</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>`;
}

subjectXmlForDisputeExpired(id) {
return `<dispute>
<amount>250.00</amount>
<amount-disputed>250.0</amount-disputed>
<amount-won>245.00</amount-won>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>expired</status>
<reason>fraud</reason>
<id>${id}</id>
<transaction>
<id>${id}</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>`;
}

subjectXmlForDisbursementException(id) {
return `<disbursement>
<id>${id}</id>
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "braintree",
"version": "2.22.0",
"version": "2.23.0",
"description": "A library for integrating with Braintree.",
"keywords": [
"braintree",
Expand Down

0 comments on commit 27b80ac

Please sign in to comment.