Skip to content

Commit

Permalink
Notes on remote site packaging (#649)
Browse files Browse the repository at this point in the history
* Setting error emails properly

* Fetch KMS right away

* Notes on packaging and remote sites

* Managed package links

* JIRA link
  • Loading branch information
mbianco-stripe authored Aug 10, 2022
1 parent 41b37bf commit 2e603ca
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Installation Link
# Installation Links

https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5f00000074P3
Production Package Install:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5f000000n8RNAAY

Update with `sfdx force:package1:version:list --json -u [email protected] | jq -r '.result[-1].MetadataPackageVersionId'`

QA Package Install:
https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5f00000074nmAAA

Update with `sfdx force:package1:version:list --json -u [email protected] | jq -r '.result[-1].MetadataPackageVersionId'`

# stripe-salesforce

Expand Down Expand Up @@ -135,7 +143,6 @@ Then create a new package in the production packaging org.
- Click on the name of the package
- Copy the package name field (`stripeConnector`), you'll need it in the next step
- Click on upload, then:

- Release Type > Managed Released
- Version Name: `QaStripeConnect`
- New version number will be determined automatically
Expand All @@ -152,6 +159,12 @@ Some notes:
- If something is causing an error that you deleted in your source code, you can edit the offending file to resolve whatever is causing the error. This is often easier than asking SF to move your package to beta.
- Ensure the "old order save behavior" is NOT checked

### Production Package Release

- https://security.secure.force.com/security/tools/forcecom/scanner use username and password of the production packaging org.
- Include sec rev in the username of another account which contains the latest production package.
- Make sure to write the Release Notes

### Production Package Testing

- We only wish to test the currently deployed production package. Therefore we do NOT run the salesforce tests like we do in QA, this is because those tests involve pushing a new source install.
Expand All @@ -172,12 +185,6 @@ Some notes:
- Enable Negative Quantity
- Enable Zero Quantity

### Production Package Release

- https://security.secure.force.com/security/tools/forcecom/scanner use username and password of the production packaging org.
- Include sec rev in the username of another account which contains the latest production package.
- Make sure to write the Release Notes

## Creating a new QA package

[Here's the full guide to creating a new package](https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/uploading_packages.htm). Below is the short guide.
Expand Down Expand Up @@ -212,6 +219,8 @@ https://appiphony92-dev-ed.my.salesforce.com/

**Warning:** the QA package is automatically updated on each CI build, so it is possible that CI runs the deploy command _right_ after your deploy command finishes running, which could cause strange issues where QA includes a WIP branch.

**Note:** Everytime you upload a package you'll see a "Are you sure?" message letting you know you can't edit components. Ignore it.

## Removing Components from QA or Production Packages

As referenced above, it is a slightly convoluted process to remove a component from a package once it has been added. You must:
Expand Down Expand Up @@ -287,6 +296,12 @@ TODO this may not be applicable anymore since we've removed the `.sfdx` folder f
- `sfdx/.sfdx/sfdx-config.json` edit the `defaultdevhubusername` / `defaultusername` TODO confirm if this is needed
- `sf alias:set [email protected]` adds an entry to `~/.sfdx/alias.json`

## Resetting Salesforce Org Keys

- Debug console
- Anon Apex
- maintenanceUtilities.resetServiceConnection();

# Development

## Deployment
Expand Down
4 changes: 3 additions & 1 deletion lib/stripe-force/db/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class User < Sequel::Model
SF_STRIPE_LIVEMODE_API_KEY = ENV.fetch('STRIPE_API_KEY')
SF_STRIPE_TESTMODE_API_KEY = ENV.fetch('STRIPE_TEST_API_KEY')

AWS_KMS_SALESFORCE_CREDENTIALS = ENV.fetch('AWS_KMS_SALESFORCE_CREDENTIALS')

DEFAULT_CONNECTOR_SETTINGS = {
api_percentage_limit: 95,
sync_start_date: nil,
Expand Down Expand Up @@ -254,7 +256,7 @@ def stripe_credentials(forced_livemode: nil)
end

protected def kms_encryption_key(field=nil)
ENV.fetch('AWS_KMS_SALESFORCE_CREDENTIALS')
AWS_KMS_SALESFORCE_CREDENTIALS
end

end
Expand Down
6 changes: 6 additions & 0 deletions salesforce_devtips.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@

- `SBQQ__PriceEditable__c` must be true on the line to customize the price later on

## Packaging

- You'll see an apexdevnet as a remote site https://salesforce.stackexchange.com/questions/33167/apexdevnet-in-the-remote-site
- Do not include this in the package
- If you edit the URL of a remote site, it won't be updated in a package update. However, admins who have installed the package can manually edit it

## Tools

Most of these are blocked, but still interesting finds:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexEmailNotifications xmlns="http://soap.sforce.com/2006/04/metadata"/>

<ApexEmailNotifications xmlns="http://soap.sforce.com/2006/04/metadata">
<apexEmailNotification>
<email>[email protected]</email>
</apexEmailNotification>
</ApexEmailNotifications>
1 change: 1 addition & 0 deletions test/integration/test_translate_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class Critic::OrderTranslation < Critic::FunctionalTest
assert_equal(SyncRecordResolutionStatuses::SUCCESS.serialize, sync_records.first[prefixed_stripe_field(SyncRecordFields::RESOLUTION_STATUS.serialize)])
end

# https://jira.corp.stripe.com/browse/PLATINT-1482
it 'does not filter out $0 line items' do
sf_product_id_1, sf_pricebook_id_1 = salesforce_recurring_product_with_price
sf_product_id_2, sf_pricebook_id_2 = salesforce_recurring_product_with_price(price: 0)
Expand Down

0 comments on commit 2e603ca

Please sign in to comment.