| 110 | } |
| 111 | |
| 112 | renderPayPalButton () { |
| 113 | if (this.$('#paypal-button-container').length && !this.$('#paypal-button-container').children().length) { |
| 114 | const descriptionTranslationKey = 'subscribe.lifetime' |
| 115 | const discount = (this.basicProduct.get('amount') * 12) - this.lifetimeProduct.get('amount') |
| 116 | const discountString = (discount / 100).toFixed(2) |
| 117 | const description = $.i18n.t(descriptionTranslationKey).replace('{{discount}}', discountString) |
| 118 | return (payPal != null |
| 119 | ? payPal.makeButton({ |
| 120 | buttonContainerID: '#paypal-button-container', |
| 121 | product: this.lifetimeProduct, |
| 122 | onPaymentStarted: this.onPayPalPaymentStarted, |
| 123 | onPaymentComplete: this.onPayPalPaymentComplete, |
| 124 | description |
| 125 | }) |
| 126 | : undefined) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | afterRender () { |
| 131 | super.afterRender() |