public static Payment BasePaymentDto2RestApiPayment(this BasePaymentDTO dto, BillingEnums.ePaymentAction action, BillingEnums.ePaymentMethods method, bool keepDecimal, RedirectUrls urls = null, Courses entity = null, CRS_Bundles bundleEntity = null, Payer payer = null) { var payment = new Payment { intent = action.EnumToLowerString(), payer = new Payer { payment_method = method.EnumToLowerString() }, transactions = new List <Transaction> { dto.PaymentDto2TransactionToken(keepDecimal) } }; if (urls != null) { payment.redirect_urls = urls; } if (entity != null) { payment.transactions[0].item_list = new ItemList { items = new List <Item> { entity.CourseEntity2PaypalRestApiItem(dto, keepDecimal) } }; } else if (bundleEntity != null) { payment.transactions[0].item_list = new ItemList { items = new List <Item> { bundleEntity.BundleEntity2PaypalRestApiItem(dto, keepDecimal) } }; } if (payer != null) { payment.payer = payer; } return(payment); }
public ActionResult CancelSubscription(int?id, BillingEnums.ePaymentMethods paymentMethod) { if (id == null) { return(ErrorResponse("id required")); } string error; var result = (paymentMethod == BillingEnums.ePaymentMethods.Saved_Instrument || _paypalManageServices.CancelSubscription((int)id, out error)) && _billingManageServices.BlockUserCourseAccessAndCancelOrderOnSubscriptionCancel((int)id, out error); return(Json(new JsonResponseToken { success = result , error = error }, JsonRequestBehavior.AllowGet)); }
public static PayPalAgreementDTO CoursePurchaseDataToken2PayPalAgreementDto(this ItemPurchaseDataToken token, string buyerName, string buyerEmail, string SUCCESS_PAYMENT_URL, string CANCEL_PAYMENT_URL, int?addressId, Guid?instrumentId, BillingEnums.ePaymentMethods paymentMethod, PriceLineDTO priceToken) { return(new PayPalAgreementDTO { cancel_url = CANCEL_PAYMENT_URL , success_url = SUCCESS_PAYMENT_URL , currency = token.PriceToken.Currency.ISO //"USD" , priceLineId = token.PriceToken.PriceLineID , amount = token.Price , Type = token.Type , courseId = token.Type == BillingEnums.ePurchaseItemTypes.COURSE ? token.ItemId : (int?)null , bundleId = token.Type == BillingEnums.ePurchaseItemTypes.BUNDLE ? token.ItemId : (int?)null , couponCode = token.CouponCode , trackingId = token.TrackingID , addressId = addressId , paymentInstrumentId = instrumentId , description = token.ItemName.ItemName2SubscriptionDescription() , method = paymentMethod , buyerEmail = buyerEmail , buyerName = buyerName , Currency = priceToken.Currency }); }