paypal payflow pro cancelling recurring billings - paypal

I am using Payflow pro for recurring payment using the below code, as
per my knowledge this code return profileid.
Do I need to store this profile id in a database so that user can
cancel the subscription in the future.
please do reply with your useful comments .
----------------------------------------------------------------------------------------- PayPalRequest = "TRXTYPE=R"
+ "&TENDER=C" //C - Credit card
+ "&ACTION=A"
+ "&OPTIONALTRX=A"
+ "&TERM=0" //0 - recuring never stops
+ "&COMMENT1=Advertisement package subscription (Recurring)"
+ "&PROFILENAME=" + viewModel.PackageName + "-" + UserID
+ "&USER=" + AppProperties.PayPalFlowUser
+ "&VENDOR=" + AppProperties.PayPalFlowVendor
+ "&PARTNER=" + AppProperties.PayPalFlowPartner
+ "&PWD=" + AppProperties.PayPalFlowPassword
+ "&AMT=" + viewModel.PayAmount
+ "&CURRENCY=" + AppProperties.CurrencyId
+ "&ACCT=" + viewModel.CardNumber //card number
+ "&EXPDATE=" + viewModel.ExpirationMonth + viewModel.ExpirationYear.Substring(2, 2)
+ "&START=" + DateTime.Now.Date.ToString(AppConstants.ddMMyyyy)
+ "&PAYPERIOD=" + GetPayFlowPeriodVariables(viewModel);
PayflowNETAPI PayflowNETAPI = new PayflowNETAPI();
string PayPalResponse = PayflowNETAPI.SubmitTransaction(PayPalRequest,PayflowUtility.RequestId);

Yes, I would store the profile ID in your database along with the order/customer info so you can always lookup details about it in the future or update the status accordingly.
The following API's could be used to manage profiles using their ID.
ManageRecurringPaymentsProfileStatus
UpdateRecurringPaymentsProfile
TransactionSearch

Related

HTML String on Object Property Won't Update

I have an object constructor that sets some properties, and later uses them to concatenate a string to write to the DOM. I can see that this works in some cases, but not in others.
function Fighter(name, level, attackPts, defencePts, imgSource) {
// TRUNCATED PROPERTY ASSIGNMENTS AREA:
this.attackPts = attackPts;
this.defencePts = defencePts;
// DOM ELEMENT CONSTRUCTORS:
this.img = "style='background: #444 url(" + imgSource + ") no-repeat center'";
this.char_card_name = "<h3>" + this.name + "</h3>";
this.char_card_hitdef = "<h4>" + this.attackPts + "/" + this.defencePts + "</h4>";
this.char_card = "<div class='fighter " + faction + "' " + "id='" + this.name + "'>" + this.img + this.char_card_name + this.char_card_hitdef + "</div>";
In a game function later on I modify the attack and defense points for this "Fighter" object, and that works as expected, and my console.log() tests verify that the concatenated properties also update . . . . up until the final string to pull it all together and display:
this.char_card = "<div class='fighter " + faction + "' " + "id='" + this.name + "'>" + this.img + this.char_card_name + this.char_card_hitdef + "</div>";
When I log this property, those attack and defense numbers don't budge, even though they update successfully in the previous property, this.char_card_hitdef
What could I be overlooking here? I crawled all over the web looking for scope or variable reference issues, but my log statements bring me right back to this one pinching point.
Because you are still in the constructor, you need to refer to the variables without this. that are a parameter AND property of the Object Fighter.
So change
this.char_card = "<div class='fighter " + faction + "' " + "id='" + this.name + "'>" + this.img + this.char_card_name + this.char_card_hitdef + "</div>";
to
this.char_card = "<div class='fighter " + faction + "' " + "id='" + name + "'>" + this.img + this.char_card_name + this.char_card_hitdef + "</div>"
And all other properties that refer to properties above them.
You can read more about constructors here

Google Actions SDK assistant doesn't get user input during in-line dialog?

I am having trouble getting the getRawInput() method to capture user input after it's initial call. I would like the user to choose and action, and then the assistant to respond with a question, which the user has to answer to go forward. For example, a user would like to transfer money from a checking account to a savings account would say "I would like to make a transfer." The assistant will ask "Which account would you like to transfer from." The user would respond with the account they would like to transfer from. The issue seems to be that assistant isn't taking the second input, and I get the error "Action: {name of my action} isn’t responding right now. Try again soon." Please let me know if there is a better way or a more appropriate method to call for in-line dialogues.
Here is the code I'm trying to execute:
else if (assistant.getRawInput() === 'I want to make a transfer') {
let inputPrompt = assistant.buildInputPrompt(true, 'Sure, which account would you like to transfer from? You can say checking or savings.');
assistant.ask(inputPrompt);
if(assistant.getRawInput() === 'checking') {
let transFrom = 'checking';
let transTo = 'savings';
let inputPrompt = assistant.buildInputPrompt(true, 'You are going to make a transfer from your ' + transFrom + ' account to your ' + transTo + ' account. What is the amount you would like to transfer?');
assistant.ask(inputPrompt);
let amtInput = assistant.getRawInput();
let amt = parseInt(amtInput);
transferMoney(transFrom, transTo, amt);
inputPrompt = assistant.buildInputPrompt(true, 'Cool, you have transfered ' + amt + ' dollars from your ' + transFrom + ' account to your ' + transTo + ' account. Your new balance is ' + customer1.chkBal + ' dollars in your ' + transFrom + ' account and ' + customer1.savBal + ' in your ' + transTo + ' account.');
assistant.ask(inputPrompt);
} else if (assistant.getRawInput() === 'savings') {
let transFrom = 'savings';
let transTo = 'checking';
let inputPrompt = assistant.buildInputPrompt(true, 'You are going to make a transfer from your ' + transFrom + ' account to your ' + transTo + ' account. What is the amount you would like to transfer?');
assistant.ask(inputPrompt);
let amtInput = assistant.getRawInput();
let amt = parseInt(amtInput);
transferMoney(transFrom, transTo, amt);
inputPrompt = assistant.buildInputPrompt(true, 'Cool, you have transfered ' + amt + ' dollars from your ' + transFrom + ' account to your ' + transTo + ' account. Your new balance is ' + customer1.chkBal + ' dollars in your ' + transFrom +' account and ' + customer1.savBal + ' in your ' + transTo + ' account.');
assistant.ask(inputPrompt);
}
You haven't indicated if you are using API.AI or the Actions API directly, but it sounds like you're using the Actions API. It also looks like you're writing the function linearly - as if you're expecting assistant.ask() to stop the program and wait for a reply from the user. This isn't how assistant.ask(), or Actions in general, work.
Think of the Google Home as a web browser, and your Action will be running on a web server somewhere. assistant.ask() is equivalent to sending back a message to the browser and closing the connection (but not closing the microphone). There is no additional processing that can be done, so having statements after the ask() doesn't make sense.
If you're using the Actions API directly, you'll need to keep track of where in the conversation you are (the state - or what questions have been asked so far and what answers you've gotten) and execute different code paths appropriately.
You may be more interested in API.AI, which lets you build the conversations more interactively and indicate only which commands will need to send your webhook the information. Using API.AI, your programming logic doesn't need to keep track of where in the conversation you are - you build the state machine and conversation path through API.AI.

Get previous day in an Expression

Just need help on this as I am new at SSIS. I got an expression but I want yesterday, not today.
"Daily "+ (RIGHT("0" + (DT_STR,4,1252) DatePart("yyyy",getdate()),4))+(RIGHT("0" + (DT_STR,4,1252) DatePart("mm",getdate()),2))+(RIGHT("0" + (DT_STR,4,1252) DatePart("dd",getdate()),2))+".CSV"
Currently it looks like this
Daily 20161006.CSV
What I want is
Daily 20161005.CSV
Here you go.
"Daily "
+ (DT_WSTR, 4) YEAR(DATEADD("day",-1,GETDATE()))
+ RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", DATEADD("day", -1, GETDATE())),2)
+ RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", DATEADD("day", -1, GETDATE())),2)
+ ".CSV"
It looks like you are in Australia, so it is 20161006 there, but in US Right now, it is 20161005, and see how it shows yesterday i.e. 20161004 in the file name when I clicked Evaluate value
"Daily "+ (RIGHT("0" + (DT_STR,4,1252) DatePart("yyyy",getdate()),4))+(RIGHT("0" + (DT_STR,4,1252) DatePart("mm",getdate()),2))+(RIGHT("0" +(DT_STR,4,1252) (DatePart("dd",getdate())-1),2))+".CSV"
This should work.

jQuery UI DatePicker date convert to RFC 3339 format

Currently working on the Google Calendar API and basically my end will provide Start and End date for user to pick the date and time. But would like anyone to advise how to convert them from (DatePicker/TimePicker/input field) to RFC 3339 format (e.g. 2013-07-24T10:00:00.000-07:00).
var date = new Date();
var timeZone = date.getTimezoneOffset();
alert(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "." + date.getMilliseconds() + (timeZone > 0 ? "-" : "+") + Math.floor(Math.abs(timeZone) / 60) + ":" + Math.abs(timeZone) % 60);

Checking User Agent in Wicket

I am using wicket 1.5 and I am not able to see in the getClientInfo() method
(WebRequest)RequestCycle.get().getRequest()
I saw the other place this code
WebClientInfo clientInfo = (WebClientInfo)WebRequestCycle.get().getClientInfo();
But I am not able to see any WebRequestCycle in Wicket 1.5.
Any ideas how to check the user agent in Wicket 1.5?
The easiest way is to use
WebSession.get().getClientInfo().getUserAgent();
On newer Wicket Versions (6 or newer), you should use:
WebClientInfo clientInfo = new WebClientInfo(getRequestCycle());
System.out.println("Client: " + clientInfo.getUserAgent());
System.out.println("Navigator: " + clientInfo.getProperties().getNavigatorAppName() + ", version " + clientInfo.getProperties().getNavigatorAppVersion() + ", codName: " + clientInfo.getProperties().getNavigatorAppCodeName() + ", plataform: " + clientInfo.getProperties().getNavigatorPlatform() + ", AppCodName: " + clientInfo.getProperties().getNavigatorAppCodeName());
System.out.println("NavigatorUserAgent: " + clientInfo.getProperties().getNavigatorUserAgent());
System.out.println("Tamanho da tela (Width x Height): " + clientInfo.getProperties().getScreenWidth() + " x " + clientInfo.getProperties().getScreenHeight() );
You can also do:
((WebRequest) getRequest()).getHeader("User-Agent")