コード例 #1
0
 public SA_AmazonReceipt(PurchaseReceipt data)
 {
     _sku          = data.Sku;
     _productType  = data.ProductType;
     _receiptId    = data.ReceiptId;
     _purchaseDate = data.PurchaseDate;
     _cancelDate   = data.CancelDate;
 }
コード例 #2
0
 public OrderReceiptEmail(ICommunicationUser to, Order order, IEnumerable <Product> orderProducts, IEnumerable <Credit> orderPrimaryCredits, IEnumerable <ProductCreditAdjustment> orderPrimaryAdjustments, PurchaseReceipt receipt)
     : base(to)
 {
     _order       = order;
     _products    = orderProducts.ToArray();
     _credits     = orderPrimaryCredits.ToArray();
     _adjustments = orderPrimaryAdjustments.ToArray();
     _receipt     = receipt;
 }
コード例 #3
0
        private void NotifyFullfillment(PurchaseReceipt receipt, bool fulfilled)
        {
            var notify_fulfillment = new NotifyFulfillmentInput {
                ReceiptId         = receipt.ReceiptId,
                FulfillmentResult = fulfilled ? "FULFILLED" : "UNAVAILABLE"
            };

            this.amazonIapV2.NotifyFulfillment(notify_fulfillment);
        }
コード例 #4
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        //args.purchasedProduct.receipt

        PurchaseReceipt tempReceipt = JsonUtility.FromJson <PurchaseReceipt>(args.purchasedProduct.receipt);

                #if UNITY_ANDROID
        GooglePayload tempGooglelPayload = JsonUtility.FromJson <GooglePayload>(tempReceipt.Payload);
        mStrReceiptJSON = tempGooglelPayload.json;
        GooglePayloadJson tempGooglePayloadJson = JsonUtility.FromJson <GooglePayloadJson>(tempGooglelPayload.json);
        if (tempGooglePayloadJson.developerPayload != null)
        {
            StartCoroutine(PostPayloadValidation(token, tempGooglePayloadJson.developerPayload, ValidSuccessDeveloperPayloadCallback));
        }
        else
        {
            StartCoroutine(PostReceiptValidation(token, mStrReceiptJSON, () => {
                PrintConsole("Receipt is valid");
            }));
        }
                #elif UNITY_IOS
        StartCoroutine(PostReceiptValidation(token, tempReceipt.Payload, () => {
            PrintConsole("Receipt is valid");
        }));
                #endif

        // A consumable product has been purchased by this user.
        // if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
        // {
        //     PrintConsole(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        //     // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
        //     ScoreManager.score += 100;
        // }
        // // Or ... a non-consumable product has been purchased by this user.
        // else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
        // {
        //     PrintConsole(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        //     // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
        // }
        // // Or ... a subscription product has been purchased by this user.
        // else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
        // {
        //     PrintConsole(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        //     // TODO: The subscription item has been successfully purchased, grant this to the player.
        // }
        // // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        // else
        // {
        //     PrintConsole(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        // }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
コード例 #5
0
        /// <summary>
        /// 选择DataGridView时赋值输入控件
        /// </summary>
        /// <param name="pur"></param>
        void SelectDgv(PurchaseReceipt pur)
        {
            ip_ProductQuantity1.Value = pur.ProductQuantity1;
            TxtBox_note.Text          = pur.note;

            TxtBox_PurchaseReceiptID.Text      = pur.PurchaseReceiptID;
            TxtBox_PurchaseNo.Text             = pur.PurchaseNo;
            TxtBox_SupplierName.Text           = pur.SupplierName;
            TxtBox_BatchNo.Text                = pur.BatchNo;
            TxtBox_MaterialCode.Text           = pur.MaterialCode;
            TxtBox_MaterialName.Text           = pur.MaterialName;
            TxtBox_MaterialSpecifications.Text = pur.MaterialSpecifications;
            ip_ProductQuantity.Value           = pur.ProductQuantity;

            dti_Updatetime.Value = pur.Updatetime;
        }
コード例 #6
0
        public static int CreateReceipt(Guid userId, long transactionId, string vendorTransactionId, TransactionType transactionType, TransactionProvider provider, TransactionStatus transactionStatus)
        {
            int receiptId = 0;

            using (var context = new OnStoreEntities())
            {
                PurchaseReceipt receipt = context.PurchaseReceipt.Create();
                receipt.TransactionId       = transactionId;
                receipt.UserId              = userId;
                receipt.VendorTransactionId = vendorTransactionId;
                receipt.TransactionStatus   = (byte)transactionStatus;
                receipt.TransactionProvider = (byte)provider;
                receipt.TransactionType     = (byte)transactionType;
                receipt.CreatedDate         = DateTime.UtcNow;
                context.PurchaseReceipt.Add(receipt);
                if (context.SaveChanges() > 0)
                {
                    return(receipt.PurchaseReceiptId);
                }
            }
            return(receiptId);
        }
コード例 #7
0
        void IOrdersHandler.OnOrderPurchased(Order order, PurchaseReceipt receipt)
        {
            var allProducts = _productsQuery.GetProducts();

            // Reorder the items by primary credit description just to introduce some certainty.

            order.Items = (from i in order.Items
                           join p in allProducts on i.ProductId equals p.Id
                           let a = p.GetPrimaryCreditAdjustment()
                                   let c = a == null ? null : _creditsQuery.GetCredit(a.CreditId)
                                           orderby c == null ? "" : c.Description
                                           select i).ToList();

            // Grab the list of products selected.

            var orderProducts = (from i in order.Items
                                 join p in allProducts on i.ProductId equals p.Id
                                 select p).ToList();

            // Grab the list of primary properties.

            var orderPrimaryCredits = (from p in orderProducts
                                       let a = p.GetPrimaryCreditAdjustment()
                                               where a != null
                                               select _creditsQuery.GetCredit(a.CreditId)).ToList();
            var orderPrimaryAdjustments = (from p in orderProducts
                                           let a = p.GetPrimaryCreditAdjustment()
                                                   where a != null
                                                   select a).ToList();

            // Grab the purchaser, who is being sent the email.

            var purchaser = _employersQuery.GetEmployer(order.PurchaserId);

            _emailsCommand.TrySend(new OrderReceiptEmail(purchaser, order, orderProducts, orderPrimaryCredits, orderPrimaryAdjustments, receipt));
        }
コード例 #8
0
        public override void OnOperationSave(bool askForConfirmation)
        {
            #region Prepare the purchase object

            if (!OperationValidate())
            {
                return;
            }

            if (!OperationDetailsValidate(true))
            {
                return;
            }

            #endregion

            if (!TryApplyRules())
            {
                return;
            }

            bool printPayment;
            using (EditNewPayment dialogFinalize = new EditNewPayment(operation)) {
                if (dialogFinalize.Run() != ResponseType.Ok)
                {
                    ClearDetailsFromPriceRules(true);
                    return;
                }
                printPayment = dialogFinalize.PrintDocument;
            }

            if (!PriceRule.ApplyOnPaymentSet(operation))
            {
                return;
            }

            try {
                var newPayments = GetAllNewPayments(printPayment);
                PrepareOpertionForSaving();
                CommitOperation();
                PrintAllNewPayments(newPayments);
            } catch (InsufficientItemAvailabilityException ex) {
                MessageError.ShowDialog(string.Format(Translator.GetString("The purchase cannot be saved due to insufficient quantities of item \"{0}\"."), ex.ItemName),
                                        ErrorSeverity.Warning, ex);
                ClearDetailsFromPriceRules();
                EditGridField(ex.ItemName);
                return;
            } catch (Exception ex) {
                MessageError.ShowDialog(Translator.GetString("An error occurred while saving purchase document!"),
                                        ErrorSeverity.Error, ex);
                ClearDetailsFromPriceRules(true);
                return;
            }

            ApplyFinalPriceRules();

            if (BusinessDomain.AppConfiguration.AutoCreateInvoiceOnPurchase && !editMode &&
                WaitForPendingOperationCompletion())
            {
                using (EditNewInvoice dlgInvoice = new EditNewInvoice(operation))
                    dlgInvoice.Run();
            }

            #region Ask to print a document

            bool printReceipt = false;

            if (BusinessDomain.AppConfiguration.IsPrintingAvailable() && BusinessDomain.WorkflowManager.AllowPurchaseReceiptPrint(operation, false))
            {
                if (BusinessDomain.AppConfiguration.AskBeforeDocumentPrint == AskDialogState.NotSaved)
                {
                    using (MessageYesNoRemember dialogPrint = new MessageYesNoRemember(
                               Translator.GetString("Print document"), string.Empty,
                               Translator.GetString("Do you want to print a stock receipt?"), "Icons.Question32.png")) {
                        ResponseType resp = dialogPrint.Run();
                        if (resp == ResponseType.Yes)
                        {
                            printReceipt = true;
                        }

                        if (dialogPrint.RememberChoice)
                        {
                            BusinessDomain.AppConfiguration.AskBeforeDocumentPrint = resp == ResponseType.Yes ? AskDialogState.Yes : AskDialogState.No;
                        }
                    }
                }
                else if (BusinessDomain.AppConfiguration.AskBeforeDocumentPrint == AskDialogState.Yes)
                {
                    printReceipt = true;
                }
            }

            if (printReceipt && WaitForPendingOperationCompletion())
            {
                try {
                    PurchaseReceipt receipt = new PurchaseReceipt(operation);
                    FormHelper.PrintPreviewObject(receipt);
                } catch (Exception ex) {
                    MessageError.ShowDialog(
                        Translator.GetString("An error occurred while generating stock receipt!"),
                        ErrorSeverity.Error, ex);
                }
            }

            #endregion

            OnOperationSaved();

            if (editMode)
            {
                OnPageClose();
            }
            else
            {
                ReInitializeForm(null);
            }
        }
コード例 #9
0
 private Purchase(PurchaseData purchaseData, string jsonPurchaseData, string signature)
 {
     _purchaseData    = purchaseData;
     _identifiers     = new Identifiers(_purchaseData.obfuscatedAccountId, _purchaseData.obfuscatedProfileId);
     _purchaseReceipt = new PurchaseReceipt(jsonPurchaseData, signature);
 }
コード例 #10
0
ファイル: PublishedEvents.cs プロジェクト: formist/LinkMe
 public OrderPurchasedEventArgs(Order order, PurchaseReceipt receipt)
 {
     Order   = order;
     Receipt = receipt;
 }