• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-server / 10423

11 Nov 2025 04:53PM UTC coverage: 74.435% (-0.1%) from 74.562%
10423

push

gitlab-ci

web-flow
Merge pull request #1071 from mendersoftware/dependabot/npm_and_yarn/frontend/main/development-dependencies-92732187be

3868 of 5393 branches covered (71.72%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

176 existing lines in 95 files now uncovered.

64605 of 86597 relevant lines covered (74.6%)

7.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.05
/frontend/src/js/components/settings/organization/OrganizationPaymentSettings.tsx
1
// Copyright 2020 Northern.tech AS
2✔
2
//
2✔
3
//    Licensed under the Apache License, Version 2.0 (the "License");
2✔
4
//    you may not use this file except in compliance with the License.
2✔
5
//    You may obtain a copy of the License at
2✔
6
//
2✔
7
//        http://www.apache.org/licenses/LICENSE-2.0
2✔
8
//
2✔
9
//    Unless required by applicable law or agreed to in writing, software
2✔
10
//    distributed under the License is distributed on an "AS IS" BASIS,
2✔
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2✔
12
//    See the License for the specific language governing permissions and
2✔
13
//    limitations under the License.
2✔
14
import { useSelector } from 'react-redux';
2✔
15

2✔
16
// material ui
2✔
17
import { Button } from '@mui/material';
2✔
18

2✔
19
import { getCard, getOrganization } from '@northern.tech/store/selectors';
2✔
20
import { useAppDispatch } from '@northern.tech/store/store';
2✔
21
import { confirmCardUpdate, getCurrentCard, startCardUpdate } from '@northern.tech/store/thunks';
2✔
22

2✔
23
import CardSection from '../CardSection';
2✔
24
import { CardDetails } from './Billing';
2✔
25

2✔
26
interface OrganizationPaymentSettingsProps {
2✔
27
  className: string;
2✔
28
  disabled?: boolean;
2✔
29
  omitHeader?: boolean;
2✔
30
  onComplete?: () => void;
2✔
31
  setUpdatingCard: (updatingCard: boolean) => void;
2✔
32
  updatingCard: boolean;
2✔
33
}
2✔
34
export const OrganizationPaymentSettings = (props: OrganizationPaymentSettingsProps) => {
11✔
35
  const { className, onComplete, updatingCard, setUpdatingCard, disabled, omitHeader } = props;
9✔
36
  const card = useSelector(getCard);
9✔
37
  const organization = useSelector(getOrganization);
9✔
38
  const dispatch = useAppDispatch();
9✔
39

2✔
40
  const onCardConfirm = async () => {
9✔
41
    await dispatch(confirmCardUpdate());
2✔
42
    dispatch(getCurrentCard());
2✔
43
    setUpdatingCard(false);
2✔
44
    if (onComplete) {
2!
45
      onComplete();
2✔
46
    }
2✔
47
  };
2✔
48

2✔
49
  return (
9✔
50
    <div className={className}>
2✔
51
      {!omitHeader && (
2✔
52
        <div className="flexbox center-aligned margin-top">
2✔
53
          <h5 className="margin-top-none margin-bottom-none margin-right-small">{updatingCard ? 'Edit payment card' : 'Payment card'}</h5>
2!
UNCOV
54
          <Button onClick={() => setUpdatingCard(!updatingCard)}>{updatingCard ? 'cancel' : 'edit'}</Button>
2!
55
        </div>
2✔
56
      )}
2✔
57
      {updatingCard ? (
2!
58
        <CardSection
2✔
59
          disabled={disabled}
2✔
60
          isSignUp={false}
2✔
61
          organization={organization}
2✔
62
          onClose={() => setUpdatingCard(false)}
2✔
63
          onCardConfirmed={onCardConfirm}
2✔
64
          onSubmit={() => dispatch(startCardUpdate()).unwrap()}
2✔
65
          beforeCardSubmit={() => dispatch(startCardUpdate()).unwrap()}
2✔
66
        />
2✔
67
      ) : (
2✔
68
        <CardDetails card={card} />
2✔
69
      )}
2✔
70
    </div>
2✔
71
  );
2✔
72
};
2✔
73

2✔
74
export default OrganizationPaymentSettings;
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc