forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:Tak-Iwamoto/mattermost-webapp int…
…o MM-20499 * 'master' of github.com:Tak-Iwamoto/mattermost-webapp: (71 commits) Fix bot icon heigth (mattermost#6578) Cypress/E2E: Update quick switch hint (mattermost#6691) migrate string-refs in search_results.jsx (mattermost#6671) MM-T581 Regen token (mattermost#6642) Switch button-bg-## to use button-bg-rgb variables (mattermost#6635) [MM-27142] In-Web-App purchase of Mattermost Cloud (mattermost#6583) migrate user_list_row_with_error to ts (mattermost#6624) [MM-28217] Front-end for displaying company info (mattermost#6580) [MM-28211] Plan Details Card (mattermost#6582) [MM-28216] Billing History View (UX Only) (mattermost#6637) Added final set of cypress tests part of MM-29347 (mattermost#6659) [MM-24507] - Pin comment box on bottom of RHS thread (mattermost#6167) Cypress/E2E: Fix channel switcher spec (mattermost#6662) [MM-28781] migrate string refs in channelView (mattermost#6607) [GH-15777] Replace center-channel-color-## with center-channel-color-rgb variables (mattermost#6643) [GH-15776]Switch center-channel-color-## with center-channel-color-rgb variables (mattermost#6641) MM-29038 Removed usage of centre-channel-color from post comments (mattermost#6633) [MM-29034] Remove usage of sidebar-text-## CSS variables (mattermost#6634) Translations update from Weblate (mattermost#6673) [MM-20462] migrate any_team_permission_gate to typescript (mattermost#6547) ...
- Loading branch information
Showing
363 changed files
with
26,597 additions
and
18,693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
import {Stripe} from '@stripe/stripe-js'; | ||
import {getCode} from 'country-list'; | ||
|
||
import {Client4} from 'mattermost-redux/client'; | ||
|
||
import {getConfirmCardSetup} from 'components/payment_form/stripe'; | ||
|
||
import {StripeSetupIntent, BillingDetails} from 'types/cloud/sku'; | ||
|
||
// Returns true for success, and false for any error | ||
export function completeStripeAddPaymentMethod(stripe: Stripe, billingDetails: BillingDetails, isDevMode: boolean) { | ||
return async () => { | ||
let paymentSetupIntent: StripeSetupIntent; | ||
try { | ||
paymentSetupIntent = await Client4.createPaymentMethod() as StripeSetupIntent; | ||
} catch (error) { | ||
return error; | ||
} | ||
const cardSetupFunction = getConfirmCardSetup(isDevMode); | ||
const confirmCardSetup = cardSetupFunction(stripe.confirmCardSetup); | ||
|
||
const result = await confirmCardSetup( | ||
paymentSetupIntent.client_secret, | ||
{ | ||
payment_method: { | ||
card: billingDetails.card, | ||
billing_details: { | ||
name: billingDetails.name, | ||
address: { | ||
line1: billingDetails.address, | ||
line2: billingDetails.address2, | ||
city: billingDetails.city, | ||
state: billingDetails.state, | ||
country: getCode(billingDetails.country), | ||
postal_code: billingDetails.postalCode, | ||
}, | ||
}, | ||
}, | ||
}, | ||
); | ||
|
||
if (!result) { | ||
return false; | ||
} | ||
|
||
const {setupIntent, error: stripeError} = result; | ||
|
||
if (stripeError) { | ||
return false; | ||
} | ||
|
||
if (setupIntent == null) { | ||
return false; | ||
} | ||
|
||
if (setupIntent.status !== 'succeeded') { | ||
return false; | ||
} | ||
|
||
try { | ||
await Client4.confirmPaymentMethod(setupIntent.id); | ||
} catch (error) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.