mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Support subscription payment through Google Play Store (#8437)
* Support subscription payment through Google Play Store * minor fixes to iap subscriptions * Support subscription payment through Google Play Store * minor fixes to iap subscriptions * revert change to test * add unit tests for google payments * add integration tests for google payments * change config formatting for play api * fix typo in file name * fix typo in example config * Improve google payment tests * fix linter errors
This commit is contained in:
committed by
Sabe Jones
parent
a002bc5e20
commit
4d0295a60d
@@ -7,7 +7,7 @@ export let schema = new mongoose.Schema({
|
||||
subscriptionId: String,
|
||||
owner: {type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']},
|
||||
quantity: {type: Number, default: 1},
|
||||
paymentMethod: String, // enum: ['Paypal','Stripe', 'Gift', 'Amazon Payments', '']}
|
||||
paymentMethod: String, // enum: ['Paypal', 'Stripe', 'Gift', 'Amazon Payments', 'Google', '']}
|
||||
customerId: String, // Billing Agreement Id in case of Amazon Payments
|
||||
dateCreated: Date,
|
||||
dateTerminated: Date,
|
||||
@@ -16,6 +16,9 @@ export let schema = new mongoose.Schema({
|
||||
gemsBought: {type: Number, default: 0},
|
||||
mysteryItems: {type: Array, default: () => []},
|
||||
lastBillingDate: Date, // Used only for Amazon Payments to keep track of billing date
|
||||
additionalData: mongoose.Schema.Types.Mixed, // Example for Google: {'receipt': 'serialized receipt json', 'signature': 'signature string'}
|
||||
nextPaymentProcessing: Date, // indicates when the queue server should process this subscription again.
|
||||
nextBillingDate: Date, // Next time google will bill this user.
|
||||
consecutive: {
|
||||
count: {type: Number, default: 0},
|
||||
offset: {type: Number, default: 0}, // when gifted subs, offset++ for each month. offset-- each new-month (cron). count doesn't ++ until offset==0
|
||||
@@ -29,6 +32,7 @@ export let schema = new mongoose.Schema({
|
||||
});
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
private: ['additionalData'],
|
||||
noSet: ['_id'],
|
||||
timestamps: false,
|
||||
_id: false,
|
||||
|
||||
Reference in New Issue
Block a user