-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refacto/payment method token (#1181)
* Replace client token by user id token * Implement payment method token * Adding payment method token events for each webhook * Added is_favorite column to token table * PaymentToken entity and repository * Added new JS component for vaulted payment methods * Added correct payment logo display * Added custom marks for vaulted payment methods * Moved vaulting config check to fundingSourceProvider * CS fix * Added forms for vaulting payments and setting as favorite * Renamed smarty template variables * Added token delete handler and repository functions * Temp fix for token events * Changed delete function argument type * Undid database table changes * Added event subscriber implementation * CS fix * Fixed OrderDispatcher * PHPStan fixes * Added PayPal customer saving * Added logic to set token as favorite after receiving webhook * CS fix * phpStan fix * Remove final_capture from pscheckout_order table * Added payment token delete without confirmation * Added modal component and confirmation for payment token delete * Added config for token event subscriber * Added token deletion * Added total count function for admin ajax controller * Added setting payment token as favorite on order create * Added userIdToken loading * Added payment token status to Db table, entity and repository * Added API call to get userIdToken * added payment token status fetching from webhook * Added token filtering by status * Added Payment controller for validating orders with payment token * Added check if payment token belongs to customer * Replaced new order payload builder with old one in create order command handler * Changed token and oauth functions to match API specifications * Added new handler to save paypal order and related entities to database * CS fix * Added template for 3DS error * Removed OauthHttpClient and added configuration for CheckoutHttpCLient base URL * CS fix * Add vault to legacy OrderPayloadBuilder * Added 3DS logic to payment controller and moved order entities * Fix ExpressCheckout product data * Fix create order payload address * Fix json array for card brands * Added cancel_url to order payload * Changed PayPal Order update functions and added Order update on PayPalOrderUpdated event * Fixed total token count query * PHPStan fixes * CS fix * Fixes payment token saving during order capture * Fixes for vaulting order creation and capture * Replaced returl_url in order create payload with redirect_uri in 3DS url * Remove deprecated PayPal Client Token * CS fixes --------- Co-authored-by: Bastien Tafforeau <[email protected]> Co-authored-by: Laurynas <[email protected]>
- Loading branch information
1 parent
1a5aa3a
commit 0a73564
Showing
106 changed files
with
3,788 additions
and
979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) | ||
*/ | ||
import { BaseComponent } from '../../core/dependency-injection/base.component'; | ||
|
||
export class ModalComponent extends BaseComponent { | ||
static Inject = { | ||
querySelectorService: 'QuerySelectorService', | ||
config: 'PsCheckoutConfig', | ||
$: '$' | ||
}; | ||
|
||
created() { | ||
this.data.parent = this.querySelectorService.getLoaderParent(); | ||
this.data.header = this.props.header || null; | ||
this.data.content = this.props.content || null; | ||
this.data.confirmText = this.props.confirmText || this.$('ok'); | ||
this.data.confirmType = this.props.confirmType || 'primary'; | ||
this.data.cancelText = this.props.cancelText || this.$('cancel'); | ||
this.data.cancelType = this.props.cancelType || 'primary'; | ||
this.data.onConfirm = this.props.onConfirm || (() => {}); | ||
this.data.onClose = this.props.onClose || (() => {}); | ||
} | ||
|
||
render() { | ||
this.overlay = document.createElement('div'); | ||
this.overlay.classList.add('ps-checkout', 'overlay'); | ||
|
||
this.overlay.addEventListener('click', (event) => { | ||
if (event.target === this.overlay) { | ||
this.data.onClose(); | ||
this.hide(); | ||
} | ||
}) | ||
|
||
this.modal = document.createElement('div'); | ||
this.modal.classList.add('ps-checkout', 'ps-checkout-modal'); | ||
|
||
if (this.data.header) { | ||
this.header = document.createElement('h1'); | ||
this.header.classList.add('ps-checkout', 'text'); | ||
this.header.innerHTML = this.data.header; | ||
|
||
this.modal.append(this.header); | ||
} | ||
|
||
if (this.data.content) { | ||
this.contentContainer = document.createElement('div'); | ||
this.contentContainer.classList.add('ps-checkout', 'content'); | ||
this.contentContainer.append(this.data.content); | ||
this.modal.append(this.contentContainer); | ||
} | ||
|
||
this.footer = document.createElement('div'); | ||
this.footer.classList.add('ps-checkout', 'footer'); | ||
|
||
this.cancelButton = document.createElement('button'); | ||
this.cancelButton.innerHTML = this.data.cancelText; | ||
this.cancelButton.classList.add('ps-checkout', 'btn', this.data.cancelType); | ||
|
||
this.cancelButton.addEventListener('click', (event) => { | ||
this.data.onClose(); | ||
this.hide(); | ||
}) | ||
|
||
this.confirmButton = document.createElement('button'); | ||
this.confirmButton.innerHTML = this.data.confirmText; | ||
this.confirmButton.classList.add('ps-checkout', 'btn', this.data.confirmType); | ||
|
||
this.confirmButton.addEventListener('click', (event) => { | ||
this.data.onConfirm(); | ||
this.hide(); | ||
}) | ||
|
||
this.footer.append(this.cancelButton, this.confirmButton); | ||
|
||
this.modal.append(this.footer); | ||
|
||
this.overlay.append(this.modal); | ||
this.data.parent.append(this.overlay); | ||
|
||
return this; | ||
} | ||
|
||
show() { | ||
this.overlay.classList.add('visible'); | ||
document.body.style.overflow = 'hidden'; | ||
} | ||
|
||
hide() { | ||
this.overlay.classList.remove('visible'); | ||
document.body.style.overflow = ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.