Skip to content

Commit

Permalink
Merge pull request #2760 from bc-nick/PAYPAL-4995
Browse files Browse the repository at this point in the history
feat(payment): PAYPAL-4995 Unable to Change Payment Methods With Braintree if Stored Payments are Used
  • Loading branch information
bc-nick authored Jan 13, 2025
2 parents e050766 + 1e16475 commit d30953b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ describe('BraintreeHostedForm', () => {

expect(cardFields.teardown).toHaveBeenCalled();
});

it('do not call teardown if fields are not initialized', async () => {
await subject.initialize({
...formOptions,
fields: {},
});
await subject.deinitialize();

expect(cardFields.teardown).not.toHaveBeenCalled();
});
});

describe('#tokenize', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ export default class BraintreeHostedForm {
}

async deinitialize(): Promise<void> {
this._isInitializedHostedForm = false;
if (this._isInitializedHostedForm) {
this._isInitializedHostedForm = false;

await this._cardFields?.teardown();
await this._cardFields?.teardown();
}
}

validate() {
Expand Down

0 comments on commit d30953b

Please sign in to comment.