2014-11-11 20:40:03 -05:00
|
|
|
c = require './../schemas'
|
|
|
|
|
|
|
|
PaymentSchema = c.object({title: 'Payment', required: []}, {
|
|
|
|
purchaser: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ]) # in case of gifts
|
|
|
|
recipient: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ])
|
2015-02-26 11:44:53 -05:00
|
|
|
|
2015-03-04 18:40:32 -05:00
|
|
|
service: { enum: ['stripe', 'ios', 'external']}
|
2014-11-11 20:40:03 -05:00
|
|
|
amount: { type: 'integer', description: 'Payment in cents.' }
|
|
|
|
created: c.date({title: 'Created', readOnly: true})
|
|
|
|
gems: { type: 'integer', description: 'The number of gems acquired.' }
|
2015-03-04 18:40:32 -05:00
|
|
|
productID: { enum: ['gems_5', 'gems_10', 'gems_20', 'custom']}
|
|
|
|
description: { type: 'string' }
|
2016-02-17 08:34:12 -05:00
|
|
|
prepaidID: c.objectId()
|
2015-02-26 11:44:53 -05:00
|
|
|
|
2014-11-11 20:40:03 -05:00
|
|
|
ios: c.object({title: 'iOS IAP Data'}, {
|
|
|
|
transactionID: { type: 'string' }
|
|
|
|
rawReceipt: { type: 'string' }
|
|
|
|
localPrice: { type: 'string' }
|
|
|
|
})
|
2015-02-26 11:44:53 -05:00
|
|
|
|
2014-11-11 20:40:03 -05:00
|
|
|
stripe: c.object({title: 'Stripe Data'}, {
|
|
|
|
timestamp: { type: 'integer', description: 'Unique identifier provided by the client, to guard against duplicate payments.' }
|
2014-11-17 18:15:02 -05:00
|
|
|
chargeID: { type: 'string' }
|
2014-11-11 20:40:03 -05:00
|
|
|
customerID: { type: 'string' }
|
2014-12-02 23:01:35 -05:00
|
|
|
invoiceID: { type: 'string' }
|
2014-11-11 20:40:03 -05:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
c.extendBasicProperties(PaymentSchema, 'payment')
|
|
|
|
|
|
|
|
module.exports = PaymentSchema
|