예제 #1
0
        public KlarnaCreateCaptureOrderResponse CreateKlarnaCaptureOrder(KlarnaCreateCaptureOrderRequest request)
        {
            var res = _client.CreateCaptureOrder(MakeCaptureOrderRequest(request));

            KlarnaCreateCaptureOrderResponse response = new KlarnaCreateCaptureOrderResponse
            {
                CaptureId         = res.CaptureId,
                ErrorMessage      = res.ErrorMessage,
                KlarnaOrderStatus = res.IsSuccess ? "Created" : "Failed"
            };

            return(response);
        }
예제 #2
0
        private CreateCaptureOrderRequest MakeCaptureOrderRequest(KlarnaCreateCaptureOrderRequest request)
        {
            CreateCaptureOrderRequest req = new CreateCaptureOrderRequest
            {
                KlarnaOrderId = request.KlarnaOrderId,

                CaptureData = new OrderManagementCreateCapture
                {
                    CapturedAmount = int.Parse(request.CapturedAmount.ToString("0.00").Replace(".", "").Replace(",", "")),
                    Description    = request.Description
                }
            };

            return(req);
        }