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

Method onLoaded

app/views/account/PaymentsView.js:47–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 }
46
47 onLoaded () {
48 this.prepaidMap = _.zipObject(_.map(this.prepaids.models, m => m.id), this.prepaids.models)
49 if (typeof this.reload === 'function') {
50 this.reload()
51 }
52
53 // for administration
54 for (const payment of Array.from(this.payments.models)) {
55 const payPal = payment.get('payPal')
56 let transactionId = __guard__(__guard__(__guard__(__guard__(__guard__(payPal != null ? payPal.transactions : undefined, x4 => x4[0]), x3 => x3.related_resources), x2 => x2[0]), x1 => x1.sale), x => x.id)
57 if (transactionId) {
58 console.log('PayPal Payment', transactionId, payment.get('amount'))
59 }
60
61 const payPalSale = payment.get('payPalSale')
62 transactionId = payPalSale != null ? payPalSale.id : undefined
63 if (transactionId) {
64 console.log('PayPal Subscription Payment', transactionId)
65 }
66
67 const description = payment.get('description')
68 if (payment.get('productID') === 'online-classes') {
69 this.paymentDescription[payment.id] = description.slice(0, 22)
70 } else {
71 this.paymentDescription[payment.id] = description
72 }
73 }
74
75 return super.onLoaded()
76 }
77 }
78 PaymentsView.initClass()
79 return PaymentsView

Callers

nothing calls this directly

Calls 4

reloadMethod · 0.80
logMethod · 0.80
__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected