s15 wallet.pdf

Upload: edmundo-lozada

Post on 02-Apr-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 S15 Wallet.pdf

    1/45

    M15: Wallet Support in

    Windows Phone 8

    Andy Wigley | Microsoft Technical Evangelist

    Rob Tiffany | Microsoft Enterprise Mobility Strategist

  • 7/27/2019 S15 Wallet.pdf

    2/45

    Target Agenda | Day 1

    Module and Topic | 10-minute breaks after each session / 60-minute meal break

    1a - Introducing Windows Phone 8 Application Development | Part 1 1b - Introducing Windows Phone 8 Application Development | Part 2

    2 - Designing Windows Phone Apps

    3 - Building Windows Phone Apps

    4 - Files and Storage on Windows Phone 8

    Meal Break | 60-minutes

    5 - Windows Phone 8 Application Lifecycle

    6 - Background Agents

    7 - Tiles and Lock Screen Notifications

    8 - Push Notifications

    9 - Using Phone Resources on Windows Phone 8

  • 7/27/2019 S15 Wallet.pdf

    3/45

  • 7/27/2019 S15 Wallet.pdf

    4/45

    Module Agenda

    Wallet Overview

    Applications and wallet storage Wallet capabilities

    Creating and using a membership card

    Creating the card

    The Wallet Background Agent

    Creating and using a payment

    instrument card

  • 7/27/2019 S15 Wallet.pdf

    5/45

    Wallet Overview

  • 7/27/2019 S15 Wallet.pdf

    6/45

    Windows Phone Wallet

    The Wallet is one of the 1st party Built-in apps on

    Windows Phone 8

    The Wallet acts as a container for applications that can

    store membership information and transaction data for

    paid services

    The wallet provides an additional launching point for an

    application

    The launch can be via a deep link to a page describing a

    particular offer or service

  • 7/27/2019 S15 Wallet.pdf

    7/45

    Wallet Storage

    Wallet information is held on a per-application basis

    An application can only interact with its own wallet storage

    Each application will store information relating to the services

    provided via that application

    Special offers

    Transactions

    Membership information

    Custom fields for that particular application

  • 7/27/2019 S15 Wallet.pdf

    8/45

    Opening the Wallet

    The Wallet is supplied as part of the Windows Phone

    Users can store details of membership cards in the wallet

    These are linked to wallet aware applications on the phone

    The membership cards can be credit or debit cards, or any

    form of membership tracking that you wish to add to

    your application

    This includes transaction support and also allows you to

    alert the user to any special offers or promotions associated

    with a card

  • 7/27/2019 S15 Wallet.pdf

    9/45

    Storing data in the Wallet

    Users can store details of their cards inside the wallet

    They can add as many sets of card details as they like and the

    wallet will store the details securely

    Each card is associated with an application that manages

    transactions on that card

    They can PIN protect access to the wallet

    The wallet PIN can also be used to control access to Windows

    Phone Store purchases

  • 7/27/2019 S15 Wallet.pdf

    10/45

    Adding a New Card via an Application

    The user can add a new card by tapping the + in the application bar

    The Wallet program searches the Store for Wallet-awareapplications

    A user can install one of these applications and use it to enter the

    card

    For credit/debit cards, you are asked to enter the first six digits of

    the card number which is used to identify the Card Issuer and app

    that can link to the card

  • 7/27/2019 S15 Wallet.pdf

    11/45

    Adding a New Card Manually

    Users can also enter cards manually

    Once you have created a card you can then search for thelinked application that can perform transactions on that

    card

    If an application is found the card is then bound to

    that application

  • 7/27/2019 S15 Wallet.pdf

    12/45

    Navigating the Phone Wallet

    When the user opens the wallet they are shown a list of

    all the cards that have been placed in there Each of the cards is linked to the application behind it

    Uses can open their wallet, find your membership card

    and run your application from there

  • 7/27/2019 S15 Wallet.pdf

    13/45

  • 7/27/2019 S15 Wallet.pdf

    14/45

    Wallet Enabled Applications

    A wallet application does not have to just manipulate money

    It could be any kind of club membership

    The wallet could contain membership details and any custom data about th

    Each wallet entry can also store customised data for that application

    Achievements in a game, permission levels, responsibilities, etc

    Once an application is registered with the wallet it will appear alongside all t

    applications in the wallet

  • 7/27/2019 S15 Wallet.pdf

    15/45

  • 7/27/2019 S15 Wallet.pdf

    16/45

    Wallet Applications and Capabilities

    If an application just wishes to use the Wallet to

    store membership details and transaction logs itjust needs to enable the ID_CAP_WALLET

    capability

    Any application can do this

    To use the payment instruments and store secure

    elements in published applications you will have tohave those permissions added to your account

    Contact the Dev Center Support team to do this

  • 7/27/2019 S15 Wallet.pdf

    17/45

    Adding Cards from within Applications

    Cards are linked with the applications that use them

    The app code must create and populate aWalletTransactionItem instance and pass that to the

    AddWalletItemTask which handles the storage in the Wallet

    A WalletTransactionItem object contains a number of

    standard fields

    Applications can add their own custom fields for their own use

    Only the application that is bound to a card can access the

    information in the card

  • 7/27/2019 S15 Wallet.pdf

    18/45

    Creating a Wallet entry for a Membership Card

    WalletTransactionItem membershipItem;

    membershipItem = newWalletTransactionItem("Membership");membershipItem.IssuerName = issuer.IssuerName;

    membershipItem.DisplayName = issuer.IssuerName + " Membership Card";

    membershipItem.IssuerPhone.Business = issuer.IssuerPhone;

    membershipItem.CustomerName = details.CustomerName;

    membershipItem.AccountNumber = details.MembershipNumber;

    membershipItem.BillingPhone = details.PhoneNumber;

    membershipItem.IssuerWebsite = newUri(issuer.IssuerWebSite);

    membershipItem.DisplayAvailableBalance = "1000 points";

    membershipItem.Logo336x336 = new BitmapImage(new Uri("/images/BrSml.png", ));membershipItem.Logo159x159 = new BitmapImage(new Uri("/images/BrMed.png", ));

    membershipItem.Logo336x336 = new BitmapImage(new Uri("/images/BrLge.png", ));

    AddWalletItemTask addWalletItemTask = newAddWalletItemTask();

    addWalletItemTask.Item = membershipItem;

    addWalletItemTask.Show();

  • 7/27/2019 S15 Wallet.pdf

    19/45

    Adding Cards from within Applications

    It is not possible for a card to be added to a wallet without the

    user approving the action This prevents applications from spamming the wallet with large

    numbers of cards

    The wallet also provides a means by which a user can delete a

    card that they no longer use

  • 7/27/2019 S15 Wallet.pdf

    20/45

    Demo 1: Creating a Club

  • 7/27/2019 S15 Wallet.pdf

    21/45

    Simple Wallet Use

    If you just want to store and manage membership information for your app

    wallet is a good way to do this Users can find and run your application from the Wallet

    The application can update the wallet membership properties to display info

    the status of the user

    This can be done simply by updating the text properties of the wallet inform

    This will then be reflected in the wallet display

  • 7/27/2019 S15 Wallet.pdf

    22/45

    The Wallet

    Background Agent

  • 7/27/2019 S15 Wallet.pdf

    23/45

    The Wallet Background Agent

    Applications that use the wallet can also create a Background

    Agent that can update the wallet on the phone when theapplication is not being used

    The agent will also run when the user refreshes the card from

    the Wallet

    Your application can use this in lots of different ways

    Update a list of transactions Inform the user of special offers

    Manage membership expiry

  • 7/27/2019 S15 Wallet.pdf

    24/45

    Special Offer Display

    Special offers are displayed right next to the card details

    If the user activates the offer it will perform a deep link activationof the application that can take the user directly to the page for

    that offer

    The deep link is set by the background agent, so that the

    application can identify the offer that has been made

  • 7/27/2019 S15 Wallet.pdf

    25/45

    Creating a Wallet Agent

    A Wallet Agent works in a very similar way to other background tasks

    There is no template for the creation of the agent project

    Instead you have to create the agent as a class library, or use the Scheduled

    template and modify the generated code

  • 7/27/2019 S15 Wallet.pdf

    26/45

    The Wallet Agent Project

    This is added to the solution just as with other agents

    The foreground application must also reference this project

  • 7/27/2019 S15 Wallet.pdf

    27/45

    Adding the Wallet Background Task

    To link the agent to the application you need to modify the WMAppManifest

    the application

    The ExtendedTask item needs to be added, which sets the type of the agen

    identifies the assemblies to be used when it runs

  • 7/27/2019 S15 Wallet.pdf

    28/45

    The Wallet Background Class

    This is the code that implements the agent

    The OnRefreshData method is called by the Windows Phone operating sys

    the wallet content

    It could use a web service to contact the host and do this

    publicclassMyWalletAgent : WalletAgent

    {

    protectedoverrideasyncvoid OnRefreshData(RefreshDataEventArgs{

    // Update the wallet items supplied in the args parameter

    NotifyComplete();

    }

    }

  • 7/27/2019 S15 Wallet.pdf

    29/45

    Adding a Special Offer

    protectedoverrideasyncvoid OnRefreshData(RefreshDataEventArgs args

    {

    foreach (WalletItem item in args.Items) {WalletTransactionItem card = item asWalletTransactionItem;

    if (card != null) {

    if (card.Id == "Membership") {

    card.Message =

    "Cheese sale with special deals on Edam. Tap here for mor

    card.MessageNavigationUri = newUri("/CheeseDealsPage

    UriKind.Relativeawait card.SaveAsync();

    }

    }

    }

    NotifyComplete();

    }

  • 7/27/2019 S15 Wallet.pdf

    30/45

  • 7/27/2019 S15 Wallet.pdf

    31/45

    Adding a Deal

    // Create a new Deal.

    Deal deal = newDeal(currentCoupon.ID);

    deal.DisplayName = currentCoupon.Title;deal.Description = currentCoupon.Description;

    deal.IssuerName = MockWebService.WebService.IssuerName;

    deal.IssuerWebsite = newUri(MockWebService.WebService.IssuerEmail)

    deal.IsUsed = false;

    deal.MerchantName = MockWebService.WebService.IssuerName;

    deal.TermsAndConditions = currentCoupon.Terms;

    deal.Code = currentCoupon.Code;deal.ExpirationDate = currentCoupon.ExpirationDate;

    deal.BarcodeImage = currentCoupon.Barcode;

    // Save deal to Wallet.

    await deal.SaveAsync();

  • 7/27/2019 S15 Wallet.pdf

    32/45

    Using the Deals

    Deals appear in the Wallet app, but are independent of any card in the walle

    If the user taps a Deal, the Wallet shows the Details page for the deal, whichto launch the application

  • 7/27/2019 S15 Wallet.pdf

    33/45

    Demo 2: Using a Wallet

    Agent

  • 7/27/2019 S15 Wallet.pdf

    34/45

    Refreshing the Card

    The card will be refreshed before it is used for the first time

    It can also be refreshed manually by the user When the refresh action is performed the OnRefreshData

    method is called in the card agent

    The user can also delete the card and unlink it from

    the application

  • 7/27/2019 S15 Wallet.pdf

    35/45

    Deleting the Card

    The user can also delete the card and unlink it from

    the application

    Unlinking is only a useful thing to do if other

    applications can make use of that card

    The user can edit the card information, this will be

    picked up by the application when it next uses those

    card properties If the card has custom properties added by the

    application they can be changed only by the card

    application

  • 7/27/2019 S15 Wallet.pdf

    36/45

    Creating and using a

    payment instrument card

  • 7/27/2019 S15 Wallet.pdf

    37/45

    Payment Instrument Cards

    If you want to create a card that tracks transactions you need to create a

    PaymentInstrument to hold the card information

    This manages a list of transactions that your application can add to and sea

    It is created and used in exactly the same way as the membership card

    To create a PaymentInstrument the ID_CAP_WALLET_PAYMENTINSTRUMENT

    must be set for the application

    The card serves only as a container for the application data The application must provide all the business logic to update and manage

    i i i di h ll

  • 7/27/2019 S15 Wallet.pdf

    38/45

    Creating a transaction: Finding the Wallet

    The first stage in performing a transaction is finding the wallet to use

    The FindItem method will return null if the card is not found

    // Find the payment instrument to use

    PaymentInstrument walletPay;

    walletPay = Wallet.FindItem("Credit") asPaymentInstrument;

    if (walletPay == null)

    {

    MessageBox.Show("Wallet not found");

    return;

    }

    C i i S i h i d

  • 7/27/2019 S15 Wallet.pdf

    39/45

    Creating a transaction: Setting the transaction deta

    These transaction properties are required shown here as hard-coded exam

    For your application they will reflect the actual action performed Note that the amounts are specified as strings

    They are textual descriptions of the actions performed

    // Create the transaction

    WalletTransaction transaction = newWalletTransaction();

    transaction.DisplayAmount = "10";

    transaction.Description = "Cheese Purchase";

    transaction.TransactionDate = DateTime.Now;

    C ti t ti St i th t ti

  • 7/27/2019 S15 Wallet.pdf

    40/45

    Creating a transaction: Storing the transaction

    The TransactionHistory property of a PaymentInstrument is implement

    dictionary that is indexed on a transaction identifier string

    Each identifier string must be unique or the Add action will fail

    The SaveAsync method commits the action to the actual wallet

    It is an asynchronous operation and so the method performing this action

    made async

    // Add the transaction to the wallet

    walletPay.TransactionHistory.Add("Cheese Purchase " + DateTime.Now,

    await walletPay.SaveAsync();

    MessageBox.Show("Transaction stored");

    Vi i T ti

  • 7/27/2019 S15 Wallet.pdf

    41/45

    Viewing Transactions

    Transactions are stored in the wallet and can be viewed in along

    with the card data

    The transaction list is only displayed once some transactions have

    been added

  • 7/27/2019 S15 Wallet.pdf

    42/45

    Demo 3:

    Using a Payment

    Instrument

    Pa ment Inst ments

  • 7/27/2019 S15 Wallet.pdf

    43/45

    Payment Instruments

    A payment instrument can be used as a store for credit and debit card detai

    transactions that have been performed on them

    However, the card does not implement any of the banking behaviours as su

    The application must perform the management of the account informatio

    The Wallet infrastructure will provide a display mechanism and bring all th

    management activity into one place

    Review

  • 7/27/2019 S15 Wallet.pdf

    44/45

    Review

    Applications in Windows 8 can use the Wallet to manage membership infor

    The Wallet Agent allows an application to update special offers and other in

    automatically

    The Payment Instrument mechanism provides a way that transactions can b

    viewed on Windows Phone

  • 7/27/2019 S15 Wallet.pdf

    45/45

    The information herein is for informational

    purposes only an represents the current view of

    Microsoft Corporation as of the date of this

    presentation. Because Microsoft must respond

    to changing market conditions, it should not be

    interpreted to be a commitment on the part of

    Microsoft, and Microsoft cannot guarantee the

    accuracy of any information provided after the

    date of this presentation.

    2012 Microsoft Corporation.

    All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

    MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION

    IN THIS PRESENTATION.