Introduced in Feature Pack 1

Migrating coupon data to digital wallets

If your starter store has been issuing coupons to shoppers, you can migrate existing coupon data to digital wallets, so that customers can retain their coupon assets when implementing digital wallets. That is, when enabling digital wallets, the storefront coupon wallet begins using digital wallet services to manage digital coupon assets in the storefront. The coupons previously issued to customers can be migrated to digital wallets.

Before you begin

Procedure

Run the following SQL statement. It creates and updates digital wallets from existing customer coupons:
Apache DerbyDB2Oracle
INSERT INTO WALLET (WALLET_ID, STOREENT_ID, MEMBER_ID, NAME)
SELECT DISTINCT USERS_ID, STOREENT_ID, USERS_ID, '' FROM PX_COUPON WHERE STATUS IN (0, 2);

UPDATE KEYS SET COUNTER=COALESCE((SELECT MAX(WALLET_ID) FROM WALLET) + 1, COUNTER) WHERE TABLENAME='wallet' AND COLUMNNAME='wallet_id';

INSERT INTO WALLETITEM (WALLETITEM_ID, WALLET_ID, NAME, TYPE, UNREAD, DELETABLE, MOVABLE, RENAMABLE, CREATIONDATE, CONTENT)
SELECT PX_COUPON_ID, USERS_ID, 'Coupon ' || CAST(PX_COUPON_ID AS CHAR(20)), -2, 0, 1, 0, 0, EFFECTIVE, CAST(PX_COUPON_ID AS CHAR(20)) FROM PX_COUPON WHERE STATUS IN (0, 2);

UPDATE KEYS SET COUNTER=COALESCE((SELECT MAX(WALLETITEM_ID) FROM WALLETITEM) + 1, COUNTER) WHERE TABLENAME='walletitem' AND COLUMNNAME='walletitem_id';