@@ -114,9 +114,6 @@ export default Component.extend(FormMixin, EventWizardMixin, {
114
114
if ( ! this . isCreate && this . get ( 'data.event.copyright' ) && ! this . get ( 'data.event.copyright.content' ) ) {
115
115
this . set ( 'data.event.copyright' , this . store . createRecord ( 'event-copyright' ) ) ;
116
116
}
117
- if ( ! this . isCreate && this . get ( 'data.event.stripeAuthorization' ) && ! this . get ( 'data.event.stripeAuthorization.content' ) ) {
118
- this . set ( 'data.event.stripeAuthorization' , this . store . createRecord ( 'stripe-authorization' ) ) ;
119
- }
120
117
} ,
121
118
122
119
getValidationRules ( ) {
@@ -328,17 +325,24 @@ export default Component.extend(FormMixin, EventWizardMixin, {
328
325
329
326
actions : {
330
327
connectStripe ( ) {
331
- this . get ( 'data.event.stripeAuthorization.content' ) || this . set ( 'data.event.stripeAuthorization' , this . store . createRecord ( 'stripe-authorization' ) ) ;
332
328
this . torii . open ( 'stripe' )
333
329
. then ( authorization => {
334
- this . set ( 'data.event.stripeAuthorization.stripeAuthCode' , authorization . authorizationCode ) ;
330
+ this . set ( 'data.event.stripeAuthorization' , this . store . createRecord ( 'stripe-authorization' , {
331
+ stripeAuthCode : authorization . authorizationCode ,
332
+ stripePublishableKey : this . settings . stripePublishableKey
333
+ } ) ) ;
335
334
} )
336
335
. catch ( error => {
337
336
this . notify . error ( this . l10n . t ( `${ error . message } . Please try again` ) ) ;
338
337
} ) ;
339
338
} ,
340
- disconnectStripe ( ) {
341
- this . get ( 'data.event.stripeAuthorization.content' ) . destroyRecord ( ) ;
339
+ async disconnectStripe ( ) {
340
+ let stripeAuthorization = await this . get ( 'data.event.stripeAuthorization' ) ;
341
+ stripeAuthorization . destroyRecord ( )
342
+ . then ( ( ) => {
343
+ this . notify . success ( this . l10n . t ( 'Stripe disconnected successfully' ) ) ;
344
+ } ) ;
345
+
342
346
} ,
343
347
addTicket ( type , position ) {
344
348
const event = this . get ( 'data.event' ) ;
0 commit comments