public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is TerminalRefund other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((RefundId == null && other.RefundId == null) || (RefundId?.Equals(other.RefundId) == true)) && ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) && ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) && ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) && ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) && ((DeviceId == null && other.DeviceId == null) || (DeviceId?.Equals(other.DeviceId) == true)) && ((DeadlineDuration == null && other.DeadlineDuration == null) || (DeadlineDuration?.Equals(other.DeadlineDuration) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((CancelReason == null && other.CancelReason == null) || (CancelReason?.Equals(other.CancelReason) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true))); }
public override int GetHashCode() { int hashCode = 2064570648; if (PaymentId != null) { hashCode += PaymentId.GetHashCode(); } if (Type != null) { hashCode += Type.GetHashCode(); } if (AmountMoney != null) { hashCode += AmountMoney.GetHashCode(); } if (FeeMoney != null) { hashCode += FeeMoney.GetHashCode(); } return(hashCode); }
public override int GetHashCode() { int hashCode = 1278947048; if (PaymentId != null) { hashCode += PaymentId.GetHashCode(); } if (Type != null) { hashCode += Type.GetHashCode(); } if (Reason != null) { hashCode += Reason.GetHashCode(); } if (RefundedMoney != null) { hashCode += RefundedMoney.GetHashCode(); } if (RequestIdempotenceKey != null) { hashCode += RequestIdempotenceKey.GetHashCode(); } return(hashCode); }
public async Task CancelUnsignedTx(int paymendId) { var req = new PaymentId(); req.Id = paymendId; await client.CancelTxAsync(req); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is V1Refund other && ((Context == null && other.Context == null) || (Context?.Equals(other.Context) == true)) && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) && ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) && ((RefundedMoney == null && other.RefundedMoney == null) || (RefundedMoney?.Equals(other.RefundedMoney) == true)) && ((RefundedProcessingFeeMoney == null && other.RefundedProcessingFeeMoney == null) || (RefundedProcessingFeeMoney?.Equals(other.RefundedProcessingFeeMoney) == true)) && ((RefundedTaxMoney == null && other.RefundedTaxMoney == null) || (RefundedTaxMoney?.Equals(other.RefundedTaxMoney) == true)) && ((RefundedAdditiveTaxMoney == null && other.RefundedAdditiveTaxMoney == null) || (RefundedAdditiveTaxMoney?.Equals(other.RefundedAdditiveTaxMoney) == true)) && ((RefundedAdditiveTax == null && other.RefundedAdditiveTax == null) || (RefundedAdditiveTax?.Equals(other.RefundedAdditiveTax) == true)) && ((RefundedInclusiveTaxMoney == null && other.RefundedInclusiveTaxMoney == null) || (RefundedInclusiveTaxMoney?.Equals(other.RefundedInclusiveTaxMoney) == true)) && ((RefundedInclusiveTax == null && other.RefundedInclusiveTax == null) || (RefundedInclusiveTax?.Equals(other.RefundedInclusiveTax) == true)) && ((RefundedTipMoney == null && other.RefundedTipMoney == null) || (RefundedTipMoney?.Equals(other.RefundedTipMoney) == true)) && ((RefundedDiscountMoney == null && other.RefundedDiscountMoney == null) || (RefundedDiscountMoney?.Equals(other.RefundedDiscountMoney) == true)) && ((RefundedSurchargeMoney == null && other.RefundedSurchargeMoney == null) || (RefundedSurchargeMoney?.Equals(other.RefundedSurchargeMoney) == true)) && ((RefundedSurcharges == null && other.RefundedSurcharges == null) || (RefundedSurcharges?.Equals(other.RefundedSurcharges) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((ProcessedAt == null && other.ProcessedAt == null) || (ProcessedAt?.Equals(other.ProcessedAt) == true)) && ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) && ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) && ((IsExchange == null && other.IsExchange == null) || (IsExchange?.Equals(other.IsExchange) == true))); }
public override int GetHashCode() { int hash = 1; if (groupBookingId_ != null) { hash ^= GroupBookingId.GetHashCode(); } if (paymentId_ != null) { hash ^= PaymentId.GetHashCode(); } if (reservationId_ != null) { hash ^= ReservationId.GetHashCode(); } if (amount_ != null) { hash ^= Amount.GetHashCode(); } if (State != 0) { hash ^= State.GetHashCode(); } return(hash); }
private void LogInput(PaymentRequest command, PaymentId paymentId) { _logger.Log(LogLevel.Information, $"Call Acquirer Bank : " + $"Amount : {command.AmountToCharge.Amount} {command.AmountToCharge.Currency.ToString()}" + $"Reference : {paymentId}"); }
public async Task <PaymentDto> ExecuteQueryAsync(GetPaymentQuery query, CancellationToken cancellationToken) { var paymentId = PaymentId.With(query.PaymentId).Value; var readModel = await _readStore.GetAsync(paymentId, cancellationToken).ConfigureAwait(false); return(readModel.ReadModel.ToPaymentDto()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is PaymentRefund other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) && ((AppFeeMoney == null && other.AppFeeMoney == null) || (AppFeeMoney?.Equals(other.AppFeeMoney) == true)) && ((ProcessingFee == null && other.ProcessingFee == null) || (ProcessingFee?.Equals(other.ProcessingFee) == true)) && ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) && ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) && ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true))); }
public override int GetHashCode() { int hash = 1; if (groupBookingIndicator_ != null) { hash ^= GroupBookingIndicator.GetHashCode(); } if (paymentId_ != null) { hash ^= PaymentId.GetHashCode(); } if (PaymentDate.Length != 0) { hash ^= PaymentDate.GetHashCode(); } if (PaymentReference.Length != 0) { hash ^= PaymentReference.GetHashCode(); } if (PaymentType.Length != 0) { hash ^= PaymentType.GetHashCode(); } if (creditAmount_ != null) { hash ^= CreditAmount.GetHashCode(); } return(hash); }
public async Task When_AddPaymentCommand_Get_Subscription_Corresponding_To_CreditCard() { var subId = CreditCardSubscriptionId.NewId(); var creditCard = new CreditCard(CreditCardId.NewId(), subId, DateTimeOffset.Now); var repo = A.Fake <IAggregateRepository <CreditCard> >(); A.CallTo(() => repo.GetByIdAsync(creditCard.Id)) .Returns(creditCard); var subRepository = A.Fake <IAggregateRepository <CreditCardSubscription> >(); var sub = new CreditCardSubscription(subId, DateTimeOffset.Now, new CreditCardSubscriptionName("gold")); sub.UseNoPaymentFee(DateTimeOffset.Now); A.CallTo(subRepository) .WithReturnType <Task <CreditCardSubscription> >() .Returns(sub); var sut = new AddPaymentCommandHandler(repo, subRepository); await sut.Handle(new AddPaymentCommand { AggregateId = creditCard.Id, Payment = new Payment(PaymentId.NewId(), Money.CreateAUD(200), DateTimeOffset.Now) }, CancellationToken.None); A.CallTo(() => subRepository.GetByIdAsync(subId)) .MustHaveHappenedOnceExactly(); A.CallTo(() => repo.SaveAsync(A <CreditCard> ._, A <long> ._)) .MustHaveHappenedOnceExactly(); }
public override async Task <Guid> ExecuteCommand(MakePaymentCommand command, CancellationToken cancellationToken) { var paymentId = new PaymentId(command.PaymentId); var payment = await _unitOfWork.Payments .GetById(paymentId, cancellationToken); if (payment == null) { throw new ApplicationDataException("Payment not found."); } if (payment.OrderId.Value == Guid.Empty) { throw new ApplicationDataException("Order not found."); } try { // Making a fake payment // (here we could call a financial institution service and use the customer billing info) var paymentSuccess = MakePayment(payment); if (paymentSuccess) { payment.MarkAsPaid(); } } catch (Exception) { throw; } return(payment.Id.Value); }
public override int GetHashCode() { int hashCode = -682129491; if (IdempotencyKey != null) { hashCode += IdempotencyKey.GetHashCode(); } if (AmountMoney != null) { hashCode += AmountMoney.GetHashCode(); } if (AppFeeMoney != null) { hashCode += AppFeeMoney.GetHashCode(); } if (PaymentId != null) { hashCode += PaymentId.GetHashCode(); } if (Reason != null) { hashCode += Reason.GetHashCode(); } return(hashCode); }
public override int GetHashCode() { int hash = 13; hash += (hash * 43) + PaymentId.GetHashCode(); return(hash); }
public async Task <PaymentView> GetById(PaymentId id) { var tableResult = await _azTableHelper.RetrieveAsync(id.IdAsString(), id.IdAsString(), _table); var paymentView = _mapper.Map <PaymentView>(tableResult.Result); return(paymentView); }
public void Handle(PayDepositCommand payDepositCommand) { var paymentId = PaymentId.From(payDepositCommand.AgreementId); var payment = _paymentRepository.Get(paymentId); var accountId = AccountOwnerId.From(payDepositCommand.TenantId); var title = Title.From("Deposit payment"); _paymentService.PayDeposit(accountId, title, payment, paymentId); }
/// <summary> /// Gets the details of an individual payment /// </summary> /// <param name="merchantId">The merchant id</param> /// <param name="paymentId">The payment id</param> /// <returns>A paymentItem object</returns> public async Task <PaymentItem> GetPaymentByPaymentId(MerchantId merchantId, PaymentId paymentId) { PaymentItem payment = await DataAccess.GetPaymentByPaymentId(merchantId, paymentId).ConfigureAwait(false); payment.PaymentCard.CardNumber = "**** **** **** ****"; payment.PaymentCard.Cvv = 000; return(payment); }
public async Task SimulatePaymentDue(PaymentDueRequest request) { var payment = await _queryProcessor.ProcessAsync(new GetPaymentByInvoiceIdQuery(request.InvoiceId), CancellationToken.None); if (payment == null) { throw new ArgumentException($"No payment found for invoice {request.InvoiceId}"); } await _commandBus.PublishAsync(new PaymentDueCommand(PaymentId.With(payment.PaymentId), payment.InvoiceId), CancellationToken.None); }
public static AddPaymentCommand ToPaymentCommand(this AddPaymentModel model, CreditCardId cardId, ISystemClock clock, CurrencyCode currencyCode) { return(new AddPaymentCommand { Occured = clock.Now, AggregateId = cardId, Payment = new Payment(PaymentId.NewId(), Money.Create(model.Amount, currencyCode), model.Date) }); }
public static Payment Create(IProvideDateTime dateProvider) { var expiryDate = ExpiryDate.Create(08, 2020, dateProvider); var cardNumber = CardNumber.Create("4111 1111 1111 1111"); var ccv = Ccv.Create(123); var paymentId = PaymentId.Create(); var creditCard = CreditCard.Create(cardNumber, expiryDate, ccv); var amount = Money.Create(12, Currency.EUR); return(new Payment(paymentId, creditCard, amount)); }
public async Task <PaymentId> CreatePayment(string cardNumber, int ccv, int expiryMonthDate, int expiryYearDate, double amount, Currency currency) { var card = CreditCard.Create(CardNumber.Create(cardNumber), ExpiryDate.Create(expiryMonthDate, expiryYearDate, _dateProvider), Ccv.Create(ccv)); var money = Money.Create(amount, currency); var payment = new Payment(PaymentId.Create(), card, money); await _paymentRepository.Save(payment); return(payment.Id); }
/// <summary> /// Update Payment Status /// </summary> /// <param name="paymentId"></param> /// <param name="paymentStatus"></param> /// <returns></returns> public Task <PaymentId> UpdatePaymentStatusAsync(PaymentId paymentId, PaymentStatus paymentStatus) { var entity = GetPaymentById(paymentId); if (entity == null) { throw new Exception($"update error for {paymentId.ToGuid()}"); } entity.Status = (byte)paymentStatus; return(Task.FromResult(paymentId)); }
public void When_No_Fee_Apply_do_not_add_Additional_Transaction() { var fee = Money.CreateAUD(1337); var sut = CreateSut(); var card = CreateCard(subscriptionId: sut.Id); sut.UseNoPaymentFee(DateTimeOffset.Now); sut.AddTransactionTo(card, new Payment(PaymentId.NewId(), Money.CreateAUD(200), DateTimeOffset.Now), DateTimeOffset.Now); Assert.False(card.GetUncommittedChanges().OfType <CreditCardTransactionAdded>() .Any(x => x.Transaction.Type == TransactionType.Fee)); }
private async Task <ResultDto> CallBank(PaymentRequest command, PaymentId paymentId) { var resultDto = await _acquiringBankGateway.AuthorizePaymentAsync(new BankPaymentDto { Amount = command.AmountToCharge.Amount, Currency = command.AmountToCharge.Currency.ToString(), CardNumber = command.Card.CardNumber.GetUnMaskerCardNumber(), Cvv = command.Card.Cvv, ExpirationDate = command.Card.ExpirationDate, Reference = paymentId }); return(resultDto); }
public async Task <OptionAsync <Payment> > GetAsync(MerchantId merchantId, PaymentId paymentId) { if (!Databag.ContainsKey(paymentId)) { return(OptionAsync <Payment> .None); } Payment payment = Databag[paymentId]; if (payment.MerchantId != merchantId) { return(OptionAsync <Payment> .None); } return(await Task.FromResult(OptionAsync <Payment> .Some(payment))); }
public PaymentProcessorTests() { var today = new DateTimeOffset(new DateTime(2019, 08, 19, 0, 0, 0, DateTimeKind.Utc)); var dateProvider = Substitute.For <IProvideDateTime>(); dateProvider.UtcNow().Returns(today); var payment = PaymentFactory.Create(dateProvider); _paymentId = payment.Id; _paymentService = Substitute.For <IPaymentService>(); _bank = Substitute.For <IAcquiringBank>(); _paymentRepo = Substitute.For <IAggregateRepository <Payment, PaymentId> >(); _paymentRepo.Get(Arg.Is(_paymentId)).Returns(payment); }
/// <summary> /// Gets the details of a payment by Id /// </summary> /// <param name="merchantId"></param> /// <param name="paymentId"></param> /// <returns></returns> public async Task <PaymentItem> GetPaymentByPaymentId(MerchantId merchantId, PaymentId paymentId) { await using PaymentControllerDbContext context = DbContextProvider.Create(); Model.PaymentItem payment = await context.Payments.Include(c => c.PaymentCard) .Include(p => p.PaymentCustomer).FirstOrDefaultAsync( p => p.PaymentMerchant.Equals(new Model.Merchant() { MerchantId = merchantId.UUID }) && p.PaymentId.Equals(paymentId.UUID) ).ConfigureAwait(false); return(payment.ToDto()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is V1SettlementEntry other && ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) && ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) && ((FeeMoney == null && other.FeeMoney == null) || (FeeMoney?.Equals(other.FeeMoney) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CreateRefundRequest other && ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) && ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) && ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) && ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true))); }
protected void PrepareOutputParameters(CodeActivityContext executionContext, BasePaymentResponse apiResponse, ITracingService tracingService) { tracingService.Trace("PrepareOutputParameters()"); var status = string.IsNullOrEmpty(apiResponse.state?.status) ? string.Empty : apiResponse.state?.status; tracingService.Trace("PrepareOutputParameters() status = {0}", status); PaymentStatus.Set(executionContext, status); var id = string.IsNullOrEmpty(apiResponse.payment_id) ? string.Empty : apiResponse.payment_id; tracingService.Trace("PrepareOutputParameters() payment_id = {0}", id); PaymentId.Set(executionContext, id); var finished = (apiResponse.state?.finished == null) ? false : apiResponse.state?.finished; tracingService.Trace("PrepareOutputParameters() finished = {0}", apiResponse.state?.finished); PaymentFinished.Set(executionContext, apiResponse.state?.finished); var href = string.IsNullOrEmpty(apiResponse._links?.next_url?.href) ? string.Empty : apiResponse._links?.next_url?.href; tracingService.Trace("PrepareOutputParameters() apiResponse._links?.next_url.href) = {0}", href); PaymentNextUrlHref.Set(executionContext, href); var method = string.IsNullOrEmpty(apiResponse._links?.next_url?.method) ? string.Empty : apiResponse._links?.next_url?.method; tracingService.Trace("PrepareOutputParameters() apiResponse._links?.next_url.method = {0}", method); PaymentNextUrlMethod.Set(executionContext, method); var cancelhref = string.IsNullOrEmpty(apiResponse._links?.cancel?.href) ? string.Empty : apiResponse._links?.cancel?.href; tracingService.Trace("PrepareOutputParameters() cancel.href = {0}", cancelhref); PaymentCancelUrlHref.Set(executionContext, cancelhref); var cancelmethod = string.IsNullOrEmpty(apiResponse._links?.cancel?.method) ? string.Empty : apiResponse._links?.cancel?.method; tracingService.Trace("PrepareOutputParameters() cancel.method = {0}", cancelmethod); PaymentCancelUrlMethod.Set(executionContext, cancelmethod); var provider = string.IsNullOrEmpty(apiResponse.payment_provider) ? string.Empty : apiResponse.payment_provider; tracingService.Trace("PrepareOutputParameters() payment_provider = {0}", provider); PaymentProvider.Set(executionContext, provider); }