How to update recurly subscription price on next renewal date? - subscription

Using the Recurly python SDK, modify the subscription price not immediately but o the next billing date

According Recurly docs
Using the Recurly python SDK you can set the subscription timeframe value to bill_date below a python SDK example.
subscription = recurly.Subscription.get(subscription_uuid)
subscription.unit_amount_in_cents = unit_amount_in_cents
subscription.timeframe = 'bill_date'
subscription.save()
This will cause the pricing update occur on the next billing date and not immediate.

Related

Apex/Salesforce/flow: Be able to increase price and clone/update product automatically

I asked a similar question before but I am still struggling and was not able to do what I was required to do and am coming back to this community for help.
I am trying to increase the price of the products on a quote in salesforce CPQ/Billing based on a field and to do this automatically.
The Setup
In Salesforce CPQ, If you go to account -> Contract -> Sales Service: There is a field called Price Increase %(PROD_Price_Increase__c)
A contract can have multiple quotes
What I want to do
When a quote has reached the final step a contract is created. In the contract I have the option to click a button called Amend. Which allows me to take the products in the existing quotes and amend it.
I want to create a batch job that does the following:
The Contract has these fields: Start Date (PROD_Start_Date__c), Price increase Date (PROD_Increase_Date__c), End Date (PROD_End_Date__c).
-- If the Price Increase Date is 12 months after the start date, these are the contracts that will need to be updated
-- For example, If the start date is 15 Feb 2023, Price increase is 1 Jan 2024, end date is 15 Feb 2025. Since the increase date is not 12 months, these contract should be ignored.
Main Task
When products who have a price increase 12 months after the start date, the contract should be able to 'amend' and update the quantity of the products and clone the products.
In the contract, the action buttons on top have "Amend". once clicked, it shows all the subscriptions products, you click next then it comes into the edit quote page.
Once here it shows all the products that were part of the contract and its quote. The net price filed for the original products will be '0'. These products will need to be cloned and the quantity for these to be applied to the cloned products. Once the quantity has been copied over, the original products quantity should change to 0.
After these products have a quantity of 0, the clone products should have the price increase. The value I mentioned from earlier Price Increase % (ROD_Price_Increase__c) value should be added to the Discount filed in the quote but as a minus value since we are doing an increase of price.
Once this has been done, we can submit/order the quote. This creates a new quote. Once the new quote has been created, I want to be able to update a filed in the quote - a checkbox that says order. I want to be able to check the value on it.
This all should be done automatically like though Apex and Flows.
Sorry for this long text and request. I apologise and know some of the information not be out of box or confusing. Its one of these challenges I have been facing with trying to automate this.

Salesforce Get a list of all opportunities which are new, updated or deleted since a given date using api

I am trying to receive a list of all opportunities that are created/updated/deleted since a given date. When I run query: SELECT Id FROM Opportunity WHERE SystemModStamp >= '2022-09-20' AND isDeleted = TRUE ALL ROWS I get a response stating "message": "ALL ROWS not allowed in this context", "errorCode": "MALFORMED_QUERY".
Going over the salesforce documentation I found out using queryAll() api method we can also get the opportunities which are created/updated/deleted. But I am not able to find an example of how to use this api. Any help in this direction would be highly appreciated.
Salesforce queryAll documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_queryall.htm
Have you tried using queryAll instead of query? Start with
/services/data/v54.0/queryAll?q=SELECT+Id,+Name,+isDeleted,+StageName+FROM+Opportunity+ORDER+BY+isDeleted+DESC+LIMIT+20
and experiment, remove the ORDER BY, put filter by date...
SELECT Id, Name, isDeleted
FROM Opportunity
WHERE LastModifiedDate >2022-09-01T00:00:00Z
There's also dedicated "data replication API" which you can use to get opportunities updated / deleted in given time window (imagine an oppty that's edited 3 times in September, once in October - the last modified date will happily say October, how would you retrieve the fact it was touched in September too?). It'll give you just the IDs, you'd have to collect them and send the query for actual data - but it's something.

Is it possible to get the price of bitcoin in USD from the coinbase API for a specific time in the past?

GET https://api.coinbase.com/v2/prices/:currency_pair/spot
This price seems to be the current price
This question already has answers. Copy and pasted from here: Coinbase API v2 Getting Historic Price for Multiple Days
Any reason you aren't using coinbase pro?
The new api is very easy to use. Simply add the get command you want followed by the parameters separated with a question mark. Here is the new historic rates api documentation: https://docs.pro.coinbase.com/#get-historic-rates
The get command with the new api most similar to prices is "candles". It requires three parameters to be identified, start and stop time in iso format and granularity which is in seconds. Here is an example:
https://api.pro.coinbase.com/products/BTC-USD/candles?start=2018-07-10T12:00:00&stop=2018-07-15T12:00:00&granularity=900
EDIT: also, note the time zone is not for your time zone, I believe its GMT.

Setting a monthly Budget

So I am building a budgeting app for a Salesforce project and I was wondering if there was a way to automatically set a Budget every month.
I have 3 objects: Budget, Account(Custom for finances), Transaction
I suppose I could write a method that subtracts money from Account and adds it to budget but that still doesn't address the fact that I want it to update every month.
public void setFoodBudget() {
//This.Budget = [SELECT BudgetLimit
//FROM Budget__c
//WHERE BudgetCategory = 'Food'];
FoodBudget = 600;
}
If I were to do it manually every month then I could use the query I commented out
I advise you to see schedule batch
https://developer.salesforce.com/forums/?id=9062I000000IEIhQAO

Schedule Nintex Workflow on every 15th of the month querying SP List

I have a SP Custom List with events matrix. I have a Start Date, End Date. I would like to gather all the events from the list that has a start date between 15th of the current month to 15th of the next month and send email notification with details of all those events.
I would like to schedule this workflow to run on every 15th of the month.
Please advise.
Thank you!
For this you would need to build a site workflow because this can be scheduled.
To get the workflow completed:
Step 1. From the workflow use the calculate date action to store the date variable to check for (I.E. between 15th and 15th). Step 2. Use the query list action to find all items (events) that meet that criteria. Step 3. Send email to owners/participant or whomever on those events.

Resources