/// <summary> /// Provides and indication if any values have been set in <see cref="MerchantDescriptor"/> /// </summary> /// <param name="descriptor"> /// The descriptor. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public static bool HasValues(this MerchantDescriptor descriptor) { var values = new[] { descriptor.Name, descriptor.Url, descriptor.Phone }; var all = string.Join(" ", values).Trim(); return(!string.IsNullOrEmpty(all)); }
/// <summary> /// Maps a /// </summary> /// <param name="descriptor"> /// The descriptor. /// </param> /// <returns> /// The <see cref="DescriptorRequest"/>. /// </returns> public static DescriptorRequest AsDescriptorRequest(this MerchantDescriptor descriptor) { var mapped = Mapper.Map <DescriptorRequest>(descriptor); mapped.Name = mapped.Name.Replace(" ", "*"); if (mapped.Name.Length < 22) { mapped.Name = mapped.Name.PadRight(22, '*'); } else { mapped.Name = mapped.Name.Substring(0, 21); } return(mapped); }