codecombat/app/models/StripeCoupon.coffee
Scott Erickson f0fa88206d Add Enrollment start/end dates, remove self-serve
* Refactor several related endpoints and views
* Redesign EnrollmentView, add TeacherContactModal
* Add "Enrollment Status" tab to TeacherClassView
* Delete PurchaseCoursesView and related files
* Style-flatten RemoveStudentModal
* Fix error handling in ActivateLicensesModal
* TeacherCoursesView loads faster by only loading course campaigns, and not load prepaids
2016-05-24 14:07:28 -07:00

19 lines
564 B
CoffeeScript

CocoModel = require './CocoModel'
module.exports = class StripeCoupon extends CocoModel
@className: 'StripeCoupon'
@schema: {}
urlRoot: '/stripe/coupons'
idAttribute: 'id'
formatString: ->
bits = [@id]
if @get('percent_off')
bits.push "(#{@get('percent_off')}% off)"
else if @get('amount_off')
bits.push "($#{@get('amount_off')} off)"
if @get('duration')
bits.push "(duration: #{@get('duration')})"
if @redeem_by
bits.push "(redeem by: #{moment(@get('redeem_by')).format('lll')}"
return bits.join(' ')