GithubHelp home page GithubHelp logo

arambazamba / az-native Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 3.0 22.23 MB

Designing & Implementing Cloud Native Applications using Microsoft Azure

License: Other

PowerShell 1.73% Shell 0.23% Bicep 1.85% C# 46.91% TypeScript 36.18% HTML 7.03% SCSS 4.87% JavaScript 0.66% Dockerfile 0.44% CSS 0.10%
azure azure-container-apps cloud-native containers dapr

az-native's Introduction

header

Ask me about:

  • Cloud Native Apps, Azure Container Apps & Dapr
  • Azure DevOps & Infrastructure as Code
  • Angular & Micro-Frontends
  • Azure AI Studio, OpenAI, Semantic Kernel
  • Microsoft Graph & Identity Platform
  • Microsoft 365, Teams & SharePoint Development

arambazamba's Stats

az-native's People

Contributors

arambazamba avatar

Stargazers

 avatar

Watchers

 avatar

az-native's Issues

payment - move to repsitory

// http://localhost:PORT/payment/create
[HttpPost()]
[Route("create")]
[Dapr.Topic("food-pubsub", "payment-requests-topic")]
public async Task AddPayment(OrderEvent evt)
{
Console.WriteLine($"Received payment request for order: {evt.OrderId}", evt);
PaymentRequest paymentRequest = Newtonsoft.Json.JsonConvert.DeserializeObject<PaymentRequest>(evt.Data.ToString());
if (paymentRequest != null)
{
// When using transactional Outbox pattern, we need to add the payment to the database
// We then could use Cosmos Change feed to execute the payment against our dapr bank service
// PaymentTransaction payment = new PaymentTransaction()
// {
// Id = Guid.NewGuid().ToString(),
// CustomerId = evt.CustomerId,
// OrderId = paymentRequest.OrderId,
// PaymentInfo = paymentRequest.PaymentInfo,
// Amount = paymentRequest.Amount,
// Status = "Pending"
// };
// await this.payment.AddPaymentAsync(payment);
// To keep things simple we will just execute the payment against our dapr bank service
// Make sure to created the bank account with the same account number in advance
// You will find a sample in the bank client of the starter
var usersBank = ActorProxy.Create<IBankActor>(new ActorId(paymentRequest.PaymentInfo.AccountNumber), "BankActor");
var withdrawResp = await usersBank.Withdraw(new WithdrawRequest() { Amount = paymentRequest.Amount });
// Now we could issue a payment response just like we did in
PaymentResponse paymentResponse = new PaymentResponse()
{
OrderId = paymentRequest.OrderId,
Status = withdrawResp.Status,
Data = withdrawResp.Message
};
await daprClient.PublishEventAsync("food-pubsub", "payment-response-topic", paymentResponse);
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.