Pay U IOS SDK 3.2 Seamless Integration - Mandatory Parameter FURL missing - payu

I am new to Payment gateway integration. I am integrating the latest PAY U SDK version 3.2 seamless in my App. I am following the code as per the sample App.
I have the key and salt values.
But the Payment is not happening and it always throws an error as mandatory parameter furl is missing. What am i doing wrong.
I am filling in the surl and furl and then creating the request.
should i add something in the project plist file.
I am using xcode 6.3 , ios 8.3 and running on simulator
/Generate the random transaction id/
NSString *letters = #"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
NSMutableString *randomString = [NSMutableString stringWithCapacity: 15];
for (int i=0; i<15; i++) {
[randomString appendFormat: #"%C", [letters characterAtIndex: arc4random_uniform((u_int32_t)[letters length])]];
}
self.paymentParamForPassing = [PayUModelPaymentParams new];
self.paymentParamForPassing.key = #"gtKFFx";//#"gtKFFx";
self.paymentParamForPassing.transactionID = #"Ywism0Q9XC88qvy";
self.paymentParamForPassing.amount = #"1";//[#(self.amountToPay) stringValue];
self.paymentParamForPassing.productInfo = #"Nokia";//[NSString stringWithFormat:#"%#-%#_%#",self.selectedDeal.title,self.displayCheckInDate,self.displayCheckOutDate];
self.paymentParamForPassing.firstName = #"Ram";//self.currentUser.name;
self.paymentParamForPassing.email = #"email#testsdk1.com";//self.currentUser.email;
self.paymentParamForPassing.userCredentials = #"ra:ra";
self.paymentParamForPassing.phoneNumber = #"1111111111";
self.paymentParamForPassing.SURL = #"https://payu.herokuapp.com/ios_success";
self.paymentParamForPassing.FURL = #"https://payu.herokuapp.com/ios_failure";
self.paymentParamForPassing.udf1 = #"u1";
self.paymentParamForPassing.udf2 = #"u2";
self.paymentParamForPassing.udf3 = #"u3";
self.paymentParamForPassing.udf4 = #"u4";
self.paymentParamForPassing.udf5 = #"u5";
self.paymentParamForPassing.environment = ENVIRONMENT_MOBILETEST;
self.paymentParamForPassing.offerKey = #"test123#6622";
self.paymentParamForPassing.hashes.paymentHash = #"ade84bf6dd9da35d0aab50a5bf61d6272ab0fc488b361b65c66745054aacf1900e3c60b5022d2114bae7360174ebcb3cd7185a5d472e5c99701e5e7e1eccec34";
self.paymentParamForPassing.hashes.paymentRelatedDetailsHash = #"915299224c80eff0eb2407b945a5087556292f58baca25fd05a0bceb6826aa9eb531810001dd4b4677dd928dd60d39eecf843b2189f213f9bb82c5a9483e3aac";
self.paymentParamForPassing.hashes.VASForMobileSDKHash = #"5c0314c2781876f7e0a53676b0d08e1457dafe904d2d15d948626b57409538d51093eef4f15c792b1b9651be7b5659efdd45926e43a1145d68cea094687011ca";
self.paymentParamForPassing.hashes.deleteUserCardHash = #"03e10e892005755f91061121036fb1b10f46202b4138d182f153c5de5c7fd44930ed94b32fac230e59bac1e4ca123aca3297e4b9d25024bf13237db9721fec1a";
self.paymentParamForPassing.hashes.offerHash = #"1e99fdb59bd91c1a85624104c0fcfae34d7fcb850dd17a0b75e7efe49857d15fdefc47dd0d86ca34cbc3a8b580839aea6341a573e4e60dc1ddcf7ecc32bf9cae";
self.paymentParamForPassing.expiryYear = #"2019";
self.paymentParamForPassing.expiryMonth = #"12";
self.paymentParamForPassing.nameOnCard = #“NOC”;//self.selectedCard.cardHolderName;
self.paymentParamForPassing.cardNumber = #"5123456789012346";//self.selectedCard.cardNumber;
self.paymentParamForPassing.CVV = #"123";//self.selectedCard.cvc;
//self.paymentParamForPassing.saveStoreCard = #"1";
self.paymentParamForPassing.storeCardName = #"My TestCard";
self.createRequest = [PayUCreateRequest new];
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_CCDC withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
if (error == nil) {
UIStoryboard *stry = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
PayUMoneyViewController *PVC = (PayUMoneyViewController *)[stry instantiateViewControllerWithIdentifier:#"PVC"];
PVC.theRequest = request;
NSLog(#"TheRequest: %#", request);
[self.navigationController pushViewController:PVC animated:true];
}
else{
NSLog(#"URL request from createRequestWithPostParam: %#",request);
NSLog(#"PostParam from createRequestWithPostParam:%#",postParam);
NSLog(#"Error from createRequestWithPostParam:%#",error);
[[[UIAlertView alloc] initWithTitle:#"ERROR" message:error delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil] show];
}
}];
Please let me know if anybody has integrated the PAYU IOS SDK seamless 3.2

Related

Linechart show info on point tapped

I'm implementing a little app with Xamarin Forms for a web page, the thing is that in this web is a linear chart with multiple entries and if the user clicks on a point of the line shows info about that point, as you can see in the picture:
Web Line Chart
After some work, I could create a more or less similar line chart using the OxyPlot.Xamarin.Forms plugin with multiple entries which shows the points
My App Line Chart
This is my code:
OnPropertyChanged("GraphModel");
var model = new PlotModel
{
LegendPlacement = LegendPlacement.Outside,
LegendPosition = LegendPosition.BottomCenter,
LegendOrientation = LegendOrientation.Horizontal,
LegendBorderThickness = 0
};
model.PlotType = PlotType.XY;
model.InvalidatePlot(false);
Dictionary<string, List<Prices>> values = HistoricData[Selected.ProductId];
int colorIndex = 0;
List<string> x_names = new List<string>();
foreach (var item in values.Keys)
{
if (item.ToUpper() == Selected.ProductName) { SelectedIndex = colorIndex; }
var lineSeries = new LineSeries()
{
Title = item,
MarkerType = MarkerType.Circle,
};
lineSeries.MarkerResolution = 3;
lineSeries.MarkerFill = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
lineSeries.MarkerStroke = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
lineSeries.MarkerSize = 3;
var points = new List<DataPoint>();
lineSeries.Color = OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
foreach (var price in values[item])
{
points.Add(new DataPoint(price.Week+price.Year, price.Price));
}
if (ButtonsVisibility.Count == 0)
{
lineSeries.IsVisible = (Selected.ProductName == item.ToUpper()) ? true : false;
}
else
{
lineSeries.IsVisible = ButtonsVisibility[colorIndex];
}
lineSeries.ItemsSource = points;
lineSeries.MarkerType = OxyPlot.MarkerType.Circle;
model.Series.Add(lineSeries);
colorIndex++;
}
NumButtons = colorIndex;
LinearAxis yaxis = new LinearAxis();
yaxis.Position = AxisPosition.Left;
yaxis.MajorGridlineStyle = LineStyle.Dot;
model.Axes.Add(yaxis);
LineChart = model;
OnPropertyChanged("GraphModel");
return LineChart;
My doubt is which property I should work with and show at least the value of a concrete point, I have seen the property OnTouchStarted but is only for all the LineSeries and not for a single point. I read in some articles that OxyPlot.Xamarin.Forms include a tracker. I added this line in my code:
lineSeries.TrackerFormatString = "X={2},\nY={4}";
Is supposed to show the x and y values on click but doesn't show anything, any suggestion?
Should show something like that: Tracker info on point
From the following example: Tracker Example
Updated Code
public PlotModel GetLineChart()
{
OnPropertyChanged("GraphModel");
var model = new PlotModel
{
LegendPlacement = LegendPlacement.Outside,
LegendPosition = LegendPosition.BottomCenter,
LegendOrientation = LegendOrientation.Horizontal,
LegendBorderThickness = 0
};
model.PlotType = PlotType.XY;
model.InvalidatePlot(false);
Dictionary<string, List<Prices>> values = HistoricData[Selected.ProductId];
int colorIndex = 0;
List<string> x_names = new List<string>();
foreach (var item in values.Keys)
{
if (item.ToUpper() == Selected.ProductName) { SelectedIndex = colorIndex; }
var lineSeries = new LineSeries()
{
Title = item,
MarkerType = MarkerType.Circle,
CanTrackerInterpolatePoints = false
};
lineSeries.MarkerResolution = 3;
lineSeries.MarkerFill = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
lineSeries.MarkerStroke = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
lineSeries.MarkerSize = 3;
var points = new List<DataPoint>();
lineSeries.Color = OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
foreach (var price in values[item])
{
points.Add(new DataPoint(price.Week+price.Year, price.Price));
}
if (ButtonsVisibility.Count == 0)
{
lineSeries.IsVisible = (Selected.ProductName == item.ToUpper()) ? true : false;
}
else
{
lineSeries.IsVisible = ButtonsVisibility[colorIndex];
}
lineSeries.ItemsSource = points;
lineSeries.MarkerType = OxyPlot.MarkerType.Circle;
lineSeries.TrackerFormatString = "X={2},\nY={4}";
lineSeries.TextColor = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
model.Series.Add(lineSeries);
colorIndex++;
}
NumButtons = colorIndex;
LinearAxis yaxis = new LinearAxis();
yaxis.Position = AxisPosition.Left;
//yaxis.StringFormat = "X={2},\nY={4}";
yaxis.MajorGridlineStyle = LineStyle.Dot;
model.Axes.Add(yaxis);
LineChart = model;
OnPropertyChanged("GraphModel");
return LineChart;
}
}
protected async override void OnAppearing()
{
await _viewModel.LinearViewModel.GetSubCategoryHistoricWeekPrices(App.ViewModel.LoginViewModel.SesionToken, FROM_DATE, TO_DATE);
Plot.Model = _viewModel.LinearViewModel.GetLineChart();
PlotController controller = new PlotController();
controller.UnbindAll();
controller.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);
Plot.Controller = controller;
AddButtons();
}
Xaml Declaration for plot view:
<oxy:PlotView
Grid.Row="2"
Grid.RowSpan="2"
Grid.ColumnSpan="4"
x:Name="Plot" />
Your problem lies with following line.
lineSeries.TrackerKey = "X={2},\nY={4}";
When you use series.TrackerKey, you are specifying that you are using a CustomTracker, which in this case you are not. Custom trackers would be useful if you need to use different trackers for each series in the model.
In you case, you should remove that line and use only TrackerFormatString.
lineSeries.TrackerFormatString = "X={2},\nY={4}";
This would show the tooltip using the format string parameters, where {2} signifies X Value and {4} signifies Y. For your information, following are place holders.
{0} = Title of Series
{1} = Title of X-Axis
{2} = X Value
{3} = Title of Y-Axis
{4} = Y Value
If you need to include additional/custom information in your tool, your Data Point needs to be include that information. This where IDataPointProvider interface becomes handy. You could create a Custom DataPoint by implementing the interface and then you could include the same information in your tooltip as well.
Update Based On Comments
Additionally, to include "Touch", you can specify TouchDown in the PlotController. You can do so by defining the PlotController in your viewModel as following.
public PlotController CustomPlotController{get;set;}
You can define the property as follows.
CustomPlotController = new PlotController();
CustomPlotController.UnbindAll();
CustomPlotController.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);
And in your Xaml
<oxy:Plot Controller="{Binding CustomPlotController}"......

Creating instance for non-existing object: <somenumber> | What Did I Do Wrong?

Every time I run my little game, it throws me the following, fatal, error:
ERROR in
action number 2
of Trigger Event:
for object obj_y:
Creating instance for non-existing object: 100012
I have no idea what's causing it. The only time I use obj_y, is in one file. When I comment that part out, it still keeps nagging it's non-existing.
My code:
var randomxnumber;
var randomynumber;
var randomarraynumber;
var array;
var snelheid;
snelheid = 3.5;
array[0] = obj_a;
array[1] = obj_b;
array[2] = obj_c;
array[3] = obj_d;
array[4] = obj_e;
array[5] = obj_f;
array[6] = obj_g;
array[7] = obj_h;
array[8] = obj_i;
array[9] = obj_j;
array[10] = obj_k;
array[11] = obj_l;
array[12] = obj_m;
array[13] = obj_n;
array[14] = obj_o;
array[15] = obj_p;
array[16] = obj_q;
array[17] = obj_r;
array[18] = obj_s;
array[19] = obj_t;
array[20] = obj_u;
array[21] = obj_v;
array[22] = obj_w;
array[23] = obj_x;
array[24] = obj_y;
array[25] = obj_z;
randomxnumber = random_range(0, 50);
randomynumber = random_range(-10, -50);
for (int = 0; int < 20; int += 1){
if(randomxnumber >= window_get_width()){
randomxnumber -= 100;
} else {
randomxnumber += 50;
}
randomynumber -= 50;
array[int] = instance_create(randomxnumber, randomynumber, array[random_range(0, 26)]);
with(array[int]){
vspeed = snelheid;
}
}
My obj_y object:
Quick note, I'm on GameMaker 8.1 Standard. I'm I being stupid and just missing something?
It's very strange code, I don't understand what you trying to do.
Although there are two errors.
array[random_range(0, 26)]
should be
array[irandom_range(0, 25)
GM rounds array's index, so if value is more than 25 (25.1, etc) you will have out of array bounds.
Second.
array[int] = instance_create(...)
There instance's id will be stored into array. Not object's id. But instance_create requires object index. You can get object's index using object_index variable:
array[int] = instance_create(randomxnumber, randomynumber, array[irandom_range(0, 25)].object_index);

How to use OCMock to return different result base on different argument

I am trying to mock different method return when passing different argument for the same method.
self.myMock = [OCMockObject mockForClass:[MyClass class]];
[[[self.myMock expect] andReturnValue:5] myStaticMethod:3];
[[[self.myMock expect] andReturnValue:10] myStaticMethod:6];
But it only takes the first one, when argument is 3 then return 5, and when argument is 6, it return nil instead of 10. Does anyone know whether is a way to test this?
the real code:
-(NSMutableArray*)convertChildStringToChildDic:(NSString*)strchildren
{
NSArray *kididarray = [strchildren componentsSeparatedByString:#","];
//处理小孩信息
/*children = (
{
avatarSmall = "<null>";
currentStatus = 0;
displayName = stu1;
"id_str" = "70938032-3811-e411-946a-005056c00008";
title = Child;
}
)*/
NSMutableArray *rstchildarray = [NSMutableArray arrayWithCapacity:1];
for (NSString *enrollment_id in kididarray) {
if (enrollment_id.length <= 0) {
continue;
}
**NSMutableDictionary *mdic = [[RoomInfoManager sharedManager] getKidDictionaryByID:enrollment_id];**
[mdic setValue:enrollment_id forKey:#"id_str"];
if (mdic != nil) {
[rstchildarray addObject:mdic];
}
}
return rstchildarray;
}
Test:
-(void) testconvertChildStringToChildDic_InvalidAgruments {
NSMutableDictionary *childdic = [[NSMutableDictionary alloc] init];
childdic[#"id"] = #"josh";
NSMutableDictionary *childdic1 = [[NSMutableDictionary alloc] init];
childdic1[#"id"] = #"joy";
id mockRIM = OCMClassMock([RoomInfoManager class]);
**OCMStub([mockRIM getKidDictionaryByID:#"josh"]).andReturn(childdic);
**OCMStub([mockRIM getKidDictionaryByID:#"joy"]).andReturn(childdic1);****
RoomInfoManager *roomInfoMgr = [RoomInfoManager alloc];
id mockPartialRIM = OCMPartialMock(roomInfoMgr);
OCMExpect([mockPartialRIM sharedManager]).andReturn(mockRIM); // use expect
NSString *childStr = #"josh,joy";
NSMutableArray *childarray = [[ReportOperator alloc] convertChildStringToChildDic:childStr];
NSDictionary *childrenArraydic = #{#"id" : #"josh", #"id_str": #"josh"};
NSMutableArray *resultArray = [NSMutableArray arrayWithObjects:childrenArraydic, nil];
[mockPartialRIM verify]; // verify expect,验证该对像是否被调用。
XCTAssertEqualObjects(childarray, resultArray);
}
the second call
OCMStub([mockRIM getKidDictionaryByID:#"joy"]).andReturn(childdic1);
does not seem take effect and return nil instead.

ios NSAttributedString firstLineHeadIndent bug

I try to use FirstLineHeadIndent,but when i use, The string will be truncated.
NSString *string = #"hello,i am aaa,123456 my name is";
UIFont *textFont = [UIFont systemFontOfSize:15];
self.textView = [UILabel new];
_textView.backgroundColor = [UIColor clearColor];
[self.view addSubview:_textView];
_textView.numberOfLines = 0;
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.lineHeightMultiple = 1.4;
[paragraphStyle setLineSpacing:4];
[paragraphStyle setFirstLineHeadIndent:30];
[paragraphStyle setAlignment:NSTextAlignmentJustified];
[paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:string attributes:#{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:textFont,NSForegroundColorAttributeName:[UIColor darkGrayColor]}];
[_textView setAttributedText:string];
The results of the intercept is hello,i am aaa,123456 my.
about the first line retract, am i wrong? thanks!

Solution for Paypal Error 589023 in iphone application

This is the Resolution for Paypal (Sandbox) Error "589023" in iPhone Application
-(void)payWithPayPal{
for (int i=0;i
PayPal *payPal=[PayPal getPayPalInst];
payPal.shippingEnabled = FALSE;
payPal.dynamicAmountUpdateEnabled = NO;
payPal.feePayer = FEEPAYER_EACHRECEIVER;
PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];
payment.recipient = #"UKMCA2010#GMAIL.COM";
payment.paymentCurrency = #"USD";
payment.description = #"Payment Discription here...";
SampleSingleton *sample=[SampleSingleton sharedInstance];
payment.merchantName =[sample getStrRestaurantName];
payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];
payment.invoiceData.invoiceItems = [NSMutableArray array];
PayPalInvoiceItem *item = [[PayPalInvoiceItem alloc] init];
item.totalPrice=[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:#"%.2f", 126.34545]]; // If u give xxx.xx , no need to give the %.2f , u can give directly %f
item.name = objTempReceived.strItemName;
item.itemId = #"Item ID";
[payment.invoiceData.invoiceItems addObject:item];
[item release];
}
payment.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:#"%.2f",126.34545]]; //Total and Subtotal must be equal
payment.invoiceData.totalTax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:#"%.2f",3.34]];
NSLog(#"Total Tax is :%#",[payment.invoiceData.totalTax stringValue]);
[payPal checkoutWithPayment:payment];
}
Here the total and subtotal and Tax allows only two digits after the .(dot) Ex: (234.xx). So by using the %.2f to work perfectly.

Resources