public SinglePaymentResult CreateSinglePayment(long alias, decimal amount, DateTime payDate, PaymentType payType) { var paymentResult = new SinglePaymentResult(); try { var result = modClient.CreatePayment( this.clientId, this.clientCode, alias, payDate, (int)payType, amount); paymentResult.TransactionId = result; switch (result) { case -1: paymentResult.ErrorMessage = "Authentication with Modpay failed"; break; case -2: paymentResult.ErrorMessage = "Customer alias not found."; break; case -3: paymentResult.ErrorMessage = "An ACH payment was specified, but the customer has no bank account information."; break; case -4: paymentResult.ErrorMessage = "A Credit Card payment was specified, but the customer record contains no credit card."; break; case -5: paymentResult.ErrorMessage = "Customer's credit card number is not a known or supported type."; break; case -6: paymentResult.ErrorMessage = "Invalid payment type."; break; //worked! The value is the transactionId. default: paymentResult.Accepted = true; break; } } catch (Exception exc) { paymentResult = new SinglePaymentResult() { Accepted = false, ServiceUnavailable = true, ErrorMessage = exc.Message, }; } return(paymentResult); }
public SinglePaymentResult CreateSinglePayment(long alias, decimal amount, DateTime payDate, PaymentType payType) { var paymentResult = new SinglePaymentResult(); try { var result = modClient.CreatePayment( this.clientId, this.clientCode, alias, payDate, (int)payType, amount); paymentResult.TransactionId = result; switch(result) { case -1: paymentResult.ErrorMessage = "Authentication with Modpay failed"; break; case -2: paymentResult.ErrorMessage = "Customer alias not found."; break; case -3: paymentResult.ErrorMessage = "An ACH payment was specified, but the customer has no bank account information."; break; case -4: paymentResult.ErrorMessage = "A Credit Card payment was specified, but the customer record contains no credit card."; break; case -5: paymentResult.ErrorMessage = "Customer's credit card number is not a known or supported type."; break; case -6: paymentResult.ErrorMessage = "Invalid payment type."; break; //worked! The value is the transactionId. default: paymentResult.Accepted = true; break; } } catch(Exception exc) { paymentResult = new SinglePaymentResult() { Accepted = false, ServiceUnavailable = true, ErrorMessage = exc.Message, }; } return paymentResult; }