mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Amazon payment fixes (#9562)
* Added custom amazon event, removed redundency, fixed variable names * Fixed more variables and group plan data
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<template lang="pug">
|
||||
.standard-page
|
||||
amazon-payments-modal(:amazon-payments-prop='amazonPayments')
|
||||
|
||||
h1 {{ $t('subscription') }}
|
||||
.row
|
||||
.col-6
|
||||
@@ -82,9 +80,8 @@
|
||||
a.purchase(:href='paypalPurchaseLink', :disabled='!subscription.key', target='_blank')
|
||||
img(src='https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png', :alt="$t('paypal')")
|
||||
.col-md-4
|
||||
a.btn.btn-secondary.purchase(@click="amazonPaymentsInit({type: 'subscription', subscription:subscription.key, coupon:subscription.coupon})")
|
||||
a.btn.btn-secondary.purchase(@click="payWithAmazon()")
|
||||
img(src='https://payments.amazon.com/gp/cba/button', :alt="$t('amazonPayments')")
|
||||
|
||||
.row
|
||||
.col-6
|
||||
h2 {{ $t('giftSubscription') }}
|
||||
@@ -115,14 +112,10 @@ import { mapState } from 'client/libs/store';
|
||||
|
||||
import subscriptionBlocks from '../../../common/script/content/subscriptionBlocks';
|
||||
import planGemLimits from '../../../common/script/libs/planGemLimits';
|
||||
import amazonPaymentsModal from '../payments/amazonModal';
|
||||
import paymentsMixin from '../../mixins/payments';
|
||||
|
||||
export default {
|
||||
mixins: [paymentsMixin],
|
||||
components: {
|
||||
amazonPaymentsModal,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
gemCostTranslation: {
|
||||
@@ -132,6 +125,7 @@ export default {
|
||||
subscription: {
|
||||
key: 'basic_earned',
|
||||
},
|
||||
// @TODO: Remove the need for this or move it to mixin
|
||||
amazonPayments: {},
|
||||
paymentMethods: {
|
||||
AMAZON_PAYMENTS: 'Amazon Payments',
|
||||
@@ -247,6 +241,13 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
payWithAmazon () {
|
||||
this.amazonPaymentsInit({
|
||||
type: 'subscription',
|
||||
subscription: this.subscription.key,
|
||||
coupon: this.subscription.coupon,
|
||||
});
|
||||
},
|
||||
async applyCoupon (coupon) {
|
||||
let response = await axios.get(`/api/v3/coupons/validate/${coupon}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user