private void addToList(bool isWriteToFile, List <MoneyInput> list, String muc, String ngay, String khoan, String money) { // ADD TO LIST MoneyInput moneyInput = new MoneyInput(ngay, khoan, money); list.Add(moneyInput); // PRINT OUT TABLE ListViewItem item = new ListViewItem(); item.SubItems.Add(muc); item.SubItems.Add(ngay); item.SubItems.Add(khoan); item.SubItems.Add(money); Lst_AllData.Items.Add(item); // append to file if (isWriteToFile) { appendData(getDataLine(muc, ngay, khoan, money)); } }
public void TestCheckoutCompleteWithTokenizedPaymentV2() { MutationQuery query = new MutationQuery(); string checkoutId = "an-id"; var billingAddress = new MailingAddressInput("123 Test Street", "456", "Toronto", "Shopify", "Canada", "First", "Last", "1234567890", "Ontario", "A1B2C3"); var paymentAmount = new MoneyInput(new decimal(1), CurrencyCode.CAD); var tokenizedPaymentInputV2 = new TokenizedPaymentInputV2( paymentAmount: paymentAmount, idempotencyKey: "unique_id", billingAddress: billingAddress, paymentData: "some_utf8_data_string", type: "apple_pay" ); DefaultQueries.checkout.CheckoutCompleteWithTokenizedPaymentV2(query, checkoutId, tokenizedPaymentInputV2); Assert.AreEqual( "mutation{checkoutCompleteWithTokenizedPaymentV2 (checkoutId:\"an-id\",payment:{paymentAmount:{amount:1,currencyCode:CAD},idempotencyKey:\"unique_id\",billingAddress:{address1:\"123 Test Street\",address2:\"456\",city:\"Toronto\",company:\"Shopify\",country:\"Canada\",firstName:\"First\",lastName:\"Last\",phone:\"1234567890\",province:\"Ontario\",zip:\"A1B2C3\"},type:\"apple_pay\",paymentData:\"some_utf8_data_string\"}){checkout {id webUrl currencyCode requiresShipping subtotalPrice totalTax totalPrice ready }payment {checkout {id webUrl currencyCode requiresShipping subtotalPrice totalTax totalPrice ready completedAt }errorMessage id ready }userErrors {field message }}}", query.ToString() ); }
public void FetchApplePayCheckoutStatusForToken(string serializedMessage) { var checkout = CartState.CurrentCheckout; var message = NativeMessage.CreateFromJSON(serializedMessage); var paymentAmount = new MoneyInput(checkout.totalPriceV2().amount(), checkout.currencyCode()); var payment = new NativePayment(message.Content); var tokenizedPaymentInputV2 = new TokenizedPaymentInputV2( paymentAmount: paymentAmount, billingAddress: payment.BillingAddress, idempotencyKey: payment.TransactionIdentifier, paymentData: payment.PaymentData, type: "apple_pay" ); Action performCheckout = () => { CheckoutWithTokenizedPaymentV2(tokenizedPaymentInputV2, checkout, (ApplePayEventResponse errorResponse) => { if (errorResponse == null) { message.Respond((new ApplePayEventResponse(ApplePayAuthorizationStatus.Success)).ToJsonString()); } else { message.Respond(errorResponse.ToJsonString()); } }); }; SetFinalCheckoutFieldsForPayment(payment, checkout, (ApplePayEventResponse errorResponse) => { if (errorResponse == null) { performCheckout(); } else { message.Respond(errorResponse.ToJsonString()); } }); }