MCPcopy Create free account
hub / github.com/codecombat/codecombat / confirmRedeem

Method confirmRedeem

app/views/account/PrepaidView.js:93–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 }
92
93 confirmRedeem () {
94 const options = {
95 url: '/db/subscription/-/subscribe_prepaid',
96 method: 'POST',
97 data: { ppc: this.dashedPPC() }
98 }
99
100 options.error = (model, res, options, foo) => {
101 // console.error 'FAILED redeeming prepaid code'
102 const msg = model.responseText != null ? model.responseText : ''
103 return this.statusMessage(`Error: Could not redeem prepaid code. ${msg}`, 'error')
104 }
105
106 options.success = (model, res, options) => {
107 // console.log 'SUCCESS redeeming prepaid code'
108 this.statusMessage('Prepaid Code Redeemed!', 'success')
109 this.supermodel.loadCollection(this.codes, 'prepaid', { cache: false })
110 this.codes.fetch()
111 return me.fetch({ cache: false })
112 }
113
114 return this.supermodel.addRequestResource('subscribe_prepaid', options, 0).load()
115 }
116
117 loadPrepaid (ppc) {
118 if (!ppc) { return }

Callers

nothing calls this directly

Calls 4

dashedPPCMethod · 0.95
statusMessageMethod · 0.95
fetchMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected