I am trying to get an email when one of my items sell. However, no email ever comes. If I change it to notify me when an item is listed, that email arrives so I know my code is somewhat working. Here is my code:
ApiContext apiContext= GetApiContext();
SetNotificationPreferencesCall apiCall = new SetNotificationPreferencesCall(apiContext);
ApplicationDeliveryPreferencesType applicationDeliveryPreferences = new ApplicationDeliveryPreferencesType();
applicationDeliveryPreferences.ApplicationEnable = EnableCodeType.Enable;
applicationDeliveryPreferences.ApplicationEnableSpecified = true;
applicationDeliveryPreferences.ApplicationURL = "mailto://myemail#gmail.com";
applicationDeliveryPreferences.AlertEmail = "mailto://myemail#gmail.com";
applicationDeliveryPreferences.AlertEnable = EnableCodeType.Enable;
applicationDeliveryPreferences.AlertEnableSpecified = true;
NotificationEnableType notification =
new NotificationEnableType
{
EventEnable = EnableCodeType.Enable,
EventEnableSpecified = true,
EventType = NotificationEventTypeCodeType.ItemSold,
EventTypeSpecified = true
};
apiCall.UserDeliveryPreferenceList = new NotificationEnableTypeCollection(new[] { notification });
apiCall.ApplicationDeliveryPreferences = applicationDeliveryPreferences;
apiCall.UserDeliveryPreferenceList = new NotificationEnableTypeCollection(new[] { notification });
apiCall.Execute();
Related
Well.. I'm trying this code to create an Event
CalendarService service;
GoogleCredential credential;
try
{
string[] scopes = new string[] { CalendarService.Scope.Calendar };
using (var stream = new FileStream(#"C:\Prueba\meet.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream)
.CreateScoped(scopes);
}
service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});
Event calendarEvent = new Event();
DateTime start = DateTime.Now;
calendarEvent.Kind = "";
calendarEvent.Summary = "prueba";
calendarEvent.Status = "confirmed";
calendarEvent.Visibility = "public";
calendarEvent.Description = "prueba";
calendarEvent.Creator = new Event.CreatorData
{
Email = "email#example.com", //email#example.com
Self = true
};
calendarEvent.Organizer = new Event.OrganizerData
{
Email = "email#example.com",
Self = true
};
calendarEvent.Start = new EventDateTime
{
DateTime = start,
TimeZone = "America/Mexico_City"
};
calendarEvent.End = new EventDateTime
{
DateTime = start.AddHours(1),
TimeZone = "America/Mexico_City"
};
calendarEvent.Recurrence = new String[] { "RRULE:FREQ=DAILY;COUNT=1" };
calendarEvent.Sequence = 0;
calendarEvent.HangoutLink = "";
calendarEvent.ConferenceData = new ConferenceData
{
CreateRequest = new CreateConferenceRequest
{
RequestId = "1234abcdef",
ConferenceSolutionKey = new ConferenceSolutionKey
{
Type = "hangoutsMeet"
},
Status = new ConferenceRequestStatus
{
StatusCode = "success"
}
},
EntryPoints = new List<EntryPoint>
{
new EntryPoint
{
EntryPointType = "video",
Uri = "",
Label = ""
}
},
ConferenceSolution = new ConferenceSolution
{
Key = new ConferenceSolutionKey
{
Type = "hangoutsMeet"
},
Name = "Google Meet",
IconUri = ""
},
ConferenceId = ""
};
//calendarEvent.EventType = "default";
EventsResource.InsertRequest request = service.Events.Insert(calendarEvent, "email#example.com");
request.ConferenceDataVersion = 0;
Event createEvent = request.Execute();
string url = createEvent.HangoutLink;
}
catch (Exception ex)
{
}
The source code is here
When I execute the line 116: Event createEvent = request.Execute();
I get this error: Google.Apis.Requests.RequestError Invalid conference type value. [400] Errors [Message[Invalid conference type value.] Location[ - ] Reason[invalid] Domain[global]
I don't know what means this error o with line I wrong
Could anyone help me with an example to create an event using classes C# from Google API Calendar?
As described in the C# library documentation for createRequest:
Either conferenceSolution and at least one entryPoint, or createRequest is required.
This means that you should use only CreateConferenceRequest as this conference is brand new (if it already existed then you would be wanting to use ConferenceSolution along with EntryPoints ). Therefore, simply remove ConferenceSolution and EntryPoints to leave just CreateConferenceRequest which as specified in the documentation is used for generating a new conference and attach it to the event.
I create sample a windows form application.
I download pay pal sdk in visual studio.
I create paypal sandbox test account
whre to add the credential details?
where we put app id:
Sandbox test AppID:
APP-80W284485P519543T
I have copy some code for winform app while click a button that is.
Dictionary<string, string> sdkConfig = new Dictionary<string, string>();
sdkConfig.Add("mode", "sandbox");
accessToken = new OAuthTokenCredential("AQkquBDf1zctJOWGKWUEtKXm6qVhueUEMvXO_-MCI4DQQ4-LWvkDLIN2fGsd", "EL1tVxAjhT7cJimnz5-Nsx9k2reTKSVfErNQF-CmrwJgxRtylkGTKlU4RvrX", sdkConfig).GetAccessToken();
HttpContext CurrContext = HttpContext.Current;
APIContext apiContext = new APIContext(accessToken);
Item item = new Item();
item.name = _ItemDescription;
item.currency = "USD";
item.price = _Amount;
item.quantity = "1";
item.sku = _UPC;
List<Item> itms = new List<Item>();
itms.Add(item);
ItemList itemList = new ItemList();
itemList.items = itms;
Address billingAddress = new Address();
billingAddress.city = "Chennai";
billingAddress.country_code = "US";
billingAddress.line1 = "11/12";
billingAddress.line2 = "Andavar nager main street";
billingAddress.postal_code = "600089";
billingAddress.state = "Tamil nadu";
CreditCard crdtCard = new CreditCard();
crdtCard.billing_address = billingAddress;
crdtCard.cvv2 = 2222;
crdtCard.expire_month = 4;
crdtCard.expire_year = 2020;
crdtCard.first_name = "Arul";
crdtCard.last_name = "Murugan";
crdtCard.number = "4032039053301695";
crdtCard.type = "visa";
Details details = new Details();
details.tax = "0";
details.shipping = "0";
details.subtotal = _Amount;
Amount amont = new Amount();
amont.currency = "USD";
amont.total = _Amount;
amont.details = details;
Transaction tran = new Transaction();
tran.amount = amont;
tran.description = _ItemDescription;
tran.item_list = itemList;
List<Transaction> transactions = new List<Transaction>();
transactions.Add(tran);
FundingInstrument fundInstrument = new FundingInstrument();
fundInstrument.credit_card = crdtCard;
List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
fundingInstrumentList.Add(fundInstrument);
PayerInfo pi = new PayerInfo();
pi.email = "sysumurugan-facilitator#gmail.com";
pi.first_name = "Arul";
pi.last_name = "Murugan";
Payer payr = new Payer();
payr.funding_instruments = fundingInstrumentList;
payr.payment_method = "credit_card";
payr.payer_info = pi;
pi.shipping_address = new ShippingAddress
{
city = "San Mateo",
country_code = "US",
line1 = "SO TEST",
line2 = "",
postal_code = "94002",
state = "CA",
};
Payment paymnt = new Payment();
paymnt.intent = "sale";
paymnt.payer = payr;
paymnt.transactions = transactions;
try
{
Payment createdPayment = paymnt.Create(apiContext);
CurrContext.Items.Add("ResponseJson", JObject.Parse(createdPayment.ConvertToJson()).ToString(Formatting.Indented));
}
catch (PayPal.Exception.PayPalException ex)
{
if (ex.InnerException is PayPal.Exception.ConnectionException)
{
CurrContext.Response.Write(((PayPal.Exception.ConnectionException)ex.InnerException).Response);
}
else
{
CurrContext.Response.Write(ex.Message);
}
}
catch (Exception es)
{
MessageBox.Show( es.ToString());
}
CurrContext.Items.Add("RequestJson", JObject.Parse(paymnt.ConvertToJson()).ToString(Formatting.Indented));
my reference link is
http://pastebin.com/H7VuPQs4
Parsing a PayPal REST Credit Card Transaction Response (JSON),
C# PayPal REST API Checkout with Credit Card
please explian to me any other way for credit card transaction for POS(Point Of Sale) through win form application.
The PayPal .NET SDK is meant for server applications (e.g. ASP.NET) where application credentials are stored in a secure manner. Using the SDK directly from a WinForms application running on a POS system presents a security risk because your merchant account credentials are not stored in a secure manner. Ideally, the POS system should be communicating back to a secure server somewhere that performs the processing.
With that said, this use case is what PayPal Here is designed for.
I am using Exchange Web Services v1 to pull down unread emails from a user's mailbox like so:
//get exchange service
ExchangeServiceBinding exchangeService = new ExchangeServiceBinding();
exchangeService.Credentials = credentials; //LAN credentials of user
exchangeService.Url = URL; // http://myserver.com/ews/exchange.asmx
//REturn all properties
FindItemType findType = new FindItemType();
findType.Traversal = ItemQueryTraversalType.Shallow;
findType.ItemShape = new ItemResponseShapeType();
findType.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
//Only search the inbox
DistinguishedFolderIdType[] foldersToSearch = new DistinguishedFolderIdType[1];
foldersToSearch[0] = new DistinguishedFolderIdType();
foldersToSearch[0].Id = DistinguishedFolderIdNameType.inbox;
findType.ParentFolderIds = foldersToSearch;
//Only unread emails
RestrictionType restriction = new RestrictionType();
IsEqualToType isEqualTo = new IsEqualToType();
PathToUnindexedFieldType pathToFieldType = new PathToUnindexedFieldType();
pathToFieldType.FieldURI = UnindexedFieldURIType.messageIsRead;
//Not IsRead
FieldURIOrConstantType constantType = new FieldURIOrConstantType();
ConstantValueType constantValueType = new ConstantValueType();
constantValueType.Value = "0";
constantType.Item = constantValueType;
isEqualTo.Item = pathToFieldType;
isEqualTo.FieldURIOrConstant = constantType;
restriction.Item = isEqualTo;
findType.Restriction = restriction;
FindItemResponseType findResponse = exchangeService.FindItem(findType);
ResponseMessageType[] responseMessType = findResponse.ResponseMessages.Items;
List<ItemIdType> unreadItemIds = new List<ItemIdType>();
Now I would like to find emails from a generic mailbox.
How would I go about specifying the mailbox I would like to pull emails from?
I am using the below code to send email to newsletter subscribers in website, but this code does not seems to work, can anyone guide me, how to integrate mail chimp in asp.net website: -
listSubscribe cmd = new listSubscribe();
listSubscribeParms newlistSubscribeParms = new listSubscribeParms
{
apikey = apikey,
id = "1",
email_address = "test#gmail.com",
merge_vars = new Dictionary<string, object>(),
double_optin = false,
email_type = EnumValues.emailType.html,
replace_interests = true,
send_welcome = false,
update_existing = true
};
listSubscribeInput newlistSubscribeInput = new listSubscribeInput(newlistSubscribeParms);
var subscribeSuccess = cmd.Execute(newlistSubscribeInput);
I'm using Jamaa SMPP Client
Does anyone have a working example on sending SMS?
Here is my code :
var textMessage = new TextMessage() { DestinationAddress = "XXXXXXXXX", SourceAddress = "XXXXXXXXX", Text = "test" };
var client = new SmppClient();
client.Properties.SystemID = "xxxx";
client.Properties.Password = "YYYY";
client.Properties.Port = ZZZZ;
client.Properties.Host = "255.255.255.255";
client.Properties.DefaultEncoding = DataCoding.SMSCDefault;
client.Properties.AddressNpi = NumberingPlanIndicator.Unknown;
client.Properties.AddressTon = TypeOfNumber.Unknown;
client.ForceConnect();
client.Start();
client.SendMessage(textMessage);
client.Shutdown();
But my provider is saying that I'm lacking the bind info (Bind_transceiver, Bind_transmitter, Bind_receiver)
Have a look at the below sample code . I think you are missing the SystemType parameter. The send operation works fine with me .
// Initialize Connection
client = new SmppClient();
properties = client.Properties;
properties.SystemID = "BBBB";
properties.Password = "BBBB";
properties.Port = 1234; //IP port to use
properties.Host = "1.2.3.4"; //SMSC host name or IP Address
properties.SystemType = "EXT_SME";
properties.DefaultServiceType = "EXT_SME";
//Resume a lost connection after 30 seconds
client.AutoReconnectDelay = 3000;
TextMessage send_msg = new TextMessage();
send_msg.DestinationAddress = mobile_number; //Receipient number
send_msg.SourceAddress = "1234"; //Originating number
send_msg.Text = message;
send_msg.RegisterDeliveryNotification = true; /
client.SendMessage(send_msg);
general_obj.WriteLog(mobile_number +" "+message, "SendLog");