com.yandex.money.api.methods.params.PhoneParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ym-java-epr-sdk Show documentation
Show all versions of ym-java-epr-sdk Show documentation
This Java library contains classes that allows you to do payments using Yandex.Money public API.
The newest version!
package com.yandex.money.api.methods.params;
import com.yandex.money.api.utils.Strings;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Convenience class for phone top up parameters.
*
* @author Dmitriy Melnikov ([email protected])
*/
public class PhoneParams implements Params {
public static final String PATTERN_ID = "phone-topup";
private static final String PARAM_PHONE_NUMBER = "phone-number";
private static final String PARAM_AMOUNT = "amount";
private final String number;
private final BigDecimal amount;
/**
* Constructor.
*
* @param number phone number
* @param amount top up amount
*/
public PhoneParams(String number, BigDecimal amount) {
if (Strings.isNullOrEmpty(number))
throw new IllegalArgumentException(PARAM_PHONE_NUMBER + " is null or empty");
this.number = number;
if (amount == null)
throw new IllegalArgumentException(PARAM_AMOUNT + " is null or empty");
this.amount = amount;
}
@Override
public Map makeParams() {
Map result = new HashMap();
result.put(PARAM_PHONE_NUMBER, number);
result.put(PARAM_AMOUNT, amount.toPlainString());
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy