Skip to content

Commit

Permalink
refactor: updates to Amazon tests & subscriptionPlan.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriousMagpie committed Dec 17, 2024
1 parent 2e4457d commit 4b49938
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/api/unit/libs/payments/amazon/cancel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ describe('Amazon Payments - Cancel Subscription', () => {
expectAmazonCancelGroupSubscriptionSpy(group._id);
amzLib.closeBillingAgreement.restore();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ describe('#upgradeGroupPlan', () => {
},
});
});
});
});
2 changes: 1 addition & 1 deletion website/client/src/mixins/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default {
let paymentMethod = group
? group.purchased.plan.paymentMethod
: this.user.purchased.plan.paymentMethod;
paymentMethod = paymentMethod.toLowerCase();
paymentMethod = paymentMethod === 'Amazon Payments' ? 'amazon' : paymentMethod.toLowerCase();

const queryParams = {
noRedirect: true,
Expand Down
2 changes: 1 addition & 1 deletion website/server/libs/payments/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async function prepareSubscriptionValues (data) {
dateTerminated: null,
// Specify a lastBillingDate just for Amazon Payments
// Resetted every time the subscription restarts
lastBillingDate: data.paymentMethod === 'Amazon Payments' ? today : undefined,
// lastBillingDate: data.paymentMethod === 'Amazon Payments' ? today : undefined,
nextPaymentProcessing: data.nextPaymentProcessing,
nextBillingDate: data.nextBillingDate,
additionalData: data.additionalData,
Expand Down
2 changes: 1 addition & 1 deletion website/server/models/subscriptionPlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const schema = new mongoose.Schema({
subscriptionId: String,
owner: { $type: String, ref: 'User', validate: [v => validator.isUUID(v), 'Invalid uuid for subscription owner.'] },
quantity: { $type: Number, default: 1 },
paymentMethod: String, // enum: ['Paypal', 'Stripe', 'Gift', 'Amazon Payments', Google', '']}
paymentMethod: String, // enum: ['Paypal', 'Stripe', 'Gift', 'Amazon Payments', 'Google', '']}
customerId: String, // Billing Agreement Id in case of Amazon Payments
dateCreated: Date,
dateTerminated: Date,
Expand Down

0 comments on commit 4b49938

Please sign in to comment.