Credit Cards Web Part
The Credit Cards Web Part shows all the credit card profile records associated with the current shopper. There are no filtering or paging options for this list as it is not expected to be lengthy. Each record in the list has a label to show if the credit card is the default payment (a shopper can have only one default payment entry), and a link to edit the credit card information is available that takes the shopper to an Edit page. There is also a link to remove a saved credit card record, with the shopper prompted with a confirmation message before deleting the credit card (this is optional; shoppers can set a property to confirm deletion or not). A shopper can add a new credit card record by clicking on the Add New Credit Card button which navigates the shopper to the Credit Card Detail Web Part in Add mode.
Architecture
The Credit Cards Web Part contains these components:
CreditCardListWebPart: dynamically loads the CreditCardList user control.
ReadOnlyCreditCardDetail.ascx: displays the properties of the credit card in read-only mode.
CreditCardList.ascx: displays the shopper's list of credit cards and provides a means to conduct actions on the cards. Card information such as a partial card number, card type, and first line of the billing address display in labels. Actions are provided to create, edit, or remove a card. The partial card number displayed is the CreditCard object property CreditCardIdentifier.
Properties
The following table lists the mapping of the properties for the Credit Cards Web Part.
Property |
Maps to |
---|---|
"Action" URL parameter |
ActionQueryParameter |
Display "Back" button |
AllowBackUrlButton |
"Billing address" section title text |
BillingAddressHeaderLabelText |
"Add new credit card" button text |
ButtonAddNewCreditCardText |
"Back" button text |
ButtonBackText |
"Edit" button text |
ButtonEditText |
"Remove" button text |
ButtonRemoveText |
"Credit card number" column header text |
CCNumberHeaderLabelText |
"Credit card type" column header text |
CCTypeHeaderLabelText |
Use "delete confirmation" pop-up |
ConfirmDeletion |
"Credit Card Detail" page URL |
CreditCardDetailUrl |
"Credit card id" URL parameter |
CreditCardIdQueryParameter |
"Credit card list" section title text |
CreditCardListHeader |
CSS class |
CssClass |
"Default credit card" label text |
DefaultCreditCardLabelText |
"Delete confirmation" pop-up text |
DeleteConfirmationMessage |
Instructional text |
InstructionText |
"Remove" link button image Url |
RemoveLinkButtonImageUrl |
Customization
You can customize the Credit Cards Web Part by modifying the .ascx file.
Error Handling
There is no design-time error handing required for this Web Part.
API Dependencies
The Credit Cards Web Part uses the CreditCards relationship of the UserProfile object. It retrieves the user profile by using Query<UserProfile>. Billing addresses are related to a credit card and are retrieved by using QueryRelatedItem<Address> using the ModelSearch criteria.
You can use the strongly typed members CreditCardIdentifier, ID, and CreditCardType of the CreditCard object as well as the Line1 member of Address.
See Also
Other Resources
Developing with SharePoint Commerce Services