Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
842
Issues
842
List
Boards
Labels
Service Desk
Milestones
Merge Requests
43
Merge Requests
43
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
ed8141103205e86497e27f625a345d59d4f4a281...727ebfccdde3d1a6d164c38c937c2c0a05f4cc39
Source
727ebfccdde3d1a6d164c38c937c2c0a05f4cc39
Select Git revision
...
Target
ed8141103205e86497e27f625a345d59d4f4a281
Select Git revision
Compare
Commits (2)
fixed up metamask
· 15472022
Ben Hayward
authored
1 hour ago
15472022
more updates
· 727ebfcc
Ben Hayward
authored
2 minutes ago
727ebfcc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
46 deletions
+35
-46
payment-plan.component.scss
src/app/modules/plus/plan/payment-plan.component.scss
+4
-0
payment-plan.component.spec.ts
src/app/modules/plus/plan/payment-plan.component.spec.ts
+28
-40
payment-plan.component.ts
src/app/modules/plus/plan/payment-plan.component.ts
+3
-6
No files found.
src/app/modules/plus/plan/payment-plan.component.scss
View file @
727ebfcc
...
...
@@ -131,4 +131,8 @@
}
}
}
.minds-error
{
width
:
100%
;
text-align
:
center
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/plus/plan/payment-plan.component.spec.ts
View file @
727ebfcc
...
...
@@ -39,21 +39,13 @@ let overlayModal = new function () {
});
};
describe
(
'
WirePaymentsCreatorComponent
'
,
()
=>
{
f
describe
(
'
WirePaymentsCreatorComponent
'
,
()
=>
{
let
comp
:
PaymentPlanComponent
;
let
fixture
:
ComponentFixture
<
PaymentPlanComponent
>
;
function
getMonthlyButton
():
DebugElement
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-plus-plan__plans > div:nth-child(1) > button
'
));
}
function
getYearlyButton
():
DebugElement
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-plus-plan__plans > div:nth-child(2) > button
'
));
}
function
getLifeButton
():
DebugElement
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-plus-plan__plans > div:nth-child(3) > button
'
));
function
getButton
():
DebugElement
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-plus-plan__period-buy-button__blue
'
));
}
beforeEach
(
async
(()
=>
{
...
...
@@ -96,6 +88,7 @@ describe('WirePaymentsCreatorComponent', () => {
window
.
Minds
.
blockchain
=
{
plus_address
:
'
oxtn
'
}
// comp.receiver = window.Minds.blockchain.plus_address;
comp
=
fixture
.
componentInstance
;
// LoginForm test instance
fixture
.
detectChanges
();
...
...
@@ -113,55 +106,50 @@ describe('WirePaymentsCreatorComponent', () => {
jasmine
.
clock
().
uninstall
();
});
it
(
'
should have a
buy monthly
button
'
,
()
=>
{
const
monthlyButton
=
getMonthly
Button
();
expect
(
monthlyB
utton
).
not
.
toBeNull
();
it
(
'
should have a
purchase
button
'
,
()
=>
{
const
button
=
get
Button
();
expect
(
b
utton
).
not
.
toBeNull
();
});
it
(
'
should create the payment object for monthly
'
,
()
=>
{
const
monthlyButton
=
getMonthlyButton
();
spyOn
(
comp
,
'
createPayment
'
).
and
.
stub
();
monthlyButton
.
nativeElement
.
click
();
expect
(
comp
.
createPayment
).
toHaveBeenCalledWith
(
'
month
'
);
});
it
(
'
should set the amount correctly for monthly
'
,
()
=>
{
const
result
=
comp
.
createPayment
(
'
month
'
);
expect
(
result
.
amount
).
toBe
(
20
);
const
button
=
getButton
();
spyOn
(
comp
,
'
submit
'
).
and
.
stub
();
button
.
nativeElement
.
click
();
expect
(
comp
.
submit
).
toHaveBeenCalledWith
(
'
month
'
);
});
it
(
'
should
have a buy yearly butto
n
'
,
()
=>
{
co
nst
yearlyButton
=
getYearlyButton
(
);
expect
(
yearlyButton
).
not
.
toBeNull
(
);
it
(
'
should
set the amount correctly for monthly offchai
n
'
,
()
=>
{
co
mp
.
createWire
(
'
offchain month
'
);
expect
(
comp
.
wire
.
amount
).
toBe
(
20
);
});
it
(
'
should create the payment object for yearly
'
,
()
=>
{
const
yearlyButton
=
getYearly
Button
();
spyOn
(
comp
,
'
createPaymen
t
'
).
and
.
stub
();
yearlyB
utton
.
nativeElement
.
click
();
expect
(
comp
.
createPaymen
t
).
toHaveBeenCalledWith
(
'
year
'
);
const
button
=
get
Button
();
spyOn
(
comp
,
'
submi
t
'
).
and
.
stub
();
b
utton
.
nativeElement
.
click
();
expect
(
comp
.
submi
t
).
toHaveBeenCalledWith
(
'
year
'
);
});
it
(
'
should set the amount correctly for yearly
'
,
()
=>
{
co
nst
result
=
comp
.
createPayment
(
'
year
'
);
expect
(
result
.
amount
).
toBe
(
18
0
);
co
mp
.
createWire
(
'
offchain month
'
);
expect
(
comp
.
wire
.
amount
).
toBe
(
20
0
);
});
it
(
'
should have a buy life button
'
,
()
=>
{
const
lifeButton
=
getLife
Button
();
expect
(
lifeB
utton
).
not
.
toBeNull
();
const
button
=
get
Button
();
expect
(
b
utton
).
not
.
toBeNull
();
});
it
(
'
should create the payment object for life
'
,
()
=>
{
const
lifeButton
=
getLife
Button
();
spyOn
(
comp
,
'
createPaymen
t
'
).
and
.
stub
();
lifeB
utton
.
nativeElement
.
click
();
expect
(
comp
.
createPaymen
t
).
toHaveBeenCalledWith
(
'
lifetime
'
)
const
button
=
get
Button
();
spyOn
(
comp
,
'
submi
t
'
).
and
.
stub
();
b
utton
.
nativeElement
.
click
();
expect
(
comp
.
submi
t
).
toHaveBeenCalledWith
(
'
lifetime
'
)
});
it
(
'
should set the amount correctly for lifetime
'
,
()
=>
{
co
nst
result
=
comp
.
createPayment
(
'
lifetime
'
);
expect
(
result
.
amount
).
toBe
(
500
);
co
mp
.
createWire
(
'
offchain
lifetime
'
);
expect
(
comp
.
wire
.
amount
).
toBe
(
500
);
});
});
This diff is collapsed.
Click to expand it.
src/app/modules/plus/plan/payment-plan.component.ts
View file @
727ebfcc
...
...
@@ -80,8 +80,6 @@ export class PaymentPlanComponent {
this
.
setDefaults
();
}
@
Input
()
receiver
;
constructor
(
public
session
:
Session
,
private
cd
:
ChangeDetectorRef
,
...
...
@@ -207,7 +205,6 @@ export class PaymentPlanComponent {
this
.
wire
.
recurring
=
false
;
this
.
wire
.
guid
=
this
.
minds
.
blockchain
.
plus_guid
;
this
.
wire
.
payload
=
''
;
}
async
submit
()
{
...
...
@@ -302,9 +299,9 @@ export class PaymentPlanComponent {
balance
=
this
.
balances
.
offchain
/
Math
.
pow
(
10
,
18
);
if
(
this
.
wire
.
amount
>
wireCap
)
{
throw
new
VisibleWireError
(
`You cannot spend more than
${
wireCap
}
tokens today.`
)
throw
new
VisibleWireError
(
`You cannot spend more than
${
wireCap
}
tokens today.`
)
;
}
else
if
(
this
.
wire
.
amount
>
balance
)
{
throw
new
VisibleWireError
(
`You cannot spend more than
${
balance
}
tokens.`
)
throw
new
VisibleWireError
(
`You cannot spend more than
${
balance
}
tokens.`
)
;
}
break
;
}
...
...
@@ -353,7 +350,7 @@ export class PaymentPlanComponent {
* Sets the onchain specific wire payment nonce
*/
setOnchainNoncePayload
(
address
:
string
)
{
return
this
.
setNoncePayload
({
receiver
:
this
.
receiver
,
address
})
return
this
.
setNoncePayload
({
receiver
:
this
.
blockchain
.
plus_address
,
address
})
}
/**
...
...
This diff is collapsed.
Click to expand it.