mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +02:00
Add a domain application update custom pricing logic test
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=142294037
This commit is contained in:
parent
9764ab0a56
commit
d485c5d7e2
3 changed files with 56 additions and 3 deletions
|
@ -82,6 +82,26 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeesAndCredits customizeApplicationUpdatePrice(
|
||||||
|
ApplicationUpdatePriceParameters priceParameters) throws EppException {
|
||||||
|
if (priceParameters
|
||||||
|
.domainApplication()
|
||||||
|
.getFullyQualifiedDomainName()
|
||||||
|
.startsWith("non-free-update")) {
|
||||||
|
FeesAndCredits feesAndCredits = priceParameters.feesAndCredits();
|
||||||
|
List<BaseFee> newFeesAndCredits =
|
||||||
|
new ImmutableList.Builder<BaseFee>()
|
||||||
|
.addAll(feesAndCredits.getFeesAndCredits())
|
||||||
|
.add(Fee.create(BigDecimal.valueOf(100), FeeType.UPDATE))
|
||||||
|
.build();
|
||||||
|
return new FeesAndCredits(
|
||||||
|
feesAndCredits.getCurrency(), toArray(newFeesAndCredits, BaseFee.class));
|
||||||
|
} else {
|
||||||
|
return priceParameters.feesAndCredits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FeesAndCredits customizeRenewPrice(RenewPriceParameters priceParameters)
|
public FeesAndCredits customizeRenewPrice(RenewPriceParameters priceParameters)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
|
|
|
@ -673,11 +673,13 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_flags_feeMismatch() throws Exception {
|
public void testFailure_customPricingLogic_feeMismatch() throws Exception {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainApplication("update-42.flags").asBuilder().setRepoId("1-ROID").build());
|
newDomainApplication("non-free-update.tld").asBuilder().setRepoId("1-ROID").build());
|
||||||
setEppInput("domain_update_sunrise_flags.xml", ImmutableMap.of("FEE", "12"));
|
setEppInput(
|
||||||
|
"domain_update_sunrise_fee.xml",
|
||||||
|
ImmutableMap.of("DOMAIN", "non-free-update.tld", "AMOUNT", "12"));
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
thrown.expect(FeesMismatchException.class);
|
thrown.expect(FeesMismatchException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
|
|
31
javatests/google/registry/flows/domain/testdata/domain_update_sunrise_fee.xml
vendored
Normal file
31
javatests/google/registry/flows/domain/testdata/domain_update_sunrise_fee.xml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>%DOMAIN%</domain:name>
|
||||||
|
<domain:add>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns2.example.tld</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
</domain:add>
|
||||||
|
<domain:rem>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns1.example.tld</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
</domain:rem>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<launch:update xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
|
||||||
|
<launch:phase name="landrush">sunrise</launch:phase>
|
||||||
|
<launch:applicationID>1-ROID</launch:applicationID>
|
||||||
|
</launch:update>
|
||||||
|
<fee:update xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:fee>%AMOUNT%</fee:fee>
|
||||||
|
</fee:update>
|
||||||
|
</extension>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue