示例#1
0
        private void BindPaymentProfile()
        {
            // load cc payment method
            PaymentMethod ccMethod = StorefrontHelper.GetContractPaymentMethod(myContract.ContractId,
                                                                               PaymentMethod.CREDIT_CARD);

            //
            if (ccMethod == null)
            {
                ShowWarningMessage("PAYMENT_METHOD_NOT_SUPPORTED");
                // hide controls
                ecUtils.ToggleControls(false, ctlPaymentProfile, btnCreateProfile,
                                       btnDeleteProfile, btnUpdateProfile);
                //
                return;
            }
            //
            ctlPaymentProfile.CheckSupportedItems(ccMethod.SupportedItems);
            //
            bool exists = StorehouseHelper.PaymentProfileExists(myContract.ContractId);

            // toggle buttons
            ecUtils.ToggleControls(!exists, btnCreateProfile);
            ecUtils.ToggleControls(exists, btnUpdateProfile, btnDeleteProfile);
            //
            if (exists)
            {
                //
                ctlPaymentProfile.SetCheckoutDetails(StorehouseHelper.GetPaymentProfile(myContract.ContractId));
            }
            else
            {
                ShowWarningMessage("EMPTY_PAYMENT_PROFILE");
                ctlPaymentProfile.SetCheckoutDetails(null);
            }
        }