Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web/satellite: token payments logic #3581

Merged
merged 26 commits into from
Nov 25, 2019
Merged

Conversation

NikolaiYurchenko
Copy link
Contributor

@NikolaiYurchenko NikolaiYurchenko commented Nov 15, 2019

What:
front end logic and markup for token payment related components
Why:
to be able to create token transactions
Please describe the tests:

  • Test 1:
  • Test 2:

Please describe the performance impact:

Code Review Checklist (to be filled out by reviewer)

  • NEW: Are there any Satellite database migrations? Are they forwards and backwards compatible?
  • Does the PR describe what changes are being made?
  • Does the PR describe why the changes are being made?
  • Does the code follow our style guide?
  • Does the code follow our testing guide?
  • Is the PR appropriately sized? (If it could be broken into smaller PRs it should be)
  • Does the new code have enough tests? (every PR should have tests or justification otherwise. Bug-fix PRs especially)
  • Does the new code have enough documentation that answers "how do I use it?" and "what does it do?"? (both source documentation and higher level, diagrams?)
  • Does any documentation need updating?
  • Do the database access patterns make sense?

@NikolaiYurchenko NikolaiYurchenko requested a review from a team November 15, 2019 15:10
@cla-bot cla-bot bot added the cla-signed label Nov 15, 2019
@ghost ghost requested review from JessicaGreben and kaloyan-raev and removed request for a team November 15, 2019 15:10
throw new ErrorUnauthorized();
}

throw new Error('can not process coin payment');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api response could contain 3 error codes:
401 - unauthrized
400 - bad data
500 - internal error

we could possibly add new error check to improve err message

throw new Error('can not process coin payment');
}

return await response.json();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets return real type, not a deserialized json

private readonly type: BillingHistoryItemType;

private readonly expirationDateTime: number;
private now = Math.trunc((new Date()).getTime() / 1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need additional brackets around new Date?

@Prop({default: 0})
private readonly type: BillingHistoryItemType;

private readonly expirationDateTime: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be renamed. Timeout, f.e.

if (this.type) {
return this.start.toLocaleDateString();
public get quantity(): Amount {
if (this.tokenAmount === '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check type, not amount

@NikolaiYurchenko NikolaiYurchenko added the Request Code Review Code review requested label Nov 20, 2019
Copy link
Contributor

@crawter crawter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not enough comments and unit tests

},
})
export default class BillingItem extends Vue {
@Prop({default: new BillingHistoryItem()})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

() => new BillingHistoryItem()

import { BillingHistoryItemType } from '@/types/payments';

@Component
export default class BillingHistoryDate extends Vue {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BillingHistoryItemDate?


private readonly expirationTimeInSeconds: number;
private nowInSeconds = Math.trunc(new Date().getTime() / 1000);
private intervalID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type?


Vue.filter('twoDigits', function (value: number): string {
if (value.toString().length <= 1) {
return `0${value.toString()}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.toString() is redundant here

@NikolaiYurchenko NikolaiYurchenko added Do Not Merge and removed Reviewer Can Merge If all checks have passed, non-owner can merge PR labels Nov 21, 2019
@NikolaiYurchenko NikolaiYurchenko added Reviewer Can Merge If all checks have passed, non-owner can merge PR and removed Do Not Merge labels Nov 21, 2019
import { BillingHistoryItemType } from '@/types/payments';

@Component
export default class BillingHistoryDate extends Vue {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have more comments here

@@ -123,6 +127,10 @@ export default class PaymentMethods extends Vue {
return this.areaState === PaymentMethodsBlockState.ADDING_CARD;
}

public onChangeTokenValue(value: number) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return type


return;
}

public onConfirmAddSTORJ(): void {
public async onConfirmAddSTORJ(): Promise<void> {
if (this.tokenDepositValue >= 1000000 || this.tokenDepositValue === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets place it to constants?

@@ -123,6 +140,18 @@ export enum BillingHistoryItemType {
Transaction = 1,
}

export class TokenDeposit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments

@NikolaiYurchenko NikolaiYurchenko merged commit 8234e24 into master Nov 25, 2019
@NikolaiYurchenko NikolaiYurchenko deleted the ny/token_payments branch November 25, 2019 12:59
bryanchriswhite added a commit that referenced this pull request Nov 25, 2019
* storj/master: (63 commits)
  web/satellite:  token payments logic (#3581)
  satellite/metainfo: reduce pointerDB access for CommitObject (#3589)
  satellite/metainfo: Fix misspelling in comment (#3636)
  argon2: choose a steady parallelism value (#3630)
  satellitedb: add support to testplanet for cockroachdb (#3634)
  satellite/console/auth: return in error handle added (#3639)
  Make sed a little more cross platformable (#3629)
  web: ms edge support bug fixed (#3638)
  web/satellite: registration/welcome message fixed, usage-report url fixed, storj-sim fixed (#3622)
  web/satellite: fonts changed to Inter (#3620)
  storagenode/updater: read identity location from storagenode's config.yaml (#3607)
  cmd/segment-reaper: Implement bitmask type (#3626)
  storagenode/gracefulexit: improve logging (#3633)
  private/testplanet: add a mock referral manager server into testplanet (#3631)
  satellite/gracefulexit: refactor concurrency (#3624)
  pkg/pb/referralmanager: update to add satellite ID to Get Tokens request (#3625)
  satellite/metainfo: improve Loop comments (#3595)
  storagenode: add bandwidth metrics (#3623)
  satellite/console: Add security headers (#3615)
  satellite/payments: token deposit accept cents (#3628)
  ...
bryanchriswhite pushed a commit to bryanchriswhite/storj that referenced this pull request Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR Sprint Release Goal Sprint Release Goal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants