Search in sources :

Example 6 with SendSmsRequest

use of org.citrusframework.schema.samples.smsgateway.v1.SendSmsRequest in project vertx-zero by silentbalanceyh.

the class SmsClientImpl method send.

@Override
public SmsClient send(final String mobile, final String tplCode, final JsonObject params, final Handler<AsyncResult<JsonObject>> handler) {
    final SendSmsRequest request = this.getRequest(mobile, this.config.getTpl(tplCode), params);
    handler.handle(this.getResponse(request));
    return this;
}
Also used : SendSmsRequest(com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest)

Example 7 with SendSmsRequest

use of org.citrusframework.schema.samples.smsgateway.v1.SendSmsRequest in project sailfish-mfa by picos-io.

the class AliyunSmsSender method sendPasscode.

@Override
public void sendPasscode(String toPhoneNumber, String code) {
    SendSmsRequest request = new SendSmsRequest();
    try {
        request.setMethod(MethodType.POST);
        request.setSignName(signName);
        request.setTemplateCode(passcodeTemplate);
        request.setTemplateParam(String.format(PASSCODE_MESSAGE, code));
        request.setPhoneNumbers(toPhoneNumber);
        SendSmsResponse httpResponse = client.getAcsResponse(request);
    // TODO parse code
    } catch (ServerException e) {
        throw new SmsException(e);
    } catch (ClientException e) {
        throw new SmsException(e);
    }
}
Also used : ServerException(com.aliyuncs.exceptions.ServerException) SendSmsRequest(io.picos.sailfish.mfa.sms.repackage.com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest) ClientException(com.aliyuncs.exceptions.ClientException) SendSmsResponse(io.picos.sailfish.mfa.sms.repackage.com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse) SmsException(io.picos.sailfish.mfa.sms.exception.SmsException)

Aggregations

SendSmsRequest (com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest)5 SendSmsResponse (com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse)1 ClientException (com.aliyuncs.exceptions.ClientException)1 ServerException (com.aliyuncs.exceptions.ServerException)1 SmsException (io.picos.sailfish.mfa.sms.exception.SmsException)1 SendSmsRequest (io.picos.sailfish.mfa.sms.repackage.com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest)1 SendSmsResponse (io.picos.sailfish.mfa.sms.repackage.com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse)1 SendSmsRequest (org.citrusframework.schema.samples.smsgateway.v1.SendSmsRequest)1 Test (org.junit.Test)1