public void RefundRequest_OnValidRequestWithOptions_ReturnObjects() { // arrange const int refundAmount = 1000; const string posRefId = "test"; const bool suppressMerchantPassword = true; const string merchantReceiptHeader = ""; const string merchantReceiptFooter = "merchantfooter"; const string customerReceiptHeader = "customerheader"; const string customerReceiptFooter = ""; var options = new TransactionOptions(); options.SetMerchantReceiptFooter(merchantReceiptFooter); options.SetCustomerReceiptHeader(customerReceiptHeader); // act var request = new RefundRequest(refundAmount, posRefId, suppressMerchantPassword); request.Options = options; var msg = request.ToMessage(); // assert Assert.Equal(merchantReceiptHeader, msg.GetDataStringValue("merchant_receipt_header")); Assert.Equal(merchantReceiptFooter, msg.GetDataStringValue("merchant_receipt_footer")); Assert.Equal(customerReceiptHeader, msg.GetDataStringValue("customer_receipt_header")); Assert.Equal(customerReceiptFooter, msg.GetDataStringValue("customer_receipt_footer")); }
public void RefundRequest_OnValidRequestWithOptionsNone_ReturnObjects() { // arrange const int refundAmount = 1000; const string posRefId = "test"; const bool suppressMerchantPassword = true; // act var request = new RefundRequest(refundAmount, posRefId, suppressMerchantPassword); var msg = request.ToMessage(); // assert Assert.Equal("", msg.GetDataStringValue("merchant_receipt_header")); Assert.Equal("", msg.GetDataStringValue("merchant_receipt_footer")); Assert.Equal("", msg.GetDataStringValue("customer_receipt_header")); Assert.Equal("", msg.GetDataStringValue("customer_receipt_footer")); }
public void RefundRequest_OnValidRequest_ReturnObjects() { // arrange const int refundAmount = 1000; const string posRefId = "test"; const bool suppressMerchantPassword = true; // act var request = new RefundRequest(refundAmount, posRefId, suppressMerchantPassword); var msg = request.ToMessage(); // assert Assert.Equal("refund", msg.EventName); Assert.Equal(refundAmount, msg.GetDataIntValue("refund_amount")); Assert.Equal(posRefId, msg.GetDataStringValue("pos_ref_id")); Assert.Equal(suppressMerchantPassword, msg.GetDataBoolValue("suppress_merchant_password", false)); Assert.NotNull(request.Id); }
public void RefundRequest_OnValidRequestWithConfig_ReturnObjects() { // arrange const int refundAmount = 1000; const string posRefId = "test"; const bool suppressMerchantPassword = true; var config = new SpiConfig(); config.PrintMerchantCopy = true; config.PromptForCustomerCopyOnEftpos = false; config.SignatureFlowOnEftpos = true; // act var request = new RefundRequest(refundAmount, posRefId, suppressMerchantPassword); request.Config = config; var msg = request.ToMessage(); // assert Assert.Equal(config.PrintMerchantCopy, msg.GetDataBoolValue("print_merchant_copy", false)); Assert.Equal(config.PromptForCustomerCopyOnEftpos, msg.GetDataBoolValue("prompt_for_customer_copy", false)); Assert.Equal(config.SignatureFlowOnEftpos, msg.GetDataBoolValue("print_for_signature_required_transactions", false)); }