...
 
Commits (2)
......@@ -47,7 +47,11 @@ class Plus
}
// 20 tokens, 180 tokens, 500 tokens.
if ($wire->getAmount() != "20000000000000000000" && $wire->getAmount() != "180000000000000000000" && $wire->getAmount() != "500000000000000000000") {
if (($wire->getAmount() != "20000000000000000000" && $receiver_address === 'offchain') // 20 offchain
&& ($wire->getAmount() != "200000000000000000000" && $receiver_address === 'offchain') // 200 offchain
&& ($wire->getAmount() != "5000000000000000000000" && $receiver_address === 'offchain') // 5000 offchain
&& ($wire->getAmount() != "40000000000000000000" && $receiver_address !== 'offchain') // 40 onchain
&& ($wire->getAmount() != "400000000000000000000" && $receiver_address !== 'offchain')) { // 400 onchain
return $wire; //incorrect wire amount sent
}
......
......@@ -65,38 +65,6 @@ class PlusSpec extends ObjectBehavior
$this->onWire($wire, 'offchain');
}
function it_should_not_make_a_user_plus_if_offchain_wire_is_wrong_guid_sent(
Config $config
)
{
$this->beConstructedWith($config);
$config->get('blockchain')
->willReturn([
'contracts' => [
'wire' => [
'plus_guid' => 123,
'plus_address' => '0xaddr',
]
]
]);
$receiver = new User;
$receiver->guid = 123;
$sender = new User;
$sender->guid = 456;
$wire = new Wire();
$wire->setReceiver($receiver)
->setAmount("10000000000000000000")
->setSender($sender);
$wire = $this->onWire($wire, 'offchain');
$wire->getSender()->isPlus()->shouldBe(false);
}
function it_should_make_a_user_plus_if_onchain_wire_sent(
Config $config,
User $receiver,
......@@ -213,4 +181,4 @@ class PlusSpec extends ObjectBehavior
->shouldEqualApproximately(strtotime('+13 months', time()), 1.0e-9);
}
}
\ No newline at end of file
}